From 5b94aa005e38aa3b6ba97031c3ce265f0e86b711 Mon Sep 17 00:00:00 2001 From: rfl890 <87506407+rfl890@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:12:45 -0500 Subject: [PATCH] nodejs: update to 20.9.0 --- srcpkgs/nodejs/patches/cross-aarch64.patch | 42 +++++++++---------- srcpkgs/nodejs/patches/ppc32.patch | 2 +- srcpkgs/nodejs/patches/python312.patch | 6 +-- srcpkgs/nodejs/patches/shared-uv.patch | 4 +- .../nodejs/patches/xxx-ppc-hwcap-musl.patch | 16 ++----- srcpkgs/nodejs/template | 21 ++++++---- 6 files changed, 42 insertions(+), 49 deletions(-) diff --git a/srcpkgs/nodejs/patches/cross-aarch64.patch b/srcpkgs/nodejs/patches/cross-aarch64.patch index fa05cb15813e8..fea72922e52e8 100644 --- a/srcpkgs/nodejs/patches/cross-aarch64.patch +++ b/srcpkgs/nodejs/patches/cross-aarch64.patch @@ -1,23 +1,18 @@ -From 6bdf9dc3ec7dbff00acef081f4e3dd3e061fd744 Mon Sep 17 00:00:00 2001 -From: Ben Noordhuis -Date: Tue, 6 Dec 2022 11:27:49 +0100 -Subject: [PATCH] build: fix arm64 cross-compilation +From e6345abf20aaa82460b7fa49ac5c4bc7d3a0d02a Mon Sep 17 00:00:00 2001 +From: RFL890 +Date: Mon, 13 Nov 2023 09:19:23 -0500 +Subject: [PATCH] Fix cross compilation on arm64 -Commit 938212f added -msign-return-address=all to _all_ cflags but that -is wrong when cross-compiling, it should only be added to the target's -cflags. - -Fixes: https://github.com/nodejs/node/issues/42888 --- configure.py | 2 -- node.gyp | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py -index 40e0395e..9de3148f 100755 +index 62f041ce52..e55c5a6353 100755 --- a/configure.py +++ b/configure.py -@@ -1294,9 +1294,7 @@ def configure_node(o): +@@ -1268,9 +1268,7 @@ def configure_node(o): o['variables']['want_separate_host_toolset'] = int(cross_compiling) @@ -28,16 +23,19 @@ index 40e0395e..9de3148f 100755 if options.node_snapshot_main is not None: diff --git a/node.gyp b/node.gyp -index cf52281b..5218d941 100644 +index 4e614df1a9..ed0ffcc582 100644 --- a/node.gyp +++ b/node.gyp -@@ -112,6 +112,9 @@ - }, - - 'conditions': [ -+ ['target_arch=="arm64"', { -+ 'cflags': ['-msign-return-address=all'], # Pointer authentication. -+ }], - ['OS in "aix os400"', { - 'ldflags': [ - '-Wl,-bnoerrmsg', +@@ -411,6 +411,9 @@ + [ 'node_shared=="true"', { + 'node_target_type%': 'shared_library', + 'conditions': [ ++ ['target_arch=="arm64"', { ++ 'cflags': ['-msign-return-address=all'], # Pointer authentication. ++ }], + ['OS in "aix os400"', { + # For AIX, always generate static library first, + # It needs an extra step to generate exp and +-- +2.42.0 + diff --git a/srcpkgs/nodejs/patches/ppc32.patch b/srcpkgs/nodejs/patches/ppc32.patch index ddfceb2f2179c..068b5bd3ba58e 100644 --- a/srcpkgs/nodejs/patches/ppc32.patch +++ b/srcpkgs/nodejs/patches/ppc32.patch @@ -1,6 +1,6 @@ --- a/deps/v8/src/libsampler/sampler.cc +++ b/deps/v8/src/libsampler/sampler.cc -@@ -423,10 +423,17 @@ +@@ -441,10 +441,17 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) { state->lr = reinterpret_cast(ucontext->uc_mcontext.regs->link); #else // Some C libraries, notably Musl, define the regs member as a void pointer diff --git a/srcpkgs/nodejs/patches/python312.patch b/srcpkgs/nodejs/patches/python312.patch index b5f1d22877f7e..9486ed94c8529 100644 --- a/srcpkgs/nodejs/patches/python312.patch +++ b/srcpkgs/nodejs/patches/python312.patch @@ -1,5 +1,5 @@ ---- ./configure.orig 2023-10-11 07:49:24.971659089 -0400 -+++ ./configure 2023-10-11 07:49:51.615780727 -0400 +--- a/configure ++++ b/configure @@ -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. @@ -8,7 +8,7 @@ command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" -@@ -23,7 +24,7 @@ +@@ -23,7 +24,7 @@ except ImportError: from distutils.spawn import find_executable as which print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) diff --git a/srcpkgs/nodejs/patches/shared-uv.patch b/srcpkgs/nodejs/patches/shared-uv.patch index 47a167b439582..5545ab82fdf3d 100644 --- a/srcpkgs/nodejs/patches/shared-uv.patch +++ b/srcpkgs/nodejs/patches/shared-uv.patch @@ -1,12 +1,12 @@ --- a/deps/uvwasi/uvwasi.gyp +++ b/deps/uvwasi/uvwasi.gyp -@@ -33,6 +33,9 @@ +@@ -38,6 +38,9 @@ '../uv/uv.gyp:libuv', ], }], + [ 'node_shared_libuv=="true"', { + 'libraries': [ '-luv' ], -+ }] ++ }], ], } ] diff --git a/srcpkgs/nodejs/patches/xxx-ppc-hwcap-musl.patch b/srcpkgs/nodejs/patches/xxx-ppc-hwcap-musl.patch index 952892caed386..0ecfcea1f1921 100644 --- a/srcpkgs/nodejs/patches/xxx-ppc-hwcap-musl.patch +++ b/srcpkgs/nodejs/patches/xxx-ppc-hwcap-musl.patch @@ -1,24 +1,16 @@ -commit 558ab896cbdd90259950c631ba29a1c66bf4c2d3 -Author: q66 -Date: Mon Feb 28 23:53:22 2022 +0100 - - add some hwcap bits fallbacks - -diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc -index a1b21d2..8e52802 100644 --- a/deps/v8/src/base/cpu.cc +++ b/deps/v8/src/base/cpu.cc -@@ -768,6 +768,13 @@ CPU::CPU() +@@ -788,7 +788,12 @@ CPU::CPU() + #endif // V8_OS_WIN #elif V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 - +- +#ifndef PPC_FEATURE2_HAS_ISEL +#define PPC_FEATURE2_HAS_ISEL 0x08000000 +#endif +#ifndef PPC_FEATURE2_ARCH_3_1 +#define PPC_FEATURE2_ARCH_3_1 0x00040000 +#endif -+ #ifndef USE_SIMULATOR #if V8_OS_LINUX - // Read processor info from getauxval() (needs at least glibc 2.18 or musl). + // Read processor info from /proc/self/auxv. diff --git a/srcpkgs/nodejs/template b/srcpkgs/nodejs/template index 2576dbdbbbe89..2d652816af82a 100644 --- a/srcpkgs/nodejs/template +++ b/srcpkgs/nodejs/template @@ -1,21 +1,19 @@ # Template file for 'nodejs' pkgname=nodejs -version=18.16.0 +version=20.9.0 revision=3 -# Need these for host v8 for torque, see https://github.com/nodejs/node/pull/21079 -hostmakedepends="which pkg-config python3-setuptools zlib-devel - $(vopt_if icu icu-devel) $(vopt_if ssl openssl-devel) $(vopt_if libuv libuv-devel) - $(vopt_if nghttp2 nghttp2-devel) $(vopt_if cares c-ares-devel)" -makedepends="zlib-devel $(vopt_if icu icu-devel) +hostmakedepends="which pkg-config python3" +_make_depends="libatomic-devel zlib-devel brotli-devel $(vopt_if icu icu-devel) $(vopt_if ssl openssl-devel) $(vopt_if libuv libuv-devel) $(vopt_if nghttp2 nghttp2-devel) $(vopt_if cares c-ares-devel)" +makedepends="$_make_depends" checkdepends="procps-ng iana-etc" short_desc="Evented I/O for V8 javascript" maintainer="Enno Boland " license="MIT" homepage="https://nodejs.org/" distfiles="https://nodejs.org/dist/v${version}/node-v${version}.tar.gz" -checksum=6a4f5c5d76e5c50cef673099e56f19bc3266ae363f56ca0ab77dd2f3c5088c6d +checksum=a7e6547a951406e4e546a74160ed27b26f9abd4baf7c44dd5a0fa992852d0cfa python_version=3 build_options="ssl libuv icu nghttp2 cares" @@ -30,6 +28,11 @@ replaces="iojs>=0" conflicts="nodejs-lts-10" provides="nodejs-runtime-0_1" +if [ "$CROSS_BUILD" ]; then + # Need these for host v8 for torque, see https://github.com/nodejs/node/pull/21079 + hostmakedepends+=" $_make_depends" +fi + # https://build.voidlinux.org/builders/i686_builder/builds/27325/steps/shell_3/logs/stdio if [ "$XBPS_WORDSIZE" = 32 ]; then LDFLAGS="-Wl,--no-keep-memory" @@ -41,7 +44,7 @@ fi case "$XBPS_TARGET_MACHINE" in ppc64*) ;; - ppc*) broken="Node 18.x does not support 32-bit ppc" ;; + ppc*) broken="Node 20.x does not support 32-bit ppc" ;; esac CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" @@ -71,7 +74,7 @@ do_configure() { # to execute it within the build system fails _args+=" --cross-compiling" fi - ./configure --prefix=/usr --shared-zlib \ + ./configure --prefix=/usr --shared-zlib --shared-brotli --enable-lto \ $(vopt_if icu --with-intl=system-icu) \ $(vopt_if ssl --shared-openssl) \ $(vopt_if libuv --shared-libuv) \