pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

nodejs: added version 16.4.0



Module Name:	pkgsrc-wip
Committed By:	Adam Ciarciński <aciarcinski%teonite.com@localhost>
Pushed By:	adam
Date:		Wed Mar 9 15:06:14 2022 +0100
Changeset:	3ef718af49d6bd9aade50d84f81736c569764530

Modified Files:
	Makefile
Added Files:
	nodejs/DESCR
	nodejs/Makefile
	nodejs/PLIST
	nodejs/buildlink3.mk
	nodejs/distinfo
	nodejs/options.mk
	nodejs/patches/patch-common.gypi
	nodejs/patches/patch-deps_cares_cares.gyp
	nodejs/patches/patch-deps_uv_common.gypi
	nodejs/patches/patch-deps_uvwasi_include_wasi__serdes.h
	nodejs/patches/patch-deps_v8_src_base_platform_platform-freebsd.cc
	nodejs/patches/patch-deps_v8_src_base_platform_platform-openbsd.cc
	nodejs/patches/patch-deps_v8_src_base_platform_platform-posix.cc
	nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc
	nodejs/patches/patch-deps_v8_src_codegen_arm_cpu-arm.cc
	nodejs/patches/patch-deps_v8_src_common_globals.h
	nodejs/patches/patch-deps_v8_src_compiler_types.h
	nodejs/patches/patch-deps_v8_tools_run-llprof.sh
	nodejs/patches/patch-node.gyp
	nodejs/patches/patch-node.gypi
	nodejs/patches/patch-src_inspector__agent.cc
	nodejs/patches/patch-src_node__postmortem__metadata.cc
	nodejs/patches/patch-tools_gyp_pylib_gyp_generator_make.py
	nodejs/patches/patch-tools_gyp_pylib_gyp_xcode__emulation.py
	nodejs/patches/patch-tools_install.py
	nodejs/patches/patch-tools_v8_gypfiles_v8.gyp

Log Message:
nodejs: added version 16.4.0

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3ef718af49d6bd9aade50d84f81736c569764530

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 nodejs/DESCR                                       |  4 ++
 nodejs/Makefile                                    | 43 +++++++++++++++++
 nodejs/PLIST                                       | 27 +++++++++++
 nodejs/buildlink3.mk                               | 36 ++++++++++++++
 nodejs/distinfo                                    | 25 ++++++++++
 nodejs/options.mk                                  | 35 ++++++++++++++
 nodejs/patches/patch-common.gypi                   | 20 ++++++++
 nodejs/patches/patch-deps_cares_cares.gyp          | 17 +++++++
 nodejs/patches/patch-deps_uv_common.gypi           | 15 ++++++
 .../patch-deps_uvwasi_include_wasi__serdes.h       | 21 +++++++++
 ...h-deps_v8_src_base_platform_platform-freebsd.cc | 33 +++++++++++++
 ...h-deps_v8_src_base_platform_platform-openbsd.cc | 55 ++++++++++++++++++++++
 ...tch-deps_v8_src_base_platform_platform-posix.cc | 53 +++++++++++++++++++++
 .../patch-deps_v8_src_base_platform_semaphore.cc   | 18 +++++++
 .../patch-deps_v8_src_codegen_arm_cpu-arm.cc       | 26 ++++++++++
 nodejs/patches/patch-deps_v8_src_common_globals.h  | 14 ++++++
 nodejs/patches/patch-deps_v8_src_compiler_types.h  | 21 +++++++++
 nodejs/patches/patch-deps_v8_tools_run-llprof.sh   | 15 ++++++
 nodejs/patches/patch-node.gyp                      | 15 ++++++
 nodejs/patches/patch-node.gypi                     | 14 ++++++
 nodejs/patches/patch-src_inspector__agent.cc       | 13 +++++
 .../patch-src_node__postmortem__metadata.cc        | 15 ++++++
 .../patch-tools_gyp_pylib_gyp_generator_make.py    | 25 ++++++++++
 .../patch-tools_gyp_pylib_gyp_xcode__emulation.py  | 24 ++++++++++
 nodejs/patches/patch-tools_install.py              | 18 +++++++
 nodejs/patches/patch-tools_v8_gypfiles_v8.gyp      | 19 ++++++++
 27 files changed, 622 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 66635e799b..5873da4e08 100644
--- a/Makefile
+++ b/Makefile
@@ -2626,6 +2626,7 @@ SUBDIR+=	nlopt
 SUBDIR+=	nncp
 SUBDIR+=	nnrpd
 SUBDIR+=	nodau
+SUBDIR+=	nodejs
 SUBDIR+=	nodm
 SUBDIR+=	noip
 SUBDIR+=	noiptun
diff --git a/nodejs/DESCR b/nodejs/DESCR
new file mode 100644
index 0000000000..65c6d26de1
--- /dev/null
+++ b/nodejs/DESCR
@@ -0,0 +1,4 @@
+Node.js is an evented I/O framework for the V8 JavaScript engine. It is
+intended for writing scalable network programs such as web servers.
+
+This package holds the latest release.
diff --git a/nodejs/Makefile b/nodejs/Makefile
new file mode 100644
index 0000000000..2c3c834c70
--- /dev/null
+++ b/nodejs/Makefile
@@ -0,0 +1,43 @@
+# $NetBSD$
+
+DISTNAME=	node-v16.14.0
+EXTRACT_SUFX=	.tar.xz
+
+USE_LANGUAGES=	c gnu++14
+
+.include "../../mk/bsd.prefs.mk"
+
+# XXX: figure out a way to add rpaths to torque
+MAKE_ENV+=	LD_LIBRARY_PATH=${PREFIX}/lib
+
+CONFIGURE_ARGS+=	--shared-brotli
+CONFIGURE_ARGS+=	--shared-nghttp2
+CONFIGURE_ARGS+=	--with-intl=system-icu
+CONFIGURE_ARGS+=	--without-corepack
+
+PYTHON_VERSIONS_INCOMPATIBLE=	27
+
+CHECK_PORTABILITY_SKIP+=	tools/macos-installer/pkgbuild/npm/scripts/preinstall
+
+.if ${MACHINE_ARCH} == "i386"
+# required for SSE2 code under i386.
+CXXFLAGS+=	-mstackrealign
+.endif
+
+.include "options.mk"
+
+# Node turns on -latomic for arm, mips and ppc.
+.if !empty(MACHINE_ARCH:M*arm*) || \
+    !empty(MACHINE_ARCH:M*powerpc*) || \
+    !empty(MACHINE_ARCH:M*mips*)
+.include "../../devel/libatomic/buildlink3.mk"
+.endif
+
+.include "../../lang/nodejs/Makefile.common"
+.include "../../archivers/brotli/buildlink3.mk"
+.include "../../textproc/icu/buildlink3.mk"
+# Requires nghttp2_option_set_max_settings
+BUILDLINK_API_DEPENDS.nghttp2+=	nghttp2>=1.41.0
+.include "../../www/nghttp2/buildlink3.mk"
+.include "../../mk/atomic64.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/nodejs/PLIST b/nodejs/PLIST
new file mode 100644
index 0000000000..7aac6cb3f2
--- /dev/null
+++ b/nodejs/PLIST
@@ -0,0 +1,27 @@
+@comment $NetBSD: PLIST,v 1.62 2020/07/22 06:53:50 adam Exp $
+bin/node
+include/node/common.gypi
+include/node/config.gypi
+include/node/cppgc/common.h
+include/node/js_native_api.h
+include/node/js_native_api_types.h
+include/node/libplatform/libplatform-export.h
+include/node/libplatform/libplatform.h
+include/node/libplatform/v8-tracing.h
+include/node/node.h
+include/node/node_api.h
+include/node/node_api_types.h
+include/node/node_buffer.h
+include/node/node_object_wrap.h
+include/node/node_version.h
+include/node/v8-internal.h
+include/node/v8-platform.h
+include/node/v8-profiler.h
+include/node/v8-version.h
+include/node/v8.h
+include/node/v8config.h
+${PLIST.dtrace}lib/dtrace/node.d
+man/man1/node.1
+share/doc/node/gdbinit
+share/doc/node/lldb_commands.py
+share/systemtap/tapset/node.stp
diff --git a/nodejs/buildlink3.mk b/nodejs/buildlink3.mk
new file mode 100644
index 0000000000..73c26bd646
--- /dev/null
+++ b/nodejs/buildlink3.mk
@@ -0,0 +1,36 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	nodejs
+
+.if !defined(NODEJS_BUILDLINK3_MK)
+NODEJS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.nodejs+=	nodejs>=16.14.0
+BUILDLINK_ABI_DEPENDS.nodejs+=	nodejs>=16.14.0
+BUILDLINK_PKGSRCDIR.nodejs?=	../../wip/nodejs
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if ${OPSYS} != "Darwin"
+.include "../../devel/libexecinfo/buildlink3.mk"
+.endif
+# Stated by the changelog
+BUILDLINK_API_DEPENDS.libuv+=	libuv>=1.23
+.include "../../devel/libuv/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../textproc/icu/buildlink3.mk"
+# Requires nghttp2_option_set_max_settings
+BUILDLINK_API_DEPENDS.nghttp2+=	nghttp2>=1.41.0
+.include "../../www/nghttp2/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+
+pkgbase := nodejs
+.include "../../mk/pkg-build-options.mk"
+
+.if ${PKG_BUILD_OPTIONS.nodejs:Mopenssl}
+.  include "../../security/openssl/buildlink3.mk"
+.endif
+
+.endif # NODEJS_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-nodejs
diff --git a/nodejs/distinfo b/nodejs/distinfo
new file mode 100644
index 0000000000..5ef54a177a
--- /dev/null
+++ b/nodejs/distinfo
@@ -0,0 +1,25 @@
+$NetBSD: distinfo,v 1.207 2022/01/11 08:02:04 adam Exp $
+
+BLAKE2s (node-v16.14.0.tar.xz) = d03a3d755ef39fa687e9452c5cea2b1a4892d43eb3e9bb38aefe2c11bc260834
+SHA512 (node-v16.14.0.tar.xz) = 5bde7f6691b6577f9df5b5574327a8602a68ddd438235be1970240893d7f298f1617a66fd43c6f3f62bba7647b7d07b841a9cb9607e384e29caec2049e129c23
+Size (node-v16.14.0.tar.xz) = 34311760 bytes
+SHA1 (patch-common.gypi) = 15393846d9dce28f963ef66faa504d5bb3e92018
+SHA1 (patch-deps_cares_cares.gyp) = 22b44f2ac59963f694dfe4f4585e08960b3dec32
+SHA1 (patch-deps_uv_common.gypi) = d38a9c8d9e3522f15812aec2f5b1e1e636d4bab3
+SHA1 (patch-deps_uvwasi_include_wasi__serdes.h) = 32b85ef5824b96b35aba9280bbe7aa7899d9e5cf
+SHA1 (patch-deps_v8_src_base_platform_platform-freebsd.cc) = b47025f33d2991275bbcd15dbabb28900afab0e1
+SHA1 (patch-deps_v8_src_base_platform_platform-openbsd.cc) = 5e593879dbab095f99e82593272a0de91043f9a8
+SHA1 (patch-deps_v8_src_base_platform_platform-posix.cc) = f99d9bee3ce452dda41c9b2943ee16cebcbd0af3
+SHA1 (patch-deps_v8_src_base_platform_semaphore.cc) = 802a95f1b1d131e0d85c1f99c659cc68b31ba2f6
+SHA1 (patch-deps_v8_src_codegen_arm_cpu-arm.cc) = 84c75d61bc99c2ff9adeac3152f5b11ebb0e582b
+SHA1 (patch-deps_v8_src_common_globals.h) = 86637724864389f2b24251904de41669a2f00fbc
+SHA1 (patch-deps_v8_src_compiler_types.h) = 2a212282ab9d71e98ae56827fdb1d9778a6047a5
+SHA1 (patch-deps_v8_tools_run-llprof.sh) = 39aa3faf77492ef8dd35b411b7b0e4605b469af3
+SHA1 (patch-node.gyp) = 0c2e5ccae623a7b730490baf8d509fa550b63e03
+SHA1 (patch-node.gypi) = 4a104dba6c22702211009bc60a6be6f87554e2fa
+SHA1 (patch-src_inspector__agent.cc) = 2ec2a7be459648700488096f467a4ae6af5a9d91
+SHA1 (patch-src_node__postmortem__metadata.cc) = 9938482d724ad6636af5dc3fa719ec26ed8539ff
+SHA1 (patch-tools_gyp_pylib_gyp_generator_make.py) = 570fe9889767c555468a225cd7f0b398ea6a193c
+SHA1 (patch-tools_gyp_pylib_gyp_xcode__emulation.py) = 4ee24115f5e97ffbd23aaa6dc62f408d381d4e22
+SHA1 (patch-tools_install.py) = c01515e3001bebd50f12bcada548f1cc0c25a49f
+SHA1 (patch-tools_v8_gypfiles_v8.gyp) = a1a40e77ee2f28d9d3dec11d6d73f2deff0d4701
diff --git a/nodejs/options.mk b/nodejs/options.mk
new file mode 100644
index 0000000000..2a6e22afcf
--- /dev/null
+++ b/nodejs/options.mk
@@ -0,0 +1,35 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.node
+PKG_SUPPORTED_OPTIONS=	openssl dtrace
+PKG_SUGGESTED_OPTIONS=	openssl
+
+.include "../../mk/bsd.prefs.mk"
+
+.if (${OPSYS} == "SunOS" || ${OPSYS} == "Darwin") \
+    && exists(/usr/sbin/dtrace)
+PKG_SUGGESTED_OPTIONS+=	dtrace
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=		dtrace
+
+.if !empty(PKG_OPTIONS:Mdtrace)
+CONFIGURE_ARGS+=	--with-dtrace
+PLIST.dtrace=		yes
+.else
+CONFIGURE_ARGS+=	--without-dtrace
+.endif
+
+# print-PLIST helper
+PRINT_PLIST_AWK+=	{if ($$0 ~ /lib\/dtrace/) {$$0 = "$${PLIST.dtrace}" $$0;}}
+
+.if !empty(PKG_OPTIONS:Mopenssl)
+.include "../../security/openssl/buildlink3.mk"
+CONFIGURE_ARGS+=	--shared-openssl
+_WRAP_EXTRA_ARGS.CXX+=	${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
+CWRAPPERS_APPEND.cxx+=	${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
+.else
+CONFIGURE_ARGS+=	--without-ssl
+.endif
diff --git a/nodejs/patches/patch-common.gypi b/nodejs/patches/patch-common.gypi
new file mode 100644
index 0000000000..7f0b2f8d71
--- /dev/null
+++ b/nodejs/patches/patch-common.gypi
@@ -0,0 +1,20 @@
+$NetBSD: patch-common.gypi,v 1.8 2020/01/08 22:30:38 adam Exp $
+
+Add support for NetBSD.
+
+--- common.gypi.orig	2021-08-03 05:54:22.000000000 +0000
++++ common.gypi
+@@ -376,11 +376,11 @@
+           'BUILDING_UV_SHARED=1',
+         ],
+       }],
+-      [ 'OS in "linux freebsd openbsd solaris aix"', {
++      [ 'OS in "linux freebsd openbsd netbsd solaris aix"', {
+         'cflags': [ '-pthread' ],
+         'ldflags': [ '-pthread' ],
+       }],
+-      [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
++      [ 'OS in "linux freebsd openbsd netbsd netbsd solaris android aix cloudabi"', {
+         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
+         'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++14' ],
+         'defines': [ '__STDC_FORMAT_MACROS' ],
diff --git a/nodejs/patches/patch-deps_cares_cares.gyp b/nodejs/patches/patch-deps_cares_cares.gyp
new file mode 100644
index 0000000000..f2e9c83f6f
--- /dev/null
+++ b/nodejs/patches/patch-deps_cares_cares.gyp
@@ -0,0 +1,17 @@
+$NetBSD: patch-deps_cares_cares.gyp,v 1.2 2019/08/03 07:31:15 adam Exp $
+
+Add support for NetBSD.
+
+--- deps/cares/cares.gyp.orig	2013-03-14 10:55:24.000000000 +0900
++++ deps/cares/cares.gyp	2013-03-14 10:55:47.000000000 +0900
+@@ -140,6 +140,10 @@
+           'include_dirs': [ 'config/freebsd' ],
+           'sources': [ 'config/freebsd/ares_config.h' ]
+         }],
++        [ 'OS=="netbsd"', {
++          'include_dirs': [ 'config/netbsd' ],
++          'sources': [ 'config/netbsd/ares_config.h' ]
++        }],
+         [ 'OS=="openbsd"', {
+           'include_dirs': [ 'config/openbsd' ],
+           'sources': [ 'config/openbsd/ares_config.h' ]
diff --git a/nodejs/patches/patch-deps_uv_common.gypi b/nodejs/patches/patch-deps_uv_common.gypi
new file mode 100644
index 0000000000..053263a0eb
--- /dev/null
+++ b/nodejs/patches/patch-deps_uv_common.gypi
@@ -0,0 +1,15 @@
+$NetBSD: patch-deps_uv_common.gypi,v 1.4 2018/05/03 21:19:16 fhajny Exp $
+
+Add support for NetBSD.
+
+--- deps/uv/common.gypi.orig	2018-04-24 14:41:22.000000000 +0000
++++ deps/uv/common.gypi
+@@ -134,7 +134,7 @@
+           }]
+         ]
+       }],
+-      ['OS in "freebsd dragonflybsd linux openbsd solaris android aix"', {
++      ['OS in "freebsd dragonflybsd linux openbsd netbsd solaris android aix"', {
+         'cflags': [ '-Wall' ],
+         'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
+         'target_conditions': [
diff --git a/nodejs/patches/patch-deps_uvwasi_include_wasi__serdes.h b/nodejs/patches/patch-deps_uvwasi_include_wasi__serdes.h
new file mode 100644
index 0000000000..cd2ed785c7
--- /dev/null
+++ b/nodejs/patches/patch-deps_uvwasi_include_wasi__serdes.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-deps_uvwasi_include_wasi__serdes.h,v 1.2 2020/08/12 06:53:28 adam Exp $
+
+NetBSD<9 used to have #define uint8_t etc. which caused issues with complicated
+defines like this one.
+
+--- deps/uvwasi/include/wasi_serdes.h.orig	2020-08-11 14:32:04.000000000 +0000
++++ deps/uvwasi/include/wasi_serdes.h
+@@ -3,6 +3,13 @@
+ 
+ #include "wasi_types.h"
+ 
++#ifdef __NetBSD__
++#undef uint8_t
++#undef uint16_t
++#undef uint32_t
++#undef uint64_t
++#endif
++
+ /* Basic uint{8,16,32,64}_t read/write functions. */
+ 
+ #define BASIC_TYPE(name, type)                                                \
diff --git a/nodejs/patches/patch-deps_v8_src_base_platform_platform-freebsd.cc b/nodejs/patches/patch-deps_v8_src_base_platform_platform-freebsd.cc
new file mode 100644
index 0000000000..44d8f148ec
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_base_platform_platform-freebsd.cc
@@ -0,0 +1,33 @@
+$NetBSD: patch-deps_v8_src_base_platform_platform-freebsd.cc,v 1.3 2020/01/08 22:30:38 adam Exp $
+
+Overlapping variables, taken from https://github.com/joyent/node/issues/9175
+
+--- deps/v8/src/base/platform/platform-freebsd.cc.orig	2020-01-07 22:07:49.000000000 +0000
++++ deps/v8/src/base/platform/platform-freebsd.cc
+@@ -47,7 +47,7 @@ static unsigned StringToLong(char* buffe
+ }
+ 
+ std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+-  std::vector<SharedLibraryAddress> result;
++  std::vector<SharedLibraryAddress> address_result;
+   int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
+   size_t miblen = sizeof(mib) / sizeof(mib[0]);
+   size_t buffer_size;
+@@ -80,7 +80,7 @@ std::vector<OS::SharedLibraryAddress> OS
+           } else {
+             lib_name = std::string(path);
+           }
+-          result.push_back(SharedLibraryAddress(
++          address_result.push_back(SharedLibraryAddress(
+               lib_name, reinterpret_cast<uintptr_t>(map->kve_start),
+               reinterpret_cast<uintptr_t>(map->kve_end)));
+         }
+@@ -89,7 +89,7 @@ std::vector<OS::SharedLibraryAddress> OS
+       }
+     }
+   }
+-  return result;
++  return address_result;
+ }
+ 
+ void OS::SignalCodeMovingGC() {}
diff --git a/nodejs/patches/patch-deps_v8_src_base_platform_platform-openbsd.cc b/nodejs/patches/patch-deps_v8_src_base_platform_platform-openbsd.cc
new file mode 100644
index 0000000000..969cb2602e
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_base_platform_platform-openbsd.cc
@@ -0,0 +1,55 @@
+$NetBSD: patch-deps_v8_src_base_platform_platform-openbsd.cc,v 1.3 2017/09/27 12:17:10 fhajny Exp $
+
+Add support for NetBSD/arm.
+
+--- deps/v8/src/base/platform/platform-openbsd.cc.orig	2017-09-26 21:14:30.000000000 +0000
++++ deps/v8/src/base/platform/platform-openbsd.cc
+@@ -34,6 +34,48 @@
+ namespace v8 {
+ namespace base {
+ 
++#ifdef __arm__
++
++bool OS::ArmUsingHardFloat() {
++  // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
++  // the Floating Point ABI used (PCS stands for Procedure Call Standard).
++  // We use these as well as a couple of other defines to statically determine
++  // what FP ABI used.
++  // GCC versions 4.4 and below don't support hard-fp.
++  // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or
++  // __ARM_PCS_VFP.
++
++#define GCC_VERSION (__GNUC__ * 10000                                          \
++                     + __GNUC_MINOR__ * 100                                    \
++                     + __GNUC_PATCHLEVEL__)
++#if GCC_VERSION >= 40600
++#if defined(__ARM_PCS_VFP)
++  return true;
++#else
++  return false;
++#endif
++
++#elif GCC_VERSION < 40500
++  return false;
++
++#else
++#if defined(__ARM_PCS_VFP)
++  return true;
++#elif defined(__ARM_PCS) || defined(__SOFTFP__) || defined(__SOFTFP) || \
++      !defined(__VFP_FP__)
++  return false;
++#else
++#error "Your version of GCC does not report the FP ABI compiled for."          \
++       "Please report it on this issue"                                        \
++       "http://code.google.com/p/v8/issues/detail?id=2140";
++
++#endif
++#endif
++#undef GCC_VERSION
++}
++
++#endif  // def __arm__
++
+ TimezoneCache* OS::CreateTimezoneCache() {
+   return new PosixDefaultTimezoneCache();
+ }
diff --git a/nodejs/patches/patch-deps_v8_src_base_platform_platform-posix.cc b/nodejs/patches/patch-deps_v8_src_base_platform_platform-posix.cc
new file mode 100644
index 0000000000..5d3aea3d7d
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_base_platform_platform-posix.cc
@@ -0,0 +1,53 @@
+$NetBSD: patch-deps_v8_src_base_platform_platform-posix.cc,v 1.7 2021/04/24 06:30:28 rin Exp $
+
+Use sysconf(_SC_THREAD_STACK_MIN) instead of PTHREAD_STACK_MIN.
+Cast explicitly.
+
+Avoid using a random hint, some low numbers cause spurious ENOMEM on netbsd
+(PR port-arm/55533)
+
+--- deps/v8/src/base/platform/platform-posix.cc.orig	2021-04-07 04:42:14.000000000 +0900
++++ deps/v8/src/base/platform/platform-posix.cc	2021-04-24 07:39:15.080548801 +0900
+@@ -323,6 +323,10 @@ void* OS::GetRandomMmapAddr() {
+ #endif
+ #endif
+ #endif
++
++#if V8_OS_NETBSD && V8_TARGET_ARCH_ARM64
++  raw_addr = 0;
++#endif
+   return reinterpret_cast<void*>(raw_addr);
+ }
+ 
+@@ -564,6 +568,8 @@ int OS::GetCurrentThreadId() {
+   return static_cast<int>(syscall(__NR_gettid));
+ #elif V8_OS_ANDROID
+   return static_cast<int>(gettid());
++#elif V8_OS_NETBSD || V8_OS_FREEBSD
++  return static_cast<int>(reinterpret_cast<intptr_t>(pthread_self()));
+ #elif V8_OS_AIX
+   return static_cast<int>(thread_self());
+ #elif V8_OS_FUCHSIA
+@@ -756,8 +762,13 @@ Thread::Thread(const Options& options)
+     : data_(new PlatformData),
+       stack_size_(options.stack_size()),
+       start_semaphore_(nullptr) {
++#if V8_OS_NETBSD
++  if (stack_size_ > 0 && static_cast<size_t>(stack_size_) < sysconf(_SC_THREAD_STACK_MIN)) {
++    stack_size_ = sysconf(_SC_THREAD_STACK_MIN);
++#else
+   if (stack_size_ > 0 && static_cast<size_t>(stack_size_) < PTHREAD_STACK_MIN) {
+     stack_size_ = PTHREAD_STACK_MIN;
++#endif
+   }
+   set_name(options.name());
+ }
+@@ -773,7 +784,7 @@ static void SetThreadName(const char* na
+   pthread_set_name_np(pthread_self(), name);
+ #elif V8_OS_NETBSD
+   STATIC_ASSERT(Thread::kMaxThreadNameLength <= PTHREAD_MAX_NAMELEN_NP);
+-  pthread_setname_np(pthread_self(), "%s", name);
++  pthread_setname_np(pthread_self(), "%s", (void *)name);
+ #elif V8_OS_MACOSX
+   // pthread_setname_np is only available in 10.6 or later, so test
+   // for it at runtime.
diff --git a/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc b/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc
new file mode 100644
index 0000000000..69a94529e1
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc
@@ -0,0 +1,18 @@
+$NetBSD: patch-deps_v8_src_base_platform_semaphore.cc,v 1.6 2019/12/09 20:03:51 adam Exp $
+
+Work around lack of sem_timedwait(3) in NetBSD < 6.99.4.
+Adapted from d4f11c0cf476dd854eaebec1cbacb1afc7bea18e of the Chromium V8 sources.
+
+--- deps/v8/src/base/platform/semaphore.cc.orig	2016-10-25 13:26:03.000000000 +0000
++++ deps/v8/src/base/platform/semaphore.cc
+@@ -11,6 +11,10 @@
+ 
+ #include <errno.h>
+ 
++#if V8_OS_NETBSD
++#include <sys/param.h>	// for __NetBSD_Version__
++#endif
++
+ #include "src/base/logging.h"
+ #include "src/base/platform/elapsed-timer.h"
+ #include "src/base/platform/time.h"
diff --git a/nodejs/patches/patch-deps_v8_src_codegen_arm_cpu-arm.cc b/nodejs/patches/patch-deps_v8_src_codegen_arm_cpu-arm.cc
new file mode 100644
index 0000000000..0a713f3cb1
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_codegen_arm_cpu-arm.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-deps_v8_src_codegen_arm_cpu-arm.cc,v 1.1 2020/10/17 07:22:15 mrg Exp $
+
+port to NetBSD/arm.
+
+--- deps/v8/src/codegen/arm/cpu-arm.cc.orig	2020-10-07 10:47:41.000000000 -0700
++++ deps/v8/src/codegen/arm/cpu-arm.cc	2020-10-17 00:16:51.732785305 -0700
+@@ -19,6 +19,10 @@
+ 
+ #include "src/codegen/cpu-features.h"
+ 
++#if V8_OS_NETBSD
++#include <machine/sysarch.h>
++#endif
++
+ namespace v8 {
+ namespace internal {
+ 
+@@ -32,6 +36,8 @@
+   struct arm_sync_icache_args args = {
+       .addr = reinterpret_cast<uintptr_t>(start), .len = size};
+   sysarch(ARM_SYNC_ICACHE, reinterpret_cast<void*>(&args));
++#elif V8_OS_NETBSD
++  arm_sync_icache(reinterpret_cast<uintptr_t>(start), size);
+ #else
+   register uint32_t beg asm("r0") = reinterpret_cast<uint32_t>(start);
+   register uint32_t end asm("r1") = beg + size;
diff --git a/nodejs/patches/patch-deps_v8_src_common_globals.h b/nodejs/patches/patch-deps_v8_src_common_globals.h
new file mode 100644
index 0000000000..5dffb477bf
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_common_globals.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-deps_v8_src_common_globals.h,v 1.1 2019/12/09 20:03:51 adam Exp $
+
+stdarg.h is needed for va_list on at least NetBSD.
+
+--- deps/v8/src/common/globals.h.orig	2019-11-19 08:29:07.000000000 +0000
++++ deps/v8/src/common/globals.h
+@@ -7,6 +7,7 @@
+ 
+ #include <stddef.h>
+ #include <stdint.h>
++#include <stdarg.h>
+ 
+ #include <limits>
+ #include <ostream>
diff --git a/nodejs/patches/patch-deps_v8_src_compiler_types.h b/nodejs/patches/patch-deps_v8_src_compiler_types.h
new file mode 100644
index 0000000000..05b177133e
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_src_compiler_types.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-deps_v8_src_compiler_types.h,v 1.3 2019/12/09 20:03:51 adam Exp $
+
+NetBSD 6 doesn't have nearbyint/nearbyintf.
+
+--- deps/v8/src/compiler/types.h.orig	2019-11-19 08:29:07.000000000 +0000
++++ deps/v8/src/compiler/types.h
+@@ -5,6 +5,14 @@
+ #ifndef V8_COMPILER_TYPES_H_
+ #define V8_COMPILER_TYPES_H_
+ 
++#ifdef __NetBSD__
++#include <sys/param.h>
++#if __NetBSD_Version__ - 0 < 699001700
++#define nearbyint rint
++#define nearbyintf rintf
++#endif
++#endif
++
+ #include "src/base/compiler-specific.h"
+ #include "src/common/globals.h"
+ #include "src/compiler/heap-refs.h"
diff --git a/nodejs/patches/patch-deps_v8_tools_run-llprof.sh b/nodejs/patches/patch-deps_v8_tools_run-llprof.sh
new file mode 100644
index 0000000000..6f699231a7
--- /dev/null
+++ b/nodejs/patches/patch-deps_v8_tools_run-llprof.sh
@@ -0,0 +1,15 @@
+$NetBSD: patch-deps_v8_tools_run-llprof.sh,v 1.1 2015/04/30 15:04:56 ryoon Exp $
+
+POSIX shell portability.
+
+--- deps/v8/tools/run-llprof.sh.orig	2015-03-31 22:13:01.000000000 +0000
++++ deps/v8/tools/run-llprof.sh
+@@ -46,7 +46,7 @@ framework, then calls the low level tick
+ EOF
+ }
+ 
+-if [ $# -eq 0 ] || [ "$1" == "-h" ]  || [ "$1" == "--help" ] ; then
++if [ $# -eq 0 ] || [ "$1" = "-h" ]  || [ "$1" = "--help" ] ; then
+   usage
+   exit 1
+ fi
diff --git a/nodejs/patches/patch-node.gyp b/nodejs/patches/patch-node.gyp
new file mode 100644
index 0000000000..abf928d7ce
--- /dev/null
+++ b/nodejs/patches/patch-node.gyp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Avoid building vendored OpenSSL.
+
+--- node.gyp.orig	2022-03-01 10:28:22.000000000 +0000
++++ node.gyp
+@@ -1393,7 +1393,7 @@
+       ]
+     }], # end aix section
+     # TODO(RaisinTen): Enable this to build on other platforms as well.
+-    ['(OS=="mac" or (OS=="linux" and target_arch=="x64")) and \
++    ['(OS=="linux" and target_arch=="x64") and \
+       node_use_openssl=="true"', {
+       'targets': [
+         {
diff --git a/nodejs/patches/patch-node.gypi b/nodejs/patches/patch-node.gypi
new file mode 100644
index 0000000000..f57dc7ba3c
--- /dev/null
+++ b/nodejs/patches/patch-node.gypi
@@ -0,0 +1,14 @@
+$NetBSD: patch-node.gypi,v 1.1 2018/05/12 08:59:56 fhajny Exp $
+
+Linking in libcares requires libsocket.
+
+--- node.gypi.orig	2018-04-24 14:41:37.000000000 +0000
++++ node.gypi
+@@ -251,6 +251,7 @@
+     [ 'OS=="solaris"', {
+       'libraries': [
+         '-lkstat',
++        '-lsocket',
+         '-lumem',
+       ],
+       'defines!': [
diff --git a/nodejs/patches/patch-src_inspector__agent.cc b/nodejs/patches/patch-src_inspector__agent.cc
new file mode 100644
index 0000000000..62acf335cb
--- /dev/null
+++ b/nodejs/patches/patch-src_inspector__agent.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_inspector__agent.cc,v 1.3 2019/12/09 20:03:51 adam Exp $
+
+--- src/inspector_agent.cc.orig	2019-11-19 08:29:09.000000000 +0000
++++ src/inspector_agent.cc
+@@ -112,7 +112,7 @@ static int StartDebugSignalHandler() {
+   CHECK_EQ(0, uv_sem_init(&start_io_thread_semaphore, 0));
+   pthread_attr_t attr;
+   CHECK_EQ(0, pthread_attr_init(&attr));
+-#if defined(PTHREAD_STACK_MIN) && !defined(__FreeBSD__)
++#if defined(PTHREAD_STACK_MIN) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+   // PTHREAD_STACK_MIN is 2 KB with musl libc, which is too small to safely
+   // receive signals. PTHREAD_STACK_MIN + MINSIGSTKSZ is 8 KB on arm64, which
+   // is the musl architecture with the biggest MINSIGSTKSZ so let's use that
diff --git a/nodejs/patches/patch-src_node__postmortem__metadata.cc b/nodejs/patches/patch-src_node__postmortem__metadata.cc
new file mode 100644
index 0000000000..8558b545c1
--- /dev/null
+++ b/nodejs/patches/patch-src_node__postmortem__metadata.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_node__postmortem__metadata.cc,v 1.1 2018/03/23 21:07:53 joerg Exp $
+
+--- src/node_postmortem_metadata.cc.orig	2018-03-23 20:05:49.909811719 +0000
++++ src/node_postmortem_metadata.cc
+@@ -11,6 +11,10 @@
+ #define NODEDBG_OFFSET(Class, Member, Type) \
+     NODEDBG_SYMBOL(offset_ ## Class ## __ ## Member ## __ ## Type)
+ 
++// Some systems provide macros for the types as well, which get expanded
++// by the nested macros here.
++#undef uintptr_t
++
+ // These are the constants describing Node internal structures. Every constant
+ // should use the format described above.  These constants are declared as
+ // global integers so that they'll be present in the generated node binary. They
diff --git a/nodejs/patches/patch-tools_gyp_pylib_gyp_generator_make.py b/nodejs/patches/patch-tools_gyp_pylib_gyp_generator_make.py
new file mode 100644
index 0000000000..12a462a8fb
--- /dev/null
+++ b/nodejs/patches/patch-tools_gyp_pylib_gyp_generator_make.py
@@ -0,0 +1,25 @@
+$NetBSD: patch-tools_gyp_pylib_gyp_generator_make.py,v 1.4 2020/10/08 10:58:35 adam Exp $
+
+Use the system libtool on Darwin.
+Add support for NetBSD and DragonFly.
+
+--- tools/gyp/pylib/gyp/generator/make.py.orig	2021-08-03 05:54:27.000000000 +0000
++++ tools/gyp/pylib/gyp/generator/make.py
+@@ -179,7 +179,7 @@ cmd_solink_module = $(LINK.$(TOOLSET)) -
+ 
+ LINK_COMMANDS_MAC = """\
+ quiet_cmd_alink = LIBTOOL-STATIC $@
+-cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
++cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool /usr/bin/libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
+ 
+ quiet_cmd_link = LINK($(TOOLSET)) $@
+ cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
+@@ -2335,7 +2335,7 @@ def GenerateOutput(target_list, target_d
+                 "flock_index": 2,
+             }
+         )
+-    elif flavor == "freebsd":
++    elif flavor == "freebsd" or flavor == 'dragonflybsd' or flavor == 'netbsd':
+         # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
+         header_params.update({"flock": "lockf"})
+     elif flavor == "openbsd":
diff --git a/nodejs/patches/patch-tools_gyp_pylib_gyp_xcode__emulation.py b/nodejs/patches/patch-tools_gyp_pylib_gyp_xcode__emulation.py
new file mode 100644
index 0000000000..da8c3807b9
--- /dev/null
+++ b/nodejs/patches/patch-tools_gyp_pylib_gyp_xcode__emulation.py
@@ -0,0 +1,24 @@
+$NetBSD: patch-tools_gyp_pylib_gyp_xcode__emulation.py,v 1.2 2020/10/08 10:58:35 adam Exp $
+
+Do not generate debugging symbols (uses lots of disk space).
+
+--- tools/gyp/pylib/gyp/xcode_emulation.py.orig	2020-10-07 17:47:43.000000000 +0000
++++ tools/gyp/pylib/gyp/xcode_emulation.py
+@@ -610,7 +610,7 @@ class XcodeSettings(object):
+ 
+         self._Appendf(cflags, "GCC_OPTIMIZATION_LEVEL", "-O%s", default="s")
+ 
+-        if self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES"):
++        if self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="NO"):
+             dbg_format = self._Settings().get("DEBUG_INFORMATION_FORMAT", "dwarf")
+             if dbg_format == "dwarf":
+                 cflags.append("-gdwarf-2")
+@@ -1097,7 +1097,7 @@ class XcodeSettings(object):
+         # For static libraries, no dSYMs are created.
+         result = []
+         if (
+-            self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES")
++            self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="NO")
+             and self._Test(
+                 "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym", default="dwarf"
+             )
diff --git a/nodejs/patches/patch-tools_install.py b/nodejs/patches/patch-tools_install.py
new file mode 100644
index 0000000000..34ac11eecf
--- /dev/null
+++ b/nodejs/patches/patch-tools_install.py
@@ -0,0 +1,18 @@
+$NetBSD: patch-tools_install.py,v 1.6 2019/12/09 20:03:51 adam Exp $
+
+Install man pages under the right directory.
+
+--- tools/install.py.orig	2021-09-10 17:25:14.000000000 +0000
++++ tools/install.py
+@@ -156,10 +156,7 @@ def files(action):
+   action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
+   action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/')
+ 
+-  if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
+-    action(['doc/node.1'], 'man/man1/')
+-  else:
+-    action(['doc/node.1'], 'share/man/man1/')
++  action(['doc/node.1'], os.environ.get('PKGMANDIR') + '/man1/')
+ 
+   if 'true' == variables.get('node_install_npm'):
+     npm_files(action)
diff --git a/nodejs/patches/patch-tools_v8_gypfiles_v8.gyp b/nodejs/patches/patch-tools_v8_gypfiles_v8.gyp
new file mode 100644
index 0000000000..df9a87d1cf
--- /dev/null
+++ b/nodejs/patches/patch-tools_v8_gypfiles_v8.gyp
@@ -0,0 +1,19 @@
+$NetBSD: patch-tools_v8_gypfiles_v8.gyp,v 1.1 2020/10/17 21:48:41 mrg Exp $
+
+Add -larm on netbsd arm platforms.
+
+--- tools/v8_gypfiles/v8.gyp.orig	2021-08-03 05:54:27.000000000 +0000
++++ tools/v8_gypfiles/v8.gyp
+@@ -951,6 +951,12 @@
+         }],
+         # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
+         # to implement atomic memory access
++        # NetBSD/arm also needs -larm.
++        ['OS == "netbsd" and v8_current_cpu in ["arm"]', {
++          'link_settings': {
++            'libraries': ['-larm', ],
++          },
++        }],
+         ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64"]', {
+           'link_settings': {
+             'libraries': ['-latomic', ],


Home | Main Index | Thread Index | Old Index