diff options
Diffstat (limited to 'meta-oe/recipes-devtools/nodejs/nodejs')
15 files changed, 500 insertions, 288 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps.patch index 5d0dc03b66..12f6cd8b96 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps.patch @@ -1,26 +1,46 @@ -From c2aff16cc196a61f4ab1cdae4a91c7926123c239 Mon Sep 17 00:00:00 2001 +From 7d94bfe53beeb2d25eb5f2ff6b1d509df7e6ab80 Mon Sep 17 00:00:00 2001 From: Zuzana Svetlikova <zsvetlik@redhat.com> Date: Thu, 27 Apr 2017 14:25:42 +0200 Subject: [PATCH] Disable running gyp on shared deps +Upstream-Status: Inappropriate [embedded specific] + +Probably imported from: +https://src.fedoraproject.org/rpms/nodejs/c/41af04f2a3c050fb44628e91ac65fd225b927acb?branch=22609d8c1bfeaa21fe0057645af20b3a2ccc7f53 +which is probably based on dont-run-gyp-files-for-bundled-deps.patch added in: +https://github.com/alpinelinux/aports/commit/6662eb3199902e8451fb20dce82554ad96f796bb + +We also explicitly prune some dependencies from source in the bitbake recipe: + +python prune_sources() { + import shutil + + shutil.rmtree(d.getVar('S') + '/deps/openssl') + if 'ares' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/cares') + if 'brotli' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/brotli') + if 'libuv' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/uv') + if 'nghttp2' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/nghttp2') + if 'zlib' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/zlib') +} +do_unpack[postfuncs] += "prune_sources" + --- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/Makefile b/Makefile -index a98772f..f5663e2 100644 --- a/Makefile +++ b/Makefile -@@ -123,8 +123,8 @@ with-code-cache: - test-code-cache: with-code-cache - $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) code-cache +@@ -169,7 +169,7 @@ with-code-cache test-code-cache: + $(warning '$@' target is a noop) --out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ -- deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ -+out/Makefile: common.gypi deps/http_parser/http_parser.gyp \ -+ deps/v8/gypfiles/toolchain.gypi \ - deps/v8/gypfiles/features.gypi deps/v8/gypfiles/v8.gyp node.gyp \ - config.gypi - $(PYTHON) tools/gyp_node.py -f make --- -2.19.2 + out/Makefile: config.gypi common.gypi node.gyp \ +- deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \ ++ deps/llhttp/llhttp.gyp \ + deps/simdutf/simdutf.gyp deps/ada/ada.gyp \ + tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ + tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch new file mode 100644 index 0000000000..0178cec777 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch @@ -0,0 +1,94 @@ +From 6c3ac20477a4bac643088f24df3c042e627fafa9 Mon Sep 17 00:00:00 2001 +From: Guillaume Burel <guillaume.burel@stormshield.eu> +Date: Fri, 3 Jan 2020 11:25:54 +0100 +Subject: [PATCH] Using native binaries + +Upstream-Status: Inappropriate [embedded specific] + +Originally added in: +https://git.openembedded.org/meta-openembedded/commit/?id=1c8e4a679ae382f953b2e5c7a4966a4646314f3e +later extended and renamed in: +https://git.openembedded.org/meta-openembedded/commit/?id=feeb172d1a8bf010490d22b8df9448b20d9d2aed + +Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> +--- + node.gyp | 3 + + tools/v8_gypfiles/v8.gyp | 5 +++++ + 2 files changed, 6 insertions(+) + +diff --git a/node.gyp b/node.gyp +index e8e1d9f9..e60ccc10 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -320,6 +320,7 @@ + 'action_name': 'node_mksnapshot', + 'process_outputs_as_sources': 1, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(node_mksnapshot_exec)', + '<(node_snapshot_main)', + ], +@@ -935,6 +935,7 @@ + 'action_name': 'node_js2c', + 'process_outputs_as_sources': 1, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(node_js2c_exec)', + '<@(library_files)', + '<@(deps_files)', +@@ -944,6 +945,7 @@ + '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', + ], + 'action': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(node_js2c_exec)', + '<@(_outputs)', + 'lib', + +diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp +index 42e26cd9..bc721991 100644 +--- a/tools/v8_gypfiles/v8.gyp ++++ b/tools/v8_gypfiles/v8.gyp +@@ -68,6 +68,7 @@ + { + 'action_name': 'run_torque_action', + 'inputs': [ # Order matters. ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', + '<@(torque_files)', + ], +@@ -99,6 +100,7 @@ + '<@(torque_outputs_inc)', + ], + 'action': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', + '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated', + '-v8-root', '<(V8_ROOT)', +@@ -211,6 +213,7 @@ + { + 'action_name': 'generate_bytecode_builtins_list_action', + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', + ], + 'outputs': [ +@@ -400,6 +403,7 @@ + ], + }, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(mksnapshot_exec)', + ], + 'outputs': [ +@@ -1539,6 +1543,7 @@ + { + 'action_name': 'run_gen-regexp-special-case_action', + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', + ], + 'outputs': [ +-- +2.34.1 + diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-fix-build-with-Python-3.12.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-fix-build-with-Python-3.12.patch new file mode 100644 index 0000000000..39026d0742 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-fix-build-with-Python-3.12.patch @@ -0,0 +1,55 @@ +From 656f6c91f1da7f1e1ffb01e2de7d9026a84958b5 Mon Sep 17 00:00:00 2001 +From: Luigi Pinca <luigipinca@gmail.com> +Date: Wed, 8 Nov 2023 21:20:53 +0100 +Subject: [PATCH] build: fix build with Python 3.12 + +Replace `distutils.version.StrictVersion` with +`packaging.version.Version`. + +Refs: https://github.com/nodejs/node/pull/50209#issuecomment-1795852539 +PR-URL: https://github.com/nodejs/node/pull/50582 +Reviewed-By: Richard Lau <rlau@redhat.com> +Reviewed-By: Chengzhong Wu <legendecas@gmail.com> + +Upstream-Status: Backport [https://github.com/nodejs/node/commit/95534ad82f4e33f53fd50efe633d43f8da70cba6] +Signed-off-by: Alexander Kanavin <alex@linutronix.de> +--- + configure.py | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/configure.py b/configure.py +index 62f041ce..18fe7c14 100755 +--- a/configure.py ++++ b/configure.py +@@ -14,8 +14,6 @@ import bz2 + import io + from pathlib import Path + +-from distutils.version import StrictVersion +- + # If not run from node/, cd to node/. + os.chdir(Path(__file__).parent) + +@@ -30,6 +28,7 @@ tools_path = Path('tools') + + sys.path.insert(0, str(tools_path / 'gyp' / 'pylib')) + from gyp.common import GetFlavor ++from packaging.version import Version + + # imports in tools/configure.d + sys.path.insert(0, str(tools_path / 'configure.d')) +@@ -1565,10 +1564,10 @@ def configure_openssl(o): + # supported asm compiler for AVX2. See https://github.com/openssl/openssl/ + # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69 + openssl110_asm_supported = \ +- ('gas_version' in variables and StrictVersion(variables['gas_version']) >= StrictVersion('2.23')) or \ +- ('xcode_version' in variables and StrictVersion(variables['xcode_version']) >= StrictVersion('5.0')) or \ +- ('llvm_version' in variables and StrictVersion(variables['llvm_version']) >= StrictVersion('3.3')) or \ +- ('nasm_version' in variables and StrictVersion(variables['nasm_version']) >= StrictVersion('2.10')) ++ ('gas_version' in variables and Version(variables['gas_version']) >= Version('2.23')) or \ ++ ('xcode_version' in variables and Version(variables['xcode_version']) >= Version('5.0')) or \ ++ ('llvm_version' in variables and Version(variables['llvm_version']) >= Version('3.3')) or \ ++ ('nasm_version' in variables and Version(variables['nasm_version']) >= Version('2.10')) + + if is_x86 and not openssl110_asm_supported: + error('''Did not find a new enough assembler, install one or build with diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-gyp-resolve-python-3.12-issues.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-gyp-resolve-python-3.12-issues.patch new file mode 100644 index 0000000000..9d878dfb8d --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-gyp-resolve-python-3.12-issues.patch @@ -0,0 +1,63 @@ +From bf8c96ba6936050ed4a0de5bc8aeeaf2b3c50dc1 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex@linutronix.de> +Date: Thu, 7 Dec 2023 12:54:30 +0100 +Subject: [PATCH] gyp: resolve python 3.12 issues + +Upstream has updated gyp wholesale in the main branch, so +this patch can be dropped in due time. + +Upstream-Status: Inappropriate [issue will be fixed upstream with the next nodejs LTS update] + +Signed-off-by: Alexander Kanavin <alex@linutronix.de> +--- + deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 4 ++-- + tools/gyp/pylib/gyp/input.py | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +index d9699a0a..173e9465 100644 +--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py ++++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +@@ -16,7 +16,7 @@ import subprocess + import sys + import threading + import traceback +-from distutils.version import StrictVersion ++from packaging.version import Version + from gyp.common import GypError + from gyp.common import OrderedSet + +@@ -1183,7 +1183,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil + else: + ast_code = compile(cond_expr_expanded, "<string>", "eval") + cached_conditions_asts[cond_expr_expanded] = ast_code +- env = {"__builtins__": {}, "v": StrictVersion} ++ env = {"__builtins__": {}, "v": Version} + if eval(ast_code, env, variables): + return true_dict + return false_dict +diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py +index 354958bf..ab6112e5 100644 +--- a/tools/gyp/pylib/gyp/input.py ++++ b/tools/gyp/pylib/gyp/input.py +@@ -16,7 +16,7 @@ import subprocess + import sys + import threading + import traceback +-from distutils.version import StrictVersion ++from packaging.version import Version + from gyp.common import GypError + from gyp.common import OrderedSet + +@@ -1190,7 +1190,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil + else: + ast_code = compile(cond_expr_expanded, "<string>", "eval") + cached_conditions_asts[cond_expr_expanded] = ast_code +- env = {"__builtins__": {}, "v": StrictVersion} ++ env = {"__builtins__": {}, "v": Version} + if eval(ast_code, env, variables): + return true_dict + return false_dict +-- +2.39.2 + diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-liftoff-Correct-function-signatures.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-liftoff-Correct-function-signatures.patch new file mode 100644 index 0000000000..5af87d866e --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-liftoff-Correct-function-signatures.patch @@ -0,0 +1,71 @@ +From dc3652c0abcdf8573fd044907b19d8eda7ca1124 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 3 Jul 2023 12:33:16 +0000 +Subject: [PATCH] [liftoff] Correct function signatures + +Fixes builds on mips where clang reports an error +../deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h:661:5: error: no matching member function for call to 'Move' + Move(tmp, src, type.value_type()); + ^~~~ + +Upstream-Status: Submitted [https://chromium-review.googlesource.com/c/v8/v8/+/3235674] + +Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> +--- + deps/v8/src/wasm/baseline/liftoff-assembler.h | 6 +++--- + deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h | 2 +- + deps/v8/src/wasm/baseline/riscv/liftoff-assembler-riscv64.h | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/deps/v8/src/wasm/baseline/liftoff-assembler.h b/deps/v8/src/wasm/baseline/liftoff-assembler.h +index aef63c64..f2a11b01 100644 +--- a/deps/v8/src/wasm/baseline/liftoff-assembler.h ++++ b/deps/v8/src/wasm/baseline/liftoff-assembler.h +@@ -717,7 +717,7 @@ class LiftoffAssembler : public MacroAssembler { + void FinishCall(const ValueKindSig*, compiler::CallDescriptor*); + + // Move {src} into {dst}. {src} and {dst} must be different. +- void Move(LiftoffRegister dst, LiftoffRegister src, ValueKind); ++ void Move(LiftoffRegister dst, LiftoffRegister src, ValueKind kind); + + // Parallel register move: For a list of tuples <dst, src, kind>, move the + // {src} register of kind {kind} into {dst}. If {src} equals {dst}, ignore +@@ -884,8 +884,8 @@ class LiftoffAssembler : public MacroAssembler { + inline void MoveStackValue(uint32_t dst_offset, uint32_t src_offset, + ValueKind); + +- inline void Move(Register dst, Register src, ValueKind); +- inline void Move(DoubleRegister dst, DoubleRegister src, ValueKind); ++ inline void Move(Register dst, Register src, ValueKind kind); ++ inline void Move(DoubleRegister dst, DoubleRegister src, ValueKind kind); + + inline void Spill(int offset, LiftoffRegister, ValueKind); + inline void Spill(int offset, WasmValue); +diff --git a/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h b/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h +index 96cba24c..53e1842d 100644 +--- a/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h ++++ b/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h +@@ -592,7 +592,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, + pinned.set(dst_op.rm()); + LiftoffRegister tmp = GetUnusedRegister(src.reg_class(), pinned); + // Save original value. +- Move(tmp, src, type.value_type()); ++ Move(tmp, src, type.value_type().kind()); + + src = tmp; + pinned.set(tmp); +diff --git a/deps/v8/src/wasm/baseline/riscv/liftoff-assembler-riscv64.h b/deps/v8/src/wasm/baseline/riscv/liftoff-assembler-riscv64.h +index 1d6ae09e..397e82b2 100644 +--- a/deps/v8/src/wasm/baseline/riscv/liftoff-assembler-riscv64.h ++++ b/deps/v8/src/wasm/baseline/riscv/liftoff-assembler-riscv64.h +@@ -286,7 +286,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, + pinned.set(dst_op.rm()); + LiftoffRegister tmp = GetUnusedRegister(src.reg_class(), pinned); + // Save original value. +- Move(tmp, src, type.value_type()); ++ Move(tmp, src, type.value_type().kind()); + + src = tmp; + pinned.set(tmp); +-- +2.40.0 diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch new file mode 100644 index 0000000000..dd9c9015e2 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch @@ -0,0 +1,25 @@ +From 0976af0f3b328436ea44a74a406f311adb2ab211 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 15 Jun 2021 19:01:31 -0700 +Subject: [PATCH] ppc64: Do not use -mminimal-toc with clang + +clang does not support this option + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + common.gypi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/common.gypi ++++ b/common.gypi +@@ -417,7 +417,7 @@ + 'ldflags': [ '-m32' ], + }], + [ 'target_arch=="ppc64" and OS!="aix"', { +- 'cflags': [ '-m64', '-mminimal-toc' ], ++ 'cflags': [ '-m64' ], + 'ldflags': [ '-m64' ], + }], + [ 'target_arch=="s390x"', { diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-torque.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-torque.patch deleted file mode 100644 index e9035f9eb3..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-torque.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 4bbee5e3d58bc4911999f3ec2cc5aab8ded6717b Mon Sep 17 00:00:00 2001 -From: "Winker Matthias (TT-CA/ENG1)" <Matthias.Winker@de.bosch.com> -Date: Tue, 11 Dec 2018 10:44:29 +0100 -Subject: [PATCH] Using native torque - ---- - deps/v8/gypfiles/v8.gyp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/deps/v8/gypfiles/v8.gyp b/deps/v8/gypfiles/v8.gyp -index 8c78f02255..434168844e 100644 ---- a/deps/v8/gypfiles/v8.gyp -+++ b/deps/v8/gypfiles/v8.gyp -@@ -2831,7 +2831,6 @@ - { - 'action_name': 'run_torque', - 'inputs': [ # Order matters. -- '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', - '../src/builtins/base.tq', - '../src/builtins/array.tq', - '../src/builtins/typed-array.tq', -@@ -2845,7 +2844,10 @@ - '<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtins-typed-array-from-dsl-gen.cc', - '<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtins-typed-array-from-dsl-gen.h', - ], -- 'action': ['<@(_inputs)', '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated'], -+ 'action': [ -+ 'torque', -+ '<@(_inputs)', -+ '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated'], - }, - ], - }, # torque --- -2.19.2 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0003-Crypto-reduce-memory-usage-of-SignFinal.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0003-Crypto-reduce-memory-usage-of-SignFinal.patch deleted file mode 100644 index ed3bac39bd..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0003-Crypto-reduce-memory-usage-of-SignFinal.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 20282b1cb0389553421c4c5b14de198c5dfff50b Mon Sep 17 00:00:00 2001 -From: Anna Henningsen <anna@addaleax.net> -Date: Sat, 20 Oct 2018 05:24:54 +0200 -Subject: [PATCH] src: use more explicit return type in Sign::SignFinal() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Using the non-indexed variant of `std::get<>` broke Travis CI. -Also, this allows us to be a bit more concise when returning -from `SignFinal()` due to some error condition. - -Refs: https://github.com/nodejs/node/pull/23427 - -PR-URL: https://github.com/nodejs/node/pull/23779 -Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> -Reviewed-By: Tobias Nießen <tniessen@tnie.de> -Reviewed-By: Refael Ackermann <refack@gmail.com> -Reviewed-By: Colin Ihrig <cjihrig@gmail.com> ---- - src/node_crypto.cc | 23 +++++++++++------------ - src/node_crypto.h | 12 +++++++++++- - 2 files changed, 22 insertions(+), 13 deletions(-) - -diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index bd8d9e032554..ec7d4f2bb5be 100644 ---- a/src/node_crypto.cc -+++ b/src/node_crypto.cc -@@ -3562,22 +3562,20 @@ static MallocedBuffer<unsigned char> Node_SignFinal(EVPMDPointer&& mdctx, - return MallocedBuffer<unsigned char>(); - } - --std::pair<SignBase::Error, MallocedBuffer<unsigned char>> Sign::SignFinal( -+Sign::SignResult Sign::SignFinal( - const char* key_pem, - int key_pem_len, - const char* passphrase, - int padding, - int salt_len) { -- MallocedBuffer<unsigned char> buffer; -- - if (!mdctx_) -- return std::make_pair(kSignNotInitialised, std::move(buffer)); -+ return SignResult(kSignNotInitialised); - - EVPMDPointer mdctx = std::move(mdctx_); - - BIOPointer bp(BIO_new_mem_buf(const_cast<char*>(key_pem), key_pem_len)); - if (!bp) -- return std::make_pair(kSignPrivateKey, std::move(buffer)); -+ return SignResult(kSignPrivateKey); - - EVPKeyPointer pkey(PEM_read_bio_PrivateKey(bp.get(), - nullptr, -@@ -3588,7 +3586,7 @@ std::pair<SignBase::Error, MallocedBuffer<unsigned char>> Sign::SignFinal( - // without `pkey` being set to nullptr; - // cf. the test of `test_bad_rsa_privkey.pem` for an example. - if (!pkey || 0 != ERR_peek_error()) -- return std::make_pair(kSignPrivateKey, std::move(buffer)); -+ return SignResult(kSignPrivateKey); - - #ifdef NODE_FIPS_MODE - /* Validate DSA2 parameters from FIPS 186-4 */ -@@ -3612,9 +3610,10 @@ std::pair<SignBase::Error, MallocedBuffer<unsigned char>> Sign::SignFinal( - } - #endif // NODE_FIPS_MODE - -- buffer = Node_SignFinal(std::move(mdctx), pkey, padding, salt_len); -+ MallocedBuffer<unsigned char> buffer = -+ Node_SignFinal(std::move(mdctx), pkey, padding, salt_len); - Error error = buffer.is_empty() ? kSignPrivateKey : kSignOk; -- return std::make_pair(error, std::move(buffer)); -+ return SignResult(error, std::move(buffer)); - } - - -@@ -3639,18 +3638,18 @@ void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) { - - ClearErrorOnReturn clear_error_on_return; - -- std::pair<Error, MallocedBuffer<unsigned char>> ret = sign->SignFinal( -+ SignResult ret = sign->SignFinal( - buf, - buf_len, - len >= 2 && !args[1]->IsNull() ? *passphrase : nullptr, - padding, - salt_len); - -- if (std::get<Error>(ret) != kSignOk) -- return sign->CheckThrow(std::get<Error>(ret)); -+ if (ret.error != kSignOk) -+ return sign->CheckThrow(ret.error); - - MallocedBuffer<unsigned char> sig = -- std::move(std::get<MallocedBuffer<unsigned char>>(ret)); -+ std::move(ret.signature); - - Local<Object> rc = - Buffer::New(env, reinterpret_cast<char*>(sig.release()), sig.size) -diff --git a/src/node_crypto.h b/src/node_crypto.h -index 6fcf737f6c43..0c26c1f6ff1d 100644 ---- a/src/node_crypto.h -+++ b/src/node_crypto.h -@@ -518,7 +518,17 @@ class Sign : public SignBase { - public: - static void Initialize(Environment* env, v8::Local<v8::Object> target); - -- std::pair<Error, MallocedBuffer<unsigned char>> SignFinal( -+ struct SignResult { -+ Error error; -+ MallocedBuffer<unsigned char> signature; -+ -+ explicit SignResult( -+ Error err, -+ MallocedBuffer<unsigned char>&& sig = MallocedBuffer<unsigned char>()) -+ : error(err), signature(std::move(sig)) {} -+ }; -+ -+ SignResult SignFinal( - const char* key_pem, - int key_pem_len, - const char* passphrase, diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0004-Make-compatibility-with-gcc-4.8.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0004-Make-compatibility-with-gcc-4.8.patch deleted file mode 100644 index 925c085e9b..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0004-Make-compatibility-with-gcc-4.8.patch +++ /dev/null @@ -1,69 +0,0 @@ -Implement function as wrapper for std::make_unique -method to be compatible with gcc < 4.9 . -"error::make_unique is not a member of 'std'" - -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> -Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> - -diff -Naur node-v10.15.1/src/cares_wrap.cc node-v10.15.1/src/cares_wrap.cc ---- node-v10.15.1/src/cares_wrap.cc 2019-01-29 08:20:50.000000000 +0100 -+++ node-v10.15.1/src/cares_wrap.cc 2019-02-21 16:22:25.489131665 +0100 -@@ -52,6 +52,16 @@ - # define AI_V4MAPPED 0 - #endif - -+#ifndef __cpp_lib_make_unique -+namespace std { -+ /// make_unique implementation -+ template<typename T, typename... Args> -+ std::unique_ptr<T> make_unique(Args&&... args) { -+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); -+ } -+} -+#endif -+ - namespace node { - namespace cares_wrap { - -diff -Naur node-v10.15.1/src/inspector_agent.cc node-v10.15.1/src/inspector_agent.cc ---- node-v10.15.1/src/inspector_agent.cc 2019-01-29 08:20:50.000000000 +0100 -+++ node-v10.15.1/src/inspector_agent.cc 2019-02-21 16:22:09.000185992 +0100 -@@ -24,6 +24,16 @@ - #include <pthread.h> - #endif // __POSIX__ - -+#ifndef __cpp_lib_make_unique -+namespace std { -+ /// make_unique implementation -+ template<typename T, typename... Args> -+ std::unique_ptr<T> make_unique(Args&&... args) { -+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); -+ } -+} -+#endif -+ - namespace node { - namespace inspector { - namespace { - -diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc -index e374c0fd70..05d7d8c60f 100644 ---- a/src/inspector/main_thread_interface.cc -+++ b/src/inspector/main_thread_interface.cc -@@ -6,6 +6,16 @@ - #include <functional> - #include <unicode/unistr.h> - -+#ifndef __cpp_lib_make_unique -+namespace std { -+ /// make_unique implementation -+ template<typename T, typename... Args> -+ std::unique_ptr<T> make_unique(Args&&... args) { -+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); -+ } -+} -+#endif -+ - namespace node { - namespace inspector { - namespace { diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0004-v8-don-t-override-ARM-CFLAGS.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0004-v8-don-t-override-ARM-CFLAGS.patch new file mode 100644 index 0000000000..97ed972cee --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0004-v8-don-t-override-ARM-CFLAGS.patch @@ -0,0 +1,102 @@ +From 47ee5cc5501289205d3e8e9f27ea9daf18cebac1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net> +Date: Sat, 9 Nov 2019 14:45:30 +0000 +Subject: [PATCH] v8: don't override ARM CFLAGS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This overrides yocto-provided build flags with its own, e.g we get + arm-poky-linux-musleabi-g++ -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 \ + ... \ + -march=armv7-a -mfpu=neon -mfloat-abi=hard -marm + +Causing the latter to override the former, and compiler warnings: + cc1plus: warning: switch '-mcpu=cortex-a7' conflicts with '-march=armv7-a' switch + +Patch this out, so that yocto-provided flags take precedence. +Note that in reality the same should probably be done for all the other +supported architectures, too. + +Note that this also switches to Thumb(2) mode (in my case). No obvious +problems have been noted during compilation or runtime. + +Upstream-Status: Inappropriate [oe-specific] +Signed-off-by: André Draszik <git@andred.net> +--- + tools/v8_gypfiles/toolchain.gypi | 52 ++------------------------------ + 1 file changed, 2 insertions(+), 50 deletions(-) + +diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi +index 264b3e478e..0b41848145 100644 +--- a/tools/v8_gypfiles/toolchain.gypi ++++ b/tools/v8_gypfiles/toolchain.gypi +@@ -211,31 +211,7 @@ + 'target_conditions': [ + ['_toolset=="host"', { + 'conditions': [ +- ['v8_target_arch==host_arch', { +- # Host built with an Arm CXX compiler. +- 'conditions': [ +- [ 'arm_version==7', { +- 'cflags': ['-march=armv7-a',], +- }], +- [ 'arm_version==7 or arm_version=="default"', { +- 'conditions': [ +- [ 'arm_fpu!="default"', { +- 'cflags': ['-mfpu=<(arm_fpu)',], +- }], +- ], +- }], +- [ 'arm_float_abi!="default"', { +- 'cflags': ['-mfloat-abi=<(arm_float_abi)',], +- }], +- [ 'arm_thumb==1', { +- 'cflags': ['-mthumb',], +- }], +- [ 'arm_thumb==0', { +- 'cflags': ['-marm',], +- }], +- ], +- }, { +- # 'v8_target_arch!=host_arch' ++ ['v8_target_arch!=host_arch', { + # Host not built with an Arm CXX compiler (simulator build). + 'conditions': [ + [ 'arm_float_abi=="hard"', { +@@ -254,31 +230,7 @@ + }], # _toolset=="host" + ['_toolset=="target"', { + 'conditions': [ +- ['v8_target_arch==target_arch', { +- # Target built with an Arm CXX compiler. +- 'conditions': [ +- [ 'arm_version==7', { +- 'cflags': ['-march=armv7-a',], +- }], +- [ 'arm_version==7 or arm_version=="default"', { +- 'conditions': [ +- [ 'arm_fpu!="default"', { +- 'cflags': ['-mfpu=<(arm_fpu)',], +- }], +- ], +- }], +- [ 'arm_float_abi!="default"', { +- 'cflags': ['-mfloat-abi=<(arm_float_abi)',], +- }], +- [ 'arm_thumb==1', { +- 'cflags': ['-mthumb',], +- }], +- [ 'arm_thumb==0', { +- 'cflags': ['-marm',], +- }], +- ], +- }, { +- # 'v8_target_arch!=target_arch' ++ ['v8_target_arch!=target_arch', { + # Target not built with an Arm CXX compiler (simulator build). + 'conditions': [ + [ 'arm_float_abi=="hard"', { +-- +2.20.1 + diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0005-Link-atomic-library.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0005-Link-atomic-library.patch deleted file mode 100644 index 66ff18b4a3..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0005-Link-atomic-library.patch +++ /dev/null @@ -1,20 +0,0 @@ -Link atomic library to fix missing undefined referrences -like "undefined reference to `__atomic_fetch_add_8'" - -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - -diff -Naur node-v10.15.1/deps/v8/gypfiles/v8.gyp node-v10.15.1/deps/v8/gypfiles/v8.gyp ---- node-v10.15.1/deps/v8/gypfiles/v8.gyp 2019-02-13 09:02:21.000000000 +0100 -+++ node-v10.15.1/deps/v8/gypfiles/v8.gyp 2019-02-15 21:27:11.755679660 +0100 -@@ -452,6 +452,11 @@ - '<(DEPTH)', - '<(SHARED_INTERMEDIATE_DIR)' - ], -+ 'link_settings': { -+ 'libraries': [ -+ '-latomic' -+ ], -+ }, - 'sources': [ - '<@(inspector_all_sources)', - '../include//v8-inspector-protocol.h', diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch deleted file mode 100644 index f6569cd57a..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch +++ /dev/null @@ -1,24 +0,0 @@ -The target LDFLAGS have been ignored. Tools like torque -have been loaded from system libraries, even if a native -one was the target. -|$ ldd torque -| libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 -| libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 -| libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 -| libicui18n.so.63 => not found -| libicuuc.so.63 => not found -... - -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - -diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi ---- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi 2019-03-18 15:01:39.000000000 +0100 -+++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi 2019-03-18 15:04:08.628361308 +0100 -@@ -1106,6 +1106,7 @@ - 'cflags': [ '-fno-strict-aliasing' ], - }], - ], # conditions -+ 'ldflags+': [ '$(LDFLAGS)' ], - }], - ['OS=="solaris"', { - 'defines': [ '__C99FEATURES__=1' ], # isinf() etc. diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch new file mode 100644 index 0000000000..cb0237309e --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch @@ -0,0 +1,21 @@ +Link mksnapshot with libatomic on x86 + +Clang-12 on x86 emits atomic builtins + +Fixes +| module-compiler.cc:(.text._ZN2v88internal4wasm12_GLOBAL__N_123ExecuteCompilationUnitsERKSt10shared_ptrINS2_22BackgroundCompileTokenEEPNS0_8CountersEiNS2_19CompileBaselineOnlyE+0x558): un +defined reference to `__atomic_load' + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- a/tools/v8_gypfiles/v8.gyp ++++ b/tools/v8_gypfiles/v8.gyp +@@ -1436,6 +1436,7 @@ + { + 'target_name': 'mksnapshot', + 'type': 'executable', ++ 'libraries': [ '-latomic' ], + 'dependencies': [ + 'v8_base_without_compiler', + 'v8_compiler_for_mksnapshot', diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/run-ptest b/meta-oe/recipes-devtools/nodejs/nodejs/run-ptest new file mode 100755 index 0000000000..e82f373626 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/run-ptest @@ -0,0 +1,8 @@ +#!/bin/sh + +./cctest +if [ $? = 0 ]; then + echo "PASS: nodejs" +else + echo "FAIL: nodejs" +fi diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/system-c-ares.patch b/meta-oe/recipes-devtools/nodejs/nodejs/system-c-ares.patch new file mode 100644 index 0000000000..141889ad23 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/system-c-ares.patch @@ -0,0 +1,24 @@ +keep nodejs compatible with c-ares 1.17.1 + +Upstream-Status: Inappropriate [c-ares specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- a/src/cares_wrap.h ++++ b/src/cares_wrap.h +@@ -22,7 +22,15 @@ + # include <netdb.h> + #endif // __POSIX__ + +-# include <ares_nameser.h> ++#if defined(__ANDROID__) || \ ++ defined(__MINGW32__) || \ ++ defined(__OpenBSD__) || \ ++ defined(_MSC_VER) ++ ++# include <nameser.h> ++#else ++# include <arpa/nameser.h> ++#endif + + namespace node { + namespace cares_wrap { |