diff --git a/clean.sh b/clean.sh index e26dba32a..6f7d0b0fd 100755 --- a/clean.sh +++ b/clean.sh @@ -5,14 +5,14 @@ source config.sh if [ $# = 0 ] then - recipes="$(target/release/list_recipes --short)" + recipes="$(list_recipes --short)" else recipes="$@" fi for recipe_name in $recipes do - recipe_path=`target/release/find_recipe $recipe_name` + recipe_path=`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/config.sh b/config.sh index 71131eb89..c3eccb17d 100755 --- a/config.sh +++ b/config.sh @@ -6,6 +6,11 @@ if [ -z "${TARGET}" ] then export TARGET=x86_64-unknown-redox fi +if [ $(uname -s) = 'Redox' ] +then + export IS_REDOX="1" +fi + ARCH="${TARGET%%-*}" HOST="$TARGET" if [ x"${HOST}" == x"riscv64gc-unknown-redox" ] ; then @@ -14,7 +19,6 @@ fi # Automatic variables ROOT="$(cd `dirname "$0"` && pwd)" -export PATH="${ROOT}/bin:$PATH" export AR="${HOST}-gcc-ar" export AS="${HOST}-as" @@ -48,9 +52,21 @@ fi export FIND -if [ ! "$(uname -s)" = "Redox" ] +if [ -z "${IS_REDOX}" ] then function pkgar { "$ROOT/pkgar/target/release/pkgar" "$@" } +function cook { + "$ROOT/target/release/cook" "$@" +} +function repo_builder { + "$ROOT/target/release/repo_builder" "$@" +} +function list_recipes { + "$ROOT/target/release/list_recipes" "$@" +} +function find_recipe { + "$ROOT/target/release/find_recipe" "$@" +} fi diff --git a/fetch.sh b/fetch.sh index 2a1e87a99..73da2648a 100755 --- a/fetch.sh +++ b/fetch.sh @@ -3,4 +3,4 @@ set -e source config.sh -target/release/cook --fetch-only ${@:1} +cook --fetch-only ${@:1} diff --git a/recipes/core/uutils/recipe.toml b/recipes/core/uutils/recipe.toml index 56fcb14df..2f2d85737 100644 --- a/recipes/core/uutils/recipe.toml +++ b/recipes/core/uutils/recipe.toml @@ -41,6 +41,7 @@ BINS=( hashsum head join + install link ln ls diff --git a/recipes/dev/gcc13/recipe.toml b/recipes/dev/gcc13/recipe.toml index 38dde656d..6b61540bd 100644 --- a/recipes/dev/gcc13/recipe.toml +++ b/recipes/dev/gcc13/recipe.toml @@ -21,12 +21,8 @@ mkdir -p "${COOKBOOK_SYSROOT}/usr" ln -sf "${COOKBOOK_SYSROOT}/include" "${COOKBOOK_SYSROOT}/usr/include" ln -sf "${COOKBOOK_SYSROOT}/lib" "${COOKBOOK_SYSROOT}/usr/lib" -COOKBOOK_CONFIGURE_FLAGS=( - --host="${GNU_TARGET}" +COOKBOOK_CONFIGURE_FLAGS+=( --target="${GNU_TARGET}" - --prefix=/ - --enable-shared - --disable-static --with-sysroot=/ --with-build-sysroot="${COOKBOOK_SYSROOT}" --enable-languages=c,c++,lto @@ -40,9 +36,12 @@ COOKBOOK_CONFIGURE_FLAGS=( "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-gcc all-target-libgcc all-target-libstdc++-v3 "${COOKBOOK_MAKE}" install-gcc install-target-libgcc install-target-libstdc++-v3 DESTDIR="${COOKBOOK_STAGE}" -ln -s "gcc" "${COOKBOOK_STAGE}/bin/cc" -mkdir -p "${COOKBOOK_STAGE}/usr/libexec" -ln -s "/libexec/gcc" "${COOKBOOK_STAGE}/usr/libexec/gcc" +ln -s "gcc" "${COOKBOOK_STAGE}/usr/bin/cc" # Avoid conflict with libgcc & libstdcxx -rm -f "${COOKBOOK_STAGE}"/lib/libgcc_s.so* "${COOKBOOK_STAGE}"/lib/libstdc++.so* +rm -f "${COOKBOOK_STAGE}"/usr/lib/libgcc_s.so* "${COOKBOOK_STAGE}"/usr/lib/libstdc++.so* """ + +[package] +dependencies = [ + "gnu-binutils" +] diff --git a/recipes/libs/libarchive/recipe.toml b/recipes/libs/libarchive/recipe.toml index b5686e0ba..033f271ee 100644 --- a/recipes/libs/libarchive/recipe.toml +++ b/recipes/libs/libarchive/recipe.toml @@ -1,6 +1,9 @@ [source] tar = "https://libarchive.org/downloads/libarchive-3.6.2.tar.xz" blake3 = "f98695fe81235a74fa3fc2c3ba0f0d4f13ea15f9be3850b83e304cf5d78be710" +patches = [ + "redox.patch" +] [build] template = "configure" diff --git a/recipes/libs/libarchive/redox.patch b/recipes/libs/libarchive/redox.patch new file mode 100644 index 000000000..de545f297 --- /dev/null +++ b/recipes/libs/libarchive/redox.patch @@ -0,0 +1,13 @@ +diff -ruwN source/configure source-new/configure +--- source/configure 2022-12-09 20:38:47.000000000 +0700 ++++ source-new/configure 2025-09-14 17:17:50.138530195 +0700 +@@ -19039,7 +19039,8 @@ + ac_fn_c_check_func "$LINENO" "fstatat" "ac_cv_func_fstatat" + if test "x$ac_cv_func_fstatat" = xyes + then : +- printf "%s\n" "#define HAVE_FSTATAT 1" >>confdefs.h ++# When fstatat works, remove this patch ++# printf "%s\n" "#define HAVE_FSTATAT 1" >>confdefs.h + + fi + ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" diff --git a/recipes/other/cookbook/recipe.toml b/recipes/other/cookbook/recipe.toml new file mode 100644 index 000000000..9b24639a5 --- /dev/null +++ b/recipes/other/cookbook/recipe.toml @@ -0,0 +1,28 @@ +[source] +git = "https://gitlab.redox-os.org/redox-os/cookbook.git" + +[build] +template = "custom" +script = """ +cookbook_cargo + +mkdir -pv "${COOKBOOK_STAGE}/home/user/cookbook" +cp -rv "${COOKBOOK_SOURCE}"/* "${COOKBOOK_STAGE}/home/user/cookbook" +""" + +[package] +dependencies = [ + # TODO: When rust working, use this + # "dev-essential", + "autoconf", + "automake", + "gcc13", + "git", + "gnu-make", + "libtool", + "patch", + "pkg-config", + "pkgar", + "sed", + "wget", +] diff --git a/recipes/wip/dev/lang/php/recipe.toml b/recipes/wip/dev/lang/php/recipe.toml deleted file mode 100644 index b82e6f59b..000000000 --- a/recipes/wip/dev/lang/php/recipe.toml +++ /dev/null @@ -1,11 +0,0 @@ -#TODO can't detect libiconv -# in case of problems, read https://www.php.net/manual/en/install.unix.php -[source] -tar = "https://www.php.net/distributions/php-8.3.0.tar.xz" -[build] -template = "configure" -dependencies = [ - "libxml2", - "sqlite3", - "libiconv", -] diff --git a/recipes/wip/dev/lang/php84/recipe.toml b/recipes/wip/dev/lang/php84/recipe.toml new file mode 100644 index 000000000..c004b5ef2 --- /dev/null +++ b/recipes/wip/dev/lang/php84/recipe.toml @@ -0,0 +1,60 @@ +#TODO fix readline and openssl +[source] +tar = "https://www.php.net/distributions/php-8.4.12.tar.xz" +patches = [ + "redox.patch" +] + +[build] +template = "custom" +dependencies = [ + "curl", + "libffi", + "libgmp", + "libavif", + "libjpeg", +# "libedit", + "libonig", + "libpng", + "libwebp", + "libxml2", + "libzip", +# "ncurses", + "nghttp2", + "openssl1", + "pcre", +# "readline", + "sqlite3", + "xz", + "zlib", +] +script = """ +DYNAMIC_INIT +# extension stuff +export CURL_LIBS="-lcurl -lnghttp2 -lssl -lcrypto" +#export READLINE_DIR="${COOKBOOK_SYSROOT}/usr" +COOKBOOK_CONFIGURE_FLAGS+=( + --without-iconv + --disable-phar + --disable-opcache + --enable-gd + --with-curl + --with-gmp + --with-jpeg + --with-webp + --with-avif + --with-ffi + --with-intl + --with-mbstring +# --with-libedit +# --with-readline +# --with-openssl + --with-zip +) + +"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "$@" +"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" +"${COOKBOOK_MAKE}" install \ + INSTALL_ROOT="${COOKBOOK_STAGE}" \ + datarootdir=/usr/share localstatedir=/var +""" diff --git a/recipes/wip/dev/lang/php84/redox.patch b/recipes/wip/dev/lang/php84/redox.patch new file mode 100644 index 000000000..eed8d1169 --- /dev/null +++ b/recipes/wip/dev/lang/php84/redox.patch @@ -0,0 +1,42 @@ +diff --color -ruwN source/configure source-new/configure +--- source/configure 2025-08-26 20:36:28.000000000 +0700 ++++ source-new/configure 2025-09-16 07:44:46.452670941 +0700 +@@ -25863,7 +25863,7 @@ + then : + ac_cv_lib_curl_curl_easy_perform=yes + else case e in #( +- e) ac_cv_lib_curl_curl_easy_perform=no ;; ++ e) ac_cv_lib_curl_curl_easy_perform=yes ;; + esac + fi + rm -f core conftest.err conftest.$ac_objext conftest.beam \ +@@ -37356,7 +37356,7 @@ + then : + php_cv_lib_gd_works=yes + else case e in #( +- e) php_cv_lib_gd_works=no ;; ++ e) php_cv_lib_gd_works=yes ;; + esac + fi + rm -f core conftest.err conftest.$ac_objext conftest.beam \ +@@ -40056,7 +40056,7 @@ + LIBS_SAVED=$LIBS + CFLAGS="$CFLAGS $GMP_CFLAGS" + LIBS="$LIBS $GMP_LIBS" +- gmp_check=no ++ gmp_check=yes + ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" + if test "x$ac_cv_header_gmp_h" = xyes + then : +diff --color -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c +--- source/ext/posix/posix.c 2025-08-26 20:36:28.000000000 +0700 ++++ source-new/ext/posix/posix.c 2025-09-16 07:02:03.974662569 +0700 +@@ -375,7 +375,7 @@ + + ZEND_PARSE_PARAMETERS_NONE(); + +- if ((ticks = times(&t)) == -1) { ++ { + POSIX_G(last_error) = errno; + RETURN_FALSE; + } diff --git a/recipes/wip/dev/other/valkey/recipe.toml b/recipes/wip/dev/other/valkey/recipe.toml index ec17f5dea..30c251925 100644 --- a/recipes/wip/dev/other/valkey/recipe.toml +++ b/recipes/wip/dev/other/valkey/recipe.toml @@ -1,6 +1,19 @@ -#TODO Missing script for "make", see https://github.com/valkey-io/valkey#building-valkey +#TODO Compiling, server crashes in page fault [source] git = "https://github.com/valkey-io/valkey" -rev = "26388270f197bce84817eea0a73d687d58442654" +rev = "a47e8fa1505578d78cef5c5e11da0972c3dae560" # 8.1.3 + [build] template = "custom" +dependencies = [ + "openssl1" +] + +script = """ +rsync -av --delete "${COOKBOOK_SOURCE}"/* ./ +${COOKBOOK_MAKE} MALLOC=libc BUILD_TLS=yes \ + WARN="-Wall -W -Wno-missing-field-initializers" \ + WARNINGS="-Wall -W -Wno-missing-field-initializers" \ + AR="${TARGET}-gcc-ar" +${COOKBOOK_MAKE} install PREFIX="${COOKBOOK_STAGE}"/usr +""" diff --git a/recipes/wip/dev/wasm/wasmtime/recipe.toml b/recipes/wip/dev/wasm/wasmtime/recipe.toml index a8f9539cb..ed1295bb5 100644 --- a/recipes/wip/dev/wasm/wasmtime/recipe.toml +++ b/recipes/wip/dev/wasm/wasmtime/recipe.toml @@ -1,5 +1,9 @@ -#TODO fs-set-times crate error +#TODO requires *at functions in fcntl.h +#TODO (willnode) push changes upstream [source] -git = "https://github.com/bytecodealliance/wasmtime" +git = "https://github.com/willnode/wasmtime" +branch = "v36-redox" +shallow_clone = true + [build] template = "cargo" diff --git a/recipes/wip/edu/bibiman/recipe.toml b/recipes/wip/edu/bibiman/recipe.toml new file mode 100644 index 000000000..29cbe8f55 --- /dev/null +++ b/recipes/wip/edu/bibiman/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://codeberg.org/lukeflo/bibiman" +[build] +template = "cargo" diff --git a/recipes/wip/games/space/outfly/recipe.toml b/recipes/wip/games/space/outfly/recipe.toml new file mode 100644 index 000000000..a5bd5537d --- /dev/null +++ b/recipes/wip/games/space/outfly/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://codeberg.org/outfly/outfly" +[build] +template = "cargo" diff --git a/recipes/wip/libs/archives/libzip/recipe.toml b/recipes/wip/libs/archives/libzip/recipe.toml index afe9a840e..4e7ec064a 100644 --- a/recipes/wip/libs/archives/libzip/recipe.toml +++ b/recipes/wip/libs/archives/libzip/recipe.toml @@ -1,23 +1,8 @@ -#TODO maybe incomplete script, see https://github.com/nih-at/libzip/blob/main/INSTALL.md +#TODO Promote [source] tar = "https://libzip.org/download/libzip-1.10.1.tar.gz" [build] -template = "custom" +template = "cmake" dependencies = [ "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 -""" diff --git a/recipes/wip/libs/other/libonig/recipe.toml b/recipes/wip/libs/other/libonig/recipe.toml new file mode 100644 index 000000000..9633af050 --- /dev/null +++ b/recipes/wip/libs/other/libonig/recipe.toml @@ -0,0 +1,9 @@ +[source] +git = "https://github.com/kkos/oniguruma" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + +[build] +template = "configure" diff --git a/recipes/wip/libs/other/libtool/recipe.toml b/recipes/wip/libs/other/libtool/recipe.toml index 9086e63ca..4788b7a54 100644 --- a/recipes/wip/libs/other/libtool/recipe.toml +++ b/recipes/wip/libs/other/libtool/recipe.toml @@ -1,5 +1,14 @@ -#TODO finish libtool setup +#TODO can build, not tested [source] -tar = "https://ftpmirror.gnu.org/libtool/libtool-2.5.4.tar.gz" +git = "https://gitlab.redox-os.org/redox-os/libtool" +branch = "v2.5.4-redox" +shallow_clone = true +script = """ +./bootstrap \ + --skip-po \ + --force \ + --gnulib-srcdir=./gnulib +""" + [build] template = "configure" diff --git a/recipes/wip/net/analysis/rkik/recipe.toml b/recipes/wip/net/analysis/rkik/recipe.toml new file mode 100644 index 000000000..c571577a1 --- /dev/null +++ b/recipes/wip/net/analysis/rkik/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/aguacero7/rkik" +[build] +template = "cargo" diff --git a/recipes/wip/net/http/nginx/recipe.toml b/recipes/wip/net/http/nginx/recipe.toml index 26da4eeeb..da416dcae 100644 --- a/recipes/wip/net/http/nginx/recipe.toml +++ b/recipes/wip/net/http/nginx/recipe.toml @@ -1,5 +1,60 @@ -#TODO Compilation error +#TODO Compiling, got some C issues on init [source] -tar = "https://nginx.org/download/nginx-1.26.0.tar.gz" +tar = "https://nginx.org/download/nginx-1.28.0.tar.gz" +patches = [ + "redox.patch" +] + [build] -template = "configure" +template = "custom" +dependencies = [ + "pcre", + "openssl1", + "zlib", +] +script = """ +DYNAMIC_INIT +rsync -av --delete "${COOKBOOK_SOURCE}"/* ./ +ARCH="${TARGET%%-*}" +COOKBOOK_CONFIGURE_FLAGS=( + --crossbuild=Redox:$ARCH + --with-cc="$CC" + --with-cc-opt="$CFLAGS" + --with-ld-opt="$LDFLAGS" + --sbin-path=/usr/bin/nginx + --modules-path=/usr/lib/nginx/modules + --conf-path=/etc/nginx/nginx.conf + --error-log-path=/var/log/nginx/error.log + --http-log-path=/var/log/nginx/access.log + --http-client-body-temp-path=/var/lib/nginx/body + --http-proxy-temp-path=/var/lib/nginx/proxy + --http-fastcgi-temp-path=/var/lib/nginx/fastcgi + --http-uwsgi-temp-path=/var/lib/nginx/uwsgi + --http-scgi-temp-path=/var/lib/nginx/scgi + --pid-path=/var/run/nginx.pid + --lock-path=/var/lock/nginx.lock + --user=nginx + --group=nginx + --with-compat + --with-debug + --with-pcre + --with-pcre-jit + --with-stream + --with-stream_realip_module + --with-stream_ssl_module + --with-stream_ssl_preread_module + --with-threads + --with-http_ssl_module + --with-http_v2_module + --with-http_realip_module + --with-http_gzip_static_module + --with-http_stub_status_module + --with-http_addition_module +) + +unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP + +cookbook_configure + +mkdir -p "$COOKBOOK_STAGE"/var/lib/nginx/{body,proxy,fastcgi,uwsgi,scgi} +""" diff --git a/recipes/wip/net/http/nginx/redox.patch b/recipes/wip/net/http/nginx/redox.patch new file mode 100644 index 000000000..df14d2f4b --- /dev/null +++ b/recipes/wip/net/http/nginx/redox.patch @@ -0,0 +1,68 @@ +diff --color -ruwN source/auto/feature source-new/auto/feature +--- source/auto/feature 2025-04-23 18:48:54.000000000 +0700 ++++ source-new/auto/feature 2025-09-16 02:23:35.565899342 +0700 +@@ -53,7 +57,7 @@ + + yes) + # /bin/sh is used to intercept "Killed" or "Abort trap" messages +- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then ++ #if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then + echo " found" + ngx_found=yes + +@@ -61,9 +65,9 @@ + have=$ngx_have_feature . auto/have + fi + +- else +- echo " found but is not working" +- fi ++ #else ++ # echo " found but is not working" ++ #fi + ;; + + value) +diff --color -ruwN source/auto/types/sizeof source-new/auto/types/sizeof +--- source/auto/types/sizeof 2025-04-23 18:48:54.000000000 +0700 ++++ source-new/auto/types/sizeof 2025-09-16 02:38:57.979145501 +0700 +@@ -33,7 +33,7 @@ + END + + +-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ ++ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS \ + -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" + + eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" +diff --color -ruwN source/auto/types/typedef source-new/auto/types/typedef +--- source/auto/types/typedef 2025-04-23 18:48:54.000000000 +0700 ++++ source-new/auto/types/typedef 2025-09-16 02:38:54.927091443 +0700 +@@ -34,7 +34,7 @@ + + END + +- ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ ++ ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS \ + -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" + + eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" +diff --color -ruwN source/src/os/unix/ngx_process.c source-new/src/os/unix/ngx_process.c +--- source/src/os/unix/ngx_process.c 2025-04-23 18:48:54.000000000 +0700 ++++ source-new/src/os/unix/ngx_process.c 2025-09-16 02:40:44.363029726 +0700 +@@ -143,6 +143,7 @@ + } + + on = 1; ++ /* + if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, + "ioctl(FIOASYNC) failed while spawning \"%s\"", name); +@@ -156,6 +157,7 @@ + ngx_close_channel(ngx_processes[s].channel, cycle->log); + return NGX_INVALID_PID; + } ++ */ + + if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, diff --git a/recipes/wip/net/monitor/rustnet/recipe.toml b/recipes/wip/net/monitor/rustnet/recipe.toml new file mode 100644 index 000000000..6ab852ff7 --- /dev/null +++ b/recipes/wip/net/monitor/rustnet/recipe.toml @@ -0,0 +1,8 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/domcyrus/rustnet" +[build] +template = "cargo" +dependencies = [ + "libpcap", +] diff --git a/recipes/wip/net/remote/ssh-portfolio/recipe.toml b/recipes/wip/net/remote/ssh-portfolio/recipe.toml new file mode 100644 index 000000000..5babdd7c3 --- /dev/null +++ b/recipes/wip/net/remote/ssh-portfolio/recipe.toml @@ -0,0 +1,6 @@ +#TODO not compiled or tested +# require nerdfonts +[source] +git = "https://github.com/CompeyDev/ssh-portfolio" +[build] +template = "cargo" diff --git a/recipes/wip/players/recordbox/recipe.toml b/recipes/wip/players/recordbox/recipe.toml new file mode 100644 index 000000000..4cb5b8a85 --- /dev/null +++ b/recipes/wip/players/recordbox/recipe.toml @@ -0,0 +1,14 @@ +#TODO missing dependencies +[source] +git = "https://codeberg.org/edestcroix/Recordbox" +[build] +template = "custom" +dependencies = [ + "sqlite3", + "gtk4", + "glib", + "libadwaita", + "liblcms", + "gstreamer", +] +script = "DYNAMIC_INIT cookbook_cargo" diff --git a/recipes/wip/shells/fish-shell/recipe.toml b/recipes/wip/shells/fish-shell/recipe.toml index 34e55922c..4ef60fe76 100644 --- a/recipes/wip/shells/fish-shell/recipe.toml +++ b/recipes/wip/shells/fish-shell/recipe.toml @@ -1,27 +1,17 @@ -#TODO not compiled or tested +# WIP: Builds, runs, but hangs on waitpid + [source] git = "https://github.com/fish-shell/fish-shell" +rev = "54e8ad7e90a8213c01ba58de0640223bee6846d6" +patches = ["redox.patch"] + [build] template = "custom" -dependencies = [ - "ncurses", - "gettext", - "pcre", -] +dependencies = ["gettext", "ncurses", "pcre"] script = """ -export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include/ncurses" -cookbook_cargo -#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 + +# The only default enabled feature is building the man pages. +# However, that requires sphinx so it can just be enabled later. +cookbook_cargo --no-default-features """ diff --git a/recipes/wip/shells/fish-shell/redox.patch b/recipes/wip/shells/fish-shell/redox.patch new file mode 100644 index 000000000..9b5a0d30d --- /dev/null +++ b/recipes/wip/shells/fish-shell/redox.patch @@ -0,0 +1,144 @@ +diff '--color=auto' -ruwN source/Cargo.toml source-new/Cargo.toml +--- source/Cargo.toml 2025-09-11 01:59:14.785564526 -0400 ++++ source-new/Cargo.toml 2025-09-11 01:59:45.885553436 -0400 +@@ -35,12 +35,12 @@ + + bitflags = "2.5.0" + errno = "0.3.0" +-libc = "0.2" ++libc = { git = "https://github.com/rust-lang/libc", rev = "b31ee9b22f99354f2ca00c68d038d6f377c8b8a4", features = ["extra_traits"] } + # lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo. + # disabling default features uses the stdlib instead, but it doubles the time to rewrite the history + # files as of 22 April 2024. + lru = "0.13.0" +-nix = { version = "0.30.1", default-features = false, features = [ ++nix = { git = "https://github.com/joshuamegnauth54/nix", branch = "redox-fish-no-merge", default-features = false, features = [ + "event", + "inotify", + "resource", +diff '--color=auto' -ruwN source/src/exec.rs source-new/src/exec.rs +--- source/src/exec.rs 2025-09-11 01:59:14.596625190 -0400 ++++ source-new/src/exec.rs 2025-09-11 02:00:00.315286369 -0400 +@@ -33,7 +33,6 @@ + use crate::nix::{getpid, isatty}; + use crate::null_terminated_array::OwningNullTerminatedArray; + use crate::parser::{Block, BlockId, BlockType, EvalRes, Parser}; +-#[cfg(FISH_USE_POSIX_SPAWN)] + use crate::proc::Pid; + use crate::proc::{ + hup_jobs, is_interactive_session, jobs_requiring_warning_on_exit, no_exec, +@@ -390,7 +389,7 @@ + ) -> ! { + // This function never returns, so we take certain liberties with constness. + +- unsafe { libc::execve(actual_cmd.as_ptr(), argv.get(), envv.get()) }; ++ unsafe { libc::execve(actual_cmd.as_ptr(), argv.get().cast(), envv.get().cast()) }; + let err = errno(); + + // The shebang wasn't introduced until UNIX Seventh Edition, so if +@@ -413,7 +412,11 @@ + // not what we would pass as argv0. + argv2[1] = actual_cmd.as_ptr(); + unsafe { +- libc::execve(_PATH_BSHELL.load(Ordering::Relaxed), &argv2[0], envv.get()); ++ libc::execve( ++ _PATH_BSHELL.load(Ordering::Relaxed), ++ argv2.as_ptr().cast(), ++ envv.get().cast(), ++ ); + } + } + } +diff '--color=auto' -ruwN source/src/fork_exec/postfork.rs source-new/src/fork_exec/postfork.rs +--- source/src/fork_exec/postfork.rs 2025-09-11 01:59:14.828576001 -0400 ++++ source-new/src/fork_exec/postfork.rs 2025-09-11 02:00:00.319001235 -0400 +@@ -339,7 +339,9 @@ + "', which is not an executable command." + ); + } +- } else if md.unwrap().mode() & u32::from(libc::S_IFMT) == u32::from(libc::S_IFDIR) { ++ } else if md.unwrap().mode() & u32::try_from(libc::S_IFMT).unwrap() ++ == u32::try_from(libc::S_IFDIR).unwrap() ++ { + FLOG_SAFE!( + exec, + "Failed to execute process '", +diff '--color=auto' -ruwN source/src/input_common.rs source-new/src/input_common.rs +--- source/src/input_common.rs 2025-09-11 01:59:14.828576001 -0400 ++++ source-new/src/input_common.rs 2025-09-11 02:00:00.316042380 -0400 +@@ -589,7 +589,9 @@ + // pselect expects timeouts in nanoseconds. + const NSEC_PER_MSEC: u64 = 1000 * 1000; + const NSEC_PER_SEC: u64 = NSEC_PER_MSEC * 1000; ++ #[cfg(not(target_os = "redox"))] + let wait_nsec: u64 = (timeout.as_millis() as u64) * NSEC_PER_MSEC; ++ #[cfg(not(target_os = "redox"))] + let timeout = libc::timespec { + tv_sec: (wait_nsec / NSEC_PER_SEC).try_into().unwrap(), + tv_nsec: (wait_nsec % NSEC_PER_SEC).try_into().unwrap(), +@@ -605,6 +607,7 @@ + libc::FD_SET(in_fd, &mut fdset); + } + ++ #[cfg(not(target_os = "redox"))] + let res = unsafe { + libc::pselect( + in_fd + 1, +@@ -616,6 +619,31 @@ + ) + }; + ++ #[cfg(target_os = "redox")] ++ let res = unsafe { ++ //HACK: pselect does this atomically ++ let mut saved = MaybeUninit::uninit(); ++ let mut saved = { ++ libc::sigfillset(saved.as_mut_ptr()); ++ saved.assume_init() ++ }; ++ libc::sigprocmask(libc::SIG_SETMASK, &sigs, &mut saved); ++ let mut timeout = libc::timeval { ++ tv_sec: timeout.as_secs() as _, ++ tv_usec: timeout.subsec_micros() as _, ++ }; ++ let res = libc::select( ++ in_fd + 1, ++ &mut fdset, ++ ptr::null_mut(), ++ ptr::null_mut(), ++ &raw mut timeout, ++ ); ++ libc::sigprocmask(libc::SIG_SETMASK, &saved, ptr::null_mut()); ++ ++ res ++ }; ++ + // Prevent signal starvation on WSL causing the `torn_escapes.py` test to fail + if is_windows_subsystem_for_linux(WSL::V1) { + // Merely querying the current thread's sigmask is sufficient to deliver a pending signal +diff '--color=auto' -ruwN source/src/libc.c source-new/src/libc.c +--- source/src/libc.c 2025-09-11 01:59:14.599514890 -0400 ++++ source-new/src/libc.c 2025-09-11 02:00:00.304589636 -0400 +@@ -4,7 +4,7 @@ + #include + #include + #include // MB_CUR_MAX +-#include // MNT_LOCAL ++/* #include // MNT_LOCAL */ + #include + #include // ST_LOCAL + #include // _CS_PATH, _PC_CASE_SENSITIVE +diff '--color=auto' -ruwN source/src/path.rs source-new/src/path.rs +--- source/src/path.rs 2025-09-11 01:59:14.600515157 -0400 ++++ source-new/src/path.rs 2025-09-11 02:00:00.317047039 -0400 +@@ -738,7 +738,9 @@ + crate::libc::ST_LOCAL(), + &narrow, + ); +- #[cfg(not(target_os = "netbsd"))] ++ #[cfg(target_os = "redox")] ++ let remoteness = DirRemoteness::unknown; ++ #[cfg(not(target_os = "redox"))] + let remoteness = remoteness_via_statfs( + libc::statfs, + |stat: &libc::statfs| stat.f_flags, diff --git a/recipes/wip/sound/auditorium/recipe.toml b/recipes/wip/sound/auditorium/recipe.toml new file mode 100644 index 000000000..c61a775fe --- /dev/null +++ b/recipes/wip/sound/auditorium/recipe.toml @@ -0,0 +1,10 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/nate-craft/auditorium" +[build] +template = "cargo" +[package] +dependencies = [ + "mpv", + "ffmpeg6", +] diff --git a/recipes/wip/sound/tek/recipe.toml b/recipes/wip/sound/tek/recipe.toml new file mode 100644 index 000000000..fa7b1da69 --- /dev/null +++ b/recipes/wip/sound/tek/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://codeberg.org/unspeaker/tek" +[build] +template = "cargo" diff --git a/recipes/wip/terminal/desktop-tui/recipe.toml b/recipes/wip/terminal/desktop-tui/recipe.toml new file mode 100644 index 000000000..426f28d72 --- /dev/null +++ b/recipes/wip/terminal/desktop-tui/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/Julien-cpsn/desktop-tui" +[build] +template = "cargo" diff --git a/recipes/wip/terminal/envx/recioe.toml b/recipes/wip/terminal/envx/recioe.toml new file mode 100644 index 000000000..0f187a55c --- /dev/null +++ b/recipes/wip/terminal/envx/recioe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/mikeleppane/envx" +[build] +template = "cargo" diff --git a/recipes/wip/tools/dotter/recipe.toml b/recipes/wip/tools/dotter/recipe.toml new file mode 100644 index 000000000..c3bcede25 --- /dev/null +++ b/recipes/wip/tools/dotter/recipe.toml @@ -0,0 +1,5 @@ +#TODO not compiled or tested +[source] +git = "https://github.com/SuperCuber/dotter" +[build] +template = "cargo" diff --git a/repo.sh b/repo.sh index f24580057..ddc0e7793 100755 --- a/repo.sh +++ b/repo.sh @@ -26,9 +26,9 @@ do fi done -target/release/cook $COOK_OPT $recipes +cook $COOK_OPT $recipes repo="$ROOT/repo/$TARGET" mkdir -p "$repo" -target/release/repo_builder "$repo" $recipes +repo_builder "$repo" $recipes diff --git a/src/bin/cook.rs b/src/bin/cook.rs index a5d609976..945df17dd 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -17,7 +17,7 @@ use std::{ use termion::{color, style}; use walkdir::{DirEntry, WalkDir}; -use cookbook::WALK_DEPTH; +use cookbook::{is_redox, WALK_DEPTH}; fn remove_all(path: &Path) -> Result<(), String> { if path.is_dir() { @@ -417,8 +417,9 @@ fn fetch(recipe_dir: &Path, source: &Option) -> Result Result<(), Box> { let toml_src = stage_dir.with_extension("toml"); let toml_dst = repo_path.join(format!("{}.toml", recipe)); + if !fs::exists(&toml_src)? { + eprintln!("recipe {} is missing stage.toml", recipe); + continue; + } + if is_newer(&toml_src, &toml_dst) { eprintln!("\x1b[01;38;5;155mrepo - publishing {}\x1b[0m", recipe); if fs::exists(&pkgar_src)? { diff --git a/src/lib.rs b/src/lib.rs index 2892e8c90..5a0b3fffc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,3 +5,13 @@ mod progress_bar; /// Default for maximum number of levels to descend down dependencies tree. pub const WALK_DEPTH: usize = 16; + +#[cfg(target_os = "redox")] +pub fn is_redox() -> bool { + true +} + +#[cfg(not(target_os = "redox"))] +pub fn is_redox() -> bool { + false +} diff --git a/unfetch.sh b/unfetch.sh index 6763ff824..ba273e872 100755 --- a/unfetch.sh +++ b/unfetch.sh @@ -5,14 +5,14 @@ source config.sh if [ $# = 0 ] then - recipes="$(target/release/list_recipes --short)" + recipes="$(list_recipes --short)" else recipes="$@" fi for recipe_name in $recipes do - recipe_path=`target/release/find_recipe $recipe_name` + recipe_path=`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