diff --git a/packages/nodejs-lts/build.sh b/packages/nodejs-lts/build.sh index 28281494c9..688918d55c 100644 --- a/packages/nodejs-lts/build.sh +++ b/packages/nodejs-lts/build.sh @@ -2,10 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://nodejs.org/ TERMUX_PKG_DESCRIPTION="Open Source, cross-platform JavaScript runtime environment" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="Yaksh Bariya " -TERMUX_PKG_VERSION=18.16.1 -TERMUX_PKG_REVISION=2 +TERMUX_PKG_VERSION=20.11.1 TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=e8404f8c8d89fdfdf7e95bbbc6066bd0e571acba58f54492599b615fbeefe272 +TERMUX_PKG_SHA256=77813edbf3f7f16d2d35d3353443dee4e61d5ee84d9e3138c7538a3c0ca5209e # Note that we do not use a shared libuv to avoid an issue with the Android # linker, which does not use symbols of linked shared libraries when resolving # symbols on dlopen(). See https://github.com/termux/termux-packages/issues/462. diff --git a/packages/nodejs-lts/common.gypi.patch b/packages/nodejs-lts/common.gypi.patch new file mode 100644 index 0000000000..3b79b4f6a5 --- /dev/null +++ b/packages/nodejs-lts/common.gypi.patch @@ -0,0 +1,13 @@ +--- ./common.gypi.orig 2024-02-18 23:11:41.173679151 +0530 ++++ ./common.gypi 2024-02-18 23:11:53.907570677 +0530 +@@ -237,10 +237,6 @@ + },], + ], + },], +- ['OS == "android"', { +- 'cflags': [ '-fPIC', '-I<(android_ndk_path)/sources/android/cpufeatures' ], +- 'ldflags': [ '-fPIC' ] +- }], + ], + 'msvs_settings': { + 'VCCLCompilerTool': { diff --git a/packages/nodejs-lts/deps-npm-node_modules-cacache-lib-util-move-file.js.patch b/packages/nodejs-lts/deps-npm-node_modules-cacache-lib-util-move-file.js.patch deleted file mode 100644 index 738d8315a0..0000000000 --- a/packages/nodejs-lts/deps-npm-node_modules-cacache-lib-util-move-file.js.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ./deps/npm/node_modules/cacache/lib/util/move-file.js.orig 2023-02-10 18:32:05.446937327 +0530 -+++ ./deps/npm/node_modules/cacache/lib/util/move-file.js 2023-02-10 18:34:11.998345174 +0530 -@@ -1,56 +1,9 @@ - 'use strict' - --const fs = require('fs/promises') - const { moveFile: move } = require('@npmcli/fs') --const pinflight = require('promise-inflight') - - module.exports = moveFile - - async function moveFile (src, dest) { -- const isWindows = process.platform === 'win32' -- -- // This isn't quite an fs.rename -- the assumption is that -- // if `dest` already exists, and we get certain errors while -- // trying to move it, we should just not bother. -- // -- // In the case of cache corruption, users will receive an -- // EINTEGRITY error elsewhere, and can remove the offending -- // content their own way. -- // -- // Note that, as the name suggests, this strictly only supports file moves. -- try { -- await fs.link(src, dest) -- } catch (err) { -- if (isWindows && err.code === 'EPERM') { -- // XXX This is a really weird way to handle this situation, as it -- // results in the src file being deleted even though the dest -- // might not exist. Since we pretty much always write files to -- // deterministic locations based on content hash, this is likely -- // ok (or at worst, just ends in a future cache miss). But it would -- // be worth investigating at some time in the future if this is -- // really what we want to do here. -- } else if (err.code === 'EEXIST' || err.code === 'EBUSY') { -- // file already exists, so whatever -- } else { -- throw err -- } -- } -- try { -- await Promise.all([ -- fs.unlink(src), -- !isWindows && fs.chmod(dest, '0444'), -- ]) -- } catch (e) { -- return pinflight('cacache-move-file:' + dest, async () => { -- await fs.stat(dest).catch((err) => { -- if (err.code !== 'ENOENT') { -- // Something else is wrong here. Bail bail bail -- throw err -- } -- }) -- // file doesn't already exist! let's try a rename -> copy fallback -- // only delete if it successfully copies - return move(src, dest) -- }) -- } - } diff --git a/packages/nodejs-lts/deps-v8-src-logging-log.cc.patch b/packages/nodejs-lts/deps-v8-src-logging-log.cc.patch index 730abea6fc..8cbcfc30a0 100644 --- a/packages/nodejs-lts/deps-v8-src-logging-log.cc.patch +++ b/packages/nodejs-lts/deps-v8-src-logging-log.cc.patch @@ -1,11 +1,11 @@ -diff '--color=auto' -uNr node-v18.0.0.orig/deps/v8/src/logging/log.cc node-v18.0.0/deps/v8/src/logging/log.cc ---- node-v18.0.0.orig/deps/v8/src/logging/log.cc 2022-04-21 15:15:34.031869789 +0530 -+++ node-v18.0.0/deps/v8/src/logging/log.cc 2022-04-21 15:44:33.497175145 +0530 -@@ -308,7 +308,7 @@ - FILE* perf_output_handle_; +--- ./deps/v8/src/logging/log.cc.orig 2024-02-18 22:32:25.705899829 +0530 ++++ ./deps/v8/src/logging/log.cc 2024-02-18 22:49:33.993837346 +0530 +@@ -367,7 +367,7 @@ + static uint64_t reference_count_; }; --const char PerfBasicLogger::kFilenameFormatString[] = "/tmp/perf-%d.map"; -+const char PerfBasicLogger::kFilenameFormatString[] = "@TERMUX_PREFIX@/tmp/perf-%d.map"; +-const char LinuxPerfBasicLogger::kFilenameFormatString[] = "/tmp/perf-%d.map"; ++const char LinuxPerfBasicLogger::kFilenameFormatString[] = "@TERMUX_PREFIX@/tmp/perf-%d.map"; // Extra space for the PID in the filename - const int PerfBasicLogger::kFilenameBufferPadding = 16; + const int LinuxPerfBasicLogger::kFilenameBufferPadding = 16; + diff --git a/packages/nodejs-lts/deps-v8-src-trap-handler-trap-handler.h.patch b/packages/nodejs-lts/deps-v8-src-trap-handler-trap-handler.h.patch index dcd67df68a..b0b66c02c8 100644 --- a/packages/nodejs-lts/deps-v8-src-trap-handler-trap-handler.h.patch +++ b/packages/nodejs-lts/deps-v8-src-trap-handler-trap-handler.h.patch @@ -1,7 +1,6 @@ -diff '--color=auto' -uNr node-v18.0.0.orig/deps/v8/src/trap-handler/trap-handler.h node-v18.0.0/deps/v8/src/trap-handler/trap-handler.h ---- node-v18.0.0.orig/deps/v8/src/trap-handler/trap-handler.h 2022-04-21 15:15:33.491869789 +0530 -+++ node-v18.0.0/deps/v8/src/trap-handler/trap-handler.h 2022-04-21 15:45:22.317175126 +0530 -@@ -17,23 +17,7 @@ +--- ./deps/v8/src/trap-handler/trap-handler.h.orig 2024-02-18 22:32:25.709233278 +0530 ++++ ./deps/v8/src/trap-handler/trap-handler.h 2024-02-18 22:51:32.229316245 +0530 +@@ -17,29 +17,7 @@ namespace internal { namespace trap_handler { @@ -14,8 +13,14 @@ diff '--color=auto' -uNr node-v18.0.0.orig/deps/v8/src/trap-handler/trap-handler -#elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_ARM64 && V8_OS_DARWIN -#define V8_TRAP_HANDLER_SUPPORTED true -// Arm64 simulator on x64 on Linux, Mac, or Windows. +-// +-// The simulator case uses some inline assembly code, which cannot be +-// compiled with MSVC, so don't enable the trap handler in that case. +-// (MSVC #defines _MSC_VER, but so does Clang when targeting Windows, hence +-// the check for __clang__.) -#elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_X64 && \ -- (V8_OS_LINUX || V8_OS_DARWIN) +- (V8_OS_LINUX || V8_OS_DARWIN || V8_OS_WIN) && \ +- (!defined(_MSC_VER) || defined(__clang__)) -#define V8_TRAP_HANDLER_VIA_SIMULATOR -#define V8_TRAP_HANDLER_SUPPORTED true -// Everything else is unsupported. @@ -23,5 +28,5 @@ diff '--color=auto' -uNr node-v18.0.0.orig/deps/v8/src/trap-handler/trap-handler #define V8_TRAP_HANDLER_SUPPORTED false -#endif - // Setup for shared library export. - #if defined(BUILDING_V8_SHARED) && defined(V8_OS_WIN) + #if V8_OS_ANDROID && V8_TRAP_HANDLER_SUPPORTED + // It would require some careful security review before the trap handler diff --git a/packages/nodejs-lts/lib-internal-test_runner-test.js.patch b/packages/nodejs-lts/lib-internal-test_runner-test.js.patch deleted file mode 100644 index d819ba8fa0..0000000000 --- a/packages/nodejs-lts/lib-internal-test_runner-test.js.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ./lib/internal/test_runner/test.js.orig 2023-02-02 02:40:18.000000000 +0530 -+++ ./lib/internal/test_runner/test.js 2023-02-10 18:46:00.132415180 +0530 -@@ -53,7 +53,7 @@ - } = require('internal/validators'); - const { setTimeout } = require('timers/promises'); - const { TIMEOUT_MAX } = require('internal/timers'); --const { cpus } = require('os'); -+const { availableParallelism } = require('os'); - const { bigint: hrtime } = process.hrtime; - const kCallbackAndPromisePresent = 'callbackAndPromisePresent'; - const kCancelledByParent = 'cancelledByParent'; -@@ -217,8 +217,7 @@ - - case 'boolean': - if (concurrency) { -- // TODO(cjihrig): Use uv_available_parallelism() once it lands. -- this.concurrency = parent === null ? MathMax(cpus().length - 1, 1) : Infinity; -+ this.concurrency = parent === null ? MathMax(availableParallelism() - 1, 1) : Infinity; - } else { - this.concurrency = 1; - } diff --git a/packages/nodejs-lts/node.gyp.patch b/packages/nodejs-lts/node.gyp.patch index 8768ee2e98..72a205af49 100644 --- a/packages/nodejs-lts/node.gyp.patch +++ b/packages/nodejs-lts/node.gyp.patch @@ -1,6 +1,6 @@ ---- ./node.gyp.orig 2023-04-12 09:39:19.000000000 +0530 -+++ ./node.gyp 2023-05-11 17:50:13.676999154 +0530 -@@ -158,7 +158,8 @@ +--- ./node.gyp.orig 2024-02-14 03:13:33.000000000 +0530 ++++ ./node.gyp 2024-02-18 23:15:08.296058654 +0530 +@@ -506,7 +506,8 @@ ], 'sources': [ @@ -10,41 +10,10 @@ ], 'dependencies': [ -@@ -1131,311 +1132,6 @@ - } ], - ] - }, # specialize_node_d -- { # fuzz_url -- 'target_name': 'fuzz_url', -- 'type': 'executable', -- 'dependencies': [ -- '<(node_lib_target_name)', -- ], -- 'includes': [ -- 'node.gypi' -- ], -- 'include_dirs': [ -- 'src', -- ], -- 'defines': [ -- 'NODE_ARCH="<(target_arch)"', -- 'NODE_PLATFORM="<(OS)"', -- 'NODE_WANT_INTERNALS=1', -- ], -- 'sources': [ -- 'src/node_snapshot_stub.cc', -- 'test/fuzzers/fuzz_url.cc', -- ], -- 'conditions': [ -- ['OS=="linux"', { -- 'ldflags': [ '-fsanitize=fuzzer' ] -- }], -- # Ensure that ossfuzz flag has been set and that we are on Linux -- [ 'OS!="linux" or ossfuzz!="true"', { -- 'type': 'none', -- }], -- ], -- }, # fuzz_url +@@ -985,207 +986,6 @@ + }, + ], + }, # node_lib_target_name - { # fuzz_env - 'target_name': 'fuzz_env', - 'type': 'executable', @@ -52,9 +21,6 @@ - '<(node_lib_target_name)', - 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', -- 'node_dtrace_header', -- 'node_dtrace_ustack', -- 'node_dtrace_provider', - ], - 'includes': [ - 'node.gypi' @@ -85,6 +51,10 @@ - [ 'OS!="linux" or ossfuzz!="true"', { - 'type': 'none', - }], +- # Avoid excessive LTO +- ['enable_lto=="true"', { +- 'ldflags': [ '-fno-lto' ], +- }], - ], - }, # fuzz_env - { @@ -98,9 +68,6 @@ - 'deps/googletest/googletest.gyp:gtest_main', - 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', -- 'node_dtrace_header', -- 'node_dtrace_ustack', -- 'node_dtrace_provider', - 'deps/simdutf/simdutf.gyp:simdutf', - 'deps/ada/ada.gyp:ada', - ], @@ -125,44 +92,20 @@ - 'NODE_WANT_INTERNALS=1', - ], - -- 'sources': [ -- 'src/node_snapshot_stub.cc', -- 'test/cctest/node_test_fixture.cc', -- 'test/cctest/node_test_fixture.h', -- 'test/cctest/test_aliased_buffer.cc', -- 'test/cctest/test_base64.cc', -- 'test/cctest/test_base_object_ptr.cc', -- 'test/cctest/test_node_postmortem_metadata.cc', -- 'test/cctest/test_environment.cc', -- 'test/cctest/test_linked_binding.cc', -- 'test/cctest/test_node_api.cc', -- 'test/cctest/test_per_process.cc', -- 'test/cctest/test_platform.cc', -- 'test/cctest/test_report.cc', -- 'test/cctest/test_json_utils.cc', -- 'test/cctest/test_sockaddr.cc', -- 'test/cctest/test_traced_value.cc', -- 'test/cctest/test_util.cc', -- ], +- 'sources': [ '<@(node_cctest_sources)' ], - - 'conditions': [ - [ 'node_use_openssl=="true"', { - 'defines': [ - 'HAVE_OPENSSL=1', - ], -- 'sources': [ -- 'test/cctest/test_crypto_clienthello.cc', -- 'test/cctest/test_node_crypto.cc', -- ] +- 'sources': [ '<@(node_cctest_openssl_sources)' ], - }], - ['v8_enable_inspector==1', { -- 'sources': [ -- 'test/cctest/test_inspector_socket.cc', -- 'test/cctest/test_inspector_socket_server.cc' -- ], - 'defines': [ - 'HAVE_INSPECTOR=1', - ], +- 'sources': [ '<@(node_cctest_inspector_sources)' ], - }, { - 'defines': [ - 'HAVE_INSPECTOR=0', @@ -187,6 +130,10 @@ - 'Ws2_32.lib', - ], - }], +- # Avoid excessive LTO +- ['enable_lto=="true"', { +- 'ldflags': [ '-fno-lto' ], +- }], - ], - }, # cctest - @@ -198,9 +145,6 @@ - '<(node_lib_target_name)', - 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', -- 'node_dtrace_header', -- 'node_dtrace_ustack', -- 'node_dtrace_provider', - 'deps/ada/ada.gyp:ada', - ], - @@ -243,6 +187,10 @@ - 'Ws2_32.lib', - ], - }], +- # Avoid excessive LTO +- ['enable_lto=="true"', { +- 'ldflags': [ '-fno-lto' ], +- }], - ], - }, # embedtest - @@ -261,12 +209,23 @@ - 'test/overlapped-checker/main_unix.c' - ], - }], +- # Avoid excessive LTO +- ['enable_lto=="true"', { +- 'ldflags': [ '-fno-lto' ], +- }], - ] - }, # overlapped-checker + { + 'target_name': 'node_js2c', + 'type': 'executable', +@@ -1219,69 +1019,7 @@ + }], + ] + }, - { - 'target_name': 'node_mksnapshot', - 'type': 'executable', -- + - 'dependencies': [ - '<(node_lib_target_name)', - 'deps/histogram/histogram.gyp:histogram', @@ -295,6 +254,9 @@ - ], - - 'conditions': [ +- ['node_write_snapshot_as_array_literals=="true"', { +- 'defines': [ 'NODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' ], +- }], - [ 'node_use_openssl=="true"', { - 'defines': [ - 'HAVE_OPENSSL=1', @@ -317,6 +279,10 @@ - 'Ws2_32.lib', - ], - }], +- # Avoid excessive LTO +- ['enable_lto=="true"', { +- 'ldflags': [ '-fno-lto' ], +- }], - ], - }, # node_mksnapshot ], # end targets diff --git a/packages/nodejs-lts/test-parallel-test-blob-buffer-too-large.js.patch b/packages/nodejs-lts/test-parallel-test-blob-buffer-too-large.js.patch index 52935defa5..4b9a09aff5 100644 --- a/packages/nodejs-lts/test-parallel-test-blob-buffer-too-large.js.patch +++ b/packages/nodejs-lts/test-parallel-test-blob-buffer-too-large.js.patch @@ -1,9 +1,9 @@ ---- ./test/parallel/test-blob-buffer-too-large.js.orig 2022-06-05 08:43:15.647600971 +0530 -+++ ./test/parallel/test-blob-buffer-too-large.js 2022-06-05 08:55:58.717600680 +0530 +--- ./test/parallel/test-blob-buffer-too-large.js.orig 2024-02-18 23:10:43.424477597 +0530 ++++ ./test/parallel/test-blob-buffer-too-large.js 2024-02-18 23:10:27.273767652 +0530 @@ -4,10 +4,14 @@ const common = require('../common'); const assert = require('assert'); - const { Blob } = require('buffer'); + const { Blob, kMaxLength } = require('buffer'); +const { platform } = require('os'); if (common.isFreeBSD) @@ -13,5 +13,5 @@ + common.skip('Android will kill heavy memory using processes sometimes crashing Termux'); + try { - new Blob([new Uint8Array(0xffffffff), [1]]); + new Blob([new Uint8Array(kMaxLength), [1]]); } catch (e) { diff --git a/packages/nodejs-lts/v8-clang-17.patch b/packages/nodejs-lts/v8-clang-17.patch deleted file mode 100644 index 73da3909bc..0000000000 --- a/packages/nodejs-lts/v8-clang-17.patch +++ /dev/null @@ -1,16 +0,0 @@ -https://github.com/gentoo/gentoo/commit/6fb7d0a7131b5a5938b12673f4b260d66cc1a527 - ---- a/deps/v8/src/base/bit-field.h -+++ b/deps/v8/src/base/bit-field.h -@@ -39,8 +39,11 @@ - static constexpr int kLastUsedBit = kShift + kSize - 1; - static constexpr U kNumValues = U{1} << kSize; - -+ #pragma clang diagnostic push -+ #pragma clang diagnostic ignored "-Wenum-constexpr-conversion" - // Value for the field with all bits set. - static constexpr T kMax = static_cast(kNumValues - 1); -+ #pragma clang diagnostic pop - - template - using Next = BitField;