From c282bde1cc5281aa56095acf6c13a3eae5a7d599 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 3 Aug 2025 15:45:10 +0100 Subject: [PATCH 01/52] add os-test recipe --- recipes/tests/os-test/recipe.toml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 recipes/tests/os-test/recipe.toml diff --git a/recipes/tests/os-test/recipe.toml b/recipes/tests/os-test/recipe.toml new file mode 100644 index 000000000..08de29695 --- /dev/null +++ b/recipes/tests/os-test/recipe.toml @@ -0,0 +1,18 @@ +[source] +git = "https://gitlab.com/sortix/os-test" + +[build] +template = "custom" +script = """ +rsync -av --delete "${COOKBOOK_SOURCE}/" ./ +mkdir -pv "${COOKBOOK_STAGE}/share/os-test" +rsync -av --delete . "${COOKBOOK_STAGE}/share/os-test" +""" + +[package] +dependencies = [ + "gnu-binutils", + "gnu-make", + "gcc13", + "libarchive" +] From 464bc977b49994ce35913ce61e50c6fabbde1466 Mon Sep 17 00:00:00 2001 From: auronandace Date: Mon, 4 Aug 2025 16:33:10 +0100 Subject: [PATCH 02/52] use cp instead of rsync --- recipes/tests/os-test/recipe.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/tests/os-test/recipe.toml b/recipes/tests/os-test/recipe.toml index 08de29695..db2771367 100644 --- a/recipes/tests/os-test/recipe.toml +++ b/recipes/tests/os-test/recipe.toml @@ -4,9 +4,8 @@ git = "https://gitlab.com/sortix/os-test" [build] template = "custom" script = """ -rsync -av --delete "${COOKBOOK_SOURCE}/" ./ mkdir -pv "${COOKBOOK_STAGE}/share/os-test" -rsync -av --delete . "${COOKBOOK_STAGE}/share/os-test" +cp -rv "${COOKBOOK_SOURCE}"/* "${COOKBOOK_STAGE}/share/os-test" """ [package] From b62bc0189dca5b0d8671dbcd83bac8fbff57c159 Mon Sep 17 00:00:00 2001 From: Petr Hrdina Date: Mon, 4 Aug 2025 19:15:33 +0200 Subject: [PATCH 03/52] Update libtool version which compiles --- recipes/wip/libs/other/libtool/recipe.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/wip/libs/other/libtool/recipe.toml b/recipes/wip/libs/other/libtool/recipe.toml index 1e3812b50..9086e63ca 100644 --- a/recipes/wip/libs/other/libtool/recipe.toml +++ b/recipes/wip/libs/other/libtool/recipe.toml @@ -1,5 +1,5 @@ -#TODO compilation error +#TODO finish libtool setup [source] -tar = "https://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz" +tar = "https://ftpmirror.gnu.org/libtool/libtool-2.5.4.tar.gz" [build] template = "configure" From 3dce7e1a58de891e446935e77c3cd20e259884ee Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Tue, 5 Aug 2025 20:59:22 +0000 Subject: [PATCH 04/52] Update and make vim usable --- recipes/tools/vim/recipe.toml | 6 ++-- recipes/tools/vim/vim.patch | 59 +++++++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/recipes/tools/vim/recipe.toml b/recipes/tools/vim/recipe.toml index 3932e229e..cc5b9363f 100644 --- a/recipes/tools/vim/recipe.toml +++ b/recipes/tools/vim/recipe.toml @@ -1,7 +1,7 @@ [source] -tar = "https://github.com/vim/vim/archive/refs/tags/v8.2.5172.tar.gz" -blake3 = "28a58578a6655e2e45078331569d6e6c96ed05189acda34c2a784581bf614cd2" -patch = ["vim.patch"] +tar = "https://github.com/vim/vim/archive/refs/tags/v9.1.0821.tar.gz" +blake3 = "d1f5802ceb047b09143f1764bf4016f084cf7e6c026c7047919264c9f262a5dd" +patches = ["vim.patch"] [build] dependencies = ["ncurses"] diff --git a/recipes/tools/vim/vim.patch b/recipes/tools/vim/vim.patch index 3a3643e4c..0537b2c95 100644 --- a/recipes/tools/vim/vim.patch +++ b/recipes/tools/vim/vim.patch @@ -1,22 +1,45 @@ +diff -ruwN source/src/configure.ac source-new/src/configure.ac +--- source/src/configure.ac 2024-10-29 04:05:26.000000000 +0700 ++++ source-new/src/configure.ac 2025-08-06 03:15:52.796303989 +0700 +@@ -3759,7 +3759,7 @@ + dnl Check for functions in one big call, to reduce the size of configure. + dnl Can only be used for functions that do not require any include. + AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \ +- getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \ ++ getpwent getpwnam getpwuid gettimeofday localtime_r lstat \ + memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ + getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ + sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \ +diff -ruwN source/src/feature.h source-new/src/feature.h +--- source/src/feature.h 2024-10-29 04:05:26.000000000 +0700 ++++ source-new/src/feature.h 2025-08-06 03:16:27.596296730 +0700 +@@ -272,6 +272,7 @@ + */ + #if defined(FEAT_NORMAL) \ + && defined(FEAT_EVAL) \ ++ && !defined (__redox__) /* disable setitimer */ \ + && ((defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) \ + && (!defined(MACOS_X) || defined(HAVE_DISPATCH_DISPATCH_H))) \ + || defined(MSWIN)) diff -ruwN source/src/libvterm/include/vterm.h source-new/src/libvterm/include/vterm.h ---- source/src/libvterm/include/vterm.h 2019-12-04 14:09:41.000000000 -0700 -+++ source-new/src/libvterm/include/vterm.h 2023-09-09 19:06:56.211783900 -0600 -@@ -15,9 +15,11 @@ - #define TRUE 1 +--- source/src/libvterm/include/vterm.h 2024-10-29 04:05:26.000000000 +0700 ++++ source-new/src/libvterm/include/vterm.h 2025-08-06 03:15:02.506316769 +0700 +@@ -17,9 +17,11 @@ #define FALSE 0 + // VIM: from stdint.h +#if !defined (__redox__) - // from stdint.h typedef unsigned char uint8_t; + typedef unsigned short uint16_t; typedef unsigned int uint32_t; +#endif - typedef struct VTerm VTerm; - typedef struct VTermState VTermState; + // VIM: define max screen cols and rows + #define VTERM_MAX_COLS 1000 diff -ruwN source/src/memfile.c source-new/src/memfile.c ---- source/src/memfile.c 2019-12-04 13:51:25.000000000 -0700 -+++ source-new/src/memfile.c 2023-09-09 19:06:08.999846625 -0600 -@@ -610,6 +610,8 @@ +--- source/src/memfile.c 2024-10-29 04:05:26.000000000 +0700 ++++ source-new/src/memfile.c 2025-08-06 03:15:36.896308173 +0700 +@@ -599,6 +599,8 @@ // No sync() on Stratus VOS # if defined(__OPENNT) || defined(__TANDEM) || defined(__VOS__) fflush(NULL); @@ -25,3 +48,19 @@ diff -ruwN source/src/memfile.c source-new/src/memfile.c # else sync(); # endif +diff -ruwN source/src/auto/configure source-new/src/auto/configure +--- source/src/auto/configure 2024-10-29 04:05:26.000000000 +0700 ++++ source-new/src/auto/configure 2025-08-06 03:56:11.765660165 +0700 +@@ -13358,12 +13358,6 @@ + printf "%s\n" "#define HAVE_GETPWUID 1" >>confdefs.h + + fi +-ac_fn_c_check_func "$LINENO" "getrlimit" "ac_cv_func_getrlimit" +-if test "x$ac_cv_func_getrlimit" = xyes +-then : +- printf "%s\n" "#define HAVE_GETRLIMIT 1" >>confdefs.h +- +-fi + ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" + if test "x$ac_cv_func_gettimeofday" = xyes + then : From 48eff2e7ac0da2c56dc1f51200df69092597be42 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Tue, 5 Aug 2025 21:15:50 +0000 Subject: [PATCH 05/52] Add zsh to WIP recipe --- recipes/wip/shells/zsh/01_redox.patch | 54 +++++++++++++++++++++++++++ recipes/wip/shells/zsh/recipe.toml | 24 ++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 recipes/wip/shells/zsh/01_redox.patch create mode 100644 recipes/wip/shells/zsh/recipe.toml diff --git a/recipes/wip/shells/zsh/01_redox.patch b/recipes/wip/shells/zsh/01_redox.patch new file mode 100644 index 000000000..c1f230a9e --- /dev/null +++ b/recipes/wip/shells/zsh/01_redox.patch @@ -0,0 +1,54 @@ +diff --color -ruwN source/configure.ac source-new/configure.ac +--- source/configure.ac 2022-05-15 01:59:21.000000000 +0700 ++++ source-new/configure.ac 2025-08-06 02:08:48.797381523 +0700 +@@ -1311,7 +1311,7 @@ + setuid seteuid setreuid setresuid setsid \ + setgid setegid setregid setresgid \ + memcpy memmove strstr strerror strtoul \ +- getrlimit getrusage \ ++ getrusage \ + setlocale \ + isblank iswblank \ + uname \ +diff --color -ruwN source/Src/builtin.c source-new/Src/builtin.c +--- source/Src/builtin.c 2022-05-15 01:59:21.000000000 +0700 ++++ source-new/Src/builtin.c 2025-08-06 02:41:57.266846385 +0700 +@@ -7160,16 +7160,7 @@ + long clktck = get_clktck(); + + /* get time accounting information */ +- if (times(&buf) == -1) +- return 1; +- pttime(buf.tms_utime); /* user time */ +- putchar(' '); +- pttime(buf.tms_stime); /* system time */ +- putchar('\n'); +- pttime(buf.tms_cutime); /* user time, children */ +- putchar(' '); +- pttime(buf.tms_cstime); /* system time, children */ +- putchar('\n'); ++ // Somehow times() is not linking correctly + return 0; + } + +diff --color -ruwN source/Src/Builtins/rlimits.c source-new/Src/Builtins/rlimits.c +--- source/Src/Builtins/rlimits.c 2022-05-15 01:59:21.000000000 +0700 ++++ source-new/Src/Builtins/rlimits.c 2025-08-06 02:24:09.457135439 +0700 +@@ -892,7 +892,7 @@ + int + boot_(UNUSED(Module m)) + { +- set_resinfo(); ++// set_resinfo(); + return 0; + } + +@@ -900,7 +900,7 @@ + int + cleanup_(Module m) + { +- free_resinfo(); ++// free_resinfo(); + return setfeatureenables(m, &module_features, NULL); + } + diff --git a/recipes/wip/shells/zsh/recipe.toml b/recipes/wip/shells/zsh/recipe.toml new file mode 100644 index 000000000..572f979a4 --- /dev/null +++ b/recipes/wip/shells/zsh/recipe.toml @@ -0,0 +1,24 @@ +#TODO: Buggy, can't return after running commands +[source] +tar = "https://github.com/zsh-users/zsh/archive/refs/tags/zsh-5.9.tar.gz" +blake3 = "a15b94fae03e87aba6fc6a27df3c98e610b85b0c7c0fc90248f07fdcb8816860" +patches = [ + "01_redox.patch" +] +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + +[build] +template = "custom" +dependencies = [ + "ncursesw", +] +script = """ +DYNAMIC_INIT + +"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" +"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" +"${COOKBOOK_MAKE}" install.bin install.modules install.fns DESTDIR="${COOKBOOK_STAGE}" +""" From 8b6f5aaa03af4663f79f2d2d1acb6e55a72da2ba Mon Sep 17 00:00:00 2001 From: Petr Hrdina Date: Wed, 6 Aug 2025 23:10:06 +0200 Subject: [PATCH 06/52] Add recipe for library unibilium --- recipes/libs/unibilium/recipe.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 recipes/libs/unibilium/recipe.toml diff --git a/recipes/libs/unibilium/recipe.toml b/recipes/libs/unibilium/recipe.toml new file mode 100644 index 000000000..5252c1d3c --- /dev/null +++ b/recipes/libs/unibilium/recipe.toml @@ -0,0 +1,15 @@ +[source] +tar = "https://github.com/neovim/unibilium/archive/refs/tags/v2.1.2.tar.gz" +blake3 = "856a7593a412942f4716bb55bfdd225f3ce92cb013b9d4a44693255f0570b1c7" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + +[build] +template = "custom" +script = """ +DYNAMIC_INIT +rsync -av --delete "${COOKBOOK_SOURCE}/" ./ +cookbook_configure +""" From a2ee1c202b35574968c45b602c301a34e315c0f5 Mon Sep 17 00:00:00 2001 From: Petr Hrdina Date: Thu, 7 Aug 2025 23:08:14 +0200 Subject: [PATCH 07/52] Add utf8proc recipe --- recipes/libs/utf8proc/recipe.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 recipes/libs/utf8proc/recipe.toml diff --git a/recipes/libs/utf8proc/recipe.toml b/recipes/libs/utf8proc/recipe.toml new file mode 100644 index 000000000..e17e3c790 --- /dev/null +++ b/recipes/libs/utf8proc/recipe.toml @@ -0,0 +1,22 @@ +[source] +tar = "https://github.com/JuliaStrings/utf8proc/archive/refs/tags/v2.10.0.tar.gz" + +[build] +template = "custom" +script = """ +DYNAMIC_INIT +COOKBOOK_CONFIGURE="cmake" +COOKBOOK_CONFIGURE_FLAGS=( + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_CROSSCOMPILING=True + -DCMAKE_CXX_COMPILER="${TARGET}-g++" + -DCMAKE_C_COMPILER="${TARGET}-gcc" + -DCMAKE_INSTALL_PREFIX="/" + -DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" + -DCMAKE_SYSTEM_NAME=Generic + -DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)" + -DCMAKE_VERBOSE_MAKEFILE=On +"${COOKBOOK_SOURCE}" +) +cookbook_configure +""" From d6b9a690f7c2a2f2e9e1355285bf3125b6ed2a46 Mon Sep 17 00:00:00 2001 From: Petr Hrdina Date: Thu, 7 Aug 2025 23:20:59 +0200 Subject: [PATCH 08/52] Add blake3 hash to utf8proc recipe --- recipes/libs/utf8proc/recipe.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/libs/utf8proc/recipe.toml b/recipes/libs/utf8proc/recipe.toml index e17e3c790..c34c12f19 100644 --- a/recipes/libs/utf8proc/recipe.toml +++ b/recipes/libs/utf8proc/recipe.toml @@ -1,5 +1,6 @@ [source] tar = "https://github.com/JuliaStrings/utf8proc/archive/refs/tags/v2.10.0.tar.gz" +blake3 = "6f675db5d1ae55ad0825351ba9c58a5b5c24c862f559cc7bfed1cb63c1185594" [build] template = "custom" From 1f1496a56ababe63097bb640fc676618abcab045 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Fri, 8 Aug 2025 23:06:45 -0400 Subject: [PATCH 09/52] Fix and bump sdl2-mixer --- recipes/libs/sdl2-mixer/recipe.toml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/recipes/libs/sdl2-mixer/recipe.toml b/recipes/libs/sdl2-mixer/recipe.toml index 3f2c1e865..2c9d9b829 100644 --- a/recipes/libs/sdl2-mixer/recipe.toml +++ b/recipes/libs/sdl2-mixer/recipe.toml @@ -1,23 +1,25 @@ [source] -tar = "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz" +tar = "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.8.1.tar.gz" +blake3 = "fa0798ce7ffdb5f89545311292374e5b7af479df8bc99a4aacfb40d2ab2f8384" [build] template = "custom" dependencies = [ - "sdl2", - "liborbital", - "llvm18", - "mesa", - "zlib", - "libogg", - "libvorbis", + "sdl2", + "liborbital", + "llvm18", + "mesa", + "zlib", + "libogg", + "libvorbis", ] script = """ -export SDL_LIBS="-lSDL2 -lorbital $("${TARGET}-pkg-config" --libs osmesa) -lvorbis -logg -lz -lm -lpthread -lstdc++" +DYNAMIC_INIT + +export SDL_LIBS="-lSDL2 -lorbital -lOSMesa -lvorbis -logg -lz -lm -lpthread -lstdc++" COOKBOOK_CONFIGURE_FLAGS=( --prefix=/ --host="${TARGET}" - --disable-shared --disable-sdltest --enable-music-ogg --disable-music-cmd From 28e3ba32fc92db23e8ce66916ea521a1ac036cd8 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Fri, 8 Aug 2025 23:11:00 -0400 Subject: [PATCH 10/52] Add wget-log to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d63ce24e5..b172da92b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ source-new source.tar source.tar.tmp target +wget-log From 4d1a00743ad35f5066de56f5af2f2a7de0765581 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 11 Aug 2025 14:25:49 +0000 Subject: [PATCH 11/52] Remove sh script for building the repo dir --- repo.sh | 63 +-------------------------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/repo.sh b/repo.sh index ef5b61b60..40476cefd 100755 --- a/repo.sh +++ b/repo.sh @@ -108,65 +108,4 @@ declare -A APPSTREAM_SOURCES # well. recipes="$recipes $(target/release/pkg_deps $toml_recipes)" -REPO_BUILDER="./target/release/repo_builder" - -if [ -x "$REPO_BUILDER" ] # TODO: Wait until everyone has this binary -then - "$REPO_BUILDER" "$REPO" $recipes -else # TODO: Delete this soon - -for recipe in $recipes -do - recipe_path=`target/release/find_recipe $recipe` - COOKBOOK_RECIPE="$recipe_path" - TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}" - COOKBOOK_STAGE="${TARGET_DIR}/stage" - - if [ "${COOKBOOK_STAGE}.pkgar" -nt "$REPO/$recipe.pkgar" ] - then - echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2 - cp -v "${COOKBOOK_STAGE}.pkgar" "$REPO/$recipe.pkgar" - cp -v "${COOKBOOK_STAGE}.toml" "$REPO/$recipe.toml" - fi - - if [ -e "${COOKBOOK_STAGE}/usr/share/metainfo" ] - then - APPSTREAM_SOURCES["$recipe"]="${COOKBOOK_STAGE}" - fi -done - -if [ "${APPSTREAM}" == "1" ] -then - echo -e "\033[01;38;5;155mrepo - generating appstream data\033[0m" >&2 - - APPSTREAM_ROOT="$ROOT/build/${TARGET}/appstream" - APPSTREAM_PKG="$REPO/appstream.pkgar" - rm -rf "${APPSTREAM_ROOT}" "${APPSTREAM_PKG}" - mkdir -p "${APPSTREAM_ROOT}" - if [ "${#APPSTREAM_SOURCES[@]}" -ne 0 ] - then - appstreamcli compose \ - --origin=pkgar \ - --result-root="${APPSTREAM_ROOT}" \ - "${APPSTREAM_SOURCES[@]}" - fi - pkgar create \ - --archive "${APPSTREAM_PKG}" \ - --skey "${ROOT}/build/id_ed25519.toml" \ - "${APPSTREAM_ROOT}" -fi - -echo -e "\033[01;38;5;155mrepo - generating repo.toml\033[0m" >&2 - -echo "[packages]" > "$REPO/repo.toml" -for toml in "$REPO/"*".toml" -do - package="$(basename "$toml" .toml)" - if [ "$package" != "repo" ] - then - version="$(grep version "$toml" | cut -d '=' -f2-)" - echo "$package =$version" >> "$REPO/repo.toml" - fi -done - -fi +target/release/repo_builder "$REPO" $recipes From 866c527072aacf41be5859c1c59547857e03dcba Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Tue, 12 Aug 2025 16:53:05 +0000 Subject: [PATCH 12/52] Fix make clean part II --- clean.sh | 2 +- cook.sh | 2 +- fetch.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clean.sh b/clean.sh index 7f370765e..7aba7ca85 100755 --- a/clean.sh +++ b/clean.sh @@ -12,5 +12,5 @@ fi for recipe_path in $recipes do - IGNORE_ERROR=1 ./cook.sh "$recipe_path" distclean + ./cook.sh "$recipe_path" distclean done diff --git a/cook.sh b/cook.sh index 76aa4e192..521668f94 100755 --- a/cook.sh +++ b/cook.sh @@ -325,7 +325,7 @@ if [ -n "$1" ] then if (echo "$1" | grep '.*/.*' >/dev/null); then recipe_name=$(basename "$1") - recipe_path="recipes/$1" + recipe_path="$1" else recipe_name="$1" recipe_path=`target/release/find_recipe $recipe_name` diff --git a/fetch.sh b/fetch.sh index 3186cb0c6..060ac6e4d 100755 --- a/fetch.sh +++ b/fetch.sh @@ -26,7 +26,7 @@ for recipe_path in $recipes do if (echo "$recipe_path" | grep '.*/.*' >/dev/null); then recipe_name=$(basename "$recipe_path") - recipe_path="recipes/$recipe_path" + recipe_path="$recipe_path" else recipe_name="$recipe_path" recipe_path=`target/release/find_recipe $recipe_name` From db911b5b81eeb5f3492a02a9b1898f21898e5ed6 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 12 Aug 2025 16:24:00 -0600 Subject: [PATCH 13/52] libpoppler: update and implement build script --- recipes/wip/libs/other/libpoppler/recipe.toml | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/recipes/wip/libs/other/libpoppler/recipe.toml b/recipes/wip/libs/other/libpoppler/recipe.toml index cf4bf3049..482952ca0 100644 --- a/recipes/wip/libs/other/libpoppler/recipe.toml +++ b/recipes/wip/libs/other/libpoppler/recipe.toml @@ -1,21 +1,47 @@ -#TODO maybe incomplete script, see https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/INSTALL?ref_type=heads #TODO needs encoding data - https://poppler.freedesktop.org/poppler-data-0.4.12.tar.gz [source] -tar = "https://poppler.freedesktop.org/poppler-23.12.0.tar.xz" +tar = "https://poppler.freedesktop.org/poppler-25.08.0.tar.xz" +blake3 = "0732ef20594d084ae3c24cb75079a2be347df78acac80fdcbd6149b8dce197d4" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + [build] template = "custom" +dependencies = [ + "cairo", + "curl", + "expat", + "fontconfig", + "freetype2", + "gettext", + "glib", + "libffi", + "libiconv", + "libjpeg", + "libpng", + "libx11", + "libxau", + "libxcb", + "nghttp2", + "openssl1", + "pcre2", + "pixman", + #TODO: compile dylib "libtiff", + "zlib", +] script = """ -COOKBOOK_CONFIGURE="cmake" -COOKBOOK_CONFIGURE_FLAGS=( - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_CROSSCOMPILING=True - -DCMAKE_EXE_LINKER_FLAGS="-static" - -DCMAKE_INSTALL_PREFIX="/" - -DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" - -DCMAKE_SYSTEM_NAME=Generic - -DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)" - -DCMAKE_VERBOSE_MAKEFILE=On -"${COOKBOOK_SOURCE}" -) -cookbook_configure +DYNAMIC_INIT +cookbook_cmake \ + -DCMAKE_C_FLAGS="-I${COOKBOOK_SYSROOT}/include" \ + -DCMAKE_CXX_FLAGS="-I${COOKBOOK_SYSROOT}/include" \ + -DENABLE_BOOST=OFF \ + -DENABLE_GPGME=OFF \ + -DENABLE_LCMS=OFF \ + -DENABLE_LIBOPENJPEG=none \ + -DENABLE_LIBTIFF=OFF \ + -DENABLE_QT5=OFF \ + -DENABLE_QT6=OFF \ + -DENABLE_NSS3=OFF """ From a5630017f467e723415932404d654f3f283b17d2 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 13 Aug 2025 09:38:29 -0600 Subject: [PATCH 14/52] cosmic-reader: use mupdf backend --- recipes/tools/cosmic-reader/recipe.toml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/recipes/tools/cosmic-reader/recipe.toml b/recipes/tools/cosmic-reader/recipe.toml index 14635d13b..a766062c0 100644 --- a/recipes/tools/cosmic-reader/recipe.toml +++ b/recipes/tools/cosmic-reader/recipe.toml @@ -4,8 +4,25 @@ branch = "master" [build] template = "custom" +dependencies = [ + "expat", + "fontconfig", + "freetype2", + "libpng", + "zlib", +] script = """ -cookbook_cargo --no-default-features +DYNAMIC_INIT +"${COOKBOOK_CARGO}" rustc \ + --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \ + --release \ + --bin cosmic-reader \ + --no-default-features \ + --features mupdf \ + -- \ + -C link-args="-lpng -lexpat" +mkdir -pv "${COOKBOOK_STAGE}/usr/bin/" +cp -v "target/${TARGET}/release/cosmic-reader" "${COOKBOOK_STAGE}/usr/bin/" mkdir -pv "${COOKBOOK_STAGE}/ui/apps" cp -v "${COOKBOOK_RECIPE}/manifest" "${COOKBOOK_STAGE}/ui/apps/40_cosmic-reader" -""" +""" \ No newline at end of file From 2afdaac5be2106b4584c508e9352542460e84fe9 Mon Sep 17 00:00:00 2001 From: Ribbon Date: Fri, 15 Aug 2025 03:21:42 -0300 Subject: [PATCH 15/52] Add recipes --- recipes/wip/analysis/flowgger/recipe.toml | 6 ++++++ recipes/wip/data-integrity/rapidhash/recipe.toml | 8 ++++++++ recipes/wip/demos/iocraft/recipe.toml | 10 ++++++++++ recipes/wip/demos/rustui/recipe.toml | 9 +++++++++ recipes/wip/dev/lang/tur/recipe.toml | 8 ++++++++ recipes/wip/fuse/lis/recipe.toml | 8 ++++++++ recipes/wip/image/converters/dipc/recipe.toml | 5 +++++ recipes/wip/net/p2p/dumbpipe/recipe.toml | 5 +++++ recipes/wip/net/remote/zeco/recipe.toml | 5 +++++ recipes/wip/net/server/vproxy/recipe.toml | 5 +++++ 10 files changed, 69 insertions(+) create mode 100644 recipes/wip/analysis/flowgger/recipe.toml create mode 100644 recipes/wip/data-integrity/rapidhash/recipe.toml create mode 100644 recipes/wip/demos/iocraft/recipe.toml create mode 100644 recipes/wip/demos/rustui/recipe.toml create mode 100644 recipes/wip/dev/lang/tur/recipe.toml create mode 100644 recipes/wip/fuse/lis/recipe.toml create mode 100644 recipes/wip/image/converters/dipc/recipe.toml create mode 100644 recipes/wip/net/p2p/dumbpipe/recipe.toml create mode 100644 recipes/wip/net/remote/zeco/recipe.toml create mode 100644 recipes/wip/net/server/vproxy/recipe.toml diff --git a/recipes/wip/analysis/flowgger/recipe.toml b/recipes/wip/analysis/flowgger/recipe.toml new file mode 100644 index 000000000..efcaed09d --- /dev/null +++ b/recipes/wip/analysis/flowgger/recipe.toml @@ -0,0 +1,6 @@ +#TODO not compiled or tested +# build instructions: https://github.com/awslabs/flowgger/wiki/Installation +[source] +git = "https://github.com/awslabs/flowgger" +[build] +template = "cargo" diff --git a/recipes/wip/data-integrity/rapidhash/recipe.toml b/recipes/wip/data-integrity/rapidhash/recipe.toml new file mode 100644 index 000000000..c1c746e76 --- /dev/null +++ b/recipes/wip/data-integrity/rapidhash/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/hoxxep/rapidhash" +[build] +template = "custom" +script = """ +cookbook_cargo_packages rapidhash +""" diff --git a/recipes/wip/demos/iocraft/recipe.toml b/recipes/wip/demos/iocraft/recipe.toml new file mode 100644 index 000000000..18ad8f48f --- /dev/null +++ b/recipes/wip/demos/iocraft/recipe.toml @@ -0,0 +1,10 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/ccbrown/iocraft" +[build] +template = "custom" +script = """ +cookbook_cargo_examples borders calculator counter \ +fullscreen hello_world overlap progress_bar scrolling \ +table use_input use_output weather +""" diff --git a/recipes/wip/demos/rustui/recipe.toml b/recipes/wip/demos/rustui/recipe.toml new file mode 100644 index 000000000..cda858c7b --- /dev/null +++ b/recipes/wip/demos/rustui/recipe.toml @@ -0,0 +1,9 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/broccolingual/rustui" +[build] +template = "custom" +script = """ +cookbook_cargo_examples hello_world colors inputs file_reader +cookbook_cargo_packages tetris +""" diff --git a/recipes/wip/dev/lang/tur/recipe.toml b/recipes/wip/dev/lang/tur/recipe.toml new file mode 100644 index 000000000..13ffc9d4c --- /dev/null +++ b/recipes/wip/dev/lang/tur/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/rezigned/tur" +[build] +template = "custom" +script = """ +cookbook_cargo_packages tur-cli tur-tui +""" diff --git a/recipes/wip/fuse/lis/recipe.toml b/recipes/wip/fuse/lis/recipe.toml new file mode 100644 index 000000000..400e1fbd9 --- /dev/null +++ b/recipes/wip/fuse/lis/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/riffcc/lis" +[build] +template = "cargo" +dependencies = [ + "libfuse3", +] diff --git a/recipes/wip/image/converters/dipc/recipe.toml b/recipes/wip/image/converters/dipc/recipe.toml new file mode 100644 index 000000000..a4bdfb619 --- /dev/null +++ b/recipes/wip/image/converters/dipc/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/doprz/dipc" +[build] +template = "cargo" diff --git a/recipes/wip/net/p2p/dumbpipe/recipe.toml b/recipes/wip/net/p2p/dumbpipe/recipe.toml new file mode 100644 index 000000000..4ae3400fc --- /dev/null +++ b/recipes/wip/net/p2p/dumbpipe/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/n0-computer/dumbpipe" +[build] +template = "cargo" diff --git a/recipes/wip/net/remote/zeco/recipe.toml b/recipes/wip/net/remote/zeco/recipe.toml new file mode 100644 index 000000000..8a4e04275 --- /dev/null +++ b/recipes/wip/net/remote/zeco/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/julianbuettner/zeco" +[build] +template = "cargo" diff --git a/recipes/wip/net/server/vproxy/recipe.toml b/recipes/wip/net/server/vproxy/recipe.toml new file mode 100644 index 000000000..db161785d --- /dev/null +++ b/recipes/wip/net/server/vproxy/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/0x676e67/vproxy" +[build] +template = "cargo" From 85613a52b496858d639c668825ff29ed18c1b2e3 Mon Sep 17 00:00:00 2001 From: Ribbon Date: Fri, 15 Aug 2025 03:31:54 -0300 Subject: [PATCH 16/52] Add recipes --- recipes/wip/net/lan/malai/recipe.toml | 8 ++++++++ recipes/wip/net/remote/do-ssh/recipe.toml | 5 +++++ recipes/wip/net/remote/iroh-ssh/recipe.toml | 5 +++++ recipes/wip/net/sharing/sendme/recipe.toml | 5 +++++ 4 files changed, 23 insertions(+) create mode 100644 recipes/wip/net/lan/malai/recipe.toml create mode 100644 recipes/wip/net/remote/do-ssh/recipe.toml create mode 100644 recipes/wip/net/remote/iroh-ssh/recipe.toml create mode 100644 recipes/wip/net/sharing/sendme/recipe.toml diff --git a/recipes/wip/net/lan/malai/recipe.toml b/recipes/wip/net/lan/malai/recipe.toml new file mode 100644 index 000000000..237c72592 --- /dev/null +++ b/recipes/wip/net/lan/malai/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/fastn-stack/kulfi" +[build] +template = "custom" +script = """ +cookbook_cargo_packages malai +""" diff --git a/recipes/wip/net/remote/do-ssh/recipe.toml b/recipes/wip/net/remote/do-ssh/recipe.toml new file mode 100644 index 000000000..41632fc5e --- /dev/null +++ b/recipes/wip/net/remote/do-ssh/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/doEggi/do-ssh" +[build] +template = "cargo" diff --git a/recipes/wip/net/remote/iroh-ssh/recipe.toml b/recipes/wip/net/remote/iroh-ssh/recipe.toml new file mode 100644 index 000000000..3af3dc0f1 --- /dev/null +++ b/recipes/wip/net/remote/iroh-ssh/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/rustonbsd/iroh-ssh" +[build] +template = "cargo" diff --git a/recipes/wip/net/sharing/sendme/recipe.toml b/recipes/wip/net/sharing/sendme/recipe.toml new file mode 100644 index 000000000..e4162119a --- /dev/null +++ b/recipes/wip/net/sharing/sendme/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/n0-computer/sendme" +[build] +template = "cargo" From db7d763fe694fcf1f3086e333e100a1115682402 Mon Sep 17 00:00:00 2001 From: Mathew John Roberts Date: Fri, 15 Aug 2025 07:56:56 +0100 Subject: [PATCH 17/52] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Ribbon --- recipes/tests/os-test/recipe.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tests/os-test/recipe.toml b/recipes/tests/os-test/recipe.toml index db2771367..59467c204 100644 --- a/recipes/tests/os-test/recipe.toml +++ b/recipes/tests/os-test/recipe.toml @@ -13,5 +13,5 @@ dependencies = [ "gnu-binutils", "gnu-make", "gcc13", - "libarchive" + "libarchive", ] From efd3485ecda13e5c7ef13224d1d6db2c6025fbaf Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Fri, 15 Aug 2025 08:36:48 +0000 Subject: [PATCH 18/52] Only include subset of terminfo --- recipes/other/terminfo/recipe.toml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/recipes/other/terminfo/recipe.toml b/recipes/other/terminfo/recipe.toml index 856ea8735..ea8ed3129 100644 --- a/recipes/other/terminfo/recipe.toml +++ b/recipes/other/terminfo/recipe.toml @@ -5,7 +5,14 @@ branch = "master" [build] template = "custom" script = """ -mkdir -p ${COOKBOOK_STAGE}/share -cp -r ${COOKBOOK_SOURCE}/. ${COOKBOOK_STAGE}/share/ +# only copy common TERM envar +mkdir -p ${COOKBOOK_STAGE}/share/terminfo/{a,d,l,s,t,v,x} +cp -r ${COOKBOOK_SOURCE}/tabset ${COOKBOOK_STAGE}/share/ +cp ${COOKBOOK_SOURCE}/terminfo/a/ansi{,-*} ${COOKBOOK_STAGE}/share/terminfo/a/ +cp ${COOKBOOK_SOURCE}/terminfo/d/dumb{,-*} ${COOKBOOK_STAGE}/share/terminfo/d/ +cp ${COOKBOOK_SOURCE}/terminfo/l/linux{,-*} ${COOKBOOK_STAGE}/share/terminfo/l/ +cp ${COOKBOOK_SOURCE}/terminfo/s/screen{,-*} ${COOKBOOK_STAGE}/share/terminfo/s/ +cp ${COOKBOOK_SOURCE}/terminfo/t/tmux{,-*} ${COOKBOOK_STAGE}/share/terminfo/t/ +cp ${COOKBOOK_SOURCE}/terminfo/v/vt100{,-*} ${COOKBOOK_STAGE}/share/terminfo/v/ +cp ${COOKBOOK_SOURCE}/terminfo/x/xterm{,-*} ${COOKBOOK_STAGE}/share/terminfo/x/ """ - From 3da709fb1fc1a67dfa9e97a72e095c8a3c67cdfd Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 18 Aug 2025 08:45:52 +0700 Subject: [PATCH 19/52] Cache auto deps --- cook.sh | 1 + src/bin/cook.rs | 86 +++++++++++++++++++++++++++++++++---------------- src/recipe.rs | 7 +++- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/cook.sh b/cook.sh index 521668f94..6435f2cce 100755 --- a/cook.sh +++ b/cook.sh @@ -288,6 +288,7 @@ function op { ;; unstage) rm -rfv "${COOKBOOK_STAGE}" + rm -fv "${TARGET_DIR}/auto_deps.toml" ;; pkg) pkgar \ diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 4002f712d..77a8b2698 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -1,7 +1,8 @@ use cookbook::blake3::blake3_progress; -use cookbook::recipe::{BuildKind, CookRecipe, Recipe, SourceRecipe}; +use cookbook::recipe::{AutoDeps, BuildKind, CookRecipe, Recipe, SourceRecipe}; use pkg::package::Package; use pkg::{recipes, PackageName}; +use serde::Serialize; use std::collections::VecDeque; use std::convert::TryInto; use std::{ @@ -187,6 +188,20 @@ fn run_command_stdin(mut command: process::Command, stdin_data: &[u8]) -> Result Ok(()) } +fn serialize_and_write(file_path: &Path, content: &T) -> Result<(), String> { + let toml_content = toml::to_string(content).map_err(|err| { + format!( + "Failed to serialize content for '{}': {}", + file_path.display(), + err + ) + })?; + + fs::write(file_path, toml_content) + .map_err(|err| format!("Failed to write to file '{}': {}", file_path.display(), err))?; + Ok(()) +} + static SHARED_PRESCRIPT: &str = r#" function DYNAMIC_INIT { COOKBOOK_AUTORECONF="autoreconf" @@ -704,16 +719,16 @@ fn build( let sysroot_dir = target_dir.join("sysroot"); // Rebuild sysroot if source is newer //TODO: rebuild on recipe changes - if sysroot_dir.is_dir() - && (modified_dir(&sysroot_dir)? < source_modified - || modified_dir(&sysroot_dir)? < deps_modified) - { - eprintln!( - "DEBUG: '{}' newer than '{}'", - source_dir.display(), - sysroot_dir.display() - ); - remove_all(&sysroot_dir)?; + if sysroot_dir.is_dir() { + let sysroot_modified = modified_dir(&sysroot_dir)?; + if sysroot_modified < source_modified || sysroot_modified < deps_modified { + eprintln!( + "DEBUG: '{}' newer than '{}'", + source_dir.display(), + sysroot_dir.display() + ); + remove_all(&sysroot_dir)?; + } } if !sysroot_dir.is_dir() { // Create sysroot.tmp @@ -754,16 +769,16 @@ fn build( let stage_dir = target_dir.join("stage"); // Rebuild stage if source is newer //TODO: rebuild on recipe changes - if stage_dir.is_dir() - && (modified_dir(&stage_dir)? < source_modified - || modified_dir(&stage_dir)? < deps_modified) - { - eprintln!( - "DEBUG: '{}' newer than '{}'", - source_dir.display(), - stage_dir.display() - ); - remove_all(&stage_dir)?; + if stage_dir.is_dir() { + let stage_modified = modified_dir(&stage_dir)?; + if stage_modified < source_modified || stage_modified < deps_modified { + eprintln!( + "DEBUG: '{}' newer than '{}'", + source_dir.display(), + stage_dir.display() + ); + remove_all(&stage_dir)?; + } } if !stage_dir.is_dir() { @@ -1069,8 +1084,24 @@ done rename(&stage_dir_tmp, &stage_dir)?; } - // Calculate automatic dependencies - let auto_deps = auto_deps(&stage_dir, &dep_pkgars); + let auto_deps_path = target_dir.join("auto_deps.toml"); + + if auto_deps_path.is_file() && modified(&auto_deps_path)? < modified(&stage_dir)? { + remove_all(&auto_deps_path)? + } + + let auto_deps = if auto_deps_path.exists() { + let toml_content = + fs::read_to_string(&auto_deps_path).map_err(|_| "failed to read cached auto_deps")?; + let wrapper: AutoDeps = + toml::from_str(&toml_content).map_err(|_| "failed to deserialize cached auto_deps")?; + wrapper.packages + } else { + let packages = auto_deps(&stage_dir, &dep_pkgars); + let wrapper = AutoDeps { packages }; + serialize_and_write(&auto_deps_path, &wrapper)?; + wrapper.packages + }; Ok((stage_dir, auto_deps)) } @@ -1137,15 +1168,14 @@ fn package_toml( depends.push(dep.clone()); } } - let stage_toml = toml::to_string(&Package { + let package = Package { name: name.clone(), version: package_version(recipe), target: env::var("TARGET").map_err(|err| format!("failed to read TARGET: {:?}", err))?, depends, - }) - .map_err(|err| format!("failed to serialize stage.toml: {:?}", err))?; - fs::write(target_dir.join("stage.toml"), stage_toml) - .map_err(|err| format!("failed to write stage.toml: {:?}", err))?; + }; + + serialize_and_write(&target_dir.join("stage.toml"), &package)?; return Ok(()); } diff --git a/src/recipe.rs b/src/recipe.rs index 4341551d7..0a0b49347 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -1,4 +1,4 @@ -use std::{convert::TryInto, fs, path::PathBuf}; +use std::{collections::BTreeSet, convert::TryInto, fs, path::PathBuf}; use pkg::{package::PackageError, recipes, PackageName}; use serde::{ @@ -215,6 +215,11 @@ impl CookRecipe { } } +#[derive(Serialize, Deserialize)] +pub struct AutoDeps { + pub packages: BTreeSet, +} + #[cfg(test)] mod tests { use pkg::PackageName; From fec945560ee0f005d03714f604f75a2e2228b5c6 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 18 Aug 2025 02:00:58 +0000 Subject: [PATCH 20/52] Retain comment --- src/bin/cook.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 77a8b2698..dde130ffa 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -1084,6 +1084,7 @@ done rename(&stage_dir_tmp, &stage_dir)?; } + // Calculate automatic dependencies let auto_deps_path = target_dir.join("auto_deps.toml"); if auto_deps_path.is_file() && modified(&auto_deps_path)? < modified(&stage_dir)? { From c64fb342b41ea317b6c843f428b72f28c7bc1af8 Mon Sep 17 00:00:00 2001 From: Bendeguz Pisch Date: Wed, 20 Aug 2025 10:12:02 +0200 Subject: [PATCH 21/52] Move miniserve to wip/net/http, change it to toml and change source to upstream --- recipes/tools/miniserve/recipe.sh | 2 -- recipes/wip/net/http/miniserve/recipe.toml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) delete mode 100644 recipes/tools/miniserve/recipe.sh create mode 100644 recipes/wip/net/http/miniserve/recipe.toml diff --git a/recipes/tools/miniserve/recipe.sh b/recipes/tools/miniserve/recipe.sh deleted file mode 100644 index fdd79422a..000000000 --- a/recipes/tools/miniserve/recipe.sh +++ /dev/null @@ -1,2 +0,0 @@ -GIT=https://gitlab.redox-os.org/redox-os/miniserve -BUILD_DEPENDS=(openssl1 zlib) diff --git a/recipes/wip/net/http/miniserve/recipe.toml b/recipes/wip/net/http/miniserve/recipe.toml new file mode 100644 index 000000000..f5d958043 --- /dev/null +++ b/recipes/wip/net/http/miniserve/recipe.toml @@ -0,0 +1,12 @@ +#TODO missing libc:: socket-related imports + +[source] +git = "https://github.com/svenstaro/miniserve" + +[build] +dependencies = [ + "openssl1", + "zlib" +] +template = "cargo" + From 541e855d72abb05ee2ce898c3876bf9de2ba78f6 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Wed, 20 Aug 2025 12:53:38 +0000 Subject: [PATCH 22/52] Add more build templates and automatic DYNAMIC_INIT --- recipes/dev/gdk-pixbuf/recipe.toml | 16 +++++----- recipes/emulators/mgba/recipe.toml | 31 +++++++------------ recipes/net/download/wget/recipe.toml | 11 +++---- .../wip/net/download/youtube-tui/recipe.toml | 6 ++-- src/bin/cook.rs | 24 +++++++++++++- src/recipe.rs | 18 +++++++++-- 6 files changed, 63 insertions(+), 43 deletions(-) diff --git a/recipes/dev/gdk-pixbuf/recipe.toml b/recipes/dev/gdk-pixbuf/recipe.toml index afa8bff21..7ae9aa5c7 100644 --- a/recipes/dev/gdk-pixbuf/recipe.toml +++ b/recipes/dev/gdk-pixbuf/recipe.toml @@ -15,12 +15,10 @@ dependencies = [ "shared-mime-info", "zlib", ] -template = "custom" -script = """ -DYNAMIC_INIT -cookbook_meson \ - -Dbuiltin_loaders=all \ - -Dgir=false \ - -Dinstalled_tests=false \ - -Dx11=false -""" +template = "meson" +mesonflags = [ + "-Dbuiltin_loaders=all", + "-Dgir=false", + "-Dinstalled_tests=false", + "-Dx11=false", +] diff --git a/recipes/emulators/mgba/recipe.toml b/recipes/emulators/mgba/recipe.toml index 5a4d65aeb..b61b7bd05 100644 --- a/recipes/emulators/mgba/recipe.toml +++ b/recipes/emulators/mgba/recipe.toml @@ -4,24 +4,15 @@ blake3 = "a1b9e797a5058f5264d276805aef5643b7ea460916e491a0098ba32d87f1519e" patches = ["redox.patch"] [build] -dependencies = [ - "libiconv", - "liborbital", - "libpng", - "pixman", - "sdl1", - "zlib", +dependencies = ["libiconv", "liborbital", "libpng", "pixman", "sdl1", "zlib"] +template = "cmake" +cmakeflags = [ + "-DBUILD_QT=OFF", + "-DBUILD_SHARED=ON", + "-DBUILD_STATIC=OFF", + "-DUSE_SQLITE3=OFF", + "-DUSE_DEBUGGERS=OFF", + "-DBUILD_SDL=ON", + "-DSDL_VERSION=1.2", + "-DSDL_LIBRARY=-lSDL -lorbital", ] -template = "custom" -script = """ -DYNAMIC_INIT -cookbook_cmake \ - -DBUILD_QT=OFF \ - -DBUILD_SHARED=ON \ - -DBUILD_STATIC=OFF \ - -DUSE_SQLITE3=OFF \ - -DUSE_DEBUGGERS=OFF \ - -DBUILD_SDL=ON \ - -DSDL_VERSION="1.2" \ - -DSDL_LIBRARY="-lSDL -lorbital" -""" diff --git a/recipes/net/download/wget/recipe.toml b/recipes/net/download/wget/recipe.toml index dd4f52e69..fb2d6ab4b 100644 --- a/recipes/net/download/wget/recipe.toml +++ b/recipes/net/download/wget/recipe.toml @@ -1,13 +1,10 @@ [source] tar = "https://ftp.gnu.org/gnu/wget/wget-1.21.4.tar.gz" [build] -template = "custom" dependencies = [ "openssl1", ] -script = """ -COOKBOOK_CONFIGURE_FLAGS+=( - --with-ssl=openssl -) -cookbook_configure -""" +template = "configure" +configureflags = [ + "--with-ssl=openssl" +] diff --git a/recipes/wip/net/download/youtube-tui/recipe.toml b/recipes/wip/net/download/youtube-tui/recipe.toml index 83406f0ea..5306f25dc 100644 --- a/recipes/wip/net/download/youtube-tui/recipe.toml +++ b/recipes/wip/net/download/youtube-tui/recipe.toml @@ -2,10 +2,8 @@ [source] git = "https://github.com/Siriusmart/youtube-tui" [build] -template = "custom" +template = "cargo" +cargoflags = "--no-default-features" dependencies = [ "openssl1", ] -script = """ -cookbook_cargo --no-default-features -""" diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 4002f712d..6d37332d3 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -1014,6 +1014,17 @@ do done "#; + let flags_fn = |name, flags: &Vec| { + format!( + "{name}+=(\n{}\n)\n", + flags + .iter() + .map(|s| format!(" \"{s}\"")) + .collect::>() + .join("\n") + ) + }; + //TODO: better integration with redoxer (library instead of binary) //TODO: configurable target //TODO: Add more configurability, convert scripts to Rust? @@ -1027,7 +1038,18 @@ done package_path.as_deref().unwrap_or(".") ) } - BuildKind::Configure => "cookbook_configure".to_owned(), + BuildKind::Configure { configureflags } => format!( + "DYNAMIC_INIT\n{}cookbook_configure", + flags_fn("COOKBOOK_CONFIGURE_FLAGS", configureflags), + ), + BuildKind::Cmake { cmakeflags } => format!( + "DYNAMIC_INIT\n{}cookbook_cmake", + flags_fn("COOKBOOK_CMAKE_FLAGS", cmakeflags), + ), + BuildKind::Meson { mesonflags } => format!( + "DYNAMIC_INIT\n{}cookbook_meson", + flags_fn("COOKBOOK_MESON_FLAGS", mesonflags), + ), BuildKind::Custom { script } => script.clone(), BuildKind::None => "".to_owned(), }; diff --git a/src/recipe.rs b/src/recipe.rs index 4341551d7..e6252811b 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -71,13 +71,27 @@ pub enum BuildKind { Cargo { #[serde(default)] package_path: Option, - #[serde(default)] cargoflags: String, }, /// Will build and install using configure and make #[serde(rename = "configure")] - Configure, + Configure { + #[serde(default)] + configureflags: Vec, + }, + /// Will build and install using cmake + #[serde(rename = "cmake")] + Cmake { + #[serde(default)] + cmakeflags: Vec, + }, + /// Will build and install using meson + #[serde(rename = "meson")] + Meson { + #[serde(default)] + mesonflags: Vec, + }, /// Will build and install using custom commands #[serde(rename = "custom")] Custom { script: String }, From 3a53c6abbb2a2881316ff2dce38ab129283b287f Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Wed, 20 Aug 2025 12:54:12 +0000 Subject: [PATCH 23/52] Update openssh patches --- recipes/wip/ssh/openssh/recipe.toml | 13 +- recipes/wip/ssh/openssh/redox.patch | 461 ++++++++++++++++++++++------ 2 files changed, 374 insertions(+), 100 deletions(-) diff --git a/recipes/wip/ssh/openssh/recipe.toml b/recipes/wip/ssh/openssh/recipe.toml index 4d7261da5..26ed0f91f 100644 --- a/recipes/wip/ssh/openssh/recipe.toml +++ b/recipes/wip/ssh/openssh/recipe.toml @@ -1,13 +1,20 @@ -#TODO update the patch to match the current version -#TODO does the patch is still needed? +#TODO compiled but not tested +#TODO lack of utmpx.h and resolv.h, expect dns not working +#TODO maybe actually implement utmpx.h in relibc? [source] tar = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz" patches = [ "redox.patch", ] [build] -template = "configure" +template = "custom" dependencies = [ "openssl1", "zlib", ] +script = """ +DYNAMIC_INIT +cookbook_configure +mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd +rmdir "${COOKBOOK_STAGE}"/usr/sbin +""" diff --git a/recipes/wip/ssh/openssh/redox.patch b/recipes/wip/ssh/openssh/redox.patch index f19001f78..e1b43cae3 100644 --- a/recipes/wip/ssh/openssh/redox.patch +++ b/recipes/wip/ssh/openssh/redox.patch @@ -1,138 +1,405 @@ -diff -ruwN source/channels.c source-new/channels.c ---- source/channels.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/channels.c 2019-01-15 21:01:12.203686148 -0700 -@@ -1865,10 +1865,10 @@ - fatal(":%s: channel %d: no remote id", __func__, c->self); - /* for rdynamic the OPEN_CONFIRMATION has been sent already */ - isopen = (c->type == SSH_CHANNEL_RDYNAMIC_FINISH); -- if (getsockopt(c->sock, SOL_SOCKET, SO_ERROR, &err, &sz) < 0) { -- err = errno; -- error("getsockopt SO_ERROR failed"); -- } -+ // if (getsockopt(c->sock, SOL_SOCKET, SO_ERROR, &err, &sz) < 0) { -+ // err = errno; -+ // error("getsockopt SO_ERROR failed"); -+ // } - if (err == 0) { - debug("channel %d: connected to %s port %d", - c->self, c->connect_ctx.host, c->connect_ctx.port); -diff -ruwN source/config.sub source-new/config.sub ---- source/config.sub 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/config.sub 2019-01-15 19:39:26.234492329 -0700 -@@ -1407,7 +1407,7 @@ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ -- | -onefs* | -tirtos* | -phoenix*) -+ | -onefs* | -tirtos* | -phoenix* | -redox*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) -diff -ruwN source/openbsd-compat/bindresvport.c source-new/openbsd-compat/bindresvport.c ---- source/openbsd-compat/bindresvport.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/bindresvport.c 2019-01-15 20:46:06.879804135 -0700 -@@ -42,6 +42,10 @@ - #include - #include +diff -ruwN source/defines.h source-new/defines.h +--- source/defines.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/defines.h 2025-08-20 13:37:45.820728226 +0700 +@@ -52,6 +52,18 @@ + #define IPPORT_RESERVED 0 + #endif +#ifndef IPPORT_RESERVED +#define IPPORT_RESERVED 1024 +#endif + - #define STARTPORT 600 - #define ENDPORT (IPPORT_RESERVED - 1) - #define NPORTS (ENDPORT - STARTPORT + 1) -diff -ruwN source/openbsd-compat/bsd-getpeereid.c source-new/openbsd-compat/bsd-getpeereid.c ---- source/openbsd-compat/bsd-getpeereid.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/bsd-getpeereid.c 2019-01-15 20:43:12.410583244 -0700 -@@ -23,7 +23,7 @@ - - #include - --#if defined(SO_PEERCRED) -+#if defined(SO_PEERCRED) && !defined(__redox__) - int - getpeereid(int s, uid_t *euid, gid_t *gid) - { -diff -ruwN source/openbsd-compat/bsd-misc.c source-new/openbsd-compat/bsd-misc.c ---- source/openbsd-compat/bsd-misc.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/bsd-misc.c 2019-01-15 20:28:46.619332501 -0700 -@@ -25,6 +25,9 @@ - # include ++#ifndef IN_LOOPBACKNET ++#define IN_LOOPBACKNET 127 ++#endif ++ ++#ifndef MAXDNAME ++#define MAXDNAME 256 ++#endif ++ + /* + * Definitions for IP type of service (ip_tos) + */ +@@ -454,19 +466,21 @@ + # define _PATH_DEVNULL "/dev/null" #endif -+#if defined(__redox__) -+#include +-/* user may have set a different path */ +-#if defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) +-# undef _PATH_MAILDIR +-#endif /* defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) */ +- +-#ifdef MAIL_DIRECTORY +-# define _PATH_MAILDIR MAIL_DIRECTORY ++#ifndef _PATH_MAILDIR ++# define _PATH_MAILDIR "/var/mail" + #endif + + #ifndef _PATH_NOLOGIN + # define _PATH_NOLOGIN "/etc/nologin" + #endif + ++#ifndef ST_RDONLY ++#define ST_RDONLY 1 +#endif - #include - #include ++#ifndef ST_NOSUID ++#define ST_NOSUID 2 ++#endif ++ + /* Define this to be the path of the xauth program. */ + #ifdef XAUTH_PATH + #define _PATH_XAUTH XAUTH_PATH +diff -ruwN source/hostfile.c source-new/hostfile.c +--- source/hostfile.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/hostfile.c 2025-08-20 11:51:28.964103232 +0700 +@@ -44,7 +44,9 @@ + #include + + #include ++#ifndef __redox__ + #include ++#endif + #include + #include #include +diff -ruwN source/loginrec.c source-new/loginrec.c +--- source/loginrec.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/loginrec.c 2025-08-20 13:43:02.970560664 +0700 +@@ -1033,7 +1033,7 @@ + return (0); + } + # else +- if (!utmpx_write_direct(li, &ut)) { ++ if (!utmpx_write_direct(li, &utx)) { + logit("%s: utmp_write_direct() failed", __func__); + return (0); + } +diff -ruwN source/loginrec.h source-new/loginrec.h +--- source/loginrec.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/loginrec.h 2025-08-20 13:39:08.570682776 +0700 +@@ -30,6 +30,7 @@ + **/ + + #include "includes.h" ++#include "openbsd-compat/utmpx.h" + + struct ssh; + +diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-statvfs.h +--- source/openbsd-compat/bsd-statvfs.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/openbsd-compat/bsd-statvfs.h 2025-08-20 13:37:42.000730245 +0700 +@@ -37,13 +37,6 @@ + typedef unsigned long fsfilcnt_t; + #endif + +-#ifndef ST_RDONLY +-#define ST_RDONLY 1 +-#endif +-#ifndef ST_NOSUID +-#define ST_NOSUID 2 +-#endif +- + /* as defined in IEEE Std 1003.1, 2004 Edition */ + struct statvfs { + unsigned long f_bsize; /* File system block size. */ diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getrrsetbyname.c ---- source/openbsd-compat/getrrsetbyname.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/getrrsetbyname.c 2019-01-15 20:57:20.248721738 -0700 -@@ -47,7 +47,7 @@ +--- source/openbsd-compat/getrrsetbyname.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/openbsd-compat/getrrsetbyname.c 2025-08-20 13:51:15.020299084 +0700 +@@ -67,6 +67,52 @@ + #endif + #define _THREAD_PRIVATE(a,b,c) (c) - #include "includes.h" ++#ifdef __redox__ ++ ++#include ++#include ++ ++/* ++ * Minimalist replacement for for systems that lack it, ++ * such as Redox OS. This provides the basic structures needed by ++ * the OpenSSH compatibility layer. ++ */ ++ ++// Define necessary constants ++#define MAXNS 3 /* max # name servers we'll track */ ++#define MAXDNSRCH 6 /* max # domains in search path */ ++#define MAXRESOLVSORT 10 /* number of nets to sort on */ ++#define MAXDNAME 256 /* max length of a domain name */ ++ ++/* ++ * A simplified, portable version of the resolver state structure. ++ * Glibc-specific fields, hooks, and complex unions have been removed. ++ */ ++struct __res_state { ++ int retrans; /* retransmission time interval */ ++ int retry; /* number of times to retransmit */ ++ unsigned long options; /* option flags */ ++ int nscount; /* number of name servers */ ++ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name servers */ ++ unsigned short id; /* current message id */ ++ char *dnsrch[MAXDNSRCH + 1]; /* components of domain to search */ ++ char defdname[MAXDNAME]; /* default domain name */ ++ ++ struct { ++ struct in_addr addr; ++ uint32_t mask; ++ } sort_list[MAXRESOLVSORT]; ++ ++ int res_h_errno; /* last error code for this context */ ++ ++ // Simplified bitfields, removing glibc internals ++ unsigned ndots : 4; /* threshold for initial abs. query */ ++ unsigned nsort : 4; /* number of elements in sort_list[] */ ++}; ++ ++typedef struct __res_state *res_state; ++#endif /* __redox */ ++ + #ifndef HAVE__RES_EXTERN + struct __res_state _res; + #endif +@@ -167,6 +213,24 @@ + struct dns_rr *next; + }; --#if !defined (HAVE_GETRRSETBYNAME) && !defined (HAVE_LDNS) -+#if !defined (HAVE_GETRRSETBYNAME) && !defined (HAVE_LDNS) && !defined(__redox__) ++#ifdef __redox__ ++typedef struct { ++ uint16_t id; ++ uint8_t rd : 1; ++ uint8_t tc : 1; ++ uint8_t aa : 1; ++ uint8_t opcode : 4; ++ uint8_t qr : 1; ++ uint8_t rcode : 4; ++ uint8_t z : 3; ++ uint8_t ra : 1; ++ uint16_t qdcount; ++ uint16_t ancount; ++ uint16_t nscount; ++ uint16_t arcount; ++} HEADER; ++#endif ++ + struct dns_response { + HEADER header; + struct dns_query *query; +@@ -221,10 +285,10 @@ + } - #include - #include + /* initialize resolver */ +- if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { ++ // if (res_init() == -1) { + result = ERRSET_FAIL; + goto fail; +- } ++ // } + + #ifdef DEBUG + _resp->options |= RES_DEBUG; +@@ -482,12 +546,12 @@ + prev->next = curr; + + /* name */ +- length = dn_expand(answer, answer + size, *cp, name, +- sizeof(name)); +- if (length < 0) { ++ // length = dn_expand(answer, answer + size, *cp, name, ++ // sizeof(name)); ++ // if (length < 0) { + free_dns_query(head); + return (NULL); +- } ++ // } + curr->name = strdup(name); + if (curr->name == NULL) { + free_dns_query(head); +@@ -542,12 +606,12 @@ + prev->next = curr; + + /* name */ +- length = dn_expand(answer, answer + size, *cp, name, +- sizeof(name)); +- if (length < 0) { ++ // length = dn_expand(answer, answer + size, *cp, name, ++ // sizeof(name)); ++ // if (length < 0) { + free_dns_rr(head); + return (NULL); +- } ++ // } + curr->name = strdup(name); + if (curr->name == NULL) { + free_dns_rr(head); diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getrrsetbyname.h ---- source/openbsd-compat/getrrsetbyname.h 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/getrrsetbyname.h 2019-01-15 19:54:39.564320719 -0700 -@@ -50,7 +50,7 @@ - - #include "includes.h" - --#ifndef HAVE_GETRRSETBYNAME -+#if !defined(HAVE_GETRRSETBYNAME) && !defined(__redox__) +--- source/openbsd-compat/getrrsetbyname.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/openbsd-compat/getrrsetbyname.h 2025-08-20 11:51:00.744118526 +0700 +@@ -54,9 +54,13 @@ #include #include ++#ifndef __redox__ + #include ++#endif + #include ++#ifndef __redox__ + #include ++#endif + + #ifndef HFIXEDSZ + #define HFIXEDSZ 12 +diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop.c +--- source/openbsd-compat/inet_ntop.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/openbsd-compat/inet_ntop.c 2025-08-20 11:39:15.244488902 +0700 +@@ -26,7 +26,9 @@ + #include + #include + #include ++#ifndef __redox__ + #include ++#endif + #include + #include + #include diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/openbsd-compat.h ---- source/openbsd-compat/openbsd-compat.h 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/openbsd-compat/openbsd-compat.h 2019-01-15 20:14:24.316498869 -0700 -@@ -36,6 +36,10 @@ +--- source/openbsd-compat/openbsd-compat.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/openbsd-compat/openbsd-compat.h 2025-08-20 13:15:22.721439992 +0700 +@@ -36,6 +36,8 @@ #include /* for wchar_t */ -+#if defined(__redox__) -+#include -+#endif ++#include "getopt.h" + /* OpenBSD function replacements */ #include "base64.h" #include "sigact.h" +diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c +--- source/openbsd-compat/utmpx.c 1970-01-01 07:00:00.000000000 +0700 ++++ source-new/openbsd-compat/utmpx.c 2025-08-20 13:13:54.971486065 +0700 +@@ -0,0 +1,13 @@ ++#include "utmpx.h" ++#include // For NULL ++ ++#ifdef __redox__ ++ ++void endutxent(void) { /* Do nothing */ } ++struct utmpx *getutxent(void) { return NULL; } ++struct utmpx *getutxid(const struct utmpx *ut) { return NULL; } ++struct utmpx *getutxline(const struct utmpx *ut) { return NULL; } ++struct utmpx *pututxline(const struct utmpx *ut) { return NULL; } ++void setutxent(void) { /* Do nothing */ } ++ ++#endif +\ No newline at end of file +diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h +--- source/openbsd-compat/utmpx.h 1970-01-01 07:00:00.000000000 +0700 ++++ source-new/openbsd-compat/utmpx.h 2025-08-20 13:13:07.201511825 +0700 +@@ -0,0 +1,69 @@ ++#ifndef _COMPAT_UTMPX_H ++#define _COMPAT_UTMPX_H ++#ifdef __redox__ ++#include ++#include ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* ++ * This header provides a POSIX-compliant definition of the utmpx structure ++ * and related functions for systems that lack a native , such as Redox OS. ++ */ ++ ++// Define standard sizes for character arrays, based on common practice (e.g., Linux) ++#define UT_LINESIZE 32 ++#define UT_NAMESIZE 32 ++#define UT_HOSTSIZE 256 ++#define UT_IDSIZE 4 ++ ++/* ++ * The utmpx structure, containing user accounting information. ++ */ ++struct utmpx { ++ char ut_user[UT_NAMESIZE]; /* User login name */ ++ char ut_id[UT_IDSIZE]; /* Unspecified terminal id */ ++ char ut_line[UT_LINESIZE]; /* Device name of tty */ ++ pid_t ut_pid; /* Process ID */ ++ short ut_type; /* Type of entry */ ++ struct timeval ut_tv; /* Time entry was made */ ++ // Non-standard but very common fields, often needed for compatibility ++ char ut_host[UT_HOSTSIZE]; /* Host name for remote login */ ++ // Padding to align the structure, if necessary ++ char __padding[16]; ++}; ++ ++/* ++ * Symbolic constants for the ut_type field. ++ */ ++#define EMPTY 0 /* No valid user accounting information */ ++#define BOOT_TIME 1 /* Time of system boot */ ++#define OLD_TIME 2 /* Time when system clock changed */ ++#define NEW_TIME 3 /* Time after system clock changed */ ++#define USER_PROCESS 4 /* A user process */ ++#define INIT_PROCESS 5 /* A process spawned by the init process */ ++#define LOGIN_PROCESS 6 /* The session leader of a logged-in user */ ++#define DEAD_PROCESS 7 /* A session leader who has exited */ ++ ++/* ++ * Function prototypes for utmpx database manipulation. ++ * ++ * NOTE: These are stubs. Since Redox OS does not have a utmp/utmpx ++ * database, these functions won't have a real implementation. They ++ * are declared here to satisfy the linker. ++ */ ++void endutxent(void); ++struct utmpx *getutxent(void); ++struct utmpx *getutxid(const struct utmpx *); ++struct utmpx *getutxline(const struct utmpx *); ++struct utmpx *pututxline(const struct utmpx *); ++void setutxent(void); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __redox__ */ ++#endif /* _COMPAT_UTMPX_H */ +\ No newline at end of file +diff -ruwN source/regress/netcat.c source-new/regress/netcat.c +--- source/regress/netcat.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/regress/netcat.c 2025-08-20 11:50:49.164126484 +0700 +@@ -1384,7 +1384,9 @@ + #include + #include + #include ++#ifndef __redox__ + #include ++#endif + + #define SOCKS_PORT "1080" + #define HTTP_PROXY_PORT "3128" diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c ---- source/sshbuf-misc.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/sshbuf-misc.c 2019-01-15 20:45:08.969783102 -0700 +--- source/sshbuf-misc.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/sshbuf-misc.c 2025-08-20 11:51:17.444108963 +0700 @@ -28,7 +28,9 @@ #include #include #include -+#if !defined(__redox__) ++#ifndef __redox__ #include +#endif #include + #include - #include "ssherr.h" -@@ -158,4 +160,3 @@ - r[l] = '\0'; - return r; - } -- diff -ruwN source/sshkey.c source-new/sshkey.c ---- source/sshkey.c 2018-10-16 18:01:20.000000000 -0600 -+++ source-new/sshkey.c 2019-01-15 20:13:21.629829281 -0700 -@@ -42,7 +42,9 @@ - #include +--- source/sshkey.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/sshkey.c 2025-08-20 11:50:36.114133643 +0700 +@@ -43,7 +43,9 @@ #include + #include #include -+#if !defined(__redox__) ++#ifndef __redox__ #include +#endif + #include #ifdef HAVE_UTIL_H #include - #endif /* HAVE_UTIL_H */ From 2b39e7caf25d17e9ee4ad49cd576b5cf2f91a527 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Fri, 22 Aug 2025 13:41:34 +0000 Subject: [PATCH 24/52] Set openttd as shallow --- recipes/games/openttd/recipe.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/games/openttd/recipe.toml b/recipes/games/openttd/recipe.toml index 4e2a61bc3..e419e5495 100644 --- a/recipes/games/openttd/recipe.toml +++ b/recipes/games/openttd/recipe.toml @@ -1,6 +1,7 @@ [source] git = "https://github.com/OpenTTD/OpenTTD.git" branch = "release/1.8" +shallow_clone = true patches = ["redox.patch"] [build] From 6d505a649c2bdfae8121c76094196f6cf3d9e96f Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sat, 23 Aug 2025 18:33:13 +0700 Subject: [PATCH 25/52] Push many recipes to be dynamically linked --- recipes/demos/gears/recipe.toml | 10 ++++++---- recipes/demos/glutin/recipe.toml | 5 ++--- recipes/demos/osdemo/recipe.toml | 2 +- recipes/demos/sdl2-gears/recipe.toml | 5 ++++- recipes/dev/llvm18/recipe.toml | 1 + recipes/emulators/dosbox/recipe.toml | 2 +- recipes/emulators/scummvm/recipe.toml | 2 +- recipes/games/neverball/recipe.toml | 1 - recipes/games/spacecadetpinball/recipe.toml | 9 ++------- recipes/gui/orbital/recipe.toml | 2 -- recipes/libs/atk/recipe.toml | 2 +- recipes/libs/ffmpeg6/recipe.toml | 6 +++++- recipes/libs/libogg/recipe.toml | 13 ++----------- recipes/libs/libpng/recipe.toml | 2 +- recipes/libs/libvorbis/recipe.toml | 13 ++----------- recipes/libs/ncurses/recipe.toml | 1 + recipes/libs/sdl1-mixer/recipe.toml | 1 + recipes/libs/sdl2-gfx/recipe.toml | 2 +- recipes/libs/sdl2-mixer/recipe.toml | 1 - recipes/net/curl/recipe.toml | 16 +++++----------- recipes/tests/vttest/recipe.toml | 2 +- recipes/tools/nano/recipe.toml | 2 +- recipes/wip/libs/other/libtheora/recipe.toml | 2 +- 23 files changed, 40 insertions(+), 62 deletions(-) diff --git a/recipes/demos/gears/recipe.toml b/recipes/demos/gears/recipe.toml index d74ce80f1..b736d6b4f 100644 --- a/recipes/demos/gears/recipe.toml +++ b/recipes/demos/gears/recipe.toml @@ -8,9 +8,11 @@ dependencies=[ ] template = "custom" script = """ -set -x -"${CXX}" -O2 -I "${COOKBOOK_SYSROOT}/usr/include" -L "${COOKBOOK_SYSROOT}/usr/lib" "${COOKBOOK_RECIPE}/gears.c" -o gears -static -lorbital $("${PKG_CONFIG}" --libs glu) -lz -set +x +DYNAMIC_INIT + +${CXX} -O2 -I "${COOKBOOK_SYSROOT}/usr/include" \ + $LDFLAGS "${COOKBOOK_RECIPE}/gears.c" \ + -o gears -lorbital $("${PKG_CONFIG}" --libs glu) -lz mkdir -pv "${COOKBOOK_STAGE}/usr/bin" cp -v "gears" "${COOKBOOK_STAGE}/usr/bin/gears" -""" \ No newline at end of file +""" diff --git a/recipes/demos/glutin/recipe.toml b/recipes/demos/glutin/recipe.toml index 1d3a416e2..67dd944a9 100644 --- a/recipes/demos/glutin/recipe.toml +++ b/recipes/demos/glutin/recipe.toml @@ -11,6 +11,7 @@ dependencies = [ "zlib" ] script = """ +DYNAMIC_INIT EXAMPLES=( window ) @@ -21,9 +22,7 @@ do --release \ --manifest-path "${COOKBOOK_SOURCE}/glutin_examples/Cargo.toml" \ --example "${example}" \ - -- \ - -L "${COOKBOK_SYSROOT}/lib" \ - -C link-args="-Wl,-Bstatic $("${TARGET}-pkg-config" --libs osmesa) -lz -lstdc++ -lc -lgcc" + -- -C link-args="$LDFLAGS $("${TARGET}-pkg-config" --libs osmesa) -lz -lstdc++ -lc -lgcc" mkdir -pv "${COOKBOOK_STAGE}/bin" cp -v "target/${TARGET}/release/examples/${example}" "${COOKBOOK_STAGE}/bin/glutin_${example}" done diff --git a/recipes/demos/osdemo/recipe.toml b/recipes/demos/osdemo/recipe.toml index f400a6f30..3fd27e849 100644 --- a/recipes/demos/osdemo/recipe.toml +++ b/recipes/demos/osdemo/recipe.toml @@ -9,7 +9,7 @@ dependencies = [ ] script = """ cp "${COOKBOOK_SOURCE}/../osdemo.c" ./osdemo.c -"${CXX}" -O2 -I "${COOKBOOK_SYSROOT}/include" -L "${COOKBOOK_SYSROOT}/lib" osdemo.c -o osdemo -static -lorbital $("${PKG_CONFIG}" --libs glu) -lz +${CXX} -O2 -I "${COOKBOOK_SYSROOT}/include" -L "${COOKBOOK_SYSROOT}/lib" osdemo.c -o osdemo -static -lorbital $("${PKG_CONFIG}" --libs glu) -lz mkdir -pv "${COOKBOOK_STAGE}/usr/bin" cp -v "osdemo" "${COOKBOOK_STAGE}/usr/bin/osdemo" """ diff --git a/recipes/demos/sdl2-gears/recipe.toml b/recipes/demos/sdl2-gears/recipe.toml index 491270669..7c582e986 100644 --- a/recipes/demos/sdl2-gears/recipe.toml +++ b/recipes/demos/sdl2-gears/recipe.toml @@ -16,9 +16,12 @@ dependencies = [ "zlib" ] script = """ +DYNAMIC_INIT cp "${COOKBOOK_SOURCE}/../gears.c" ./gears.c rsync -av --delete --exclude='.git' "${COOKBOOK_SOURCE}/../assets" ./assets -"${CXX}" -O2 -I "${COOKBOOK_SYSROOT}/include" -L "${COOKBOOK_SYSROOT}/lib" gears.c -o sdl2_gears -dynamic -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lSDL2 -lorbital $("${PKG_CONFIG}" --libs osmesa) -lfreetype -lpng -ljpeg -lvorbisfile -lvorbis -logg -lz +${CXX} -O2 -I "${COOKBOOK_SYSROOT}/include" $LDFLAGS gears.c -o sdl2_gears \ + -dynamic -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lSDL2 -lorbital \ + $("${PKG_CONFIG}" --libs osmesa) -lfreetype -lpng -ljpeg -lvorbisfile -lvorbis -logg -lz rm -rf "${COOKBOOK_STAGE}/usr/games/sdl2_gears" mkdir -pv "${COOKBOOK_STAGE}/usr/games/sdl2_gears" cp -v "sdl2_gears" "${COOKBOOK_STAGE}/usr/games/sdl2_gears/sdl2_gears" diff --git a/recipes/dev/llvm18/recipe.toml b/recipes/dev/llvm18/recipe.toml index d6cd8458a..938511e0b 100644 --- a/recipes/dev/llvm18/recipe.toml +++ b/recipes/dev/llvm18/recipe.toml @@ -2,6 +2,7 @@ git = "https://gitlab.redox-os.org/redox-os/llvm-project.git" upstream = "https://github.com/rust-lang/llvm-project.git" branch = "redox-2024-05-11" +shallow_clone = true [build] template = "custom" diff --git a/recipes/emulators/dosbox/recipe.toml b/recipes/emulators/dosbox/recipe.toml index e3cf69f1d..c93ec9bd7 100644 --- a/recipes/emulators/dosbox/recipe.toml +++ b/recipes/emulators/dosbox/recipe.toml @@ -4,7 +4,7 @@ blake3 = "8bc50ffdba20579fb3080a0dca32cb939c8a3c19259aed026482c6ac069b0007" patches = ["01_redox.patch"] script = """ ./autogen.sh -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] diff --git a/recipes/emulators/scummvm/recipe.toml b/recipes/emulators/scummvm/recipe.toml index 0ec2f0052..db6cd35cb 100644 --- a/recipes/emulators/scummvm/recipe.toml +++ b/recipes/emulators/scummvm/recipe.toml @@ -3,7 +3,7 @@ tar = "https://downloads.scummvm.org/frs/scummvm/2.0.0/scummvm-2.0.0.tar.xz" blake3 = "02e6791fd43ad3cb4238c07d23350ca1459a0f692689e585dba1d46648f64327" patches = ["redox.patch"] script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] diff --git a/recipes/games/neverball/recipe.toml b/recipes/games/neverball/recipe.toml index c621dcff9..880c8b0c7 100644 --- a/recipes/games/neverball/recipe.toml +++ b/recipes/games/neverball/recipe.toml @@ -29,7 +29,6 @@ env -i \ PKG_CONFIG="pkg-config" \ "${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" ENABLE_FS=stdio mapc sols -export LDFLAGS+="-L${COOKBOOK_SYSROOT}/lib -z noexecstack" "${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" ENABLE_FS=stdio ENABLE_NLS=0 clean-src "${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" ENABLE_FS=stdio ENABLE_NLS=0 neverball neverputt diff --git a/recipes/games/spacecadetpinball/recipe.toml b/recipes/games/spacecadetpinball/recipe.toml index 384f78529..d0d3857e1 100644 --- a/recipes/games/spacecadetpinball/recipe.toml +++ b/recipes/games/spacecadetpinball/recipe.toml @@ -16,17 +16,12 @@ dependencies = [ "zlib", ] script = """ -COOKBOOK_CONFIGURE="cmake" +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS=( - -DCMAKE_VERBOSE_MAKEFILE=On - -DCMAKE_CROSSCOMPILING=True - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX="/usr" -DSDL2_INCLUDE_DIR="${COOKBOOK_SYSROOT}/include/SDL2" -DSDL2_LIBRARY="-lSDL2_mixer -lvorbisfile -lvorbis -logg -lSDL2 -lorbital $("${TARGET}-pkg-config" --libs osmesa)" -DSDL2_MIXER_INCLUDE_DIR="${COOKBOOK_SYSROOT}/include/SDL2" -DSDL2_MIXER_LIBRARY="SDL2_mixer" - "${COOKBOOK_SOURCE}" ) -cookbook_configure +cookbook_cmake """ diff --git a/recipes/gui/orbital/recipe.toml b/recipes/gui/orbital/recipe.toml index 0ae660fd4..b1a4a819e 100644 --- a/recipes/gui/orbital/recipe.toml +++ b/recipes/gui/orbital/recipe.toml @@ -1,5 +1,3 @@ -[source] -git = "https://gitlab.redox-os.org/redox-os/orbital.git" [build] template = "cargo" diff --git a/recipes/libs/atk/recipe.toml b/recipes/libs/atk/recipe.toml index a0d1185fe..6ad310a1d 100644 --- a/recipes/libs/atk/recipe.toml +++ b/recipes/libs/atk/recipe.toml @@ -2,7 +2,7 @@ tar = "https://download.gnome.org/sources/atk/2.38/atk-2.38.0.tar.xz" blake3 = "cbc1b7ba03009ee5cc0e646d8a86117e0d65bf8d105f2e8714fbde0299a8012e" script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] diff --git a/recipes/libs/ffmpeg6/recipe.toml b/recipes/libs/ffmpeg6/recipe.toml index b370ea4f0..3808c2f91 100644 --- a/recipes/libs/ffmpeg6/recipe.toml +++ b/recipes/libs/ffmpeg6/recipe.toml @@ -16,14 +16,18 @@ dependencies = [ "zlib", ] script = """ +DYNAMIC_INIT + ARCH="${TARGET%%-*}" COOKBOOK_CONFIGURE_FLAGS=( --enable-cross-compile --target-os=redox --arch="${ARCH}" --cross_prefix="${TARGET}-" - --prefix=/ + --prefix=/usr --disable-doc + --enable-shared + --disable-static --disable-network --enable-sdl2 --enable-zlib diff --git a/recipes/libs/libogg/recipe.toml b/recipes/libs/libogg/recipe.toml index f0dcf4064..4d35c4c05 100644 --- a/recipes/libs/libogg/recipe.toml +++ b/recipes/libs/libogg/recipe.toml @@ -6,18 +6,9 @@ patches = [ ] script = """ DYNAMIC_INIT +GNU_CONFIG_GET config.sub autotools_recursive_regenerate """ [build] -template = "custom" -script = """ -DYNAMIC_INIT -COOKBOOK_CONFIGURE_FLAGS=( - --host="${GNU_TARGET}" - --prefix="/usr" - --enable-shared - --enable-static -) -cookbook_configure -""" +template = "configure" diff --git a/recipes/libs/libpng/recipe.toml b/recipes/libs/libpng/recipe.toml index 3fedf1c51..d516a8571 100644 --- a/recipes/libs/libpng/recipe.toml +++ b/recipes/libs/libpng/recipe.toml @@ -4,7 +4,7 @@ blake3 = "36f4bbb48c70975116b00ab0cff577931b96f703b2774ac3b33131d001419435" script = """ DYNAMIC_INIT chmod +w config.sub -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub autotools_recursive_regenerate """ diff --git a/recipes/libs/libvorbis/recipe.toml b/recipes/libs/libvorbis/recipe.toml index b3908c09e..7cbeca05c 100644 --- a/recipes/libs/libvorbis/recipe.toml +++ b/recipes/libs/libvorbis/recipe.toml @@ -3,21 +3,12 @@ tar = "https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.t blake3 = "c67f3f74ec26d93a5571c4404a64eb6e6587d7d77b46b552f7b410f5bc5b1f03" script = """ DYNAMIC_INIT +GNU_CONFIG_GET config.sub autotools_recursive_regenerate """ [build] -template = "custom" +template = "configure" dependencies = [ "libogg" ] -script = """ -DYNAMIC_INIT -COOKBOOK_CONFIGURE_FLAGS=( - --host="${GNU_TARGET}" - --prefix="/usr" - --enable-shared - --enable-static -) -cookbook_configure -""" diff --git a/recipes/libs/ncurses/recipe.toml b/recipes/libs/ncurses/recipe.toml index ed678dc3f..ff2e30688 100644 --- a/recipes/libs/ncurses/recipe.toml +++ b/recipes/libs/ncurses/recipe.toml @@ -5,6 +5,7 @@ blake3 = "0d1c9fdf53c0ca4bd66ba707d49a079d2dd6f5a960cdec74a56e29952c4ffe73" [build] template = "custom" script = """ +DYNAMIC_INIT COOKBOOK_CONFIGURE_FLAGS+=( --disable-db-install --disable-stripping diff --git a/recipes/libs/sdl1-mixer/recipe.toml b/recipes/libs/sdl1-mixer/recipe.toml index 3e19795a5..59755cff9 100644 --- a/recipes/libs/sdl1-mixer/recipe.toml +++ b/recipes/libs/sdl1-mixer/recipe.toml @@ -15,6 +15,7 @@ dependencies = [ ] template = "custom" script = """ +DYNAMIC_INIT export LIBS="-lvorbis -logg" COOKBOOK_CONFIGURE_FLAGS+=( --enable-music-ogg diff --git a/recipes/libs/sdl2-gfx/recipe.toml b/recipes/libs/sdl2-gfx/recipe.toml index 8ceefde4b..bf4b621fb 100644 --- a/recipes/libs/sdl2-gfx/recipe.toml +++ b/recipes/libs/sdl2-gfx/recipe.toml @@ -2,7 +2,7 @@ tar = "http://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-1.0.4.tar.gz" blake3 = "2e9bd2dc0f004349b51418f33219ebf5cd69f25ed0ba660373652a662cbb857c" script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] diff --git a/recipes/libs/sdl2-mixer/recipe.toml b/recipes/libs/sdl2-mixer/recipe.toml index 2c9d9b829..d73bd12e9 100644 --- a/recipes/libs/sdl2-mixer/recipe.toml +++ b/recipes/libs/sdl2-mixer/recipe.toml @@ -28,6 +28,5 @@ COOKBOOK_CONFIGURE_FLAGS=( --disable-music-midi --disable-music-mod ) -set -x cookbook_configure """ diff --git a/recipes/net/curl/recipe.toml b/recipes/net/curl/recipe.toml index b09f3a22a..229d7777f 100644 --- a/recipes/net/curl/recipe.toml +++ b/recipes/net/curl/recipe.toml @@ -13,26 +13,20 @@ dependencies = [ ] script = """ rsync -av --delete "${COOKBOOK_SOURCE}/" ./ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" -# FIXME(andypython): dynamically compile +GNU_CONFIG_GET config.sub DYNAMIC_INIT autotools_recursive_regenerate COOKBOOK_CONFIGURE="./configure" -COOKBOOK_CONFIGURE_FLAGS=( - --build="$(cc -dumpmachine)" - --host="${TARGET}" - --prefix="" +COOKBOOK_CONFIGURE_FLAGS+=( --disable-ftp --disable-ipv6 --disable-ntlm-wb --disable-tftp --disable-threaded-resolver - --enable-shared - --enable-static --with-ca-path=/etc/ssl/certs - --with-nghttp2="${COOKBOOK_SYSROOT}" - --with-ssl="${COOKBOOK_SYSROOT}" - --with-zlib="${COOKBOOK_SYSROOT}" + --with-nghttp2 + --with-ssl + --with-zlib --without-libpsl ) cookbook_configure diff --git a/recipes/tests/vttest/recipe.toml b/recipes/tests/vttest/recipe.toml index 22716635f..020c41925 100644 --- a/recipes/tests/vttest/recipe.toml +++ b/recipes/tests/vttest/recipe.toml @@ -3,7 +3,7 @@ tar = "https://invisible-island.net/archives/vttest/vttest-20140305.tgz" blake3 = "b515b9a5e1f1498ed99e1a1c172fbcfdf2b7a214e185bd2005cc994407ded89e" patches = ["redox.patch"] script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] diff --git a/recipes/tools/nano/recipe.toml b/recipes/tools/nano/recipe.toml index b58776561..875e01e72 100644 --- a/recipes/tools/nano/recipe.toml +++ b/recipes/tools/nano/recipe.toml @@ -6,7 +6,7 @@ dependencies = [ "ncurses", ] script = """ -export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include/ncurses" +DYNAMIC_INIT cookbook_configure """ diff --git a/recipes/wip/libs/other/libtheora/recipe.toml b/recipes/wip/libs/other/libtheora/recipe.toml index b03418d87..95db350e5 100644 --- a/recipes/wip/libs/other/libtheora/recipe.toml +++ b/recipes/wip/libs/other/libtheora/recipe.toml @@ -2,7 +2,7 @@ [source] tar = "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2" script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] From f9d74ffc1ef6a4bc24b54dbcf81b6db47770304e Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 24 Aug 2025 00:06:21 +0700 Subject: [PATCH 26/52] Fix ffmpeg6 linking --- recipes/demos/osdemo/recipe.toml | 5 ++++- recipes/dev/llvm18/recipe.toml | 4 ---- recipes/dev/pkg-config/recipe.toml | 3 +-- recipes/libs/ffmpeg6/recipe.toml | 1 + recipes/libs/sdl2/recipe.toml | 11 ++++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/demos/osdemo/recipe.toml b/recipes/demos/osdemo/recipe.toml index 3fd27e849..720f1315f 100644 --- a/recipes/demos/osdemo/recipe.toml +++ b/recipes/demos/osdemo/recipe.toml @@ -8,8 +8,11 @@ dependencies = [ "zlib" ] script = """ +DYNAMIC_INIT + cp "${COOKBOOK_SOURCE}/../osdemo.c" ./osdemo.c -${CXX} -O2 -I "${COOKBOOK_SYSROOT}/include" -L "${COOKBOOK_SYSROOT}/lib" osdemo.c -o osdemo -static -lorbital $("${PKG_CONFIG}" --libs glu) -lz +${CXX} -O2 -I "${COOKBOOK_SYSROOT}/include" $LDFLAGS osdemo.c -o osdemo \ + -lorbital $("${PKG_CONFIG}" --libs glu) -lz mkdir -pv "${COOKBOOK_STAGE}/usr/bin" cp -v "osdemo" "${COOKBOOK_STAGE}/usr/bin/osdemo" """ diff --git a/recipes/dev/llvm18/recipe.toml b/recipes/dev/llvm18/recipe.toml index 938511e0b..da8be3e49 100644 --- a/recipes/dev/llvm18/recipe.toml +++ b/recipes/dev/llvm18/recipe.toml @@ -31,8 +31,6 @@ case "${TARGET}" in ;; esac -export LDFLAGS="-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib $LDFLAGS" - COOKBOOK_CMAKE_FLAGS=( -DCMAKE_CXX_FLAGS="--std=gnu++11" -DBUILD_SHARED_LIBS=False @@ -68,7 +66,5 @@ COOKBOOK_CMAKE_FLAGS=( -DLLVM_ENABLE_PROJECTS="llvm" ) -set -x cookbook_cmake "${COOKBOOK_SOURCE}/llvm" -set +x """ diff --git a/recipes/dev/pkg-config/recipe.toml b/recipes/dev/pkg-config/recipe.toml index 5c87b7535..0560e2dac 100644 --- a/recipes/dev/pkg-config/recipe.toml +++ b/recipes/dev/pkg-config/recipe.toml @@ -2,7 +2,7 @@ tar = "https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz" blake3 = "713372b09a1fafeec130dc9bf812a3880f2a90496af5d2194e508d91ccf667d0" script = """ -wget -O config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" +GNU_CONFIG_GET config.sub """ [build] @@ -15,6 +15,5 @@ dependencies = [ template = "custom" script = """ DYNAMIC_INIT -export LIBS="-lpcre2-8" cookbook_configure """ diff --git a/recipes/libs/ffmpeg6/recipe.toml b/recipes/libs/ffmpeg6/recipe.toml index 3808c2f91..bc63a4ec5 100644 --- a/recipes/libs/ffmpeg6/recipe.toml +++ b/recipes/libs/ffmpeg6/recipe.toml @@ -18,6 +18,7 @@ dependencies = [ script = """ DYNAMIC_INIT +export LDFLAGS="$LDFLAGS -lSDL2 -lorbital -lOSMesa -lstdc++" ARCH="${TARGET%%-*}" COOKBOOK_CONFIGURE_FLAGS=( --enable-cross-compile diff --git a/recipes/libs/sdl2/recipe.toml b/recipes/libs/sdl2/recipe.toml index c7550df6a..9cc943ac2 100644 --- a/recipes/libs/sdl2/recipe.toml +++ b/recipes/libs/sdl2/recipe.toml @@ -6,14 +6,15 @@ git = "https://gitlab.redox-os.org/redox-os/sdl2.git" template = "custom" dependencies = [ "liborbital", + "llvm18", "mesa", + "zlib", ] script = """ -COOKBOOK_CONFIGURE_FLAGS=( - --host="${TARGET}" - --prefix="/" +DYNAMIC_INIT +export LDFLAGS="$LDFLAGS -lorbital -lOSMesa -lstdc++" +COOKBOOK_CONFIGURE_FLAGS+=( --disable-pulseaudio - --disable-shared --disable-video-x11 --enable-audio --enable-dummyaudio @@ -24,5 +25,5 @@ COOKBOOK_CONFIGURE_FLAGS=( cookbook_configure # Hack to add OSMesa -sed -i "s/Requires:/Requires: osmesa >= 8.0.0/" "${COOKBOOK_STAGE}/lib/pkgconfig/sdl2.pc" +sed -i "s/Requires:/Requires: osmesa >= 8.0.0/" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/sdl2.pc" """ From 63f23348aff2ddab12292f41a1dbe8b1ad82123d Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 24 Aug 2025 00:57:57 +0700 Subject: [PATCH 27/52] Set emus as dynamically linked --- recipes/dev/git/git.patch | 2 +- recipes/emulators/dosbox/recipe.toml | 5 +++-- recipes/emulators/scummvm/recipe.toml | 6 +++--- recipes/gui/orbital/recipe.toml | 2 ++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/recipes/dev/git/git.patch b/recipes/dev/git/git.patch index 6b79e055f..0e20bc967 100644 --- a/recipes/dev/git/git.patch +++ b/recipes/dev/git/git.patch @@ -152,7 +152,7 @@ diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h + +#ifndef DEV_NULL +#if defined(__redox__) -+#define DEV_NULL "null:" ++#define DEV_NULL "/scheme/null" +#else +#define DEV_NULL "/dev/null" +#endif diff --git a/recipes/emulators/dosbox/recipe.toml b/recipes/emulators/dosbox/recipe.toml index c93ec9bd7..b017dddaf 100644 --- a/recipes/emulators/dosbox/recipe.toml +++ b/recipes/emulators/dosbox/recipe.toml @@ -14,13 +14,14 @@ dependencies = [ ] template = "custom" script = """ +DYNAMIC_INIT export CFLAGS="-I${COOKBOOK_SYSROOT}/include/SDL" export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include/SDL" -export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib -static" +export LDFLAGS+=" -lorbital" COOKBOOK_CONFIGURE_FLAGS+=( --disable-opengl --disable-sdltest - --with-sdl-prefix="${COOKBOOK_SYSROOT}" + --with-sdl ) cookbook_configure diff --git a/recipes/emulators/scummvm/recipe.toml b/recipes/emulators/scummvm/recipe.toml index db6cd35cb..fe8b377b8 100644 --- a/recipes/emulators/scummvm/recipe.toml +++ b/recipes/emulators/scummvm/recipe.toml @@ -16,12 +16,12 @@ dependencies = [ "libpng", ] script = """ -export LDFLAGS="-static" +DYNAMIC_INIT -COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/configure" +export LDFLAGS+=" -lorbital" COOKBOOK_CONFIGURE_FLAGS=( --host="${TARGET}" - --prefix="" + --prefix="/usr" --with-sdl-prefix="${COOKBOOK_SYSROOT}" --with-freetype2-prefix="${COOKBOOK_SYSROOT}" --with-png-prefix="${COOKBOOK_SYSROOT}" diff --git a/recipes/gui/orbital/recipe.toml b/recipes/gui/orbital/recipe.toml index b1a4a819e..0ae660fd4 100644 --- a/recipes/gui/orbital/recipe.toml +++ b/recipes/gui/orbital/recipe.toml @@ -1,3 +1,5 @@ +[source] +git = "https://gitlab.redox-os.org/redox-os/orbital.git" [build] template = "cargo" From d4555857d6086ebcbc291d9f1d59408e360e0793 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 24 Aug 2025 08:28:53 -0600 Subject: [PATCH 28/52] Adjust prboom recipe --- recipes/games/prboom/01_redox.patch | 12 ------------ recipes/games/prboom/recipe.toml | 2 ++ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/recipes/games/prboom/01_redox.patch b/recipes/games/prboom/01_redox.patch index 2971f07cc..6318a4093 100644 --- a/recipes/games/prboom/01_redox.patch +++ b/recipes/games/prboom/01_redox.patch @@ -1,15 +1,3 @@ -diff -burpN source-original/configure.ac source/configure.ac ---- source-original/configure.ac 2008-11-09 12:12:37.000000000 -0700 -+++ source/configure.ac 2024-09-07 10:06:36.540104562 -0600 -@@ -85,8 +85,6 @@ if test "$cross_compiling" != "yes"; the - fi - - dnl --- Header files, typedefs, structures --AC_TYPE_UID_T --AC_TYPE_SIZE_T - AC_DECL_SYS_SIGLIST - AC_HEADER_SYS_WAIT - AC_CHECK_HEADERS(unistd.h asm/byteorder.h sched.h) diff -burpN source-original/src/m_misc.c source/src/m_misc.c --- source-original/src/m_misc.c 2008-11-09 10:13:04.000000000 -0700 +++ source/src/m_misc.c 2024-09-07 10:09:06.890301682 -0600 diff --git a/recipes/games/prboom/recipe.toml b/recipes/games/prboom/recipe.toml index 3f2f49a0b..efdb13149 100644 --- a/recipes/games/prboom/recipe.toml +++ b/recipes/games/prboom/recipe.toml @@ -27,6 +27,8 @@ COOKBOOK_CONFIGURE_FLAGS+=( --without-net --with-sdl-prefix="${COOKBOOK_SYSROOT}" ac_cv_lib_SDL_mixer_Mix_OpenAudio=yes + ac_cv_type_gid_t=yes + ac_cv_type_uid_t=yes ) cookbook_configure """ From 64d98ed781780580d2c7e0d15ed58b4c14366760 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 25 Aug 2025 15:51:37 -0600 Subject: [PATCH 29/52] Add rustconf 2025 presentation --- recipes/other/rustconf2025/recipe.toml | 9 +++++++++ recipes/tools/cosmic-reader/recipe.toml | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 recipes/other/rustconf2025/recipe.toml diff --git a/recipes/other/rustconf2025/recipe.toml b/recipes/other/rustconf2025/recipe.toml new file mode 100644 index 000000000..7bd748111 --- /dev/null +++ b/recipes/other/rustconf2025/recipe.toml @@ -0,0 +1,9 @@ +[source] +git = "https://github.com/jackpot51/rustconf2025.git" + +[build] +template = "custom" +script = """ +mkdir -p "${COOKBOOK_STAGE}/home/user" +cp -v "${COOKBOOK_SOURCE}/"*.pdf "${COOKBOOK_STAGE}/home/user" +""" diff --git a/recipes/tools/cosmic-reader/recipe.toml b/recipes/tools/cosmic-reader/recipe.toml index a766062c0..c65311e46 100644 --- a/recipes/tools/cosmic-reader/recipe.toml +++ b/recipes/tools/cosmic-reader/recipe.toml @@ -13,16 +13,19 @@ dependencies = [ ] script = """ DYNAMIC_INIT +export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=${COOKBOOK_HOST_SYSROOT}/${GNU_TARGET} -I${COOKBOOK_HOST_SYSROOT}/${GNU_TARGET}/include" "${COOKBOOK_CARGO}" rustc \ --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \ --release \ --bin cosmic-reader \ --no-default-features \ --features mupdf \ + --verbose \ -- \ - -C link-args="-lpng -lexpat" + -C link-args="-lpng -lexpat" \ + --verbose mkdir -pv "${COOKBOOK_STAGE}/usr/bin/" cp -v "target/${TARGET}/release/cosmic-reader" "${COOKBOOK_STAGE}/usr/bin/" mkdir -pv "${COOKBOOK_STAGE}/ui/apps" cp -v "${COOKBOOK_RECIPE}/manifest" "${COOKBOOK_STAGE}/ui/apps/40_cosmic-reader" -""" \ No newline at end of file +""" From 0f282a5ee5d5d9fb29d423e093f219821fa95de4 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Wed, 27 Aug 2025 12:22:23 +0000 Subject: [PATCH 30/52] Disable rustpython update --- recipes/dev/rustpython/recipe.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/dev/rustpython/recipe.toml b/recipes/dev/rustpython/recipe.toml index d82595c2d..608dfcafc 100644 --- a/recipes/dev/rustpython/recipe.toml +++ b/recipes/dev/rustpython/recipe.toml @@ -13,7 +13,6 @@ template = "custom" script = """ DYNAMIC_INIT -(cd "${COOKBOOK_SOURCE}" && bash scripts/redox/uncomment-cargo.sh && cargo update) export BUILDTIME_RUSTPYTHONPATH=/lib/rustpython export OPENSSL_DIR="${COOKBOOK_SYSROOT}" export ZLIB_STATIC=1 From 7f13e82986eca81f7498a89f11b8cdfde09c3bc0 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Wed, 27 Aug 2025 13:07:26 +0000 Subject: [PATCH 31/52] Use forked go source --- recipes/wip/dev/lang/go/01_redox.patch | 800 ------------------------- recipes/wip/dev/lang/go/recipe.toml | 43 +- 2 files changed, 14 insertions(+), 829 deletions(-) delete mode 100644 recipes/wip/dev/lang/go/01_redox.patch diff --git a/recipes/wip/dev/lang/go/01_redox.patch b/recipes/wip/dev/lang/go/01_redox.patch deleted file mode 100644 index aaa224592..000000000 --- a/recipes/wip/dev/lang/go/01_redox.patch +++ /dev/null @@ -1,800 +0,0 @@ -diff -ruwN source/src/cmd/dist/build.go source-new/src/cmd/dist/build.go ---- source/src/cmd/dist/build.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/dist/build.go 2025-07-20 23:50:47.312425484 +0700 -@@ -94,6 +94,7 @@ - "wasip1", - "linux", - "android", -+ "redox", - "solaris", - "freebsd", - "nacl", // keep; -@@ -764,7 +765,7 @@ - elem = "go_bootstrap" - } - link = []string{pathf("%s/link", tooldir)} -- if goos == "android" { -+ if goos == "android" || goos == "redox" { - link = append(link, "-buildmode=pie") - } - if goldflags != "" { -@@ -1020,7 +1021,7 @@ - if symabis != "" { - compile = append(compile, "-symabis", symabis) - } -- if goos == "android" { -+ if goos == "android" || goos == "redox" { - compile = append(compile, "-shared") - } - -@@ -1084,6 +1085,7 @@ - "linux": true, - "netbsd": true, - "openbsd": true, -+ "redox": true, - "solaris": true, - } - -@@ -1093,7 +1095,7 @@ - case "gc", "cmd_go_bootstrap", "go1.1": - return true - case "linux": -- return goos == "linux" || goos == "android" -+ return goos == "linux" || goos == "android" || goos == "redox" - case "solaris": - return goos == "solaris" || goos == "illumos" - case "darwin": -@@ -1118,7 +1120,7 @@ - name := filepath.Base(file) - excluded := func(list []string, ok string) bool { - for _, x := range list { -- if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") || (ok == "ios" && x == "darwin") { -+ if x == ok || (ok == "android" && x == "linux") || (ok == "redox" && x == "linux") || (ok == "illumos" && x == "solaris") || (ok == "ios" && x == "darwin") { - continue - } - i := strings.Index(name, x) -@@ -1794,6 +1796,10 @@ - "android/amd64": true, - "android/arm": true, - "android/arm64": true, -+ "redox/386": true, -+ "redox/amd64": true, -+ "redox/arm64": true, -+ "redox/riscv64": true, - "ios/arm64": true, - "ios/amd64": true, - "js/wasm": false, -diff -ruwN source/src/cmd/go/go_test.go source-new/src/cmd/go/go_test.go ---- source/src/cmd/go/go_test.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/go/go_test.go 2025-07-20 23:50:47.312425484 +0700 -@@ -2081,7 +2081,7 @@ - tg.run(args...) - - switch runtime.GOOS { -- case "linux", "android", "freebsd": -+ case "linux", "android", "redox", "freebsd": - f, err := elf.Open(obj) - if err != nil { - t.Fatal(err) -diff -ruwN source/src/cmd/go/internal/modindex/build.go source-new/src/cmd/go/internal/modindex/build.go ---- source/src/cmd/go/internal/modindex/build.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/go/internal/modindex/build.go 2025-07-20 23:50:47.312425484 +0700 -@@ -873,6 +873,9 @@ - if ctxt.GOOS == "android" && name == "linux" { - return true - } -+ if ctxt.GOOS == "redox" && name == "linux" { -+ return true -+ } - if ctxt.GOOS == "illumos" && name == "solaris" { - return true - } -diff -ruwN source/src/cmd/go/internal/work/exec.go source-new/src/cmd/go/internal/work/exec.go ---- source/src/cmd/go/internal/work/exec.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/go/internal/work/exec.go 2025-07-20 23:50:47.312425484 +0700 -@@ -3056,7 +3056,7 @@ - dynobj := objdir + "_cgo_.o" - - ldflags := cgoLDFLAGS -- if (cfg.Goarch == "arm" && cfg.Goos == "linux") || cfg.Goos == "android" { -+ if (cfg.Goarch == "arm" && cfg.Goos == "linux") || (cfg.Goarch == "arm" && cfg.Goos == "redox") || cfg.Goos == "android" { - if !slices.Contains(ldflags, "-no-pie") { - // we need to use -pie for Linux/ARM to get accurate imported sym (added in https://golang.org/cl/5989058) - // this seems to be outdated, but we don't want to break existing builds depending on this (Issue 45940) -diff -ruwN source/src/cmd/go/internal/work/init.go source-new/src/cmd/go/internal/work/init.go ---- source/src/cmd/go/internal/work/init.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/go/internal/work/init.go 2025-07-20 23:50:47.312425484 +0700 -@@ -220,7 +220,7 @@ - codegenArg = "-fPIC" - } else { - switch cfg.Goos { -- case "linux", "android", "freebsd": -+ case "linux", "android", "redox", "freebsd": - codegenArg = "-shared" - case "windows": - // Do not add usual .exe suffix to the .dll file. -diff -ruwN source/src/cmd/go/testdata/script/cgo_suspect_flag_force_external.txt source-new/src/cmd/go/testdata/script/cgo_suspect_flag_force_external.txt ---- source/src/cmd/go/testdata/script/cgo_suspect_flag_force_external.txt 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/go/testdata/script/cgo_suspect_flag_force_external.txt 2025-08-03 00:53:55.626580074 +0700 -@@ -39,7 +39,7 @@ - ! stderr preferlinkext - env CGO_CFLAGS=-flto - go build -x -n -o dummy.exe ./noUseOfCgo --! stderr preferlinkext -+! stderr preferlinkextg - env CGO_CFLAGS= - - # Second build uses CGO, so we expect to see the token present in the -diff -ruwN source/src/cmd/internal/obj/x86/asm6.go source-new/src/cmd/internal/obj/x86/asm6.go ---- source/src/cmd/internal/obj/x86/asm6.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/internal/obj/x86/asm6.go 2025-08-03 01:50:35.376496054 +0700 -@@ -28,6 +28,13 @@ - // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - // THE SOFTWARE. - -+// ------------------- HELP NEEDED FOR REDOX ------------------- -+// We need to write the definition for obj files in Redox!!!!!!! -+// Yes, Redox is using ELF but that ELF is different with Linux -+// As of current implemention, it emits Linux binaries instead -+// Please continue your work in this file if you know how to do it -+// ------------------------------------------------------------- -+ - package x86 - - import ( -diff -ruwN source/src/cmd/internal/objabi/head.go source-new/src/cmd/internal/objabi/head.go ---- source/src/cmd/internal/objabi/head.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/internal/objabi/head.go 2025-07-20 23:50:47.312425484 +0700 -@@ -63,7 +63,7 @@ - *h = Hfreebsd - case "js": - *h = Hjs -- case "linux", "android": -+ case "linux", "android", "redox": - *h = Hlinux - case "netbsd": - *h = Hnetbsd -diff -ruwN source/src/cmd/link/internal/amd64/obj.go source-new/src/cmd/link/internal/amd64/obj.go ---- source/src/cmd/link/internal/amd64/obj.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/link/internal/amd64/obj.go 2025-08-03 01:04:51.706561825 +0700 -@@ -64,6 +64,7 @@ - ELF: ld.ELFArch{ - Linuxdynld: "/lib64/ld-linux-x86-64.so.2", - LinuxdynldMusl: "/lib/ld-musl-x86_64.so.1", -+ Redoxdynld: "/usr/lib/ld64.so.1", - Freebsddynld: "/libexec/ld-elf.so.1", - Openbsddynld: "/usr/libexec/ld.so", - Netbsddynld: "/libexec/ld.elf_so", -diff -ruwN source/src/cmd/link/internal/arm64/obj.go source-new/src/cmd/link/internal/arm64/obj.go ---- source/src/cmd/link/internal/arm64/obj.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/link/internal/arm64/obj.go 2025-08-03 01:03:56.606564078 +0700 -@@ -61,6 +61,7 @@ - - ELF: ld.ELFArch{ - Androiddynld: "/system/bin/linker64", -+ Redoxdynld: "/usr/lib/ld64.so.1", - Linuxdynld: "/lib/ld-linux-aarch64.so.1", - LinuxdynldMusl: "/lib/ld-musl-aarch64.so.1", - -diff -ruwN source/src/cmd/link/internal/ld/elf.go source-new/src/cmd/link/internal/ld/elf.go ---- source/src/cmd/link/internal/ld/elf.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/link/internal/ld/elf.go 2025-08-03 01:13:08.346551565 +0700 -@@ -197,6 +197,7 @@ - type ELFArch struct { - // TODO: Document these fields. - -+ Redoxdynld string - Androiddynld string - Linuxdynld string - LinuxdynldMusl string -@@ -204,6 +205,7 @@ - Netbsddynld string - Openbsddynld string - Dragonflydynld string -+ Redoxflydynld string - Solarisdynld string - - Reloc1 func(*Link, *OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int, int64) bool -@@ -1939,6 +1941,11 @@ - if interpreter == "" { - Exitf("ELF interpreter not set") - } -+ } else if buildcfg.GOOS == "redox" { -+ interpreter = thearch.ELF.Redoxdynld -+ if interpreter == "" { -+ Exitf("ELF interpreter not set") -+ } - } else { - interpreter = thearch.ELF.Linuxdynld - // If interpreter does not exist, try musl instead. -diff -ruwN source/src/cmd/link/internal/riscv64/obj.go source-new/src/cmd/link/internal/riscv64/obj.go ---- source/src/cmd/link/internal/riscv64/obj.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/link/internal/riscv64/obj.go 2025-08-03 01:05:35.886560535 +0700 -@@ -38,6 +38,7 @@ - Machoreloc1: machoreloc1, - - ELF: ld.ELFArch{ -+ Redoxdynld: "/usr/lib/ld64.so.1", - Linuxdynld: "/lib/ld.so.1", - - Freebsddynld: "/usr/libexec/ld-elf.so.1", -diff -ruwN source/src/cmd/link/internal/x86/obj.go source-new/src/cmd/link/internal/x86/obj.go ---- source/src/cmd/link/internal/x86/obj.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/cmd/link/internal/x86/obj.go 2025-08-03 01:05:11.816561638 +0700 -@@ -59,6 +59,7 @@ - PEreloc1: pereloc1, - - ELF: ld.ELFArch{ -+ Redoxdynld: "/usr/lib/ld.so.1", - Linuxdynld: "/lib/ld-linux.so.2", - LinuxdynldMusl: "/lib/ld-musl-i386.so.1", - Freebsddynld: "/usr/libexec/ld-elf.so.1", -diff -ruwN source/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go source-new/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go ---- source/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go 2025-07-03 04:47:15.000000000 +0700 -`+++ source-new/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go 2025-07-20 23:50:47.312425484 +0700 -@@ -155,6 +155,7 @@ - runtime.GOOS == "openbsd" || // #60614 - runtime.GOOS == "solaris" || // #60968 #60970 - runtime.GOOS == "android" || // #60967 -+ runtime.GOOS == "redox" || // plz no - runtime.GOOS == "illumos" || // #65544 - // These platforms fundamentally can't be supported: - runtime.GOOS == "js" || // #60971 -diff -ruwN source/src/crypto/internal/sysrand/internal/seccomp/seccomp_linux.go source-new/src/crypto/internal/sysrand/internal/seccomp/seccomp_linux.go ---- source/src/crypto/internal/sysrand/internal/seccomp/seccomp_linux.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/crypto/internal/sysrand/internal/seccomp/seccomp_linux.go 2025-08-02 17:13:31.518836103 +0700 -@@ -2,6 +2,8 @@ - // Use of this source code is governed by a BSD-style - // license that can be found in the LICENSE file. - -+//go:build !linux -+ - package seccomp - - /* -diff -ruwN source/src/crypto/internal/sysrand/internal/seccomp/seccomp_unsupported.go source-new/src/crypto/internal/sysrand/internal/seccomp/seccomp_unsupported.go ---- source/src/crypto/internal/sysrand/internal/seccomp/seccomp_unsupported.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/crypto/internal/sysrand/internal/seccomp/seccomp_unsupported.go 2025-08-02 17:13:37.268835776 +0700 -@@ -2,7 +2,7 @@ - // Use of this source code is governed by a BSD-style - // license that can be found in the LICENSE file. - --//go:build !linux || !cgo -+//go:build !linux || !cgo || redox - - package seccomp - -diff -ruwN source/src/go/build/build.go source-new/src/go/build/build.go ---- source/src/go/build/build.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/go/build/build.go 2025-07-20 23:50:47.312425484 +0700 -@@ -1971,6 +1971,9 @@ - if ctxt.GOOS == "android" && name == "linux" { - return true - } -+ if ctxt.GOOS == "redox" && name == "linux" { -+ return true -+ } - if ctxt.GOOS == "illumos" && name == "solaris" { - return true - } -diff -ruwN source/src/internal/goos/gengoos.go source-new/src/internal/goos/gengoos.go ---- source/src/internal/goos/gengoos.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/gengoos.go 2025-07-20 23:50:47.312425484 +0700 -@@ -43,6 +43,7 @@ - var tags []string - if target == "linux" { - tags = append(tags, "!android") // must explicitly exclude android for linux -+ tags = append(tags, "!redox") // must explicitly exclude redox for linux - } - if target == "solaris" { - tags = append(tags, "!illumos") // must explicitly exclude illumos for solaris -diff -ruwN source/src/internal/goos/zgoos_aix.go source-new/src/internal/goos/zgoos_aix.go ---- source/src/internal/goos/zgoos_aix.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_aix.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_android.go source-new/src/internal/goos/zgoos_android.go ---- source/src/internal/goos/zgoos_android.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_android.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_darwin.go source-new/src/internal/goos/zgoos_darwin.go ---- source/src/internal/goos/zgoos_darwin.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_darwin.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_dragonfly.go source-new/src/internal/goos/zgoos_dragonfly.go ---- source/src/internal/goos/zgoos_dragonfly.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_dragonfly.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_freebsd.go source-new/src/internal/goos/zgoos_freebsd.go ---- source/src/internal/goos/zgoos_freebsd.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_freebsd.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_hurd.go source-new/src/internal/goos/zgoos_hurd.go ---- source/src/internal/goos/zgoos_hurd.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_hurd.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_illumos.go source-new/src/internal/goos/zgoos_illumos.go ---- source/src/internal/goos/zgoos_illumos.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_illumos.go 2025-07-20 23:50:47.312425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_ios.go source-new/src/internal/goos/zgoos_ios.go ---- source/src/internal/goos/zgoos_ios.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_ios.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_js.go source-new/src/internal/goos/zgoos_js.go ---- source/src/internal/goos/zgoos_js.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_js.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_linux.go source-new/src/internal/goos/zgoos_linux.go ---- source/src/internal/goos/zgoos_linux.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_linux.go 2025-07-20 23:50:47.322425484 +0700 -@@ -1,6 +1,6 @@ - // Code generated by gengoos.go using 'go generate'. DO NOT EDIT. - --//go:build !android && linux -+//go:build !android && !redox && linux - - package goos - -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_netbsd.go source-new/src/internal/goos/zgoos_netbsd.go ---- source/src/internal/goos/zgoos_netbsd.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_netbsd.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 1 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_openbsd.go source-new/src/internal/goos/zgoos_openbsd.go ---- source/src/internal/goos/zgoos_openbsd.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_openbsd.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 1 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_plan9.go source-new/src/internal/goos/zgoos_plan9.go ---- source/src/internal/goos/zgoos_plan9.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_plan9.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 1 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_redox.go source-new/src/internal/goos/zgoos_redox.go ---- source/src/internal/goos/zgoos_redox.go 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_redox.go 2025-07-20 23:50:47.322425484 +0700 -@@ -0,0 +1,27 @@ -+// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. -+ -+//go:build redox -+ -+package goos -+ -+const GOOS = `redox` -+ -+const IsAix = 0 -+const IsAndroid = 0 -+const IsDarwin = 0 -+const IsDragonfly = 0 -+const IsFreebsd = 0 -+const IsHurd = 0 -+const IsIllumos = 0 -+const IsIos = 0 -+const IsJs = 0 -+const IsLinux = 0 -+const IsNacl = 0 -+const IsNetbsd = 0 -+const IsOpenbsd = 0 -+const IsPlan9 = 0 -+const IsRedox = 1 -+const IsSolaris = 0 -+const IsWasip1 = 0 -+const IsWindows = 0 -+const IsZos = 0 -diff -ruwN source/src/internal/goos/zgoos_solaris.go source-new/src/internal/goos/zgoos_solaris.go ---- source/src/internal/goos/zgoos_solaris.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_solaris.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 1 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_wasip1.go source-new/src/internal/goos/zgoos_wasip1.go ---- source/src/internal/goos/zgoos_wasip1.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_wasip1.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 1 - const IsWindows = 0 -diff -ruwN source/src/internal/goos/zgoos_windows.go source-new/src/internal/goos/zgoos_windows.go ---- source/src/internal/goos/zgoos_windows.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_windows.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 1 -diff -ruwN source/src/internal/goos/zgoos_zos.go source-new/src/internal/goos/zgoos_zos.go ---- source/src/internal/goos/zgoos_zos.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/goos/zgoos_zos.go 2025-07-20 23:50:47.322425484 +0700 -@@ -20,6 +20,7 @@ - const IsNetbsd = 0 - const IsOpenbsd = 0 - const IsPlan9 = 0 -+const IsRedox = 0 - const IsSolaris = 0 - const IsWasip1 = 0 - const IsWindows = 0 -diff -ruwN source/src/internal/platform/supported.go source-new/src/internal/platform/supported.go ---- source/src/internal/platform/supported.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/platform/supported.go 2025-08-02 18:27:27.688723910 +0700 -@@ -194,6 +194,7 @@ - "ios/amd64", "ios/arm64", - "aix/ppc64", - "openbsd/arm64", -+ "redox/386","redox/amd64","redox/arm64", - "windows/386", "windows/amd64", "windows/arm", "windows/arm64": - return true - } -@@ -209,7 +210,7 @@ - case "plugin": - switch platform { - case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/loong64", "linux/s390x", "linux/ppc64le", -- "android/amd64", "android/386", -+ "android/amd64", "android/386", "redox/amd64", "redox/386", - "darwin/amd64", "darwin/arm64", - "freebsd/amd64": - return true -@@ -226,6 +227,7 @@ - case "android/arm64", - "darwin/amd64", "darwin/arm64", - "linux/amd64", "linux/arm64", "linux/ppc64le", -+ "redox/386","redox/amd64","redox/arm64", - "windows/386", "windows/amd64", "windows/arm", "windows/arm64": - return true - } -@@ -237,7 +239,7 @@ - // so force the caller to pass that in to centralize that choice. - func DefaultPIE(goos, goarch string, isRace bool) bool { - switch goos { -- case "android", "ios": -+ case "android", "ios", "redox": - return true - case "windows": - if isRace { -diff -ruwN source/src/internal/platform/zosarch.go source-new/src/internal/platform/zosarch.go ---- source/src/internal/platform/zosarch.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/platform/zosarch.go 2025-07-20 23:50:47.322425484 +0700 -@@ -13,6 +13,9 @@ - {"android", "amd64"}, - {"android", "arm"}, - {"android", "arm64"}, -+ {"redox", "386"}, -+ {"redox", "amd64"}, -+ {"redox", "arm64"}, - {"darwin", "amd64"}, - {"darwin", "arm64"}, - {"dragonfly", "amd64"}, -@@ -67,6 +70,9 @@ - {"android", "amd64"}: {CgoSupported: true}, - {"android", "arm"}: {CgoSupported: true}, - {"android", "arm64"}: {CgoSupported: true}, -+ {"redox", "386"}: {CgoSupported: true}, -+ {"redox", "amd64"}: {CgoSupported: true}, -+ {"redox", "arm64"}: {CgoSupported: true}, - {"darwin", "amd64"}: {CgoSupported: true, FirstClass: true}, - {"darwin", "arm64"}: {CgoSupported: true, FirstClass: true}, - {"dragonfly", "amd64"}: {CgoSupported: true}, -diff -ruwN source/src/internal/poll/sendfile_unix.go source-new/src/internal/poll/sendfile_unix.go ---- source/src/internal/poll/sendfile_unix.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/poll/sendfile_unix.go 2025-07-20 23:50:47.322425484 +0700 -@@ -28,7 +28,7 @@ - // has not modified the source or destination, - // and the caller should perform the copy using a fallback implementation. - func SendFile(dstFD *FD, src int, size int64) (n int64, err error, handled bool) { -- if goos := runtime.GOOS; goos == "linux" || goos == "android" { -+ if goos := runtime.GOOS; goos == "linux" || goos == "android" || goos == "redox" { - // Linux's sendfile doesn't require any setup: - // It sends from the current position of the source file and - // updates the position of the source after sending. -diff -ruwN source/src/internal/syslist/syslist.go source-new/src/internal/syslist/syslist.go ---- source/src/internal/syslist/syslist.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/internal/syslist/syslist.go 2025-07-20 23:50:47.322425484 +0700 -@@ -29,6 +29,7 @@ - "netbsd": true, - "openbsd": true, - "plan9": true, -+ "redox": true, - "solaris": true, - "wasip1": true, - "windows": true, -@@ -50,6 +51,7 @@ - "linux": true, - "netbsd": true, - "openbsd": true, -+ "redox": true, - "solaris": true, - } - -diff -ruwN source/src/net/cgo_stub.go source-new/src/net/cgo_stub.go ---- source/src/net/cgo_stub.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/net/cgo_stub.go 2025-08-02 18:20:37.688742244 +0700 -@@ -9,7 +9,7 @@ - // (Darwin always provides the cgo functions, in cgo_unix_syscall.go) - // - on wasip1, where cgo is never available - --//go:build (netgo && unix) || (unix && !cgo && !darwin) || js || wasip1 -+//go:build (netgo && unix) || (unix && !cgo && !darwin) || js || wasip1 || redox - - package net - -diff -ruwN source/src/net/cgo_unix.go source-new/src/net/cgo_unix.go ---- source/src/net/cgo_unix.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/net/cgo_unix.go 2025-08-02 17:54:26.168771131 +0700 -@@ -7,7 +7,7 @@ - // Instead of C.foo it uses _C_foo, which is defined in either - // cgo_unix_cgo.go or cgo_unix_syscall.go - --//go:build !netgo && ((cgo && unix) || darwin) -+//go:build !netgo && ((cgo && unix) || darwin) && !redox - - package net - -diff -ruwN source/src/net/cgo_unix_cgo_res.go source-new/src/net/cgo_unix_cgo_res.go ---- source/src/net/cgo_unix_cgo_res.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/net/cgo_unix_cgo_res.go 2025-08-02 23:37:48.006690697 +0700 -@@ -4,7 +4,7 @@ - - // res_search, for cgo systems where that is thread-safe. - --//go:build cgo && !netgo && (linux || openbsd) -+//go:build cgo && !netgo && (linux || openbsd) && !redox - - package net - -@@ -18,7 +18,7 @@ - #include - #include - --#cgo !android,!openbsd LDFLAGS: -lresolv -+#cgo !android,!openbsd,!redox LDFLAGS: -lresolv - */ - import "C" - -diff -ruwN source/src/net/cgo_unix_cgo_resn.go source-new/src/net/cgo_unix_cgo_resn.go ---- source/src/net/cgo_unix_cgo_resn.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/net/cgo_unix_cgo_resn.go 2025-08-02 23:37:55.206690614 +0700 -@@ -4,7 +4,7 @@ - - // res_nsearch, for cgo systems where that's available. - --//go:build cgo && !netgo && unix && !(darwin || linux || openbsd) -+//go:build cgo && !netgo && unix && !(darwin || linux || openbsd || redox) - - package net - -@@ -18,7 +18,7 @@ - #include - #include - --#cgo !aix,!dragonfly,!freebsd LDFLAGS: -lresolv -+#cgo !aix,!dragonfly,!freebsd,!redox LDFLAGS: -lresolv - */ - import "C" - -diff -ruwN source/src/os/user/cgo_lookup_unix.go source-new/src/os/user/cgo_lookup_unix.go ---- source/src/os/user/cgo_lookup_unix.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/os/user/cgo_lookup_unix.go 2025-08-02 17:15:57.178834645 +0700 -@@ -194,7 +194,7 @@ - // Because we can't use cgo in tests: - func structPasswdForNegativeTest() _C_struct_passwd { - sp := _C_struct_passwd{} -- *_C_pw_uidp(&sp) = 1<<32 - 2 -- *_C_pw_gidp(&sp) = 1<<32 - 3 -+ *_C_pw_uidp(&sp) = 1<<31 - 2 -+ *_C_pw_gidp(&sp) = 1<<31 - 3 - return sp - } -diff -ruwN source/src/runtime/cgo/cgo.go source-new/src/runtime/cgo/cgo.go ---- source/src/runtime/cgo/cgo.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/runtime/cgo/cgo.go 2025-07-20 23:50:47.322425484 +0700 -@@ -16,7 +16,8 @@ - #cgo dragonfly LDFLAGS: -lpthread - #cgo freebsd LDFLAGS: -lpthread - #cgo android LDFLAGS: -llog --#cgo !android,linux LDFLAGS: -lpthread -+#cgo redox LDFLAGS: -llog -+#cgo !android,!redox,linux LDFLAGS: -lpthread - #cgo netbsd LDFLAGS: -lpthread - #cgo openbsd LDFLAGS: -lpthread - #cgo aix LDFLAGS: -Wl,-berok -diff -ruwN source/src/runtime/pprof/pprof_rusage.go source-new/src/runtime/pprof/pprof_rusage.go ---- source/src/runtime/pprof/pprof_rusage.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/runtime/pprof/pprof_rusage.go 2025-07-20 23:50:47.322425484 +0700 -@@ -17,7 +17,7 @@ - func addMaxRSS(w io.Writer) { - var rssToBytes uintptr - switch runtime.GOOS { -- case "aix", "android", "dragonfly", "freebsd", "linux", "netbsd", "openbsd": -+ case "aix", "android", "redox", "dragonfly", "freebsd", "linux", "netbsd", "openbsd": - rssToBytes = 1024 - case "darwin", "ios": - rssToBytes = 1 -diff -ruwN source/src/runtime/pprof/proto_test.go source-new/src/runtime/pprof/proto_test.go ---- source/src/runtime/pprof/proto_test.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/runtime/pprof/proto_test.go 2025-07-20 23:50:47.322425484 +0700 -@@ -83,7 +83,7 @@ - // to use in test profiles. - func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) { - switch runtime.GOOS { -- case "linux", "android", "netbsd": -+ case "linux", "android", "redox", "netbsd": - // Figure out two addresses from /proc/self/maps. - mmap, err := os.ReadFile("/proc/self/maps") - if err != nil { -diff -ruwN source/src/runtime/race/internal/amd64v1/doc.go source-new/src/runtime/race/internal/amd64v1/doc.go ---- source/src/runtime/race/internal/amd64v1/doc.go 2025-07-03 04:47:15.000000000 +0700 -+++ source-new/src/runtime/race/internal/amd64v1/doc.go 2025-07-20 23:50:47.322425484 +0700 -@@ -5,6 +5,6 @@ - // This package holds the race detector .syso for - // amd64 architectures with GOAMD64 /dev/null; then - GO_TARBALL=go1.24.5.linux-$( [ "$(uname -m)" = "aarch64" ] && echo "arm64" || echo "amd64" ).tar.gz + GO_TARBALL=go1.24.6.linux-$( [ "$(uname -m)" = "aarch64" ] && echo "arm64" || echo "amd64" ).tar.gz GO_DOWNLOAD_URL="https://dl.google.com/go/${GO_TARBALL}" echo "Installing Go..." wget -q --show-progress "${GO_DOWNLOAD_URL}" @@ -23,33 +22,19 @@ fi # Go does not support out-of-tree builds :( rsync -a --delete "${COOKBOOK_SOURCE}/" ./ -export GOHOSTOS=redox +export GOOS=redox case "${TARGET}" in - x86-unknown-redox) - export GOHOSTARCH=386 - ;; - x86_64-unknown-redox) - export GOHOSTARCH=amd64 - ;; - aarch64-unknown-redox) - export GOHOSTARCH=arm64 - ;; - riscv64-unknown-redox) -# TODO: Patches for this ARCH is not complete - export GOHOSTARCH=riscv64 - ;; + x86-unknown-redox) export GOARCH=386;; + x86_64-unknown-redox) export GOARCH=amd64;; + aarch64-unknown-redox) export GOARCH=arm64;; + riscv64-unknown-redox) export GOARCH=riscv64;; esac -export GOOS=${GOHOSTOS} -export GOARCH=${GOHOSTARCH} - export CGO_ENABLED=1 -export CC_FOR_redox_${GOHOSTARCH}="${CC}" -export CXX_FOR_redox_${GOHOSTARCH}="${CXX}" -# Don't poison the runtime tools (host -> host) -unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF STRIP -(cd ./src && bash ./make.bash -v --no-banner) +export CC=x86_64-unknown-redox-gcc +export CCX=x86_64-unknown-redox-g++ +(cd ./src && bash ./make.bash) mkdir -p ${COOKBOOK_STAGE}/bin -rsync -a --delete "bin/redox_${GOHOSTARCH}/" ${COOKBOOK_STAGE}/bin +rsync -a --delete "bin/redox_${GOARCH}/" ${COOKBOOK_STAGE}/bin """ From d7eb182249e828b74b6455fc7a42945c6f9ebc7e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 28 Aug 2025 13:25:25 -0600 Subject: [PATCH 32/52] cosmic-reader: install metadata --- recipes/tools/cosmic-reader/recipe.toml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/recipes/tools/cosmic-reader/recipe.toml b/recipes/tools/cosmic-reader/recipe.toml index c65311e46..71a78f2c9 100644 --- a/recipes/tools/cosmic-reader/recipe.toml +++ b/recipes/tools/cosmic-reader/recipe.toml @@ -20,12 +20,18 @@ export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=${COOKBOOK_HOST_SYSROOT}/${GNU_TARGET --bin cosmic-reader \ --no-default-features \ --features mupdf \ - --verbose \ -- \ - -C link-args="-lpng -lexpat" \ - --verbose + -C link-args="-lpng -lexpat" mkdir -pv "${COOKBOOK_STAGE}/usr/bin/" cp -v "target/${TARGET}/release/cosmic-reader" "${COOKBOOK_STAGE}/usr/bin/" mkdir -pv "${COOKBOOK_STAGE}/ui/apps" cp -v "${COOKBOOK_RECIPE}/manifest" "${COOKBOOK_STAGE}/ui/apps/40_cosmic-reader" +#TODO: install with just? +APPID="com.system76.CosmicReader" +mkdir -pv "${COOKBOOK_STAGE}/usr/share/applications/" +cp -v "${COOKBOOK_SOURCE}/res/${APPID}.desktop" "${COOKBOOK_STAGE}/usr/share/applications/" +mkdir -pv "${COOKBOOK_STAGE}/usr/share/thumbnailers/" +cp -v "${COOKBOOK_SOURCE}/res/${APPID}.thumbnailer" "${COOKBOOK_STAGE}/usr/share/thumbnailers/" +mkdir -pv "${COOKBOOK_STAGE}/usr/share/icons/" +#TODO cp -rv "${COOKBOOK_SOURCE}/res/icons/hicolor/" "${COOKBOOK_STAGE}/usr/share/icons/" """ From 4f3b3288c328bf838c4b120142a97c932027bf67 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 28 Aug 2025 13:49:58 -0600 Subject: [PATCH 33/52] cosmic-reader: install icons --- recipes/tools/cosmic-reader/recipe.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tools/cosmic-reader/recipe.toml b/recipes/tools/cosmic-reader/recipe.toml index 71a78f2c9..01619a800 100644 --- a/recipes/tools/cosmic-reader/recipe.toml +++ b/recipes/tools/cosmic-reader/recipe.toml @@ -33,5 +33,5 @@ cp -v "${COOKBOOK_SOURCE}/res/${APPID}.desktop" "${COOKBOOK_STAGE}/usr/share/app mkdir -pv "${COOKBOOK_STAGE}/usr/share/thumbnailers/" cp -v "${COOKBOOK_SOURCE}/res/${APPID}.thumbnailer" "${COOKBOOK_STAGE}/usr/share/thumbnailers/" mkdir -pv "${COOKBOOK_STAGE}/usr/share/icons/" -#TODO cp -rv "${COOKBOOK_SOURCE}/res/icons/hicolor/" "${COOKBOOK_STAGE}/usr/share/icons/" +cp -rv "${COOKBOOK_SOURCE}/res/icons/hicolor/" "${COOKBOOK_STAGE}/usr/share/icons/" """ From 560ac52c5c2fcbdb662d5630045b7a06b0a10edd Mon Sep 17 00:00:00 2001 From: "Andrzej J. Skalski" Date: Sun, 31 Aug 2025 16:30:53 +0000 Subject: [PATCH 34/52] Servo and dependencies: libpango, mozjs, aws-lc-rs, freetype-sys, mozangle, tikv-reallocator. --- recipes/libs/pango/recipe.toml | 42 ++++++++----- recipes/wip/libs/mozjs/recipe.toml | 40 ++++++++++++ recipes/wip/libs/other/aws-lc-rs/recipe.toml | 15 +++++ .../wip/libs/other/freetype-sys/recipe.toml | 28 +++++++++ recipes/wip/libs/other/mozangle/recipe.toml | 41 ++++++++++++ .../wip/libs/tikv-jemallocator/recipe.toml | 12 ++++ recipes/wip/web/servo/.servobuild | 61 ++++++++++++++++++ recipes/wip/web/servo/recipe.toml | 62 +++++++++++++++++-- 8 files changed, 279 insertions(+), 22 deletions(-) create mode 100644 recipes/wip/libs/mozjs/recipe.toml create mode 100644 recipes/wip/libs/other/aws-lc-rs/recipe.toml create mode 100644 recipes/wip/libs/other/freetype-sys/recipe.toml create mode 100644 recipes/wip/libs/other/mozangle/recipe.toml create mode 100644 recipes/wip/libs/tikv-jemallocator/recipe.toml create mode 100644 recipes/wip/web/servo/.servobuild diff --git a/recipes/libs/pango/recipe.toml b/recipes/libs/pango/recipe.toml index eaf03af80..ce771723f 100644 --- a/recipes/libs/pango/recipe.toml +++ b/recipes/libs/pango/recipe.toml @@ -1,31 +1,41 @@ [source] -tar="https://download.gnome.org/sources/pango/1.56/pango-1.56.3.tar.xz" +tar = "https://download.gnome.org/sources/pango/1.56/pango-1.56.3.tar.xz" blake3 = "78542feaaf007c1d648b94c4e9b6655ed7515d27ce434766aea99bef886c21ac" patches = ["redox.patch"] [build] dependencies = [ - "cairo", - "expat", - "fontconfig", - "freetype2", - "fribidi", - "gettext", - "glib", - "harfbuzz", - "libffi", - "libiconv", - "libpng", - "pcre", - "pixman", - "zlib", + "cairo", + "expat", + "fontconfig", + "freetype2", + "fribidi", + "gettext", + "glib", + "harfbuzz", + "libffi", + "libiconv", + "libpng", + "libpthread-stubs", + "libx11", + "libxau", + "libxcb", + "libxext", + "libxrender", + "pcre", + "pcre2", + "pixman", + "x11proto", + "xcb-proto", + "xextproto", + "zlib", ] template = "custom" script = """ DYNAMIC_INIT #TODO: why are these libs not automatic? cookbook_meson \ - -Dc_args="-lfontconfig -lexpat -lpixman-1 -lpng -lz" \ + -Dc_args="-lfontconfig -lexpat -lpixman-1 -lpng -lz -lcairo" \ -Dbuild-examples=false \ -Dbuild-testsuite=false """ diff --git a/recipes/wip/libs/mozjs/recipe.toml b/recipes/wip/libs/mozjs/recipe.toml new file mode 100644 index 000000000..611d45b57 --- /dev/null +++ b/recipes/wip/libs/mozjs/recipe.toml @@ -0,0 +1,40 @@ +#TODO "No suitable wgpu::Adapter found" error on execution +[source] +git = "https://gitlab.redox-os.org/njskalski/mozjs.git" +branch = "redox_mods" +[build] +template = "custom" + +#these dependencies are copied from Servo recipe. Some of them may be redundant, but I needed to reproduce the build bug. +dependencies = [ + "freetype2", + "gettext", + "glib", + "gstreamer", + "harfbuzz", + "libffi", + "libiconv", + "libx11", + "libxcb", + "libpng", + "openssl1", + "pcre", + "zlib", + + "x11proto", + "x11proto-kb", + "xcb-proto", + "xextproto", + "libxau", + "libpthread-stubs", + "fontconfig", + "expat", + "llvm18", + "gcc13", +] + +script = """ +# Build the library crates +"${COOKBOOK_REDOXER}" build --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" --workspace --release +# Library crates don't need installation, they're used as dependencies +""" diff --git a/recipes/wip/libs/other/aws-lc-rs/recipe.toml b/recipes/wip/libs/other/aws-lc-rs/recipe.toml new file mode 100644 index 000000000..3ef8828a3 --- /dev/null +++ b/recipes/wip/libs/other/aws-lc-rs/recipe.toml @@ -0,0 +1,15 @@ +[source] +git = "https://gitlab.redox-os.org/njskalski/aws-lc-rs.git" +branch = "redox_mods" +[build] +template = "custom" + +script = """ + # we need HOST != TARGET, because otherwise we get this error: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189 + # by this line https://gitlab.redox-os.org/njskalski/aws-lc-rs/-/blob/main/aws-lc-sys/builder/cc_builder.rs#L493 + export HOST=x86_64-linux-gnu + + rsync -a --delete "${COOKBOOK_SOURCE}/" ./ + cargo build -p aws-lc-sys --target ${TARGET} --release + cargo build -p aws-lc-rs --target ${TARGET} --release +""" diff --git a/recipes/wip/libs/other/freetype-sys/recipe.toml b/recipes/wip/libs/other/freetype-sys/recipe.toml new file mode 100644 index 000000000..5eab06962 --- /dev/null +++ b/recipes/wip/libs/other/freetype-sys/recipe.toml @@ -0,0 +1,28 @@ +[source] +git = "https://github.com/PistonDevelopers/freetype-sys.git" +[build] +template = "custom" +dependencies = [ + "freetype2", + "zlib", + "libpng" +] + +script = """ + # export PKG_CONFIG_PATH="${COOKBOOK_SYSROOT}/lib/pkgconfig" + # #:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig:${COOKBOOK_SYSROOT}/usr/share/pkgconfig" + # export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig" + # #:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig" + # export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}" + + # # I'm tired trying figure out why multiple pkgconfig paths are ignored by cargo building stuff + # # rsync -a -v ${COOKBOOK_SYSROOT}/usr/share/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/ + # rsync -a -v ${COOKBOOK_SYSROOT}/usr/lib/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/ + + # ls -al $PKG_CONFIG_PATH + + # env + + rsync -a --delete "${COOKBOOK_SOURCE}/" ./ + cargo build --release +""" diff --git a/recipes/wip/libs/other/mozangle/recipe.toml b/recipes/wip/libs/other/mozangle/recipe.toml new file mode 100644 index 000000000..08f3e5b10 --- /dev/null +++ b/recipes/wip/libs/other/mozangle/recipe.toml @@ -0,0 +1,41 @@ +[source] +git = "https://gitlab.redox-os.org/njskalski/mozangle.git" +branch = "redox_mods" +[build] +template = "custom" +dependencies = [ + "freetype2", + "gettext", + "glib", + "gstreamer", + "harfbuzz", + "libffi", + "libiconv", + "libx11", + "libxcb", + "libpng", + "openssl1", + "pcre", + "zlib", + + "x11proto", + "x11proto-kb", + "xcb-proto", + "xextproto", + "libxau", + "libpthread-stubs", + "fontconfig", + "expat", + "relibc", + "gcc13", +] + +script = """ + export TARGET=${TARGET} + export TARGET_CC=${TARGET}-gcc + export TARGET_CXX=${TARGET}-g++ + export TARGET_AR=${TARGET}-ar + + rsync -a --delete "${COOKBOOK_SOURCE}/" ./ + cargo build --release --target ${TARGET} +""" diff --git a/recipes/wip/libs/tikv-jemallocator/recipe.toml b/recipes/wip/libs/tikv-jemallocator/recipe.toml new file mode 100644 index 000000000..7d4af5ef9 --- /dev/null +++ b/recipes/wip/libs/tikv-jemallocator/recipe.toml @@ -0,0 +1,12 @@ +#TODO "No suitable wgpu::Adapter found" error on execution +[source] +git = "https://gitlab.redox-os.org/njskalski/jemallocator.git" +branch = "redox_mods" +[build] +template = "custom" + +script = """ +# Build the library crates +"${COOKBOOK_REDOXER}" build --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" --workspace --release +# Library crates don't need installation, they're used as dependencies +""" diff --git a/recipes/wip/web/servo/.servobuild b/recipes/wip/web/servo/.servobuild new file mode 100644 index 000000000..09a2abc3c --- /dev/null +++ b/recipes/wip/web/servo/.servobuild @@ -0,0 +1,61 @@ +# Copy this file to .servobuild in the Servo root directory + +# Paths starting with "./" are relative to the repo root + +# Tool options +[tools] + +[build] + +# Set "mode = dev" or use `mach build --dev` to build the project with warning. +# or Set "mode = release" or use `mach build --release` for optimized build. +# Use `mode = ` or `mach build --profile=` to build the given +# profile. Check the `Cargo.toml` manifest for a complete list of custom profiles. +# Defaults to prompting before building +#mode = "dev" + + +# Set "android = true" or use `mach build --android` to build the Android app. +android = false + +# Enable `debug_assert!` macros in release mode +debug-assertions = true + +# Set "debug-mozjs" or use `mach build --debug-mozjs` to build a debug spidermonkey. +debug-mozjs = false + +# When a GL error occurs as a result of a WebGL operation, print the stack trace for the content +# JS and native Rust code that triggered the failed operation. Warning: very slow. +webgl-backtrace = false + +# When a DOM exception is reported, print the stack trace for the content JS and native Rust code +# that triggered it. +dom-backtrace = false + +# Pick a media stack based on the target. Other values are "gstreamer" and "dummy" +media-stack = "dummy" + +# Set to the path to your ccache binary to enable caching of compiler outputs +#ccache = "/usr/local/bin/ccache" + +# Any optional flags that will be added to $RUSTFLAGS +#rustflags = "" + +# Enable or disable rustc’s incremental compilation +# Cargo’s default is to enable it in debug mode but not in release mode. +# Leaving this key unspecified makes mach keep Cargo’s default. +# It can be set to true or false in order to always enable or always disable +# incremental compilation. +#incremental = false +#incremental = true + +# Android information +[android] +# Defaults to the value of $ANDROID_SDK_ROOT, $ANDROID_NDK_ROOT respectively +#sdk = "/opt/android-sdk" +#ndk = "/opt/android-ndk" + +# OpenHarmony +[ohos] +# Defaults to the value of $OHOS_SDK_NATIVE +#ndk = "/path/to/ohos-sdk//native" diff --git a/recipes/wip/web/servo/recipe.toml b/recipes/wip/web/servo/recipe.toml index 83b7873f4..50568e30e 100644 --- a/recipes/wip/web/servo/recipe.toml +++ b/recipes/wip/web/servo/recipe.toml @@ -1,9 +1,7 @@ -#TODO not compiled or tested -# if the script is wrong, read this - https://github.com/servo/servo#release-build -# advanced build instructions - https://github.com/servo/servo/wiki/Building#manual-build-setup [source] -git = "https://github.com/servo/servo" -#git = "https://gitlab.redox-os.org/redox-os/servo" +git = "https://gitlab.redox-os.org/njskalski/servo.git" +branch = "redox_mods" + [build] template = "custom" dependencies = [ @@ -14,11 +12,63 @@ dependencies = [ "harfbuzz", "libffi", "libiconv", + "libx11", + "libxcb", "libpng", "openssl1", "pcre", "zlib", + "x11proto", + "x11proto-kb", + "xcb-proto", + "xextproto", + "libxau", + "libpthread-stubs", + "fontconfig", + "expat", + "relibc", + "gcc13", ] script = """ -cookbook_cargo_packages servoshell +cp "${COOKBOOK_RECIPE}/.servobuild" "${COOKBOOK_SOURCE}/.servobuild" + +# Add wrapper to PATH +export PATH="${COOKBOOK_RECIPE}:${PATH}" +export TARGET=${TARGET} + +# Force cargo to use the correct build target +export CARGO_BUILD_TARGET=${TARGET} + +# jemalloc specific configuration +export JEMALLOC_SYS_WITH_LG_PAGE=16 +export TARGET_CC=${TARGET}-gcc +export TARGET_CXX=${TARGET}-g++ +export TARGET_AR=${TARGET}-ar + +export PKG_CONFIG_ALLOW_CROSS=1 + +# this /usr/share/pkgconfig comes from x11proto, that stages pc files in wrong dir. +export PKG_CONFIG_PATH="${COOKBOOK_SYSROOT}/lib/pkgconfig" +#:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig:${COOKBOOK_SYSROOT}/usr/share/pkgconfig" +export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig" +#:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig" +export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}" + +export RUSTFLAGS="-C target-feature=-crt-static -C link-args=-lpng -C link-args=-lxcb -C link-args=-lexpat -C link-args=-lgcc_s -C link-args=-lz -C link-args=-lXau -C link-args=-no-pie" + +rsync -a --delete "${COOKBOOK_SOURCE}/" ./ + + +# I'm tired trying figure out why multiple pkgconfig paths are ignored by cargo building stuff +rsync -a -v ${COOKBOOK_SYSROOT}/usr/share/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/ +rsync -a -v ${COOKBOOK_SYSROOT}/usr/lib/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/ + +echo "listing ${COOKBOOK_SYSROOT}/lib/pkgconfig" +ls -al ${COOKBOOK_SYSROOT}/lib/pkgconfig + +# -j 1 to lock down "which crate fails", because cargo tree -i doesn't work for gaol +cargo build --target ${TARGET} --release + +mkdir -pv "${COOKBOOK_STAGE}/usr/servo" +cp -r -v "target/${TARGET}/release/servo" "${COOKBOOK_STAGE}/usr/servo" """ From 8814a5d49406dd6a1e2f0b8ae6c2f652925f0ce9 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 1 Sep 2025 15:17:09 +0700 Subject: [PATCH 35/52] Include flags to meson cross file --- recipes/libs/cairo/recipe.toml | 3 +-- recipes/libs/gstreamer/recipe.toml | 2 +- recipes/libs/pango/recipe.toml | 2 -- recipes/wip/libs/gtk/gtk3/recipe.toml | 3 +-- src/bin/cook.rs | 3 +++ 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/recipes/libs/cairo/recipe.toml b/recipes/libs/cairo/recipe.toml index 17e81b9b5..47b1d5ebd 100644 --- a/recipes/libs/cairo/recipe.toml +++ b/recipes/libs/cairo/recipe.toml @@ -28,9 +28,8 @@ script = """ DYNAMIC_INIT #TODO: fix mutex implementation #TODO: why are math defines missing? -#TODO: why is -lexpat not automatic? +CFLAGS="${CFLAGS} -DCAIRO_NO_MUTEX=1 -DM_SQRT2=1.41421356237309504880 -DM_LN2=0.69314718055994530942" cookbook_meson \ - -Dc_args="-DCAIRO_NO_MUTEX=1 -DM_SQRT2=1.41421356237309504880 -DM_LN2=0.69314718055994530942 -lexpat" \ -Dxlib-xcb=enabled \ -Dtests=disabled """ diff --git a/recipes/libs/gstreamer/recipe.toml b/recipes/libs/gstreamer/recipe.toml index ec9309186..4944a00b2 100644 --- a/recipes/libs/gstreamer/recipe.toml +++ b/recipes/libs/gstreamer/recipe.toml @@ -62,8 +62,8 @@ DYNAMIC_INIT export GLIB_GENMARSHAL="$(which glib-genmarshal)" export GLIB_MKENUMS="$(which glib-mkenums)" +CFLAGS="${CFLAGS} -DM_LN2=0.69314718055994530942" cookbook_meson \ - -Dc_args="-DM_LN2=0.69314718055994530942" \ -Ddevtools=disabled \ -Dexamples=disabled \ -Dlibav=disabled \ diff --git a/recipes/libs/pango/recipe.toml b/recipes/libs/pango/recipe.toml index ce771723f..6ea4fcb58 100644 --- a/recipes/libs/pango/recipe.toml +++ b/recipes/libs/pango/recipe.toml @@ -33,9 +33,7 @@ dependencies = [ template = "custom" script = """ DYNAMIC_INIT -#TODO: why are these libs not automatic? cookbook_meson \ - -Dc_args="-lfontconfig -lexpat -lpixman-1 -lpng -lz -lcairo" \ -Dbuild-examples=false \ -Dbuild-testsuite=false """ diff --git a/recipes/wip/libs/gtk/gtk3/recipe.toml b/recipes/wip/libs/gtk/gtk3/recipe.toml index 63def6794..da2310916 100644 --- a/recipes/wip/libs/gtk/gtk3/recipe.toml +++ b/recipes/wip/libs/gtk/gtk3/recipe.toml @@ -43,9 +43,8 @@ dependencies = [ template = "custom" script = """ DYNAMIC_INIT -#TODO: why are libs not automatically detected? +CFLAGS="${CFLAGS} -DM_SQRT2=1.41421356237309504880" cookbook_meson \ - -Dc_args="-DM_SQRT2=1.41421356237309504880 -lXext -lX11 -lxcb -lXau" \ -Dintrospection=false \ -Dwayland_backend=false """ diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 567a0eef3..ca2e4484b 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -965,6 +965,9 @@ function cookbook_meson { echo "[properties]" >> cross_file.txt echo "needs_exe_wrapper = true" >> cross_file.txt echo "sys_root = '${COOKBOOK_SYSROOT}'" >> cross_file.txt + echo "c_args = [$(printf "'%s', " $CFLAGS | sed 's/, $//')]" >> cross_file.txt + echo "cpp_args = [$(printf "'%s', " $CPPFLAGS | sed 's/, $//')]" >> cross_file.txt + echo "c_link_args = [$(printf "'%s', " $LDFLAGS | sed 's/, $//')]" >> cross_file.txt unset AR unset AS From fb3268b1a33caa5e0839ebb93f9ca5c2a1c7ab49 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 1 Sep 2025 10:27:03 +0000 Subject: [PATCH 36/52] Fix compile dosbox in native build --- recipes/emulators/dosbox/recipe.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emulators/dosbox/recipe.toml b/recipes/emulators/dosbox/recipe.toml index b017dddaf..c25c50430 100644 --- a/recipes/emulators/dosbox/recipe.toml +++ b/recipes/emulators/dosbox/recipe.toml @@ -21,7 +21,7 @@ export LDFLAGS+=" -lorbital" COOKBOOK_CONFIGURE_FLAGS+=( --disable-opengl --disable-sdltest - --with-sdl + --with-sdl-prefix="${COOKBOOK_SYSROOT}" ) cookbook_configure From abdfc6cc65f7f711aa473a9cd5dd7a8e66bb21f6 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 1 Sep 2025 10:43:03 +0000 Subject: [PATCH 37/52] Fix regression in mesa --- recipes/libs/mesa/recipe.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/libs/mesa/recipe.toml b/recipes/libs/mesa/recipe.toml index d473cc8c2..d581c1b31 100644 --- a/recipes/libs/mesa/recipe.toml +++ b/recipes/libs/mesa/recipe.toml @@ -13,8 +13,8 @@ dependencies = [ script = """ DYNAMIC_INIT -export CFLAGS+="-I${COOKBOOK_SYSROOT}/include -DHAVE_PTHREAD=1" -export CPPFLAGS+="-I${COOKBOOK_SYSROOT}/include -DHAVE_PTHREAD=1" +export CFLAGS+=" -DHAVE_PTHREAD=1" +export CPPFLAGS+=" -DHAVE_PTHREAD=1" export LLVM_CONFIG="${TARGET}-llvm-config" if [[ -n "${COOKBOOK_PREFER_STATIC}" ]]; then From 5f12b87dc0b708b0997782e2aadf28595810289a Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 1 Sep 2025 19:57:07 +0200 Subject: [PATCH 38/52] Move a couple not building recipes to the wip category And remove the pastel-editor recipe as pastel-editor hasn't had any updates in years. --- .../{ => wip}/demos/rust-cairo-demo/recipe.sh | 0 recipes/{ => wip}/demos/rust-cairo/recipe.sh | 0 .../games/syobonaction/01_redox.patch | 0 .../{ => wip}/games/syobonaction/recipe.sh | 0 recipes/{ => wip}/games/vvvvvv/recipe.sh | 0 recipes/{ => wip}/games/wesnoth/recipe.sh | 0 .../wip/image/editors/pastel-editor/recipe.sh | 21 ------------------- recipes/{tools => wip}/termplay/recipe.sh | 0 .../{emulators => wip}/vice/01_redox.patch | 0 recipes/{emulators => wip}/vice/recipe.sh | 0 10 files changed, 21 deletions(-) rename recipes/{ => wip}/demos/rust-cairo-demo/recipe.sh (100%) rename recipes/{ => wip}/demos/rust-cairo/recipe.sh (100%) rename recipes/{ => wip}/games/syobonaction/01_redox.patch (100%) rename recipes/{ => wip}/games/syobonaction/recipe.sh (100%) rename recipes/{ => wip}/games/vvvvvv/recipe.sh (100%) rename recipes/{ => wip}/games/wesnoth/recipe.sh (100%) delete mode 100644 recipes/wip/image/editors/pastel-editor/recipe.sh rename recipes/{tools => wip}/termplay/recipe.sh (100%) rename recipes/{emulators => wip}/vice/01_redox.patch (100%) rename recipes/{emulators => wip}/vice/recipe.sh (100%) diff --git a/recipes/demos/rust-cairo-demo/recipe.sh b/recipes/wip/demos/rust-cairo-demo/recipe.sh similarity index 100% rename from recipes/demos/rust-cairo-demo/recipe.sh rename to recipes/wip/demos/rust-cairo-demo/recipe.sh diff --git a/recipes/demos/rust-cairo/recipe.sh b/recipes/wip/demos/rust-cairo/recipe.sh similarity index 100% rename from recipes/demos/rust-cairo/recipe.sh rename to recipes/wip/demos/rust-cairo/recipe.sh diff --git a/recipes/games/syobonaction/01_redox.patch b/recipes/wip/games/syobonaction/01_redox.patch similarity index 100% rename from recipes/games/syobonaction/01_redox.patch rename to recipes/wip/games/syobonaction/01_redox.patch diff --git a/recipes/games/syobonaction/recipe.sh b/recipes/wip/games/syobonaction/recipe.sh similarity index 100% rename from recipes/games/syobonaction/recipe.sh rename to recipes/wip/games/syobonaction/recipe.sh diff --git a/recipes/games/vvvvvv/recipe.sh b/recipes/wip/games/vvvvvv/recipe.sh similarity index 100% rename from recipes/games/vvvvvv/recipe.sh rename to recipes/wip/games/vvvvvv/recipe.sh diff --git a/recipes/games/wesnoth/recipe.sh b/recipes/wip/games/wesnoth/recipe.sh similarity index 100% rename from recipes/games/wesnoth/recipe.sh rename to recipes/wip/games/wesnoth/recipe.sh diff --git a/recipes/wip/image/editors/pastel-editor/recipe.sh b/recipes/wip/image/editors/pastel-editor/recipe.sh deleted file mode 100644 index 987a251fd..000000000 --- a/recipes/wip/image/editors/pastel-editor/recipe.sh +++ /dev/null @@ -1,21 +0,0 @@ -GIT=https://gitlab.redox-os.org/redox-os/pastel.git -GIT_UPSTREAM=https://github.com/robbycerantola/pastel.git -BINDIR=/usr/bin -DEPENDS="orbital" - -function recipe_stage { - mkdir "$1/ui" - cp -rv res "$1/ui/pastel" - mkdir "$1/ui/apps" - cat > "$1/ui/apps/pastel" <<-EOF - name=Pastel - binary=/usr/bin/pastel - icon=/ui/pastel/accessories-bitmap-editor.png - accept=*.bmp - accept=*.jpg - accept=*.jpeg - accept=*.png - author=Robby Cerantola - description=Bitmap Editor - EOF -} diff --git a/recipes/tools/termplay/recipe.sh b/recipes/wip/termplay/recipe.sh similarity index 100% rename from recipes/tools/termplay/recipe.sh rename to recipes/wip/termplay/recipe.sh diff --git a/recipes/emulators/vice/01_redox.patch b/recipes/wip/vice/01_redox.patch similarity index 100% rename from recipes/emulators/vice/01_redox.patch rename to recipes/wip/vice/01_redox.patch diff --git a/recipes/emulators/vice/recipe.sh b/recipes/wip/vice/recipe.sh similarity index 100% rename from recipes/emulators/vice/recipe.sh rename to recipes/wip/vice/recipe.sh From f4d3630ef8d24b7ef1cf59f4d6a53f7f6a3bd1b6 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 1 Sep 2025 21:38:14 +0200 Subject: [PATCH 39/52] Remove all code that handles recipe.sh --- cook.sh | 275 ------------------------------------------------------- fetch.sh | 7 +- repo.sh | 60 +----------- 3 files changed, 6 insertions(+), 336 deletions(-) diff --git a/cook.sh b/cook.sh index 6435f2cce..ad457277e 100755 --- a/cook.sh +++ b/cook.sh @@ -13,28 +13,10 @@ export DEBUG= export EXAMPLES= export PREPARE_COPY=1 -if hash sha256sum 2>/dev/null -then - SHASUM="sha256sum" -else - SHASUM="shasum -a 256" -fi - function usage { echo "cook.sh $1 " >&2 - echo " dist" >&2 echo " distclean" >&2 - echo " build" >&2 - echo " clean" >&2 - echo " fetch" >&2 echo " unfetch" >&2 - echo " pkg" >&2 - echo " unpkg" >&2 - echo " prepare" >&2 - echo " unprepare" >&2 - echo " stage" >&2 - echo " unstage" >&2 - echo " version" >&2 } function op { @@ -44,275 +26,22 @@ function op { fi case "$2" in - dist) - op $1 prepare - op $1 build - op $1 stage - op $1 pkg - ;; distclean) op $1 unpkg op $1 unstage op $1 unprepare ;; - fetch) - skip=0 - if [ "$(type -t recipe_fetch)" = "function" ] - then - recipe_fetch - fi - if [ "$skip" -eq "0" ] - then - if [ -n "$TAR" ] - then - if [ ! -f source.tar ] - then - wget "$TAR" --continue -O source.tar.tmp - mv source.tar.tmp source.tar - fi - - if [ -n "$TAR_SHA256" ] - then - $SHASUM -c <<< "${TAR_SHA256} source.tar" - fi - - if [ ! -d source ] - then - mkdir source - tar xvf source.tar -C source --strip-components 1 - fi - elif [ -n "$GIT" ] - then - if [ ! -d source ] - then - if [ -n "$BRANCH" ] - then - git clone --recursive "$GIT" -b "$BRANCH" source - else - git clone --recursive "$GIT" source - fi - fi - - pushd source > /dev/null - git remote set-url origin "$GIT" - git fetch origin - if [ -n "$GIT_UPSTREAM" ] - then - git remote set-url upstream "$GIT_UPSTREAM" &> /dev/null || - git remote add upstream "$GIT_UPSTREAM" - git fetch upstream - fi - - ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)" - if [ -n "$BRANCH" ] - then - ORIGIN_BRANCH="origin/$BRANCH" - fi - - if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ] - then - git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH" - fi - git submodule sync --recursive - git submodule update --init --recursive - popd > /dev/null - fi - fi - ;; unfetch) rm -rfv source source.tar ;; - prepare) - skip=0 - if [ "$(type -t recipe_prepare)" = "function" ] - then - recipe_prepare - fi - if [ "$skip" -eq "0" ] - then - rm -rf "${COOKBOOK_SYSROOT}" - mkdir "${COOKBOOK_SYSROOT}" - - # usrmerge - mkdir "${COOKBOOK_SYSROOT}/usr" - for folder in bin include lib share - do - mkdir "${COOKBOOK_SYSROOT}/usr/${folder}" - ln -s "usr/${folder}" "${COOKBOOK_SYSROOT}/${folder}" - done - - if [ ${#BUILD_DEPENDS} -gt 0 ] - then - pushd $ROOT - ./repo.sh "${BUILD_DEPENDS[@]}" - popd - - for i in "${BUILD_DEPENDS[@]}" - do - pkgar \ - extract \ - "${COOKBOOK_SYSROOT}" \ - --archive "$REPO/$i.pkgar" \ - --pkey "${ROOT}/build/id_ed25519.pub.toml" - done - fi - - rm -rf "${COOKBOOK_BUILD}" - if [ "$PREPARE_COPY" -eq "0" ] - then - mkdir "${COOKBOOK_BUILD}" - else - cp -Rp source "${COOKBOOK_BUILD}" - fi - - for patch in *.patch - do - patch -p1 -d "${COOKBOOK_BUILD}" < "$patch" - done - fi - ;; unprepare) rm -rf "${COOKBOOK_BUILD}" rm -rf "${COOKBOOK_SYSROOT}" ;; - version) - pushd "${COOKBOOK_BUILD}" > /dev/null - skip=0 - if [ "$(type -t recipe_version)" = "function" ] - then - recipe_version - fi - if [ "$skip" -eq "0" ] - then - # there's an unstable built-in cargo config command, so hack around it - cargo-config config package.version | tr -d '"' - fi - popd > /dev/null - ;; - gitversion) - if [ -d "${COOKBOOK_BUILD}"/.git ] - then - echo "$(op $1 version)-$(git -C "${COOKBOOK_BUILD}" rev-parse --short HEAD)" - else - op $1 version - fi - ;; - build) - pushd "${COOKBOOK_BUILD}" > /dev/null - skip=0 - if [ "$(type -t recipe_build)" = "function" ] - then - recipe_build - fi - - release_flag="--release" - if [ "$DEBUG" == 1 ] - then - release_flag= - fi - - if [ -n "$CARGO_PACKAGE" ]; then - package_flag="--package=$CARGO_PACKAGE" - else - package_flag= - fi - - if [ "$skip" -eq "0" ] - then - "${CARGO[@]}" "$CARGOBUILD" --target "$TARGET" $release_flag $package_flag $CARGOFLAGS - fi - popd > /dev/null - ;; - clean) - pushd "${COOKBOOK_BUILD}" > /dev/null - skip=0 - if [ "$(type -t recipe_clean)" = "function" ] - then - recipe_clean - fi - if [ "$skip" -eq "0" ] - then - "${CARGO[@]}" clean - fi - popd > /dev/null - ;; - stage) - op $1 unstage - mkdir -p "${COOKBOOK_STAGE}" - stage="$(realpath "${COOKBOOK_STAGE}")" - source="$(realpath source)" - pushd "${COOKBOOK_BUILD}" > /dev/null - skip=0 - if [ "$(type -t recipe_stage)" = "function" ] - then - recipe_stage "$stage" - fi - if [ "$skip" -eq "0" ] - then - #TODO "${CARGO[@]}" install --root "$stage" $CARGOFLAGS - if [ "$DEBUG" == 1 ] - then - build=debug - else - build=release - fi - - bins="$(find target/$TARGET/$build/ -maxdepth 1 -type f ! -name '*.*')" - if [ -z "$bins" ] || [ "$EXAMPLES" == 1 ] - then - example=true - bins="$bins $(find target/$TARGET/$build/examples/ -maxdepth 1 -type f ! -name '*.*' ! -name '*-*' \ - 2> /dev/null || true)" - fi - if [ -n "$bins" ] - then - if [ -n "$example" ] && [ "$EXAMPLES" != 1 ] - then - echo "$(tput bold)Note$(tput sgr0): No binaries detected, using example binaries" - fi - mkdir -p "$stage/$BINDIR" - for bin in $bins - do - if [ "$DEBUG" == 1 ] - then - cp -v "$bin" "$stage/$BINDIR/$(basename $bin)" - else - "${STRIP}" -v "$bin" -o "$stage/$BINDIR/$(basename $bin)" - fi - done - else - echo "$(tput bold)Warning$(tput sgr0): Recipe does not have any binaries" >&2 - fi - fi - popd > /dev/null - ;; unstage) rm -rfv "${COOKBOOK_STAGE}" rm -fv "${TARGET_DIR}/auto_deps.toml" ;; - pkg) - pkgar \ - create \ - --archive "${COOKBOOK_STAGE}.pkgar" \ - --skey "${ROOT}/build/id_ed25519.toml" \ - "${COOKBOOK_STAGE}" - - # Generate stage.toml - echo "name = \"$1\"" > "${COOKBOOK_STAGE}.toml" - echo "version = \"$(op $1 version)\"" >> "${COOKBOOK_STAGE}.toml" - echo "target = \"$TARGET\"" >> "${COOKBOOK_STAGE}.toml" - - # Add runtime dependencies to package if they exist - if [ -n "$DEPENDS" ] - then - # Remove leading and trailing whitespace, replace whitespace between - # package names with commas, and surround package names with quotes - dependencies=$(echo -e "$DEPENDS" | sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]+/,/g;s/[^, ][^, ]*/"&"/g') - echo "depends = [$dependencies]" >> "${COOKBOOK_STAGE}.toml" - else - echo "depends = []" >> "${COOKBOOK_STAGE}.toml" - fi - ;; unpkg) rm -fv "${COOKBOOK_STAGE}.pkgar" "${COOKBOOK_STAGE}.toml" ;; @@ -351,10 +80,6 @@ then cd "${COOKBOOK_RECIPE}" - if [ -e recipe.sh ]; then - source recipe.sh - fi - ops=() for arg in "${@:2}" do diff --git a/fetch.sh b/fetch.sh index 060ac6e4d..a3bc69c76 100755 --- a/fetch.sh +++ b/fetch.sh @@ -32,10 +32,5 @@ do recipe_path=`target/release/find_recipe $recipe_name` fi - if [ -e "$recipe_path/recipe.toml" ] - then - target/release/cook --fetch-only "$recipe_name" - else - ./cook.sh "$recipe_name" fetch - fi + target/release/cook --fetch-only "$recipe_name" done diff --git a/repo.sh b/repo.sh index 40476cefd..8869c0e7b 100755 --- a/repo.sh +++ b/repo.sh @@ -34,9 +34,6 @@ then recipes="$(target/release/list_recipes)" fi -# All $recipes that are in the new TOML format. -toml_recipes="" - for recipe in $recipes do recipe_path=`target/release/find_recipe $recipe` @@ -47,65 +44,18 @@ do COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source" COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot" - if [ -e "${COOKBOOK_RECIPE}/recipe.toml" ] - then - toml_recipes+=" $recipe" - target/release/cook $COOK_OPT "$recipe" - continue - fi - - if [ ! -d "${COOKBOOK_SOURCE}" ] - then - echo -e "\033[01;38;5;155mrepo - fetching $recipe\033[0m" >&2 - ./cook.sh "$recipe" fetch - fi - - if [ ! -d "${COOKBOOK_BUILD}" ] - then - echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2 - ./cook.sh "$recipe" prepare - elif [ ! -d "${COOKBOOK_SYSROOT}" ] - then - echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2 - ./cook.sh "$recipe" unprepare prepare - else - TIME_SOURCE="$($FIND "${COOKBOOK_SOURCE}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - TIME_BUILD="$($FIND "${COOKBOOK_BUILD}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ] - then - echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2 - ./cook.sh "$recipe" unprepare prepare - fi - fi - - if [ ! -f "${COOKBOOK_STAGE}.pkgar" ] - then - echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2 - ./cook.sh "$recipe" build stage pkg $DEBUG - else - TIME_BUILD="$($FIND "${COOKBOOK_BUILD}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - TIME_STAGE="$($STAT -c "%Y" "${COOKBOOK_STAGE}.pkgar")" - TIME_RECIPE="$($FIND "${COOKBOOK_RECIPE}"/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)" - if [ "$TIME_BUILD" -gt "$TIME_STAGE" -o "$TIME_RECIPE" -gt "$TIME_STAGE" ] - then - echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2 - ./cook.sh "$recipe" untar unstage build stage pkg $DEBUG - else - echo -e "\033[01;38;5;155mrepo - $recipe up to date\033[0m" >&2 - fi - fi + target/release/cook $COOK_OPT "$recipe" done mkdir -p "$REPO" declare -A APPSTREAM_SOURCES -# Currently, we only support runtime dependencies for recipes in the new TOML -# format. Runtime dependencies include both `[package.dependencies]` and -# dynamically linked packages discovered by auto_deps. -# +# Runtime dependencies include both `[package.dependencies]` and dynamically +# linked packages discovered by auto_deps. +# # The following adds the package dependencies of the recipes to the repo as # well. -recipes="$recipes $(target/release/pkg_deps $toml_recipes)" +recipes="$recipes $(target/release/pkg_deps $recipes)" target/release/repo_builder "$REPO" $recipes From 24eccf7093faf9055fba638cca4832b7d4669731 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 1 Sep 2025 21:52:06 +0200 Subject: [PATCH 40/52] Remove cook.sh --- clean.sh | 22 ++++++++++- cook.sh | 105 ----------------------------------------------------- unfetch.sh | 13 ++++++- 3 files changed, 31 insertions(+), 109 deletions(-) delete mode 100755 cook.sh diff --git a/clean.sh b/clean.sh index 7aba7ca85..c1ed4cf24 100755 --- a/clean.sh +++ b/clean.sh @@ -10,7 +10,25 @@ else recipes="$@" fi -for recipe_path in $recipes +for recipe in $recipes do - ./cook.sh "$recipe_path" distclean + if (echo "$recipe" | grep '.*/.*' >/dev/null); then + recipe_name=$(basename "$recipe") + recipe_path="$recipe" + else + recipe_name="$recipe" + recipe_path=`target/release/find_recipe $recipe` + fi + + echo -e "\033[01;38;5;215mcook - clean $recipe_name\033[0m" + + if [ -d "$ROOT/$recipe_path" ] + then + COOKBOOK_RECIPE="${ROOT}/$recipe_path" + TARGET_DIR="${ROOT}/$recipe_path/target/${TARGET}" + + rm -rf "${TARGET_DIR}" + else + echo "clean.sh: recipe '$recipe_name' not found" >&2 + fi done diff --git a/cook.sh b/cook.sh deleted file mode 100755 index ad457277e..000000000 --- a/cook.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env bash -set -e -shopt -s nullglob - -source config.sh - -# Variables to be overriden by recipes -export BINDIR=bin -export CARGO=(env RUSTFLAGS="$PREFIX_RUSTFLAGS -C link-arg=-zmuldefs" cargo) -export CARGOBUILD=rustc -export CARGOFLAGS= -export DEBUG= -export EXAMPLES= -export PREPARE_COPY=1 - -function usage { - echo "cook.sh $1 " >&2 - echo " distclean" >&2 - echo " unfetch" >&2 -} - -function op { - if [ ! "$COOK_QUIET" = "1" ] - then - echo -e "\033[01;38;5;215mcook - $1 $2\033[0m" >&2 - fi - - case "$2" in - distclean) - op $1 unpkg - op $1 unstage - op $1 unprepare - ;; - unfetch) - rm -rfv source source.tar - ;; - unprepare) - rm -rf "${COOKBOOK_BUILD}" - rm -rf "${COOKBOOK_SYSROOT}" - ;; - unstage) - rm -rfv "${COOKBOOK_STAGE}" - rm -fv "${TARGET_DIR}/auto_deps.toml" - ;; - unpkg) - rm -fv "${COOKBOOK_STAGE}.pkgar" "${COOKBOOK_STAGE}.toml" - ;; - *) - usage $1 - ;; - esac -} - -if [ -n "$1" ] -then - if (echo "$1" | grep '.*/.*' >/dev/null); then - recipe_name=$(basename "$1") - recipe_path="$1" - else - recipe_name="$1" - recipe_path=`target/release/find_recipe $recipe_name` - fi - - if [ -d "$ROOT/$recipe_path" ] - then - export COOKBOOK_RECIPE="${ROOT}/$recipe_path" - - TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}" - mkdir -p "${TARGET_DIR}" - - export COOKBOOK_BUILD="${TARGET_DIR}/build" - export COOKBOOK_STAGE="${TARGET_DIR}/stage" - export COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source" - export COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot" - - export PKG_CONFIG_ALLOW_CROSS=1 - export PKG_CONFIG_PATH= - export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig" - export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}" - - cd "${COOKBOOK_RECIPE}" - - ops=() - for arg in "${@:2}" - do - if [ "$arg" == "--debug" ] - then - DEBUG=1 - else - ops[${#ops[@]}]="$arg" - fi - done - - for i in "${ops[@]}" - do - op "$recipe_name" "$i" - done - elif [ "$IGNORE_ERROR" != "1" ] - then - echo "cook.sh: recipe '$recipe_name' at not found" >&2 - exit 1 - fi -else - usage "{package}" -fi diff --git a/unfetch.sh b/unfetch.sh index eb73178c3..d8016a05f 100755 --- a/unfetch.sh +++ b/unfetch.sh @@ -10,7 +10,16 @@ else recipes="$@" fi -for recipe_path in $recipes +for recipe in $recipes do - ./cook.sh "$recipe_path" unfetch + if (echo "$recipe" | grep '.*/.*' >/dev/null); then + recipe_name=$(basename "$recipe") + recipe_path="$recipe" + else + recipe_name="$recipe" + recipe_path=`target/release/find_recipe $recipe` + fi + + rm -rfv "$recipe_path"/source "$recipe_path"/source.tar done + From 081367d343155280636c3d1dd246a569193f8881 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Tue, 2 Sep 2025 15:31:26 +0000 Subject: [PATCH 41/52] Fix relibc tests --- recipes/tests/relibc-tests/recipe.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tests/relibc-tests/recipe.toml b/recipes/tests/relibc-tests/recipe.toml index 023ac741e..8f587bb5d 100644 --- a/recipes/tests/relibc-tests/recipe.toml +++ b/recipes/tests/relibc-tests/recipe.toml @@ -8,7 +8,7 @@ script = """ rsync -av --delete "${COOKBOOK_SOURCE}/" ./ pushd tests export CARGO_TEST="${COOKBOOK_CARGO}" -export NATIVE_RELIBC=1 +export NATIVE_RELIBC=0 # set 0 to link against relibc "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all bins_verify/relibc-tests popd mkdir -pv "${COOKBOOK_STAGE}/share/relibc" From bf026ddaf813d0d6a8a3231e167ee1230ad8bbdb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:33:37 +0200 Subject: [PATCH 42/52] Couple more cleanups --- clean.sh | 11 +---------- config.sh | 18 +----------------- repo.sh | 15 +++------------ 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/clean.sh b/clean.sh index c1ed4cf24..45c2e14a3 100755 --- a/clean.sh +++ b/clean.sh @@ -21,14 +21,5 @@ do fi echo -e "\033[01;38;5;215mcook - clean $recipe_name\033[0m" - - if [ -d "$ROOT/$recipe_path" ] - then - COOKBOOK_RECIPE="${ROOT}/$recipe_path" - TARGET_DIR="${ROOT}/$recipe_path/target/${TARGET}" - - rm -rf "${TARGET_DIR}" - else - echo "clean.sh: recipe '$recipe_name' not found" >&2 - fi + rm -rf "${ROOT}/$recipe_path/target/${TARGET}" done diff --git a/config.sh b/config.sh index f3a3b2de4..71131eb89 100755 --- a/config.sh +++ b/config.sh @@ -14,7 +14,6 @@ fi # Automatic variables ROOT="$(cd `dirname "$0"` && pwd)" -REPO="$ROOT/repo/$TARGET" export PATH="${ROOT}/bin:$PATH" export AR="${HOST}-gcc-ar" @@ -43,26 +42,11 @@ export PKG_CONFIG_FOR_BUILD="pkg-config" if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "FreeBSD" ]]; then # GNU find FIND="gfind"; - - # GNU stat from Homebrew or MacPorts - if [ ! -z "$(which brew)" ]; then - STAT="$(brew --prefix)/opt/coreutils/libexec/gnubin/stat"; - elif [ ! -z "$(which port)" ]; then - # TODO: find a programatic way of asking MacPorts for it's root dir. - STAT="/opt/local/opt/coreutils/libexec/gnubin/stat"; - elif [ ! -z "$(which pkg)" ]; then - STAT="gnustat" - else - echo "Please install either Homebrew or MacPorts and run the boostrap script." - exit 1 - fi else - FIND="find" - STAT="stat"; + FIND="find"; fi export FIND -export STAT if [ ! "$(uname -s)" = "Redox" ] then diff --git a/repo.sh b/repo.sh index 8869c0e7b..99ec7f272 100755 --- a/repo.sh +++ b/repo.sh @@ -36,20 +36,11 @@ fi for recipe in $recipes do - recipe_path=`target/release/find_recipe $recipe` - COOKBOOK_RECIPE="$recipe_path" - TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}" - COOKBOOK_BUILD="${TARGET_DIR}/build" - COOKBOOK_STAGE="${TARGET_DIR}/stage" - COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source" - COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot" - target/release/cook $COOK_OPT "$recipe" done -mkdir -p "$REPO" - -declare -A APPSTREAM_SOURCES +repo="$ROOT/repo/$TARGET" +mkdir -p "$repo" # Runtime dependencies include both `[package.dependencies]` and dynamically # linked packages discovered by auto_deps. @@ -58,4 +49,4 @@ declare -A APPSTREAM_SOURCES # well. recipes="$recipes $(target/release/pkg_deps $recipes)" -target/release/repo_builder "$REPO" $recipes +target/release/repo_builder "$repo" $recipes From 87699a364e132b4c55d3347cea3ce14f3c2b7777 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:43:39 +0200 Subject: [PATCH 43/52] Only accept recipe name in shell scripts Rather than recipe path. --- clean.sh | 12 +++--------- fetch.sh | 10 +--------- unfetch.sh | 13 ++++--------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/clean.sh b/clean.sh index 45c2e14a3..e26dba32a 100755 --- a/clean.sh +++ b/clean.sh @@ -5,20 +5,14 @@ source config.sh if [ $# = 0 ] then - recipes="$(target/release/list_recipes)" + recipes="$(target/release/list_recipes --short)" else recipes="$@" fi -for recipe in $recipes +for recipe_name in $recipes do - if (echo "$recipe" | grep '.*/.*' >/dev/null); then - recipe_name=$(basename "$recipe") - recipe_path="$recipe" - else - recipe_name="$recipe" - recipe_path=`target/release/find_recipe $recipe` - fi + recipe_path=`target/release/find_recipe $recipe_name` echo -e "\033[01;38;5;215mcook - clean $recipe_name\033[0m" rm -rf "${ROOT}/$recipe_path/target/${TARGET}" diff --git a/fetch.sh b/fetch.sh index a3bc69c76..1ca153c51 100755 --- a/fetch.sh +++ b/fetch.sh @@ -22,15 +22,7 @@ then recipes="$(target/release/list_recipes)" fi -for recipe_path in $recipes +for recipe_name in $recipes do - if (echo "$recipe_path" | grep '.*/.*' >/dev/null); then - recipe_name=$(basename "$recipe_path") - recipe_path="$recipe_path" - else - recipe_name="$recipe_path" - recipe_path=`target/release/find_recipe $recipe_name` - fi - target/release/cook --fetch-only "$recipe_name" done diff --git a/unfetch.sh b/unfetch.sh index d8016a05f..6763ff824 100755 --- a/unfetch.sh +++ b/unfetch.sh @@ -5,21 +5,16 @@ source config.sh if [ $# = 0 ] then - recipes="$(target/release/list_recipes)" + recipes="$(target/release/list_recipes --short)" else recipes="$@" fi -for recipe in $recipes +for recipe_name in $recipes do - if (echo "$recipe" | grep '.*/.*' >/dev/null); then - recipe_name=$(basename "$recipe") - recipe_path="$recipe" - else - recipe_name="$recipe" - recipe_path=`target/release/find_recipe $recipe` - fi + recipe_path=`target/release/find_recipe $recipe_name` + echo -e "\033[01;38;5;215mcook - unfetch $recipe_name\033[0m" rm -rfv "$recipe_path"/source "$recipe_path"/source.tar done From 7388bc9d0170e2dd29e64e7fca39bb39bee12a22 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:46:36 +0200 Subject: [PATCH 44/52] Don't allow empty package list in fetch.sh and repo.sh --- fetch.sh | 5 ----- repo.sh | 5 ----- 2 files changed, 10 deletions(-) diff --git a/fetch.sh b/fetch.sh index 1ca153c51..a6b7b67cf 100755 --- a/fetch.sh +++ b/fetch.sh @@ -17,11 +17,6 @@ do fi done -if [ "$recipes" == "" ] -then - recipes="$(target/release/list_recipes)" -fi - for recipe_name in $recipes do target/release/cook --fetch-only "$recipe_name" diff --git a/repo.sh b/repo.sh index 99ec7f272..c0125c978 100755 --- a/repo.sh +++ b/repo.sh @@ -29,11 +29,6 @@ do fi done -if [ "$recipes" == "" ] -then - recipes="$(target/release/list_recipes)" -fi - for recipe in $recipes do target/release/cook $COOK_OPT "$recipe" From 13d9e4794f761f8e53e91b783125ceaf5ed33e15 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:52:44 +0200 Subject: [PATCH 45/52] Move handling of multiple recipes into cook --- fetch.sh | 10 ++-------- repo.sh | 12 +++--------- src/bin/cook.rs | 12 ++++++++---- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/fetch.sh b/fetch.sh index a6b7b67cf..dd7481ae8 100755 --- a/fetch.sh +++ b/fetch.sh @@ -6,10 +6,7 @@ source config.sh recipes="" for arg in "${@:1}" do - if [ "$arg" == "--nonstop" ] - then - set +e - elif [ "$arg" == "--offline" ] + if [ "$arg" == "--offline" ] then export COOKBOOK_OFFLINE="1" else @@ -17,7 +14,4 @@ do fi done -for recipe_name in $recipes -do - target/release/cook --fetch-only "$recipe_name" -done +target/release/cook --fetch-only $recipes diff --git a/repo.sh b/repo.sh index c0125c978..5e0f98810 100755 --- a/repo.sh +++ b/repo.sh @@ -12,15 +12,12 @@ do if [ "$arg" == "--appstream" ] then APPSTREAM="1" - elif [ "$arg" == "--debug" ] - then - DEBUG=--debug elif [ "$arg" == "--with-package-deps" ] then - COOK_OPT=--with-package-deps + COOK_OPT+=" --with-package-deps" elif [ "$arg" == "--nonstop" ] then - set +e + COOK_OPT+=" --nonstop" elif [ "$arg" == "--offline" ] then export COOKBOOK_OFFLINE="1" @@ -29,10 +26,7 @@ do fi done -for recipe in $recipes -do - target/release/cook $COOK_OPT "$recipe" -done +target/release/cook $COOK_OPT $recipes repo="$ROOT/repo/$TARGET" mkdir -p "$repo" diff --git a/src/bin/cook.rs b/src/bin/cook.rs index ca2e4484b..70a186a3f 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -928,7 +928,7 @@ EOF -Wno-dev \ "${COOKBOOK_CMAKE_FLAGS[@]}" \ "$@" - + "${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}" DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install -j"${COOKBOOK_MAKE_JOBS}" } @@ -996,7 +996,7 @@ function cookbook_meson { let post_script = r#"# Common post script # Strip binaries -for dir in "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/usr/bin" +for dir in "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/usr/bin" do if [ -d "${dir}" ] && [ -z "${COOKBOOK_NOSTRIP}" ] then @@ -1005,7 +1005,7 @@ do done # Remove libtool files -for dir in "${COOKBOOK_STAGE}/lib" "${COOKBOOK_STAGE}/usr/lib" +for dir in "${COOKBOOK_STAGE}/lib" "${COOKBOOK_STAGE}/usr/lib" do if [ -d "${dir}" ] then @@ -1282,6 +1282,7 @@ fn main() { let mut fetch_only = false; let mut with_package_deps = false; let mut quiet = false; + let mut nonstop = false; let mut recipe_names = Vec::new(); for arg in env::args().skip(1) { match arg.as_str() { @@ -1290,6 +1291,7 @@ fn main() { "--with-package-deps" if matching => with_package_deps = true, "--fetch-only" if matching => fetch_only = true, "-q" | "--quiet" if matching => quiet = true, + "--nonstop" => nonstop = true, _ => recipe_names.push(arg.try_into().expect("Invalid package name")), } } @@ -1370,7 +1372,9 @@ fn main() { style::Reset, err, ); - process::exit(1); + if !nonstop { + process::exit(1); + } } } } From 5a666533304d5f6a6a002665c7ea435394b1de45 Mon Sep 17 00:00:00 2001 From: Ribbon Date: Thu, 4 Sep 2025 19:41:36 -0300 Subject: [PATCH 46/52] Add recipes --- recipes/wip/demos/feoxdb/recipe.toml | 8 ++++++++ recipes/wip/demos/genpdf-rs/recipe.toml | 8 ++++++++ recipes/wip/demos/reticulum-rs/recipe.toml | 9 +++++++++ recipes/wip/monitors/socktop/recipe.toml | 8 ++++++++ recipes/wip/net/analysis/angryether-rs/recipe.toml | 5 +++++ recipes/wip/net/remote/bayesian-ssh/recipe.toml | 5 +++++ recipes/wip/net/server/feox-server/recipe.toml | 5 +++++ recipes/wip/office/doxx/recipe.toml | 5 +++++ recipes/wip/security/safecloset/recipe.toml | 5 +++++ recipes/wip/sound/jukebox-cli/recipe.toml | 5 +++++ recipes/wip/sys-info/ffetch/recipe.toml | 5 +++++ 11 files changed, 68 insertions(+) create mode 100644 recipes/wip/demos/feoxdb/recipe.toml create mode 100644 recipes/wip/demos/genpdf-rs/recipe.toml create mode 100644 recipes/wip/demos/reticulum-rs/recipe.toml create mode 100644 recipes/wip/monitors/socktop/recipe.toml create mode 100644 recipes/wip/net/analysis/angryether-rs/recipe.toml create mode 100644 recipes/wip/net/remote/bayesian-ssh/recipe.toml create mode 100644 recipes/wip/net/server/feox-server/recipe.toml create mode 100644 recipes/wip/office/doxx/recipe.toml create mode 100644 recipes/wip/security/safecloset/recipe.toml create mode 100644 recipes/wip/sound/jukebox-cli/recipe.toml create mode 100644 recipes/wip/sys-info/ffetch/recipe.toml diff --git a/recipes/wip/demos/feoxdb/recipe.toml b/recipes/wip/demos/feoxdb/recipe.toml new file mode 100644 index 000000000..84b8e46c4 --- /dev/null +++ b/recipes/wip/demos/feoxdb/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/mehrantsi/FeOxDB" +[build] +template = "custom" +script = """ +cookbook_cargo_examples basic_usage deterministic_test +""" diff --git a/recipes/wip/demos/genpdf-rs/recipe.toml b/recipes/wip/demos/genpdf-rs/recipe.toml new file mode 100644 index 000000000..20fc1c827 --- /dev/null +++ b/recipes/wip/demos/genpdf-rs/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://git.sr.ht/~ireas/genpdf-rs" +[build] +template = "custom" +script = """ +cookbook_cargo_examples demo +""" diff --git a/recipes/wip/demos/reticulum-rs/recipe.toml b/recipes/wip/demos/reticulum-rs/recipe.toml new file mode 100644 index 000000000..f4064148a --- /dev/null +++ b/recipes/wip/demos/reticulum-rs/recipe.toml @@ -0,0 +1,9 @@ +#TODO not compiled or tested +# the protobuf compiler needs to be installed +[source] +git = "https://github.com/BeechatNetworkSystemsLtd/Reticulum-rs" +[build] +template = "custom" +script = """ +cookbook_cargo_examples tcp_client kaonic_client +""" diff --git a/recipes/wip/monitors/socktop/recipe.toml b/recipes/wip/monitors/socktop/recipe.toml new file mode 100644 index 000000000..ab499e0e9 --- /dev/null +++ b/recipes/wip/monitors/socktop/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/jasonwitty/socktop" +[build] +template = "custom" +script = """ +cookbook_cargo_packages socktop socktop_agent +""" diff --git a/recipes/wip/net/analysis/angryether-rs/recipe.toml b/recipes/wip/net/analysis/angryether-rs/recipe.toml new file mode 100644 index 000000000..e780647da --- /dev/null +++ b/recipes/wip/net/analysis/angryether-rs/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/pg3uk/AngryEtherRust" +[build] +template = "cargo" diff --git a/recipes/wip/net/remote/bayesian-ssh/recipe.toml b/recipes/wip/net/remote/bayesian-ssh/recipe.toml new file mode 100644 index 000000000..2b0c18fcf --- /dev/null +++ b/recipes/wip/net/remote/bayesian-ssh/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/abdoufermat5/bayesian-ssh" +[build] +template = "cargo" diff --git a/recipes/wip/net/server/feox-server/recipe.toml b/recipes/wip/net/server/feox-server/recipe.toml new file mode 100644 index 000000000..c2aa744df --- /dev/null +++ b/recipes/wip/net/server/feox-server/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/mehrantsi/feox-server" +[build] +template = "cargo" diff --git a/recipes/wip/office/doxx/recipe.toml b/recipes/wip/office/doxx/recipe.toml new file mode 100644 index 000000000..4375cd1e9 --- /dev/null +++ b/recipes/wip/office/doxx/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/bgreenwell/doxx" +[build] +template = "cargo" diff --git a/recipes/wip/security/safecloset/recipe.toml b/recipes/wip/security/safecloset/recipe.toml new file mode 100644 index 000000000..4617d7afc --- /dev/null +++ b/recipes/wip/security/safecloset/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/Canop/safecloset" +[build] +template = "cargo" diff --git a/recipes/wip/sound/jukebox-cli/recipe.toml b/recipes/wip/sound/jukebox-cli/recipe.toml new file mode 100644 index 000000000..f47b45106 --- /dev/null +++ b/recipes/wip/sound/jukebox-cli/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/FedeCarollo/jukebox-cli" +[build] +template = "cargo" diff --git a/recipes/wip/sys-info/ffetch/recipe.toml b/recipes/wip/sys-info/ffetch/recipe.toml new file mode 100644 index 000000000..8b23aada9 --- /dev/null +++ b/recipes/wip/sys-info/ffetch/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/0l3d/ffetch" +[build] +template = "cargo" From 04d88c61097a309afef69bc900930f6ebdfb0f13 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:30:57 +0200 Subject: [PATCH 47/52] Replace COOKBOOK_OFFLINE with --offline --- fetch.sh | 13 +------------ repo.sh | 2 +- src/bin/cook.rs | 12 ++++++++++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/fetch.sh b/fetch.sh index dd7481ae8..2a1e87a99 100755 --- a/fetch.sh +++ b/fetch.sh @@ -3,15 +3,4 @@ set -e source config.sh -recipes="" -for arg in "${@:1}" -do - if [ "$arg" == "--offline" ] - then - export COOKBOOK_OFFLINE="1" - else - recipes+=" $arg" - fi -done - -target/release/cook --fetch-only $recipes +target/release/cook --fetch-only ${@:1} diff --git a/repo.sh b/repo.sh index 5e0f98810..5fc214215 100755 --- a/repo.sh +++ b/repo.sh @@ -20,7 +20,7 @@ do COOK_OPT+=" --nonstop" elif [ "$arg" == "--offline" ] then - export COOKBOOK_OFFLINE="1" + COOK_OPT+=" --offline" else recipes+=" $arg" fi diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 70a186a3f..7b3f291ab 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -1237,12 +1237,12 @@ fn cook( name: &PackageName, recipe: &Recipe, fetch_only: bool, + is_offline: bool, ) -> Result<(), String> { if recipe.build.kind == BuildKind::None { return cook_meta(recipe_dir, name, recipe, fetch_only); } - let is_offline = env::var("COOKBOOK_OFFLINE").unwrap_or("".to_string()) == "1"; let source_dir = match is_offline { true => fetch_offline(recipe_dir, &recipe.source), false => fetch(recipe_dir, &recipe.source), @@ -1283,6 +1283,7 @@ fn main() { let mut with_package_deps = false; let mut quiet = false; let mut nonstop = false; + let mut is_offline = false; let mut recipe_names = Vec::new(); for arg in env::args().skip(1) { match arg.as_str() { @@ -1292,6 +1293,7 @@ fn main() { "--fetch-only" if matching => fetch_only = true, "-q" | "--quiet" if matching => quiet = true, "--nonstop" => nonstop = true, + "--offline" => is_offline = true, _ => recipe_names.push(arg.try_into().expect("Invalid package name")), } } @@ -1346,7 +1348,13 @@ fn main() { } Ok(()) } else { - cook(&recipe.dir, &recipe.name, &recipe.recipe, fetch_only) + cook( + &recipe.dir, + &recipe.name, + &recipe.recipe, + fetch_only, + is_offline, + ) }; match res { From 9a40987f616ece3c52fcfe48c0ab51738de4e49b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:37:38 +0200 Subject: [PATCH 48/52] Use LF as line ending in repo_builder.rs --- src/bin/repo_builder.rs | 328 ++++++++++++++++++++-------------------- 1 file changed, 164 insertions(+), 164 deletions(-) diff --git a/src/bin/repo_builder.rs b/src/bin/repo_builder.rs index 6a7a8a35d..4af35624c 100644 --- a/src/bin/repo_builder.rs +++ b/src/bin/repo_builder.rs @@ -1,164 +1,164 @@ -use pkg::recipes; -use std::collections::{BTreeMap, HashMap}; -use std::env; -use std::fs::{self, File}; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; -use std::process::Command; -use toml::Value; - -fn is_newer(src: &Path, dst: &Path) -> bool { - match (fs::metadata(src), fs::metadata(dst)) { - (Ok(src_meta), Ok(dst_meta)) => match (src_meta.modified(), dst_meta.modified()) { - (Ok(src_time), Ok(dst_time)) => src_time > dst_time, - (Ok(_), Err(_)) => true, - _ => false, - }, - (Ok(_), Err(_)) => true, - _ => false, - } -} - -fn main() -> Result<(), Box> { - let mut args = env::args().skip(1); - let repo_dir = args - .next() - .expect("Usage: repo_builder ..."); - let recipe_list: Vec = args.collect(); - let repo_path = Path::new(&repo_dir); - - let mut appstream_sources: HashMap = HashMap::new(); - let mut packages: BTreeMap = BTreeMap::new(); - - // === 1. Push recipes in list === - for recipe in &recipe_list { - let Some(recipe_path) = recipes::find(recipe) else { - eprintln!("recipe {} not found", recipe); - continue; - }; - - let cookbook_recipe = Path::new(&recipe_path); - let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into()); - let stage_dir = cookbook_recipe.join("target").join(&target).join("stage"); - - let pkgar_src = stage_dir.with_extension("pkgar"); - let pkgar_dst = repo_path.join(format!("{}.pkgar", recipe)); - let toml_src = stage_dir.with_extension("toml"); - let toml_dst = repo_path.join(format!("{}.toml", recipe)); - - if is_newer(&toml_src, &toml_dst) { - eprintln!("\x1b[01;38;5;155mrepo - publishing {}\x1b[0m", recipe); - if fs::exists(&pkgar_src)? { - fs::copy(&pkgar_src, &pkgar_dst)?; - } - fs::copy(&toml_src, &toml_dst)?; - } - - if stage_dir.join("usr/share/metainfo").exists() { - appstream_sources.insert(recipe.clone(), stage_dir.clone()); - } - } - - // === 2. Optional AppStream generation === - if env::var("APPSTREAM").ok().as_deref() == Some("1") { - eprintln!("\x1b[01;38;5;155mrepo - generating appstream data\x1b[0m"); - - let root = env::var("ROOT").unwrap_or_else(|_| ".".into()); - let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into()); - let appstream_root = Path::new(&root) - .join("build") - .join(&target) - .join("appstream"); - let appstream_pkg = repo_path.join("appstream.pkgar"); - - fs::remove_dir_all(&appstream_root).ok(); - fs::remove_file(&appstream_pkg).ok(); - fs::create_dir_all(&appstream_root)?; - - if !appstream_sources.is_empty() { - let mut compose_cmd = Command::new("appstreamcli"); - compose_cmd - .arg("compose") - .arg("--origin=pkgar") - .arg(format!("--result-root={}", appstream_root.display())); - - for (_recipe, source_path) in &appstream_sources { - compose_cmd.arg(source_path); - } - - compose_cmd - .status()? - .success() - .then_some(()) - .ok_or("appstreamcli failed")?; - - Command::new("pkgar") - .arg("create") - .arg("--archive") - .arg(&appstream_pkg) - .arg("--skey") - .arg(format!("{}/build/id_ed25519.toml", root)) - .arg(&appstream_root) - .status()? - .success() - .then_some(()) - .ok_or("pkgar create failed")?; - } - } - - eprintln!("\x1b[01;38;5;155mrepo - generating repo.toml\x1b[0m"); - - // === 3. Read and update repo.toml === - let repo_toml_path = repo_path.join("repo.toml"); - if repo_toml_path.exists() { - let mut file = File::open(&repo_toml_path)?; - let mut contents = String::new(); - file.read_to_string(&mut contents)?; - - let parsed: Value = toml::from_str(&contents)?; - if let Some(pkg_table) = parsed.get("packages").and_then(|v| v.as_table()) { - for (k, v) in pkg_table { - if let Some(s) = v.as_str() { - packages.insert(k.clone(), format!("\"{}\"", s)); - } else { - packages.insert(k.clone(), v.to_string()); - } - } - } - } - - for entry in fs::read_dir(&repo_path)? { - let entry = entry?; - let path = entry.path(); - - if path.extension().and_then(|s| s.to_str()) != Some("toml") { - continue; - } - - if path.file_stem().and_then(|s| s.to_str()) == Some("repo") { - continue; - } - - let content = fs::read_to_string(&path)?; - let parsed: Value = toml::from_str(&content)?; - - if let Some(version_val) = parsed.get("version") { - let version_str = version_val.to_string(); // includes quotes - let package_name = path.file_stem().unwrap().to_string_lossy().to_string(); - packages.insert(package_name, version_str); - } else { - eprintln!("Warning: no [version] found in {:?}", path); - } - } - - // FIXME: Use proper TOML serializer - let mut output = String::from("[packages]\n"); - for (name, version) in &packages { - output.push_str(&format!("{name} = {version}\n")); - } - - let mut output_file = File::create(&repo_toml_path)?; - output_file.write_all(output.as_bytes())?; - - Ok(()) -} +use pkg::recipes; +use std::collections::{BTreeMap, HashMap}; +use std::env; +use std::fs::{self, File}; +use std::io::{Read, Write}; +use std::path::{Path, PathBuf}; +use std::process::Command; +use toml::Value; + +fn is_newer(src: &Path, dst: &Path) -> bool { + match (fs::metadata(src), fs::metadata(dst)) { + (Ok(src_meta), Ok(dst_meta)) => match (src_meta.modified(), dst_meta.modified()) { + (Ok(src_time), Ok(dst_time)) => src_time > dst_time, + (Ok(_), Err(_)) => true, + _ => false, + }, + (Ok(_), Err(_)) => true, + _ => false, + } +} + +fn main() -> Result<(), Box> { + let mut args = env::args().skip(1); + let repo_dir = args + .next() + .expect("Usage: repo_builder ..."); + let recipe_list: Vec = args.collect(); + let repo_path = Path::new(&repo_dir); + + let mut appstream_sources: HashMap = HashMap::new(); + let mut packages: BTreeMap = BTreeMap::new(); + + // === 1. Push recipes in list === + for recipe in &recipe_list { + let Some(recipe_path) = recipes::find(recipe) else { + eprintln!("recipe {} not found", recipe); + continue; + }; + + let cookbook_recipe = Path::new(&recipe_path); + let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into()); + let stage_dir = cookbook_recipe.join("target").join(&target).join("stage"); + + let pkgar_src = stage_dir.with_extension("pkgar"); + let pkgar_dst = repo_path.join(format!("{}.pkgar", recipe)); + let toml_src = stage_dir.with_extension("toml"); + let toml_dst = repo_path.join(format!("{}.toml", recipe)); + + if is_newer(&toml_src, &toml_dst) { + eprintln!("\x1b[01;38;5;155mrepo - publishing {}\x1b[0m", recipe); + if fs::exists(&pkgar_src)? { + fs::copy(&pkgar_src, &pkgar_dst)?; + } + fs::copy(&toml_src, &toml_dst)?; + } + + if stage_dir.join("usr/share/metainfo").exists() { + appstream_sources.insert(recipe.clone(), stage_dir.clone()); + } + } + + // === 2. Optional AppStream generation === + if env::var("APPSTREAM").ok().as_deref() == Some("1") { + eprintln!("\x1b[01;38;5;155mrepo - generating appstream data\x1b[0m"); + + let root = env::var("ROOT").unwrap_or_else(|_| ".".into()); + let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into()); + let appstream_root = Path::new(&root) + .join("build") + .join(&target) + .join("appstream"); + let appstream_pkg = repo_path.join("appstream.pkgar"); + + fs::remove_dir_all(&appstream_root).ok(); + fs::remove_file(&appstream_pkg).ok(); + fs::create_dir_all(&appstream_root)?; + + if !appstream_sources.is_empty() { + let mut compose_cmd = Command::new("appstreamcli"); + compose_cmd + .arg("compose") + .arg("--origin=pkgar") + .arg(format!("--result-root={}", appstream_root.display())); + + for (_recipe, source_path) in &appstream_sources { + compose_cmd.arg(source_path); + } + + compose_cmd + .status()? + .success() + .then_some(()) + .ok_or("appstreamcli failed")?; + + Command::new("pkgar") + .arg("create") + .arg("--archive") + .arg(&appstream_pkg) + .arg("--skey") + .arg(format!("{}/build/id_ed25519.toml", root)) + .arg(&appstream_root) + .status()? + .success() + .then_some(()) + .ok_or("pkgar create failed")?; + } + } + + eprintln!("\x1b[01;38;5;155mrepo - generating repo.toml\x1b[0m"); + + // === 3. Read and update repo.toml === + let repo_toml_path = repo_path.join("repo.toml"); + if repo_toml_path.exists() { + let mut file = File::open(&repo_toml_path)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; + + let parsed: Value = toml::from_str(&contents)?; + if let Some(pkg_table) = parsed.get("packages").and_then(|v| v.as_table()) { + for (k, v) in pkg_table { + if let Some(s) = v.as_str() { + packages.insert(k.clone(), format!("\"{}\"", s)); + } else { + packages.insert(k.clone(), v.to_string()); + } + } + } + } + + for entry in fs::read_dir(&repo_path)? { + let entry = entry?; + let path = entry.path(); + + if path.extension().and_then(|s| s.to_str()) != Some("toml") { + continue; + } + + if path.file_stem().and_then(|s| s.to_str()) == Some("repo") { + continue; + } + + let content = fs::read_to_string(&path)?; + let parsed: Value = toml::from_str(&content)?; + + if let Some(version_val) = parsed.get("version") { + let version_str = version_val.to_string(); // includes quotes + let package_name = path.file_stem().unwrap().to_string_lossy().to_string(); + packages.insert(package_name, version_str); + } else { + eprintln!("Warning: no [version] found in {:?}", path); + } + } + + // FIXME: Use proper TOML serializer + let mut output = String::from("[packages]\n"); + for (name, version) in &packages { + output.push_str(&format!("{name} = {version}\n")); + } + + let mut output_file = File::create(&repo_toml_path)?; + output_file.write_all(output.as_bytes())?; + + Ok(()) +} From ee25a707f83dce0afbc856e067dd65a80a4501a5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:22:41 +0200 Subject: [PATCH 49/52] Remove pkg_deps binary --- repo.sh | 7 ------- src/bin/pkg_deps.rs | 22 ---------------------- src/bin/repo_builder.rs | 17 +++++++++++++++-- 3 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 src/bin/pkg_deps.rs diff --git a/repo.sh b/repo.sh index 5fc214215..f24580057 100755 --- a/repo.sh +++ b/repo.sh @@ -31,11 +31,4 @@ target/release/cook $COOK_OPT $recipes repo="$ROOT/repo/$TARGET" mkdir -p "$repo" -# Runtime dependencies include both `[package.dependencies]` and dynamically -# linked packages discovered by auto_deps. -# -# The following adds the package dependencies of the recipes to the repo as -# well. -recipes="$recipes $(target/release/pkg_deps $recipes)" - target/release/repo_builder "$repo" $recipes diff --git a/src/bin/pkg_deps.rs b/src/bin/pkg_deps.rs deleted file mode 100644 index 4fddb79d9..000000000 --- a/src/bin/pkg_deps.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::env::args; - -use pkg::{ - package::{Package, PackageError}, - PackageName, -}; - -use cookbook::WALK_DEPTH; - -fn main() -> Result<(), PackageError> { - let names: Vec = args() - .skip(1) - .map(PackageName::new) - .collect::>()?; - - let packages = Package::new_recursive(&names, WALK_DEPTH)?; - for package in packages { - println!("{}", package.name); - } - - Ok(()) -} diff --git a/src/bin/repo_builder.rs b/src/bin/repo_builder.rs index 4af35624c..d903bfd13 100644 --- a/src/bin/repo_builder.rs +++ b/src/bin/repo_builder.rs @@ -1,4 +1,5 @@ -use pkg::recipes; +use cookbook::WALK_DEPTH; +use pkg::{recipes, Package, PackageName}; use std::collections::{BTreeMap, HashMap}; use std::env; use std::fs::{self, File}; @@ -24,9 +25,21 @@ fn main() -> Result<(), Box> { let repo_dir = args .next() .expect("Usage: repo_builder ..."); - let recipe_list: Vec = args.collect(); let repo_path = Path::new(&repo_dir); + // Runtime dependencies include both `[package.dependencies]` and dynamically + // linked packages discovered by auto_deps. + // + // The following adds the package dependencies of the recipes to the repo as + // well. + let recipe_list = Package::new_recursive( + &args.map(PackageName::new).collect::, _>>()?, + WALK_DEPTH, + )? + .into_iter() + .map(|pkg| pkg.name.as_str().to_owned()) + .collect::>(); + let mut appstream_sources: HashMap = HashMap::new(); let mut packages: BTreeMap = BTreeMap::new(); From 5dc9b3a5933c4f125c2a85df0dc0aafe7208003f Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Sat, 6 Sep 2025 17:58:56 +0000 Subject: [PATCH 50/52] OpenSSH daemon support --- recipes/wip/ssh/openssh/recipe.toml | 31 +- recipes/wip/ssh/openssh/redox.patch | 424 +++++++++++++++++++++++++++- 2 files changed, 437 insertions(+), 18 deletions(-) diff --git a/recipes/wip/ssh/openssh/recipe.toml b/recipes/wip/ssh/openssh/recipe.toml index 26ed0f91f..85798b1df 100644 --- a/recipes/wip/ssh/openssh/recipe.toml +++ b/recipes/wip/ssh/openssh/recipe.toml @@ -1,6 +1,7 @@ -#TODO compiled but not tested -#TODO lack of utmpx.h and resolv.h, expect dns not working -#TODO maybe actually implement utmpx.h in relibc? +#TODO lack of resolv.h, expect dns not working +#TODO lack of utmpx.h, expect no way to track login in sshd +#TODO lack of an equivalent to shadow.h, expect sshd password not working +#TODO lack of openssl support, use only ssh-keygen from redox [source] tar = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz" patches = [ @@ -9,12 +10,34 @@ patches = [ [build] template = "custom" dependencies = [ - "openssl1", "zlib", ] script = """ DYNAMIC_INIT +COOKBOOK_CONFIGURE_FLAGS+=( + --disable-strip +# requires openssl 1.1.1, result in libcrypto error otherwise + --without-openssl +) cookbook_configure mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd rmdir "${COOKBOOK_STAGE}"/usr/sbin + +# Extracted from `make host-key-force` +# TODO: Very insecure! but there's no postscript yet +ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_dsa_key -N "" +ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_rsa_key -N "" +ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_ed25519_key -N "" +ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_ecdsa_key -N "" + +# The config can be found here, not /etc +CONFIG_FILE="${COOKBOOK_STAGE}"/usr/etc/sshd_config +sed -i "s/#LogLevel INFO/LogLevel DEBUG3/g" "${CONFIG_FILE}" + +# ipv6 is not working yet +sed -i "s/#AddressFamily any/AddressFamily inet/g" "${CONFIG_FILE}" +# hardcoded to 0.0.0.0 in patches +sed -i "s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g" "${CONFIG_FILE}" +# will never work +sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/g" "${CONFIG_FILE}" """ diff --git a/recipes/wip/ssh/openssh/redox.patch b/recipes/wip/ssh/openssh/redox.patch index e1b43cae3..153e9cda2 100644 --- a/recipes/wip/ssh/openssh/redox.patch +++ b/recipes/wip/ssh/openssh/redox.patch @@ -1,6 +1,20 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/configure 2025-09-06 23:54:58.147442355 +0700 +@@ -12606,6 +12606,10 @@ + printf "%s\n" "#define BROKEN_POLL 1" >>confdefs.h + + ;; ++*-*-redox) ++ ++ # todo ++ ;; + mips-sony-bsd|mips-sony-newsos4) + + printf "%s\n" "#define NEED_SETPGRP 1" >>confdefs.h diff -ruwN source/defines.h source-new/defines.h --- source/defines.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/defines.h 2025-08-20 13:37:45.820728226 +0700 ++++ source-new/defines.h 2025-09-06 21:22:46.327552147 +0700 @@ -52,6 +52,18 @@ #define IPPORT_RESERVED 0 #endif @@ -49,9 +63,14 @@ diff -ruwN source/defines.h source-new/defines.h /* Define this to be the path of the xauth program. */ #ifdef XAUTH_PATH #define _PATH_XAUTH XAUTH_PATH +@@ -943,3 +957,4 @@ + # define USE_SNTRUP761X25519 1 + #endif + #endif /* _DEFINES_H */ ++ diff -ruwN source/hostfile.c source-new/hostfile.c --- source/hostfile.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/hostfile.c 2025-08-20 11:51:28.964103232 +0700 ++++ source-new/hostfile.c 2025-09-06 21:09:36.555438339 +0700 @@ -44,7 +44,9 @@ #include @@ -64,7 +83,7 @@ diff -ruwN source/hostfile.c source-new/hostfile.c #include diff -ruwN source/loginrec.c source-new/loginrec.c --- source/loginrec.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/loginrec.c 2025-08-20 13:43:02.970560664 +0700 ++++ source-new/loginrec.c 2025-09-06 21:09:36.556438304 +0700 @@ -1033,7 +1033,7 @@ return (0); } @@ -76,7 +95,7 @@ diff -ruwN source/loginrec.c source-new/loginrec.c } diff -ruwN source/loginrec.h source-new/loginrec.h --- source/loginrec.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/loginrec.h 2025-08-20 13:39:08.570682776 +0700 ++++ source-new/loginrec.h 2025-09-06 21:09:36.556438304 +0700 @@ -30,6 +30,7 @@ **/ @@ -85,9 +104,56 @@ diff -ruwN source/loginrec.h source-new/loginrec.h struct ssh; +diff -ruwN source/misc.c source-new/misc.c +--- source/misc.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/misc.c 2025-09-06 21:09:36.556438304 +0700 +@@ -2843,7 +2843,7 @@ + error("%s: dup2: %s", tag, strerror(errno)); + _exit(1); + } +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + + if (geteuid() == 0 && + initgroups(pw->pw_name, pw->pw_gid) == -1) { +diff -ruwN source/monitor.c source-new/monitor.c +--- source/monitor.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/monitor.c 2025-09-07 00:46:23.435378053 +0700 +@@ -484,18 +484,19 @@ + pfd[0].events = POLLIN; + pfd[1].fd = pmonitor->m_log_recvfd; + pfd[1].events = pfd[1].fd == -1 ? 0 : POLLIN; +- if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, -1) == -1) { ++ // redox can't handle timeout -1 (the poll stuck) ++ if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, 1000) == -1) { + if (errno == EINTR || errno == EAGAIN) + continue; + fatal_f("poll: %s", strerror(errno)); + } + if (pfd[1].revents) { ++ + /* + * Drain all log messages before processing next + * monitor request. + */ + monitor_read_log(pmonitor); +- continue; + } + if (pfd[0].revents) + break; /* Continues below */ +@@ -1577,7 +1578,8 @@ + res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); + if (res == 0) + goto error; +- pty_setowner(authctxt->pw, s->tty); ++ // non sense in redox ++ // pty_setowner(authctxt->pw, s->tty); + + if ((r = sshbuf_put_u32(m, 1)) != 0 || + (r = sshbuf_put_cstring(m, s->tty)) != 0) diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-statvfs.h --- source/openbsd-compat/bsd-statvfs.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/bsd-statvfs.h 2025-08-20 13:37:42.000730245 +0700 ++++ source-new/openbsd-compat/bsd-statvfs.h 2025-09-06 21:09:36.556438304 +0700 @@ -37,13 +37,6 @@ typedef unsigned long fsfilcnt_t; #endif @@ -104,7 +170,7 @@ diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-sta unsigned long f_bsize; /* File system block size. */ diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getrrsetbyname.c --- source/openbsd-compat/getrrsetbyname.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/getrrsetbyname.c 2025-08-20 13:51:15.020299084 +0700 ++++ source-new/openbsd-compat/getrrsetbyname.c 2025-09-06 21:09:36.556438304 +0700 @@ -67,6 +67,52 @@ #endif #define _THREAD_PRIVATE(a,b,c) (c) @@ -232,7 +298,7 @@ diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getr free_dns_rr(head); diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getrrsetbyname.h --- source/openbsd-compat/getrrsetbyname.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/getrrsetbyname.h 2025-08-20 11:51:00.744118526 +0700 ++++ source-new/openbsd-compat/getrrsetbyname.h 2025-09-06 21:09:36.557438268 +0700 @@ -54,9 +54,13 @@ #include @@ -249,7 +315,7 @@ diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getr #define HFIXEDSZ 12 diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop.c --- source/openbsd-compat/inet_ntop.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/inet_ntop.c 2025-08-20 11:39:15.244488902 +0700 ++++ source-new/openbsd-compat/inet_ntop.c 2025-09-06 21:09:36.557438268 +0700 @@ -26,7 +26,9 @@ #include #include @@ -262,7 +328,7 @@ diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop #include diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/openbsd-compat.h --- source/openbsd-compat/openbsd-compat.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/openbsd-compat.h 2025-08-20 13:15:22.721439992 +0700 ++++ source-new/openbsd-compat/openbsd-compat.h 2025-09-06 21:09:36.557438268 +0700 @@ -36,6 +36,8 @@ #include /* for wchar_t */ @@ -274,7 +340,7 @@ diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/open #include "sigact.h" diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c --- source/openbsd-compat/utmpx.c 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/openbsd-compat/utmpx.c 2025-08-20 13:13:54.971486065 +0700 ++++ source-new/openbsd-compat/utmpx.c 2025-09-06 21:09:36.557438268 +0700 @@ -0,0 +1,13 @@ +#include "utmpx.h" +#include // For NULL @@ -292,7 +358,7 @@ diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c \ No newline at end of file diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h --- source/openbsd-compat/utmpx.h 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/openbsd-compat/utmpx.h 2025-08-20 13:13:07.201511825 +0700 ++++ source-new/openbsd-compat/utmpx.h 2025-09-06 21:09:36.557438268 +0700 @@ -0,0 +1,69 @@ +#ifndef _COMPAT_UTMPX_H +#define _COMPAT_UTMPX_H @@ -364,9 +430,54 @@ diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h +#endif /* __redox__ */ +#endif /* _COMPAT_UTMPX_H */ \ No newline at end of file +diff -ruwN source/pathnames.h source-new/pathnames.h +--- source/pathnames.h 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/pathnames.h 2025-09-06 21:09:36.557438268 +0700 +@@ -12,7 +12,7 @@ + * called by a name other than "ssh" or "Secure Shell". + */ + +-#define ETCDIR "/etc" ++#define ETCDIR "/usr/etc" + + #ifndef SSHDIR + #define SSHDIR ETCDIR "/ssh" +@@ -166,7 +166,7 @@ + + /* chroot directory for unprivileged user when UsePrivilegeSeparation=yes */ + #ifndef _PATH_PRIVSEP_CHROOT_DIR +-#define _PATH_PRIVSEP_CHROOT_DIR "/var/empty" ++#define _PATH_PRIVSEP_CHROOT_DIR "/usr/var/empty" + #endif + + /* for passwd change */ +diff -ruwN source/readconf.c source-new/readconf.c +--- source/readconf.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/readconf.c 2025-09-06 21:09:36.558438233 +0700 +@@ -554,7 +554,7 @@ + + if (stdfd_devnull(1, 1, 0) == -1) + fatal_f("stdfd_devnull failed"); +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + + argv[0] = shell; + argv[1] = "-c"; +diff -ruwN source/readpass.c source-new/readpass.c +--- source/readpass.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/readpass.c 2025-09-06 21:09:36.558438233 +0700 +@@ -278,7 +278,7 @@ + if (pid == 0) { + if (stdfd_devnull(1, 1, 0) == -1) + fatal_f("stdfd_devnull failed"); +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + setenv("SSH_ASKPASS_PROMPT", "none", 1); /* hint to UI */ + execlp(askpass, askpass, prompt, (char *)NULL); + error_f("exec(%s): %s", askpass, strerror(errno)); diff -ruwN source/regress/netcat.c source-new/regress/netcat.c --- source/regress/netcat.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/regress/netcat.c 2025-08-20 11:50:49.164126484 +0700 ++++ source-new/regress/netcat.c 2025-09-06 21:09:36.558438233 +0700 @@ -1384,7 +1384,9 @@ #include #include @@ -377,9 +488,87 @@ diff -ruwN source/regress/netcat.c source-new/regress/netcat.c #define SOCKS_PORT "1080" #define HTTP_PROXY_PORT "3128" +diff -ruwN source/servconf.c source-new/servconf.c +--- source/servconf.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/servconf.c 2025-09-06 21:10:09.947261502 +0700 +@@ -315,6 +315,7 @@ + _PATH_HOST_XMSS_KEY_FILE, 0); + #endif /* WITH_XMSS */ + } ++ + /* No certificates by default */ + if (options->num_ports == 0) + options->ports[options->num_ports++] = SSH_DEFAULT_PORT; +@@ -390,6 +391,7 @@ + options->permit_user_env = 0; + options->permit_user_env_allowlist = NULL; + } ++ + if (options->compression == -1) + #ifdef WITH_ZLIB + options->compression = COMP_DELAYED; +@@ -463,6 +465,7 @@ + &options->num_authkeys_files, + _PATH_SSH_USER_PERMITTED_KEYS2); + } ++ + if (options->permit_tun == -1) + options->permit_tun = SSH_TUNMODE_NO; + if (options->ip_qos_interactive == -1) +@@ -529,6 +532,7 @@ + + CLEAR_ON_NONE_ARRAY(channel_timeouts, num_channel_timeouts, "none"); + CLEAR_ON_NONE_ARRAY(auth_methods, num_auth_methods, "any"); ++ + #undef CLEAR_ON_NONE + #undef CLEAR_ON_NONE_ARRAY + } +@@ -857,7 +861,7 @@ + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; + snprintf(strport, sizeof strport, "%d", port); +- if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) ++ if ((gaierr = getaddrinfo("0.0.0.0", strport, &hints, &aitop)) != 0) + fatal("bad addr or host: %s (%s)", + addr ? addr : "", + ssh_gai_strerror(gaierr)); +diff -ruwN source/session.c source-new/session.c +--- source/session.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/session.c 2025-09-07 00:41:01.350663705 +0700 +@@ -1365,10 +1365,12 @@ + exit(1); + } + /* Initialize the group list. */ ++#ifndef __redox__ + if (initgroups(pw->pw_name, pw->pw_gid) < 0) { + perror("initgroups"); + exit(1); + } ++#endif + endgrent(); + #endif + +@@ -1490,7 +1492,7 @@ + * initgroups, because at least on Solaris 2.3 it leaves file + * descriptors open. + */ +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + } + + /* +@@ -1624,7 +1626,7 @@ + exit(1); + } + +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + + do_rc_files(ssh, s, shell); + diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c --- source/sshbuf-misc.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshbuf-misc.c 2025-08-20 11:51:17.444108963 +0700 ++++ source-new/sshbuf-misc.c 2025-09-06 21:09:36.559438198 +0700 @@ -28,7 +28,9 @@ #include #include @@ -390,9 +579,150 @@ diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c #include #include +diff -ruwN source/ssh.c source-new/ssh.c +--- source/ssh.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/ssh.c 2025-09-06 21:09:36.559438198 +0700 +@@ -689,7 +689,7 @@ + * Discard other fds that are hanging around. These can cause problem + * with backgrounded ssh processes started by ControlPersist. + */ +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + + __progname = ssh_get_progname(av[0]); + +diff -ruwN source/sshconnect2.c source-new/sshconnect2.c +--- source/sshconnect2.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/sshconnect2.c 2025-09-06 21:09:36.560438163 +0700 +@@ -2057,7 +2057,7 @@ + sock = STDERR_FILENO + 1; + if (fcntl(sock, F_SETFD, 0) == -1) /* keep the socket on exec */ + debug3_f("fcntl F_SETFD: %s", strerror(errno)); +- closefrom(sock + 1); ++ // closefrom(sock + 1); + + debug3_f("[child] pid=%ld, exec %s", + (long)getpid(), _PATH_SSH_KEY_SIGN); +diff -ruwN source/sshd.c source-new/sshd.c +--- source/sshd.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/sshd.c 2025-09-06 22:33:56.902184198 +0700 +@@ -1217,12 +1217,11 @@ + compat_init_setproctitle(ac, av); + av = saved_argv; + #endif +- + if (geteuid() == 0 && setgroups(0, NULL) == -1) + debug("setgroups(): %.200s", strerror(errno)); + + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ +- sanitise_stdfd(); ++ // sanitise_stdfd(); + + /* Initialize configuration options to their default values. */ + initialize_server_options(&options); +@@ -1342,9 +1341,9 @@ + } + } + if (!test_flag && !do_dump_cfg && !path_absolute(av[0])) +- fatal("sshd requires execution with an absolute path"); ++ fatal("sshd requires execution with an absolutez path"); + +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + + /* Reserve fds we'll need later for reexec things */ + if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) +@@ -1427,16 +1426,16 @@ + * daemonisation in the presence of Match blocks, but this catches + * and warns for trivial misconfigurations that could break login. + */ +- if (options.num_auth_methods != 0) { +- for (i = 0; i < options.num_auth_methods; i++) { +- if (auth2_methods_valid(options.auth_methods[i], +- 1) == 0) +- break; +- } +- if (i >= options.num_auth_methods) +- fatal("AuthenticationMethods cannot be satisfied by " +- "enabled authentication methods"); +- } ++ // if (options.num_auth_methods != 0) { ++ // for (i = 0; i < options.num_auth_methods; i++) { ++ // if (auth2_methods_valid(options.auth_methods[i], ++ // 1) == 0) ++ // break; ++ // } ++ // if (i >= options.num_auth_methods) ++ // fatal("AuthenticationMethods cannot be satisfied by " ++ // "enabled authentication methods"); ++ // } + + /* Check that there are no remaining arguments. */ + if (optind < ac) { +@@ -1482,13 +1481,13 @@ + options.host_key_files[i]); + key->sk_flags &= ~SSH_SK_USER_PRESENCE_REQD; + } +- if (r == 0 && key != NULL && +- (r = sshkey_shield_private(key)) != 0) { +- do_log2_r(r, ll, "Unable to shield host key \"%s\"", +- options.host_key_files[i]); +- sshkey_free(key); +- key = NULL; +- } ++ // if (r == 0 && key != NULL && ++ // (r = sshkey_shield_private(key)) != 0) { ++ // do_log2_r(r, ll, "Unable to shield host key \"%s\"", ++ // options.host_key_files[i]); ++ // sshkey_free(key); ++ // key = NULL; ++ // } + if ((r = sshkey_load_public(options.host_key_files[i], + &pubkey, NULL)) != 0 && r != SSH_ERR_SYSTEM_ERROR) + do_log2_r(r, ll, "Unable to load host key \"%s\"", +@@ -1600,8 +1599,7 @@ + } + + /* Ensure privsep directory is correctly configured. */ +- need_chroot = ((getuid() == 0 || geteuid() == 0) || +- options.kerberos_authentication); ++ need_chroot = 0;// ((getuid() == 0 || geteuid() == 0) || options.kerberos_authentication); + if ((getpwnam(SSH_PRIVSEP_USER)) == NULL && need_chroot) { + fatal("Privilege separation user %s does not exist", + SSH_PRIVSEP_USER); +@@ -1773,7 +1771,7 @@ + close(startup_pipe); + } + log_redirect_stderr_to(NULL); +- closefrom(REEXEC_MIN_FREE_FD); ++ // closefrom(REEXEC_MIN_FREE_FD); + + ssh_signal(SIGHUP, SIG_IGN); /* avoid reset to SIG_DFL */ + execv(rexec_argv[0], rexec_argv); +diff -ruwN source/sshd-session.c source-new/sshd-session.c +--- source/sshd-session.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/sshd-session.c 2025-09-06 21:15:43.796191268 +0700 +@@ -1031,7 +1031,7 @@ + if (!rexeced_flag) + fatal("sshd-session should not be executed directly"); + +- closefrom(REEXEC_MIN_FREE_FD); ++ // closefrom(REEXEC_MIN_FREE_FD); + + seed_rng(); + +@@ -1073,7 +1073,7 @@ + options.timing_secret = timing_secret; + + /* Store privilege separation user for later use if required. */ +- privsep_chroot = (getuid() == 0 || geteuid() == 0); ++ privsep_chroot = 0;// (getuid() == 0 || geteuid() == 0); + if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { + if (privsep_chroot || options.kerberos_authentication) + fatal("Privilege separation user %s does not exist", diff -ruwN source/sshkey.c source-new/sshkey.c --- source/sshkey.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshkey.c 2025-08-20 11:50:36.114133643 +0700 ++++ source-new/sshkey.c 2025-09-06 21:09:36.567437916 +0700 @@ -43,7 +43,9 @@ #include #include @@ -403,3 +733,69 @@ diff -ruwN source/sshkey.c source-new/sshkey.c #include #ifdef HAVE_UTIL_H #include +diff -ruwN source/ssh-sk-client.c source-new/ssh-sk-client.c +--- source/ssh-sk-client.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/ssh-sk-client.c 2025-09-06 21:09:36.569437846 +0700 +@@ -91,7 +91,7 @@ + } + close(pair[0]); + close(pair[1]); +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + debug_f("starting %s %s", helper, + verbosity == NULL ? "" : verbosity); + execlp(helper, helper, verbosity, (char *)NULL); +diff -ruwN source/ssh-sk-helper.c source-new/ssh-sk-helper.c +--- source/ssh-sk-helper.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/ssh-sk-helper.c 2025-09-06 21:09:36.570437810 +0700 +@@ -303,7 +303,7 @@ + * Rearrange our file descriptors a little; we don't trust the + * providers not to fiddle with stdin/out. + */ +- closefrom(STDERR_FILENO + 1); ++ // closefrom(STDERR_FILENO + 1); + if ((in = dup(STDIN_FILENO)) == -1 || (out = dup(STDOUT_FILENO)) == -1) + fatal("%s: dup: %s", __progname, strerror(errno)); + close(STDIN_FILENO); +diff -ruwN source/uidswap.c source-new/uidswap.c +--- source/uidswap.c 2024-07-01 11:36:28.000000000 +0700 ++++ source-new/uidswap.c 2025-09-07 00:01:52.531094834 +0700 +@@ -37,7 +37,7 @@ + * POSIX saved uids or not. + */ + +-#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS) ++#if !defined(BROKEN_SAVED_UIDS) + /* Lets assume that posix saved ids also work with seteuid, even though that + is not part of the posix specification. */ + #define SAVED_IDS_WORK_WITH_SETEUID +@@ -83,6 +83,9 @@ + privileged = 1; + temporarily_use_uid_effective = 1; + ++ // getgroups broken in redox ++#ifndef __redox__ ++ + saved_egroupslen = getgroups(0, NULL); + if (saved_egroupslen == -1) + fatal("getgroups: %.100s", strerror(errno)); +@@ -119,6 +122,7 @@ + /* Set the effective uid to the given (unprivileged) uid. */ + if (setgroups(user_groupslen, user_groups) == -1) + fatal("setgroups: %.100s", strerror(errno)); ++#endif + #ifndef SAVED_IDS_WORK_WITH_SETEUID + /* Propagate the privileged gid to all of our gids. */ + if (setgid(getegid()) == -1) +@@ -168,8 +172,11 @@ + fatal("%s: setgid failed: %s", __func__, strerror(errno)); + #endif /* SAVED_IDS_WORK_WITH_SETEUID */ + ++ // setgroups broken in redox ++#ifndef __redox__ + if (setgroups(saved_egroupslen, saved_egroups) == -1) + fatal("setgroups: %.100s", strerror(errno)); ++#endif + temporarily_use_uid_effective = 0; + } + From 1a5d7b16e9a4a48936f126d2a717d4398ecc862d Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Sat, 6 Sep 2025 18:43:27 +0000 Subject: [PATCH 51/52] Tidy up patches, move out /usr/etc in openSSH --- recipes/wip/ssh/openssh/recipe.toml | 13 ++- recipes/wip/ssh/openssh/redox.patch | 152 +++++----------------------- 2 files changed, 31 insertions(+), 134 deletions(-) diff --git a/recipes/wip/ssh/openssh/recipe.toml b/recipes/wip/ssh/openssh/recipe.toml index 85798b1df..0ce951ba5 100644 --- a/recipes/wip/ssh/openssh/recipe.toml +++ b/recipes/wip/ssh/openssh/recipe.toml @@ -22,17 +22,16 @@ COOKBOOK_CONFIGURE_FLAGS+=( cookbook_configure mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd rmdir "${COOKBOOK_STAGE}"/usr/sbin +mv "${COOKBOOK_STAGE}"/usr/etc "${COOKBOOK_STAGE}"/etc # Extracted from `make host-key-force` # TODO: Very insecure! but there's no postscript yet -ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_dsa_key -N "" -ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_rsa_key -N "" -ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_ed25519_key -N "" -ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/usr/etc/ssh_host_ecdsa_key -N "" +ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_dsa_key -N "" +ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_rsa_key -N "" +ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/etc/ssh_host_ed25519_key -N "" +ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_ecdsa_key -N "" -# The config can be found here, not /etc -CONFIG_FILE="${COOKBOOK_STAGE}"/usr/etc/sshd_config -sed -i "s/#LogLevel INFO/LogLevel DEBUG3/g" "${CONFIG_FILE}" +CONFIG_FILE="${COOKBOOK_STAGE}"/etc/sshd_config # ipv6 is not working yet sed -i "s/#AddressFamily any/AddressFamily inet/g" "${CONFIG_FILE}" diff --git a/recipes/wip/ssh/openssh/redox.patch b/recipes/wip/ssh/openssh/redox.patch index 153e9cda2..980b9ab37 100644 --- a/recipes/wip/ssh/openssh/redox.patch +++ b/recipes/wip/ssh/openssh/redox.patch @@ -14,7 +14,7 @@ diff -ruwN source/configure source-new/configure printf "%s\n" "#define NEED_SETPGRP 1" >>confdefs.h diff -ruwN source/defines.h source-new/defines.h --- source/defines.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/defines.h 2025-09-06 21:22:46.327552147 +0700 ++++ source-new/defines.h 2025-09-07 01:35:40.209700338 +0700 @@ -52,6 +52,18 @@ #define IPPORT_RESERVED 0 #endif @@ -63,11 +63,6 @@ diff -ruwN source/defines.h source-new/defines.h /* Define this to be the path of the xauth program. */ #ifdef XAUTH_PATH #define _PATH_XAUTH XAUTH_PATH -@@ -943,3 +957,4 @@ - # define USE_SNTRUP761X25519 1 - #endif - #endif /* _DEFINES_H */ -+ diff -ruwN source/hostfile.c source-new/hostfile.c --- source/hostfile.c 2024-07-01 11:36:28.000000000 +0700 +++ source-new/hostfile.c 2025-09-06 21:09:36.555438339 +0700 @@ -106,13 +101,12 @@ diff -ruwN source/loginrec.h source-new/loginrec.h diff -ruwN source/misc.c source-new/misc.c --- source/misc.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/misc.c 2025-09-06 21:09:36.556438304 +0700 -@@ -2843,7 +2843,7 @@ ++++ source-new/misc.c 2025-09-07 01:21:42.201992304 +0700 +@@ -2843,7 +2843,6 @@ error("%s: dup2: %s", tag, strerror(errno)); _exit(1); } - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); if (geteuid() == 0 && initgroups(pw->pw_name, pw->pw_gid) == -1) { @@ -430,48 +424,25 @@ diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h +#endif /* __redox__ */ +#endif /* _COMPAT_UTMPX_H */ \ No newline at end of file -diff -ruwN source/pathnames.h source-new/pathnames.h ---- source/pathnames.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/pathnames.h 2025-09-06 21:09:36.557438268 +0700 -@@ -12,7 +12,7 @@ - * called by a name other than "ssh" or "Secure Shell". - */ - --#define ETCDIR "/etc" -+#define ETCDIR "/usr/etc" - - #ifndef SSHDIR - #define SSHDIR ETCDIR "/ssh" -@@ -166,7 +166,7 @@ - - /* chroot directory for unprivileged user when UsePrivilegeSeparation=yes */ - #ifndef _PATH_PRIVSEP_CHROOT_DIR --#define _PATH_PRIVSEP_CHROOT_DIR "/var/empty" -+#define _PATH_PRIVSEP_CHROOT_DIR "/usr/var/empty" - #endif - - /* for passwd change */ diff -ruwN source/readconf.c source-new/readconf.c --- source/readconf.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/readconf.c 2025-09-06 21:09:36.558438233 +0700 -@@ -554,7 +554,7 @@ ++++ source-new/readconf.c 2025-09-07 01:21:42.201992304 +0700 +@@ -554,7 +554,6 @@ if (stdfd_devnull(1, 1, 0) == -1) fatal_f("stdfd_devnull failed"); - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); argv[0] = shell; argv[1] = "-c"; diff -ruwN source/readpass.c source-new/readpass.c --- source/readpass.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/readpass.c 2025-09-06 21:09:36.558438233 +0700 -@@ -278,7 +278,7 @@ ++++ source-new/readpass.c 2025-09-07 01:21:42.201992304 +0700 +@@ -278,7 +278,6 @@ if (pid == 0) { if (stdfd_devnull(1, 1, 0) == -1) fatal_f("stdfd_devnull failed"); - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); setenv("SSH_ASKPASS_PROMPT", "none", 1); /* hint to UI */ execlp(askpass, askpass, prompt, (char *)NULL); error_f("exec(%s): %s", askpass, strerror(errno)); @@ -490,51 +461,20 @@ diff -ruwN source/regress/netcat.c source-new/regress/netcat.c #define HTTP_PROXY_PORT "3128" diff -ruwN source/servconf.c source-new/servconf.c --- source/servconf.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/servconf.c 2025-09-06 21:10:09.947261502 +0700 -@@ -315,6 +315,7 @@ - _PATH_HOST_XMSS_KEY_FILE, 0); - #endif /* WITH_XMSS */ - } -+ - /* No certificates by default */ - if (options->num_ports == 0) - options->ports[options->num_ports++] = SSH_DEFAULT_PORT; -@@ -390,6 +391,7 @@ - options->permit_user_env = 0; - options->permit_user_env_allowlist = NULL; - } -+ - if (options->compression == -1) - #ifdef WITH_ZLIB - options->compression = COMP_DELAYED; -@@ -463,6 +465,7 @@ - &options->num_authkeys_files, - _PATH_SSH_USER_PERMITTED_KEYS2); - } -+ - if (options->permit_tun == -1) - options->permit_tun = SSH_TUNMODE_NO; - if (options->ip_qos_interactive == -1) -@@ -529,6 +532,7 @@ - - CLEAR_ON_NONE_ARRAY(channel_timeouts, num_channel_timeouts, "none"); - CLEAR_ON_NONE_ARRAY(auth_methods, num_auth_methods, "any"); -+ - #undef CLEAR_ON_NONE - #undef CLEAR_ON_NONE_ARRAY - } -@@ -857,7 +861,7 @@ ++++ source-new/servconf.c 2025-09-07 01:38:08.219942429 +0700 +@@ -857,7 +857,8 @@ hints.ai_socktype = SOCK_STREAM; hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; snprintf(strport, sizeof strport, "%d", port); - if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) ++ // redox don't accept addr == NULL yet + if ((gaierr = getaddrinfo("0.0.0.0", strport, &hints, &aitop)) != 0) fatal("bad addr or host: %s (%s)", addr ? addr : "", ssh_gai_strerror(gaierr)); diff -ruwN source/session.c source-new/session.c --- source/session.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/session.c 2025-09-07 00:41:01.350663705 +0700 ++++ source-new/session.c 2025-09-07 01:22:43.637928015 +0700 @@ -1365,10 +1365,12 @@ exit(1); } @@ -548,21 +488,19 @@ diff -ruwN source/session.c source-new/session.c endgrent(); #endif -@@ -1490,7 +1492,7 @@ +@@ -1490,7 +1492,6 @@ * initgroups, because at least on Solaris 2.3 it leaves file * descriptors open. */ - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); } /* -@@ -1624,7 +1626,7 @@ +@@ -1624,7 +1625,6 @@ exit(1); } - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); do_rc_files(ssh, s, shell); @@ -581,37 +519,30 @@ diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c diff -ruwN source/ssh.c source-new/ssh.c --- source/ssh.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh.c 2025-09-06 21:09:36.559438198 +0700 -@@ -689,7 +689,7 @@ ++++ source-new/ssh.c 2025-09-07 01:22:43.638928030 +0700 +@@ -689,7 +689,6 @@ * Discard other fds that are hanging around. These can cause problem * with backgrounded ssh processes started by ControlPersist. */ - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); __progname = ssh_get_progname(av[0]); diff -ruwN source/sshconnect2.c source-new/sshconnect2.c --- source/sshconnect2.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshconnect2.c 2025-09-06 21:09:36.560438163 +0700 -@@ -2057,7 +2057,7 @@ ++++ source-new/sshconnect2.c 2025-09-07 01:22:58.683157171 +0700 +@@ -2057,7 +2057,6 @@ sock = STDERR_FILENO + 1; if (fcntl(sock, F_SETFD, 0) == -1) /* keep the socket on exec */ debug3_f("fcntl F_SETFD: %s", strerror(errno)); - closefrom(sock + 1); -+ // closefrom(sock + 1); debug3_f("[child] pid=%ld, exec %s", (long)getpid(), _PATH_SSH_KEY_SIGN); diff -ruwN source/sshd.c source-new/sshd.c --- source/sshd.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshd.c 2025-09-06 22:33:56.902184198 +0700 -@@ -1217,12 +1217,11 @@ - compat_init_setproctitle(ac, av); - av = saved_argv; - #endif -- - if (geteuid() == 0 && setgroups(0, NULL) == -1) ++++ source-new/sshd.c 2025-09-07 01:39:34.681252169 +0700 +@@ -1222,7 +1222,7 @@ debug("setgroups(): %.200s", strerror(errno)); /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ @@ -620,45 +551,14 @@ diff -ruwN source/sshd.c source-new/sshd.c /* Initialize configuration options to their default values. */ initialize_server_options(&options); -@@ -1342,9 +1341,9 @@ - } - } +@@ -1344,7 +1344,6 @@ if (!test_flag && !do_dump_cfg && !path_absolute(av[0])) -- fatal("sshd requires execution with an absolute path"); -+ fatal("sshd requires execution with an absolutez path"); + fatal("sshd requires execution with an absolute path"); - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); /* Reserve fds we'll need later for reexec things */ if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) -@@ -1427,16 +1426,16 @@ - * daemonisation in the presence of Match blocks, but this catches - * and warns for trivial misconfigurations that could break login. - */ -- if (options.num_auth_methods != 0) { -- for (i = 0; i < options.num_auth_methods; i++) { -- if (auth2_methods_valid(options.auth_methods[i], -- 1) == 0) -- break; -- } -- if (i >= options.num_auth_methods) -- fatal("AuthenticationMethods cannot be satisfied by " -- "enabled authentication methods"); -- } -+ // if (options.num_auth_methods != 0) { -+ // for (i = 0; i < options.num_auth_methods; i++) { -+ // if (auth2_methods_valid(options.auth_methods[i], -+ // 1) == 0) -+ // break; -+ // } -+ // if (i >= options.num_auth_methods) -+ // fatal("AuthenticationMethods cannot be satisfied by " -+ // "enabled authentication methods"); -+ // } - - /* Check that there are no remaining arguments. */ - if (optind < ac) { @@ -1482,13 +1481,13 @@ options.host_key_files[i]); key->sk_flags &= ~SSH_SK_USER_PRESENCE_REQD; @@ -735,25 +635,23 @@ diff -ruwN source/sshkey.c source-new/sshkey.c #include diff -ruwN source/ssh-sk-client.c source-new/ssh-sk-client.c --- source/ssh-sk-client.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh-sk-client.c 2025-09-06 21:09:36.569437846 +0700 -@@ -91,7 +91,7 @@ ++++ source-new/ssh-sk-client.c 2025-09-07 01:21:42.201992304 +0700 +@@ -91,7 +91,6 @@ } close(pair[0]); close(pair[1]); - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); debug_f("starting %s %s", helper, verbosity == NULL ? "" : verbosity); execlp(helper, helper, verbosity, (char *)NULL); diff -ruwN source/ssh-sk-helper.c source-new/ssh-sk-helper.c --- source/ssh-sk-helper.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh-sk-helper.c 2025-09-06 21:09:36.570437810 +0700 -@@ -303,7 +303,7 @@ ++++ source-new/ssh-sk-helper.c 2025-09-07 01:22:43.638928030 +0700 +@@ -303,7 +303,6 @@ * Rearrange our file descriptors a little; we don't trust the * providers not to fiddle with stdin/out. */ - closefrom(STDERR_FILENO + 1); -+ // closefrom(STDERR_FILENO + 1); if ((in = dup(STDIN_FILENO)) == -1 || (out = dup(STDOUT_FILENO)) == -1) fatal("%s: dup: %s", __progname, strerror(errno)); close(STDIN_FILENO); From 9061f2b2b2ff1baabe1f801fe7c5b7aa3cb31506 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Sun, 7 Sep 2025 14:23:00 +0000 Subject: [PATCH 52/52] Use sysconfdir, move config to /etc/ssh --- recipes/wip/ssh/openssh/recipe.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/wip/ssh/openssh/recipe.toml b/recipes/wip/ssh/openssh/recipe.toml index 0ce951ba5..44343a58c 100644 --- a/recipes/wip/ssh/openssh/recipe.toml +++ b/recipes/wip/ssh/openssh/recipe.toml @@ -18,20 +18,20 @@ COOKBOOK_CONFIGURE_FLAGS+=( --disable-strip # requires openssl 1.1.1, result in libcrypto error otherwise --without-openssl + --sysconfdir=/etc/ssh ) cookbook_configure mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd rmdir "${COOKBOOK_STAGE}"/usr/sbin -mv "${COOKBOOK_STAGE}"/usr/etc "${COOKBOOK_STAGE}"/etc # Extracted from `make host-key-force` # TODO: Very insecure! but there's no postscript yet -ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_dsa_key -N "" -ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_rsa_key -N "" -ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/etc/ssh_host_ed25519_key -N "" -ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/etc/ssh_host_ecdsa_key -N "" +ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_dsa_key -N "" +ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_rsa_key -N "" +ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_ed25519_key -N "" +ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_ecdsa_key -N "" -CONFIG_FILE="${COOKBOOK_STAGE}"/etc/sshd_config +CONFIG_FILE="${COOKBOOK_STAGE}"/etc/ssh/sshd_config # ipv6 is not working yet sed -i "s/#AddressFamily any/AddressFamily inet/g" "${CONFIG_FILE}"