From 43720fd297fdcb79a918a7baea15b8d88cab5950 Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Mon, 15 Sep 2025 20:04:42 +0000 Subject: [PATCH] Port nginx --- recipes/wip/net/http/nginx/recipe.toml | 61 +++++++++++++++++++++-- recipes/wip/net/http/nginx/redox.patch | 68 ++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 recipes/wip/net/http/nginx/redox.patch 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,