From 3809f94aca3a6ab8925318a4b3757eb3a0bf01c2 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 17 Nov 2025 09:47:44 +0700 Subject: [PATCH 1/3] Make cargo template dynamically linked --- recipes/core/profiled/recipe.toml | 6 +++++- recipes/core/redoxfs/recipe.toml | 6 +++++- recipes/demos/exampled/recipe.toml | 6 +++++- recipes/libs/redox-fatfs/recipe.toml | 6 +++++- src/cook/cook_build.rs | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/recipes/core/profiled/recipe.toml b/recipes/core/profiled/recipe.toml index 1876ca359..18dc3cfc1 100644 --- a/recipes/core/profiled/recipe.toml +++ b/recipes/core/profiled/recipe.toml @@ -2,4 +2,8 @@ git = "https://gitlab.redox-os.org/redox-os/profiled.git" [build] -template = "cargo" +template = "custom" +script = """ +# Must be statically linked +cookbook_cargo +""" diff --git a/recipes/core/redoxfs/recipe.toml b/recipes/core/redoxfs/recipe.toml index 31fdb491e..c6609e329 100644 --- a/recipes/core/redoxfs/recipe.toml +++ b/recipes/core/redoxfs/recipe.toml @@ -2,4 +2,8 @@ git = "https://gitlab.redox-os.org/redox-os/redoxfs.git" [build] -template = "cargo" +template = "custom" +script = """ +# Must be statically linked +cookbook_cargo +""" diff --git a/recipes/demos/exampled/recipe.toml b/recipes/demos/exampled/recipe.toml index e35bc734d..a25312cb4 100644 --- a/recipes/demos/exampled/recipe.toml +++ b/recipes/demos/exampled/recipe.toml @@ -2,4 +2,8 @@ git = "https://gitlab.redox-os.org/redox-os/exampled.git" [build] -template = "cargo" +template = "custom" +script = """ +# Must be statically linked +cookbook_cargo +""" diff --git a/recipes/libs/redox-fatfs/recipe.toml b/recipes/libs/redox-fatfs/recipe.toml index 462ccfaa8..0052d19cd 100644 --- a/recipes/libs/redox-fatfs/recipe.toml +++ b/recipes/libs/redox-fatfs/recipe.toml @@ -1,4 +1,8 @@ [source] git = "https://gitlab.redox-os.org/redox-os/redox-fatfs.git" [build] -template = "cargo" +template = "custom" +script = """ +# Must be statically linked +cookbook_cargo +""" diff --git a/src/cook/cook_build.rs b/src/cook/cook_build.rs index 603e49f9b..acd349e44 100644 --- a/src/cook/cook_build.rs +++ b/src/cook/cook_build.rs @@ -298,7 +298,7 @@ pub fn build( cargoflags, } => { format!( - "PACKAGE_PATH={} cookbook_cargo {cargoflags}", + "DYNAMIC_INIT\nPACKAGE_PATH={} cookbook_cargo {cargoflags}", package_path.as_deref().unwrap_or(".") ) } From a32eaa6b02f0bdb800033af07ae5a058493b7701 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 17 Nov 2025 11:06:16 +0700 Subject: [PATCH 2/3] Push more packages as dynamic --- recipes/core/dash/recipe.toml | 1 + recipes/core/findutils/recipe.toml | 1 + recipes/core/ion/recipe.toml | 1 + recipes/core/pkgar/recipe.toml | 10 ++-------- recipes/core/pkgutils/recipe.toml | 1 + recipes/core/userutils/recipe.toml | 1 + recipes/core/uutils/recipe.toml | 1 + recipes/demos/exampled/recipe.toml | 6 +----- recipes/graphics/procedural-wallpapers-rs/recipe.toml | 7 ++----- recipes/gui/installer-gui/recipe.toml | 1 + recipes/gui/orbterm/recipe.toml | 1 + recipes/gui/orbutils/recipe.toml | 1 + recipes/libs/redox-fatfs/recipe.toml | 6 +----- recipes/net/curl/recipe.toml | 1 + recipes/shells/bash/recipe.toml | 1 + recipes/tools/diffutils/recipe.toml | 2 +- recipes/tools/gnu-grep/recipe.toml | 6 ++---- recipes/tools/periodictable/recipe.toml | 2 ++ recipes/tools/sodium/recipe.toml | 1 + recipes/tools/vim/recipe.toml | 1 + 20 files changed, 24 insertions(+), 28 deletions(-) diff --git a/recipes/core/dash/recipe.toml b/recipes/core/dash/recipe.toml index c4bc57515..01e135d90 100644 --- a/recipes/core/dash/recipe.toml +++ b/recipes/core/dash/recipe.toml @@ -5,6 +5,7 @@ branch = "redox" [build] template = "custom" script = """ +DYNAMIC_INIT rsync -av --delete "${COOKBOOK_SOURCE}/" ./ ./autogen.sh ./configure \ diff --git a/recipes/core/findutils/recipe.toml b/recipes/core/findutils/recipe.toml index 4da7c2cb7..5c8622536 100644 --- a/recipes/core/findutils/recipe.toml +++ b/recipes/core/findutils/recipe.toml @@ -4,5 +4,6 @@ git = "https://gitlab.redox-os.org/redox-os/findutils.git" [build] template = "custom" script = """ +DYNAMIC_INIT cookbook_cargo --bin find """ diff --git a/recipes/core/ion/recipe.toml b/recipes/core/ion/recipe.toml index cdabcdc3b..2ce52ca55 100644 --- a/recipes/core/ion/recipe.toml +++ b/recipes/core/ion/recipe.toml @@ -4,5 +4,6 @@ git = "https://gitlab.redox-os.org/redox-os/ion.git" [build] template = "custom" script = """ +# Must be statically linked cookbook_cargo """ diff --git a/recipes/core/pkgar/recipe.toml b/recipes/core/pkgar/recipe.toml index 5ad0c7510..4a2849504 100644 --- a/recipes/core/pkgar/recipe.toml +++ b/recipes/core/pkgar/recipe.toml @@ -2,11 +2,5 @@ git = "https://gitlab.redox-os.org/redox-os/pkgar.git" [build] -template = "custom" -script = """ -"${COOKBOOK_CARGO}" install \ - --path "${COOKBOOK_SOURCE}/pkgar" \ - --root "${COOKBOOK_STAGE}/usr" \ - --locked \ - --no-track -""" +template = "cargo" +package_path = "pkgar" diff --git a/recipes/core/pkgutils/recipe.toml b/recipes/core/pkgutils/recipe.toml index 51ae456b6..0c500bd17 100644 --- a/recipes/core/pkgutils/recipe.toml +++ b/recipes/core/pkgutils/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/pkgutils.git" [build] template = "custom" script = """ +# Must be statically linked PACKAGE_PATH=pkg-cli cookbook_cargo """ diff --git a/recipes/core/userutils/recipe.toml b/recipes/core/userutils/recipe.toml index 6d7e23954..666bfeb10 100644 --- a/recipes/core/userutils/recipe.toml +++ b/recipes/core/userutils/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/userutils.git" [build] template = "custom" script = """ +DYNAMIC_INIT cookbook_cargo cp -rv "${COOKBOOK_SOURCE}/res" "${COOKBOOK_STAGE}/etc" ln -s id "${COOKBOOK_STAGE}/usr/bin/whoami" diff --git a/recipes/core/uutils/recipe.toml b/recipes/core/uutils/recipe.toml index 7d3919f2d..a803232ce 100644 --- a/recipes/core/uutils/recipe.toml +++ b/recipes/core/uutils/recipe.toml @@ -5,6 +5,7 @@ git = "https://github.com/uutils/coreutils" [build] template = "custom" script = """ +DYNAMIC_INIT cookbook_cargo --no-default-features --features feat_os_unix_redox --bin coreutils BINS=( diff --git a/recipes/demos/exampled/recipe.toml b/recipes/demos/exampled/recipe.toml index a25312cb4..e35bc734d 100644 --- a/recipes/demos/exampled/recipe.toml +++ b/recipes/demos/exampled/recipe.toml @@ -2,8 +2,4 @@ git = "https://gitlab.redox-os.org/redox-os/exampled.git" [build] -template = "custom" -script = """ -# Must be statically linked -cookbook_cargo -""" +template = "cargo" diff --git a/recipes/graphics/procedural-wallpapers-rs/recipe.toml b/recipes/graphics/procedural-wallpapers-rs/recipe.toml index cb4c3a9f3..1b9cccac4 100644 --- a/recipes/graphics/procedural-wallpapers-rs/recipe.toml +++ b/recipes/graphics/procedural-wallpapers-rs/recipe.toml @@ -2,8 +2,5 @@ git = "https://github.com/lukas-kirschner/procedural-wallpapers-rs.git" [build] -template = "custom" -script = """ -COOKBOOK_SOURCE="${COOKBOOK_SOURCE}"/procedural_wallpapers -cookbook_cargo -""" +template = "cargo" +package_path = "procedural_wallpapers" diff --git a/recipes/gui/installer-gui/recipe.toml b/recipes/gui/installer-gui/recipe.toml index b90147a81..4f95b53d6 100644 --- a/recipes/gui/installer-gui/recipe.toml +++ b/recipes/gui/installer-gui/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/installer-gui.git" [build] template = "custom" script = """ +DYNAMIC_INIT cookbook_cargo mkdir -pv "${COOKBOOK_STAGE}/ui/apps" diff --git a/recipes/gui/orbterm/recipe.toml b/recipes/gui/orbterm/recipe.toml index 2b52b776e..e67f2a1c6 100644 --- a/recipes/gui/orbterm/recipe.toml +++ b/recipes/gui/orbterm/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/orbterm.git" [build] template = "custom" script = """ +DYNAMIC_INIT mkdir -pv "${COOKBOOK_STAGE}/ui" cp -rv "${COOKBOOK_SOURCE}/apps" "${COOKBOOK_STAGE}/ui/apps" diff --git a/recipes/gui/orbutils/recipe.toml b/recipes/gui/orbutils/recipe.toml index 89871fb1e..bc506edfe 100644 --- a/recipes/gui/orbutils/recipe.toml +++ b/recipes/gui/orbutils/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/orbutils.git" [build] template = "custom" script = """ +DYNAMIC_INIT mkdir -pv "${COOKBOOK_STAGE}/ui" cp -rv "${COOKBOOK_SOURCE}/apps" "${COOKBOOK_STAGE}/ui/apps" diff --git a/recipes/libs/redox-fatfs/recipe.toml b/recipes/libs/redox-fatfs/recipe.toml index 0052d19cd..462ccfaa8 100644 --- a/recipes/libs/redox-fatfs/recipe.toml +++ b/recipes/libs/redox-fatfs/recipe.toml @@ -1,8 +1,4 @@ [source] git = "https://gitlab.redox-os.org/redox-os/redox-fatfs.git" [build] -template = "custom" -script = """ -# Must be statically linked -cookbook_cargo -""" +template = "cargo" diff --git a/recipes/net/curl/recipe.toml b/recipes/net/curl/recipe.toml index 229d7777f..68436ab3d 100644 --- a/recipes/net/curl/recipe.toml +++ b/recipes/net/curl/recipe.toml @@ -12,6 +12,7 @@ dependencies = [ "zlib" ] script = """ +DYNAMIC_INIT rsync -av --delete "${COOKBOOK_SOURCE}/" ./ GNU_CONFIG_GET config.sub DYNAMIC_INIT diff --git a/recipes/shells/bash/recipe.toml b/recipes/shells/bash/recipe.toml index d06245be6..3f6e8b1c0 100644 --- a/recipes/shells/bash/recipe.toml +++ b/recipes/shells/bash/recipe.toml @@ -12,6 +12,7 @@ dependencies = [ "readline", ] script = """ +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS+=( ac_cv_func_wcwidth=no # TODO: add more wc functions and remove this bash_cv_func_sigsetjmp=no diff --git a/recipes/tools/diffutils/recipe.toml b/recipes/tools/diffutils/recipe.toml index 0261fc5ff..a742e0259 100644 --- a/recipes/tools/diffutils/recipe.toml +++ b/recipes/tools/diffutils/recipe.toml @@ -9,7 +9,7 @@ autoreconf [build] template = "custom" script = """ -export LDFLAGS="-static" +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS+=( gt_cv_locale_fr=false gt_cv_locale_fr_utf8=false diff --git a/recipes/tools/gnu-grep/recipe.toml b/recipes/tools/gnu-grep/recipe.toml index 16a4763aa..b3ad6e403 100644 --- a/recipes/tools/gnu-grep/recipe.toml +++ b/recipes/tools/gnu-grep/recipe.toml @@ -6,12 +6,10 @@ patches = ["grep.patch"] [build] template = "custom" script = """ +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS+=( --prefix=/ ) cookbook_configure - -"${TARGET}-strip" "${COOKBOOK_STAGE}/bin/grep" - rm -rf "${COOKBOOK_STAGE}"/{lib,share} -""" \ No newline at end of file +""" diff --git a/recipes/tools/periodictable/recipe.toml b/recipes/tools/periodictable/recipe.toml index cfdfcb69e..109b3d42c 100644 --- a/recipes/tools/periodictable/recipe.toml +++ b/recipes/tools/periodictable/recipe.toml @@ -4,6 +4,8 @@ git = "https://gitlab.redox-os.org/redox-os/periodictable.git" [build] template = "custom" script = """ +DYNAMIC_INIT +cookbook_cargo mkdir -pv "${COOKBOOK_STAGE}/ui/apps" cp -v "${COOKBOOK_SOURCE}/pkg/manifest" "${COOKBOOK_STAGE}/ui/apps/periodictable" mkdir -pv "${COOKBOOK_STAGE}/ui/icons" diff --git a/recipes/tools/sodium/recipe.toml b/recipes/tools/sodium/recipe.toml index 559e73239..66fe407fb 100644 --- a/recipes/tools/sodium/recipe.toml +++ b/recipes/tools/sodium/recipe.toml @@ -4,6 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/sodium.git" [build] template = "custom" script = """ +DYNAMIC_INIT "${COOKBOOK_CARGO}" install \ --path "${COOKBOOK_SOURCE}" \ --root "${COOKBOOK_STAGE}/usr" \ diff --git a/recipes/tools/vim/recipe.toml b/recipes/tools/vim/recipe.toml index cc5b9363f..850bce190 100644 --- a/recipes/tools/vim/recipe.toml +++ b/recipes/tools/vim/recipe.toml @@ -7,6 +7,7 @@ patches = ["vim.patch"] dependencies = ["ncurses"] template = "custom" script = """ +DYNAMIC_INIT rsync -av --delete "${COOKBOOK_SOURCE}/" ./ export vim_cv_toupper_broken=no From 51f30bb8c611c5f5ba6a7a4710dd8ac8996c96d5 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Tue, 18 Nov 2025 14:41:37 +0700 Subject: [PATCH 3/3] Adjust extrautils to support static through features --- recipes/core/extrautils/recipe.toml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/recipes/core/extrautils/recipe.toml b/recipes/core/extrautils/recipe.toml index 82a72f0dd..120a6c2e2 100644 --- a/recipes/core/extrautils/recipe.toml +++ b/recipes/core/extrautils/recipe.toml @@ -2,7 +2,16 @@ git = "https://gitlab.redox-os.org/redox-os/extrautils.git" [build] -template = "cargo" +template = "custom" dependencies = [ "xz" ] +script = """ +DYNAMIC_INIT + +if [ "${COOKBOOK_DYNAMIC}" != "1" ]; then + install_flags+=" --features=static" +fi + +cookbook_cargo +"""