From 9199961617fd1813c29134d0e582fd8cc8872319 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 7 Dec 2025 14:00:28 +0700 Subject: [PATCH] Small fixes to nodejs --- recipes/wip/dev/lang/nodejs-21/recipe.toml | 8 +++-- recipes/wip/dev/lang/nodejs-21/redox.patch | 36 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/recipes/wip/dev/lang/nodejs-21/recipe.toml b/recipes/wip/dev/lang/nodejs-21/recipe.toml index d34be354a..e7cbeaff6 100644 --- a/recipes/wip/dev/lang/nodejs-21/recipe.toml +++ b/recipes/wip/dev/lang/nodejs-21/recipe.toml @@ -34,10 +34,10 @@ dev-dependencies = [ script = """ DYNAMIC_INIT -export PYTHONDONTWRITEBYTECODE=1 +export PYTHONDONTWRITEBYTECODE=1 COOKBOOK_NOSTRIP=true export CC_host="$CC_WRAPPER gcc" CXX_host="$CC_WRAPPER g++" -rsync -av --delete "${COOKBOOK_SOURCE}/" ./ +rsync -av "${COOKBOOK_SOURCE}/" ./ case "${TARGET}" in x86_64-unknown-linux-gnu) export NODE_CPU=x64 NODE_OS=linux;; @@ -58,6 +58,10 @@ COOKBOOK_CONFIGURE_FLAGS=( --shared-nghttp3 --shared-openssl --shared-zlib + --disable-shared-readonly-heap + --without-node-snapshot + --without-node-code-cache + --v8-lite-mode # TODO: Find a way to separate host and target flags instead? # --shared-zlib-includes="${COOKBOOK_TOOLCHAIN}/include" --shared-openssl-includes="${COOKBOOK_SYSROOT}/include" diff --git a/recipes/wip/dev/lang/nodejs-21/redox.patch b/recipes/wip/dev/lang/nodejs-21/redox.patch index 2c1217661..82f99e0ae 100644 --- a/recipes/wip/dev/lang/nodejs-21/redox.patch +++ b/recipes/wip/dev/lang/nodejs-21/redox.patch @@ -179,7 +179,7 @@ diff -ruwN source/deps/v8/src/base/platform/platform-posix.cc source-new/deps/v8 #endif +#if defined(__redox__) -+ #define PTHREAD_STACK_MIN 4096 ++ #define PTHREAD_STACK_MIN 1024 * 1024 +#endif + #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) @@ -392,6 +392,40 @@ diff -ruwN source/src/node_credentials.cc source-new/src/node_credentials.cc return value.As()->Value(); } else { Utf8Value name(isolate, value); +diff -ruwN source/src/node_dotenv.cc source-new/src/node_dotenv.cc +--- source/src/node_dotenv.cc 2024-04-10 19:46:14.000000000 +0700 ++++ source-new/src/node_dotenv.cc 2025-11-30 23:39:21.486092041 +0700 +@@ -16,10 +16,14 @@ + * The inspiration for this implementation comes from the original dotenv code, + * available at https://github.com/motdotla/dotenv + */ ++ ++// redox crash on compiling this regex ++#if !defined(__redox__) + const std::regex LINE( + "\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^']" + ")*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\r\n]+)?\\s*(?" + ":#.*)?"); // NOLINT(whitespace/line_length) ++#endif + + std::vector Dotenv::GetPathFromArgs( + const std::vector& args) { +@@ -102,6 +106,7 @@ + } + + void Dotenv::ParseContent(const std::string_view content) { ++#if !defined(__redox__) + std::string lines = std::string(content); + lines = std::regex_replace(lines, std::regex("\r\n?"), "\n"); + +@@ -131,6 +136,7 @@ + store_.insert_or_assign(std::string(key), value); + lines = match.suffix(); + } ++#endif + } + + Dotenv::ParseResult Dotenv::ParsePath(const std::string_view path) { diff -ruwN source/src/node_report.cc source-new/src/node_report.cc --- source/src/node_report.cc 2024-04-10 19:46:14.000000000 +0700 +++ source-new/src/node_report.cc 2025-10-10 13:46:05.190512964 +0700