Sunday, November 27, 2022

Re: [UPDATE] lang/node 18.12.1

On Sat, Nov 26 2022, Volker Schlecht <openbsd-ports@schlecht.dev> wrote:
> Here's a first shot at updating lang/node to the most recent LTS
> Release. 16.x is still maintained, but LTS has been switched to 18.x
> a few weeks ago.
>
> Smoke testing showed no major issues so far, so I'll be dogfooding this
> for a while. However a few more eyes on it would be very welcome.
>
> In particular:
>
> aaron@: Would you have a look at the workaround to node-pledge I needed
> to tack on to make it build with the included version of node-gyp?
>
> jca@: Could you have a look if your riscv64 patches still work as desired?

Thanks for the heads-up!

- The hunk that drops -latomic should be preserved. ;)
- New issue: cpu.cc needs more #ifdefs for Linux-only detection of CPU
features. Added for riscv64 but not for mips64 where we don't build
lang/node. arm64 and powerpc64 look ok at first glance but I can't
test them.
- FPU support can default to true on OpenBSD/riscv64.

Not architecture specific: the REVISION line can be completely dropped
on updates.

Updated patch below, cpu.cc compiles but the build isn't finished yet.


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/node/Makefile,v
retrieving revision 1.111
diff -u -p -r1.111 Makefile
--- Makefile 13 Nov 2022 15:28:44 -0000 1.111
+++ Makefile 27 Nov 2022 12:25:50 -0000
@@ -5,12 +5,11 @@ USE_WXNEEDED = Yes

COMMENT = JavaScript runtime built on Chrome's V8 JavaScript engine

-NODE_VERSION = v16.17.1
+NODE_VERSION = v18.12.1
PLEDGE_VER = 1.1.2
DISTFILES = node-pledge-{}${PLEDGE_VER}.tar.gz:0 \
${DISTNAME}-headers.tar.gz \
${DISTNAME}.tar.xz
-REVISION = 2

DISTNAME = node-${NODE_VERSION}
PKGNAME = ${DISTNAME:S/v//g}
@@ -34,7 +33,7 @@ MODULES = lang/python
WANTLIB += c execinfo m pthread ${COMPILER_LIBCXX}
WANTLIB += z brotlienc brotlidec
WANTLIB += icudata icui18n icuuc cares nghttp2 uv
-WANTLIB += lib/eopenssl11/ssl lib/eopenssl11/crypto
+WANTLIB += lib/eopenssl30/ssl lib/eopenssl30/crypto

COMPILER = base-clang ports-gcc

@@ -71,16 +70,17 @@ SUBST_VARS += WRKDIST
SUBST_VARS += NODE_VERSION
SUBST_VARS += EOPENSSL_LIB

-# OpenSSL used: {X,Ed}25519 via EVP, SSL_CIPHER_standard_name and 5-10 other missing symbols/defines.
+# OpenSSL used: {X,Ed}25519 via EVP, SSL_CIPHER_standard_name and
+# 5-10 other missing symbols/defines.
LIB_DEPENDS += archivers/brotli \
devel/libuv \
net/libcares \
textproc/icu4c \
www/nghttp2 \
- security/openssl/1.1
+ security/openssl/3.0

-EOPENSSL_LIB = ${LOCALBASE}/lib/eopenssl11
-EOPENSSL_INC = ${LOCALBASE}/include/eopenssl11
+EOPENSSL_LIB = ${LOCALBASE}/lib/eopenssl30
+EOPENSSL_INC = ${LOCALBASE}/include/eopenssl30

post-extract:
mv ${WRKDIR}/node-pledge-${PLEDGE_VER} \
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/node/distinfo,v
retrieving revision 1.65
diff -u -p -r1.65 distinfo
--- distinfo 1 Nov 2022 12:01:49 -0000 1.65
+++ distinfo 26 Nov 2022 21:20:55 -0000
@@ -1,6 +1,6 @@
SHA256 (node-pledge-1.1.2.tar.gz) = zY/JcbZ32mmtqWXXNn3/9aTh7Y3F6fAAaADDA8SYwEk=
-SHA256 (node-v16.17.1-headers.tar.gz) = Ncy5XK8CzaO9aA2kNQqK5dZmp6nq46/lwqGz7ymu8Qg=
-SHA256 (node-v16.17.1.tar.xz) = ZyH+tBUtVtLGs1jOOXq9Wn8drwnuLiXFAhubTT+GozA=
+SHA256 (node-v18.12.1-headers.tar.gz) = nVXuByum1aFB2wks7xoPcV99P8k4KFptknodCgx0Qvc=
+SHA256 (node-v18.12.1.tar.xz) = T6QGRRvFJlmikOUs/bIWKnYL1UnaS4u+vmop8pbZON8=
SIZE (node-pledge-1.1.2.tar.gz) = 3155
-SIZE (node-v16.17.1-headers.tar.gz) = 568068
-SIZE (node-v16.17.1.tar.xz) = 35661452
+SIZE (node-v18.12.1-headers.tar.gz) = 8563785
+SIZE (node-v18.12.1.tar.xz) = 38454588
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/lang/node/patches/patch-Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 patch-Makefile
--- patches/patch-Makefile 18 Mar 2022 19:35:16 -0000 1.15
+++ patches/patch-Makefile 26 Nov 2022 21:20:55 -0000
@@ -1,7 +1,7 @@
Index: Makefile
--- Makefile.orig
+++ Makefile
-@@ -163,7 +163,7 @@ config.gypi: configure configure.py src/node_version.h
+@@ -185,7 +185,7 @@ config.gypi: configure configure.py src/node_version.h
fi

.PHONY: install
@@ -10,7 +10,7 @@ Index: Makefile
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'

.PHONY: uninstall
-@@ -394,6 +394,12 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \
+@@ -416,6 +416,12 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \
# Just goes to show that recursive make really is harmful...
# TODO(bnoordhuis) Force rebuild after gyp update.
build-addons: | $(NODE_EXE) test/addons/.buildstamp
Index: patches/patch-common_gypi
===================================================================
RCS file: /cvs/ports/lang/node/patches/patch-common_gypi,v
retrieving revision 1.23
diff -u -p -r1.23 patch-common_gypi
--- patches/patch-common_gypi 1 Sep 2022 20:42:56 -0000 1.23
+++ patches/patch-common_gypi 26 Nov 2022 21:20:55 -0000
@@ -1,7 +1,7 @@
Index: common.gypi
--- common.gypi.orig
+++ common.gypi
-@@ -416,7 +416,9 @@
+@@ -413,7 +413,9 @@
}],
['OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ],
Index: patches/patch-deps_npm_node_modules_node-gyp_gyp_pylib_gyp_generator_make_py
===================================================================
RCS file: /cvs/ports/lang/node/patches/patch-deps_npm_node_modules_node-gyp_gyp_pylib_gyp_generator_make_py,v
retrieving revision 1.10
diff -u -p -r1.10 patch-deps_npm_node_modules_node-gyp_gyp_pylib_gyp_generator_make_py
--- patches/patch-deps_npm_node_modules_node-gyp_gyp_pylib_gyp_generator_make_py 11 Mar 2022 19:29:08 -0000 1.10
+++ patches/patch-deps_npm_node_modules_node-gyp_gyp_pylib_gyp_generator_make_py 26 Nov 2022 21:20:55 -0000
@@ -5,8 +5,8 @@ Index: deps/npm/node_modules/node-gyp/gy

%(make_global_settings)s

-+CXX := /usr/bin/clang++
-+CC := /usr/bin/clang
++CXX := /usr/bin/c++
++CC := /usr/bin/c
CC.target ?= %(CC.target)s
CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS)
CXX.target ?= %(CXX.target)s
Index: patches/patch-deps_npm_node_modules_node-pledge_pledge_cc
===================================================================
RCS file: patches/patch-deps_npm_node_modules_node-pledge_pledge_cc
diff -N patches/patch-deps_npm_node_modules_node-pledge_pledge_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_npm_node_modules_node-pledge_pledge_cc 26 Nov 2022 21:20:55 -0000
@@ -0,0 +1,19 @@
+Index: deps/npm/node_modules/node-pledge/pledge.cc
+--- deps/npm/node_modules/node-pledge/pledge.cc.orig
++++ deps/npm/node_modules/node-pledge/pledge.cc
+@@ -33,8 +33,13 @@ void Pledge(const FunctionCallbackInfo<Value>& args) {
+ }
+
+ const int num = pledge(*String::Utf8Value(isolate, args[0]), NULL);
+- if (num == -1)
+- err(1, "pledge");
++ if (num == -1) {
++ isolate->ThrowException(Exception::TypeError(
++ String::NewFromUtf8(isolate, "Pledge Error",
++ v8::NewStringType::kNormal).ToLocalChecked()));
++ return;
++ }
++
+
+ args.GetReturnValue().Set(num);
+ }
Index: patches/patch-deps_v8_include_v8config_h
===================================================================
RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_include_v8config_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-deps_v8_include_v8config_h
--- patches/patch-deps_v8_include_v8config_h 11 Mar 2022 19:29:08 -0000 1.2
+++ patches/patch-deps_v8_include_v8config_h 26 Nov 2022 21:20:55 -0000
@@ -1,22 +1,25 @@
---- deps/v8/include/v8config.h.orig Sat Jan 1 17:10:10 2022
-+++ deps/v8/include/v8config.h Sat Jan 1 17:10:10 2022
-@@ -181,6 +181,7 @@ path. Add it with -I<path> to the command line
+Index: deps/v8/include/v8config.h
+--- deps/v8/include/v8config.h.orig
++++ deps/v8/include/v8config.h
+@@ -183,6 +183,8 @@ path. Add it with -I<path> to the command line
&& !defined(V8_TARGET_OS_FUCHSIA) \
&& !defined(V8_TARGET_OS_IOS) \
&& !defined(V8_TARGET_OS_LINUX) \
+ && !defined(V8_TARGET_OS_OPENBSD) \
- && !defined(V8_TARGET_OS_MACOSX) \
++ && !defined(V8_TARGET_OS_FREEBSD) \
+ && !defined(V8_TARGET_OS_MACOS) \
&& !defined(V8_TARGET_OS_WIN)
# error No known target OS defined.
-@@ -192,6 +193,7 @@ path. Add it with -I<path> to the command line
+@@ -194,6 +196,8 @@ path. Add it with -I<path> to the command line
|| defined(V8_TARGET_OS_FUCHSIA) \
|| defined(V8_TARGET_OS_IOS) \
|| defined(V8_TARGET_OS_LINUX) \
+ || defined(V8_TARGET_OS_OPENBSD) \
- || defined(V8_TARGET_OS_MACOSX) \
++ || defined(V8_TARGET_OS_FREEBSD) \
+ || defined(V8_TARGET_OS_MACOS) \
|| defined(V8_TARGET_OS_WIN)
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
-@@ -212,6 +214,10 @@ path. Add it with -I<path> to the command line
+@@ -214,6 +218,16 @@ path. Add it with -I<path> to the command line

#ifdef V8_OS_LINUX
# define V8_TARGET_OS_LINUX
@@ -24,6 +27,12 @@
+
+#ifdef V8_OS_OPENBSD
+# define V8_TARGET_OS_OPENBSD
++# define V8_TARGET_OS_BSD
++

No comments:

Post a Comment