Merge branch 'nodejs-compile' into 'master'

Fix nodejs compilation

See merge request redox-os/redox!1725
This commit is contained in:
Jeremy Soller 2025-11-30 15:19:16 -07:00
commit e84899efc4
3 changed files with 46 additions and 4 deletions

View File

@ -18,6 +18,20 @@ dependencies = [
"zlib",
"zstd",
]
dev-dependencies = [
"host:libbrotli",
"host:c-ares",
"host:libuv",
"host:ngtcp2",
"host:nghttp2",
"host:nghttp3",
"host:openssl3",
"host:sqlite3",
"host:zlib",
"host:zstd",
]
script = """
DYNAMIC_INIT
export PYTHONDONTWRITEBYTECODE=1
@ -26,15 +40,17 @@ export CC_host="$CC_WRAPPER gcc" CXX_host="$CC_WRAPPER g++"
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
case "${TARGET}" in
x86-unknown-redox) export NODE_CPU=x32;;
x86_64-unknown-redox) export NODE_CPU=x64;;
aarch64-unknown-redox) export NODE_CPU=arm64;;
x86_64-unknown-linux-gnu) export NODE_CPU=x64 NODE_OS=linux;;
aarch64-unknown-linux-gnu) export NODE_CPU=arm64 NODE_OS=linux;;
i586-unknown-redox) export NODE_CPU=ia32 NODE_OS=redox;;
x86_64-unknown-redox) export NODE_CPU=x64 NODE_OS=redox;;
aarch64-unknown-redox) export NODE_CPU=arm64 NODE_OS=redox;;
esac
COOKBOOK_CONFIGURE_FLAGS=(
--prefix=/usr
--dest-cpu=${NODE_CPU}
--dest-os=redox
--dest-os=${NODE_OS}
--shared-cares
--shared-libuv
--shared-ngtcp2
@ -42,6 +58,11 @@ COOKBOOK_CONFIGURE_FLAGS=(
--shared-nghttp3
--shared-openssl
--shared-zlib
# TODO: Find a way to separate host and target flags instead?
# --shared-zlib-includes="${COOKBOOK_TOOLCHAIN}/include"
--shared-openssl-includes="${COOKBOOK_SYSROOT}/include"
--shared-zlib-libpath="${COOKBOOK_TOOLCHAIN}/lib"
--shared-openssl-libpath="${COOKBOOK_SYSROOT}/lib"
--cross-compiling
)
COOKBOOK_CONFIGURE="./configure"

View File

@ -1,3 +1,23 @@
diff -ruwN source/configure source-new/configure
--- source/configure 2024-04-10 19:46:11.000000000 +0700
+++ source-new/configure 2025-11-30 18:13:57.842696765 +0700
@@ -4,6 +4,7 @@
# Note that the mix of single and double quotes is intentional,
# as is the fact that the ] goes on a new line.
_=[ 'exec' '/bin/sh' '-c' '''
+command -v python3.13 >/dev/null && exec python3.13 "$0" "$@"
command -v python3.12 >/dev/null && exec python3.12 "$0" "$@"
command -v python3.11 >/dev/null && exec python3.11 "$0" "$@"
command -v python3.10 >/dev/null && exec python3.10 "$0" "$@"
@@ -24,7 +25,7 @@
from distutils.spawn import find_executable as which
print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info))
-acceptable_pythons = ((3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6))
+acceptable_pythons = ((3, 13), (3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6))
if sys.version_info[:2] in acceptable_pythons:
import configure
else:
diff -ruwN source/configure.py source-new/configure.py
--- source/configure.py 2024-04-10 19:46:11.000000000 +0700
+++ source-new/configure.py 2025-10-10 13:46:04.244040340 +0700

View File

@ -92,6 +92,7 @@ export PATH="${COOKBOOK_ROOT}/bin:${PATH}"
if [ ! -z "${COOKBOOK_TOOLCHAIN}" ]
then
export PATH="${COOKBOOK_TOOLCHAIN}/bin:${PATH}"
export LD_LIBRARY_PATH="${COOKBOOK_TOOLCHAIN}/lib:${LD_LIBRARY_PATH}"
fi
# This puts cargo build artifacts in the build directory