From 13e83bd009200f42741083c5a6f1fbc653205c49 Mon Sep 17 00:00:00 2001 From: Archana Polampalli Date: Thu, 28 Sep 2023 09:13:04 +0000 Subject: nodejs: upgrade 18.17.1 -> 20.5.1 Update to latest release of latest LTS 20 release * node v20 introduces several new features and fixes many bugs and CVEs as shown in [1] * Refresh 0001-liftoff-Correct-function-signatures.patch against 20.5.1 * License-Update: - Change zlib version 1.2.13, October 13th, 2022 to version 1.2.13.1, October xxth, 2022 [2] - Change Copyright 2023 from Ada authors to Yagiz Nizipli and Daniel Lemire [4] * Remove big-endian.patch as it is merged in v20.x [5] [6] * Remove below list of patches since mips32 is deleted from v8 as part of update V8 to 10.7.193.13 [7] [8] - mips-less-memory.patch - 0001-mips-Use-32bit-cast-for-operand-on-mips32.patch * Update Using-native-binaries.patch for node_js2c, it resolved below do_compile error [9] Error: /bin/sh: line 1: build/tmp/work/core2-64-poky-linux/nodejs/20.5.1/node-v20.5.1/out/Release/node_js2c: No such file or directory * Remove obsolete dtrace & etw configure options (we had: --without-) from the recipe [10] https://github.com/nodejs/node/releases/tag/v20.5.1 [1] https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md [2] https://github.com/nodejs/node/commit/f1007325753e62b13083f6e9e499fdc33f753d7d [3] https://github.com/nodejs/node/commit/900ae1bda76caaa7213431a5268560b578ed2d55 [4] https://github.com/nodejs/node/commit/d2465369243bc4313d9840b62c2393c4f179ffbb [5] https://github.com/v8/v8/commit/3cea5d5425c3a0d7d1768b3758269ac98875de77 [6] https://github.com/nodejs/node/commit/f226350fcbebd4449fb0034fdaffa147e4de28ea [7] https://github.com/v8/v8/commit/a26ca5ed147dde47f02d70c5b38d8befc1c93cb3 [8] https://github.com/nodejs/node/commit/6bd756d7c6dfb7dc25daee329ad70df68c14223e [9] https://github.com/nodejs/node/commit/4da7bc915c714989eba7eab753db9eb9ebd8451a [10] https://github.com/nodejs/node/commit/aa3a572e6bee116cde69508dc29478b40f40551a Signed-off-by: Archana Polampalli Signed-off-by: Khem Raj --- .../nodejs/nodejs-oe-cache-18.17/oe-npm-cache | 77 --------- .../nodejs/nodejs-oe-cache-20.5/oe-npm-cache | 77 +++++++++ .../nodejs/nodejs-oe-cache-native_18.17.bb | 21 --- .../nodejs/nodejs-oe-cache-native_20.5.bb | 21 +++ .../nodejs/nodejs/0001-Using-native-binaries.patch | 19 ++- .../0001-liftoff-Correct-function-signatures.patch | 42 ++--- ...mips-Use-32bit-cast-for-operand-on-mips32.patch | 34 ---- .../nodejs/nodejs/big-endian.patch | 18 -- .../nodejs/nodejs/mips-less-memory.patch | 37 ----- meta-oe/recipes-devtools/nodejs/nodejs_18.17.1.bb | 185 --------------------- meta-oe/recipes-devtools/nodejs/nodejs_20.5.1.bb | 180 ++++++++++++++++++++ 11 files changed, 310 insertions(+), 401 deletions(-) delete mode 100755 meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.17/oe-npm-cache create mode 100755 meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.5/oe-npm-cache delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.17.bb create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_20.5.bb delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0001-mips-Use-32bit-cast-for-operand-on-mips32.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/big-endian.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs_18.17.1.bb create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs_20.5.1.bb (limited to 'meta-oe/recipes-devtools') diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.17/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.17/oe-npm-cache deleted file mode 100755 index f596207648..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.17/oe-npm-cache +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env node - -/// Usage: oe-npm-cache -/// ... meta - metainformation about package -/// tgz - tarball - -const process = require("node:process"); - -module.paths.unshift("@@libdir@@/node_modules/npm/node_modules"); - -const cacache = require('cacache') -const fs = require('fs') - -// argv[0] is 'node', argv[1] is this script -const cache_dir = process.argv[2] -const type = process.argv[3] -const key = process.argv[4] -const file = process.argv[5] - -const data = fs.readFileSync(file) - -// metadata content is highly nodejs dependent; when cache entries are not -// found, place debug statements in 'make-fetch-happen/lib/cache/policy.js' -// (CachePolicy::satisfies()) -const xlate = { - 'meta': { - 'key_prefix': 'make-fetch-happen:request-cache:', - 'metadata': function() { - return { - time: Date.now(), - url: key, - reqHeaders: { - 'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', - }, - resHeaders: { - "content-type": "application/json", - "status": 200, - }, - options: { - compress: true, - } - }; - }, - }, - - 'tgz': { - 'key_prefix': 'make-fetch-happen:request-cache:', - 'metadata': function() { - return { - time: Date.now(), - url: key, - reqHeaders: { - 'accept': '*/*', - }, - resHeaders: { - "content-type": "application/octet-stream", - "status": 200, - }, - options: { - compress: true, - }, - }; - }, - }, -}; - -const info = xlate[type]; -let opts = {} - -if (info.metadata) { - opts['metadata'] = info.metadata(); -} - -cacache.put(cache_dir, info.key_prefix + key, data, opts) - .then(integrity => { - console.log(`Saved content of ${key} (${file}).`); -}) diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.5/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.5/oe-npm-cache new file mode 100755 index 0000000000..f596207648 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.5/oe-npm-cache @@ -0,0 +1,77 @@ +#!/usr/bin/env node + +/// Usage: oe-npm-cache +/// ... meta - metainformation about package +/// tgz - tarball + +const process = require("node:process"); + +module.paths.unshift("@@libdir@@/node_modules/npm/node_modules"); + +const cacache = require('cacache') +const fs = require('fs') + +// argv[0] is 'node', argv[1] is this script +const cache_dir = process.argv[2] +const type = process.argv[3] +const key = process.argv[4] +const file = process.argv[5] + +const data = fs.readFileSync(file) + +// metadata content is highly nodejs dependent; when cache entries are not +// found, place debug statements in 'make-fetch-happen/lib/cache/policy.js' +// (CachePolicy::satisfies()) +const xlate = { + 'meta': { + 'key_prefix': 'make-fetch-happen:request-cache:', + 'metadata': function() { + return { + time: Date.now(), + url: key, + reqHeaders: { + 'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', + }, + resHeaders: { + "content-type": "application/json", + "status": 200, + }, + options: { + compress: true, + } + }; + }, + }, + + 'tgz': { + 'key_prefix': 'make-fetch-happen:request-cache:', + 'metadata': function() { + return { + time: Date.now(), + url: key, + reqHeaders: { + 'accept': '*/*', + }, + resHeaders: { + "content-type": "application/octet-stream", + "status": 200, + }, + options: { + compress: true, + }, + }; + }, + }, +}; + +const info = xlate[type]; +let opts = {} + +if (info.metadata) { + opts['metadata'] = info.metadata(); +} + +cacache.put(cache_dir, info.key_prefix + key, data, opts) + .then(integrity => { + console.log(`Saved content of ${key} (${file}).`); +}) diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.17.bb b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.17.bb deleted file mode 100644 index a61dd5018f..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.17.bb +++ /dev/null @@ -1,21 +0,0 @@ -DESCRIPTION = "OE helper for manipulating npm cache" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "\ - file://oe-npm-cache \ -" - -inherit native - -B = "${WORKDIR}/build" - -do_configure() { - sed -e 's!@@libdir@@!${libdir}!g' < '${WORKDIR}/oe-npm-cache' > '${B}/oe-npm-cache' -} - -do_install() { - install -D -p -m 0755 ${B}/oe-npm-cache ${D}${bindir}/oe-npm-cache -} - -RDEPENDS:${PN} = "nodejs-native" diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_20.5.bb b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_20.5.bb new file mode 100644 index 0000000000..a61dd5018f --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_20.5.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "OE helper for manipulating npm cache" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "\ + file://oe-npm-cache \ +" + +inherit native + +B = "${WORKDIR}/build" + +do_configure() { + sed -e 's!@@libdir@@!${libdir}!g' < '${WORKDIR}/oe-npm-cache' > '${B}/oe-npm-cache' +} + +do_install() { + install -D -p -m 0755 ${B}/oe-npm-cache ${D}${bindir}/oe-npm-cache +} + +RDEPENDS:${PN} = "nodejs-native" 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 index 66e10a0d00..0178cec777 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch @@ -12,7 +12,7 @@ https://git.openembedded.org/meta-openembedded/commit/?id=feeb172d1a8bf010490d22 Signed-off-by: Archana Polampalli --- - node.gyp | 1 + + node.gyp | 3 + tools/v8_gypfiles/v8.gyp | 5 +++++ 2 files changed, 6 insertions(+) @@ -28,6 +28,23 @@ index e8e1d9f9..e60ccc10 100644 '<(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 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 index c9a522d2e2..5af87d866e 100644 --- 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 @@ -1,6 +1,6 @@ From dc3652c0abcdf8573fd044907b19d8eda7ca1124 Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Wed, 20 Oct 2021 12:49:58 -0700 +Date: Mon, 3 Jul 2023 12:33:16 +0000 Subject: [PATCH] [liftoff] Correct function signatures Fixes builds on mips where clang reports an error @@ -13,16 +13,15 @@ Upstream-Status: Submitted [https://chromium-review.googlesource.com/c/v8/v8/+/3 Signed-off-by: Archana Polampalli --- deps/v8/src/wasm/baseline/liftoff-assembler.h | 6 +++--- - deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h | 2 +- deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h | 2 +- - .../src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h | 2 +- - 4 files changed, 6 insertions(+), 6 deletions(-) + 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 22c7f73a..db4cb168 100644 +index aef63c64..f2a11b01 100644 --- a/deps/v8/src/wasm/baseline/liftoff-assembler.h +++ b/deps/v8/src/wasm/baseline/liftoff-assembler.h -@@ -646,7 +646,7 @@ class LiftoffAssembler : public TurboAssembler { +@@ -717,7 +717,7 @@ class LiftoffAssembler : public MacroAssembler { void FinishCall(const ValueKindSig*, compiler::CallDescriptor*); // Move {src} into {dst}. {src} and {dst} must be different. @@ -31,7 +30,7 @@ index 22c7f73a..db4cb168 100644 // Parallel register move: For a list of tuples , move the // {src} register of kind {kind} into {dst}. If {src} equals {dst}, ignore -@@ -795,8 +795,8 @@ class LiftoffAssembler : public TurboAssembler { +@@ -884,8 +884,8 @@ class LiftoffAssembler : public MacroAssembler { inline void MoveStackValue(uint32_t dst_offset, uint32_t src_offset, ValueKind); @@ -42,24 +41,11 @@ index 22c7f73a..db4cb168 100644 inline void Spill(int offset, LiftoffRegister, ValueKind); inline void Spill(int offset, WasmValue); -diff --git a/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h b/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h -index c76fd2f4..0fffe231 100644 ---- a/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h -+++ b/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h -@@ -661,7 +661,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, - pinned = pinned | LiftoffRegList{dst_op.rm(), src}; - 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/mips64/liftoff-assembler-mips64.h b/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h -index 36413545..48207337 100644 +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 -@@ -593,7 +593,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, +@@ -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. @@ -68,11 +54,11 @@ index 36413545..48207337 100644 src = tmp; pinned.set(tmp); -diff --git a/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h b/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h -index 642a7d2a..56ffcc2a 100644 ---- a/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h -+++ b/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h -@@ -589,7 +589,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, +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. @@ -82,4 +68,4 @@ index 642a7d2a..56ffcc2a 100644 src = tmp; pinned.set(tmp); -- -2.34.1 +2.40.0 diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-mips-Use-32bit-cast-for-operand-on-mips32.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-mips-Use-32bit-cast-for-operand-on-mips32.patch deleted file mode 100644 index a0242d8e18..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0001-mips-Use-32bit-cast-for-operand-on-mips32.patch +++ /dev/null @@ -1,34 +0,0 @@ -From e65dde8db17da5acddeef7eb9316199c4e5e0811 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 19 Apr 2022 12:40:25 -0700 -Subject: [PATCH] mips: Use 32bit cast for operand on mips32 - -Fixes -deps/v8/src/compiler/backend/mips/code-generator-mips.cc: In member function 'void v8::internal::compiler::CodeGenerator::AssembleReturn(v8::internal::compiler::InstructionOperand*)': -../deps/v8/src/compiler/backend/mips/code-generator-mips.cc:4233:48: error: call of overloaded 'Operand(int64_t)' is ambiguous - 4233 | Operand(static_cast(0))); - | ^ - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - deps/v8/src/compiler/backend/mips/code-generator-mips.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/deps/v8/src/compiler/backend/mips/code-generator-mips.cc b/deps/v8/src/compiler/backend/mips/code-generator-mips.cc -index 2b8197e..b226140 100644 ---- a/deps/v8/src/compiler/backend/mips/code-generator-mips.cc -+++ b/deps/v8/src/compiler/backend/mips/code-generator-mips.cc -@@ -4230,7 +4230,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) { - } else if (FLAG_debug_code) { - __ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue, - g.ToRegister(additional_pop_count), -- Operand(static_cast(0))); -+ Operand(static_cast(0))); - } - } - // Functions with JS linkage have at least one parameter (the receiver). --- -2.36.0 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/big-endian.patch b/meta-oe/recipes-devtools/nodejs/nodejs/big-endian.patch deleted file mode 100644 index 529381842f..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/big-endian.patch +++ /dev/null @@ -1,18 +0,0 @@ - -https://github.com/v8/v8/commit/878ccb33bd3cf0e6dc018ff8d15843f585ac07be - -did some automated cleanups but it missed big-endian code. - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- a/deps/v8/src/runtime/runtime-utils.h -+++ b/deps/v8/src/runtime/runtime-utils.h -@@ -126,7 +126,7 @@ static inline ObjectPair MakePair(Object - #if defined(V8_TARGET_LITTLE_ENDIAN) - return x.ptr() | (static_cast(y.ptr()) << 32); - #elif defined(V8_TARGET_BIG_ENDIAN) -- return y->ptr() | (static_cast(x->ptr()) << 32); -+ return y.ptr() | (static_cast(x.ptr()) << 32); - #else - #error Unknown endianness - #endif diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory.patch b/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory.patch deleted file mode 100644 index 16776cb762..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory.patch +++ /dev/null @@ -1,37 +0,0 @@ -Description: mksnapshot uses too much memory on 32-bit mipsel -Author: Jérémy Lal -Last-Update: 2020-06-03 -Forwarded: https://bugs.chromium.org/p/v8/issues/detail?id=10586 - -This ensures that we reserve 500M instead of 2G range for codegen -ensures that qemu-mips can allocate such large ranges - -Upstream-Status: Inappropriate [embedded specific] - -Imported from debian https://salsa.debian.org/js-team/nodejs/-/blob/master-12.x/debian/patches/mips-less-memory.patch -https://buildd.debian.org/status/fetch.php?pkg=nodejs&arch=mipsel&ver=12.17.0~dfsg-2&stamp=1591050388&raw=0 - -Signed-off-by: Khem Raj - ---- a/deps/v8/src/common/globals.h -+++ b/deps/v8/src/common/globals.h -@@ -224,7 +224,7 @@ constexpr size_t kMinimumCodeRangeSize = - constexpr size_t kMinExpectedOSPageSize = 64 * KB; // OS page on PPC Linux - #elif V8_TARGET_ARCH_MIPS - constexpr bool kPlatformRequiresCodeRange = false; --constexpr size_t kMaximalCodeRangeSize = 2048LL * MB; -+constexpr size_t kMaximalCodeRangeSize = 512 * MB; - constexpr size_t kMinimumCodeRangeSize = 0 * MB; - constexpr size_t kMinExpectedOSPageSize = 4 * KB; // OS page. - #else ---- a/deps/v8/src/codegen/mips/constants-mips.h -+++ b/deps/v8/src/codegen/mips/constants-mips.h -@@ -140,7 +140,7 @@ const uint32_t kLeastSignificantByteInIn - namespace v8 { - namespace internal { - --constexpr size_t kMaxPCRelativeCodeRangeInMB = 4096; -+constexpr size_t kMaxPCRelativeCodeRangeInMB = 1024; - - // ----------------------------------------------------------------------------- - // Registers and FPURegisters. diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_18.17.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_18.17.1.bb deleted file mode 100644 index ee5e848bf8..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs_18.17.1.bb +++ /dev/null @@ -1,185 +0,0 @@ -DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" -HOMEPAGE = "http://nodejs.org" -LICENSE = "MIT & ISC & BSD-2-Clause & BSD-3-Clause & Artistic-2.0 & Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=bc1f9ebe76be76f163e3b675303ad9cd" - -CVE_PRODUCT = "nodejs node.js" - -DEPENDS = "openssl file-replacement-native" -DEPENDS:append:class-target = " qemu-native" -DEPENDS:append:class-native = " c-ares-native" - -inherit pkgconfig python3native qemu ptest - -COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*" -COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*" -COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*" - -COMPATIBLE_HOST:riscv64 = "null" -COMPATIBLE_HOST:riscv32 = "null" -COMPATIBLE_HOST:powerpc = "null" - -SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ - file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ - file://0004-v8-don-t-override-ARM-CFLAGS.patch \ - file://big-endian.patch \ - file://mips-less-memory.patch \ - file://system-c-ares.patch \ - file://0001-liftoff-Correct-function-signatures.patch \ - file://0001-mips-Use-32bit-cast-for-operand-on-mips32.patch \ - file://run-ptest \ - " - -SRC_URI:append:class-target = " \ - file://0001-Using-native-binaries.patch \ - " -SRC_URI:append:toolchain-clang:x86 = " \ - file://libatomic.patch \ - " -SRC_URI:append:toolchain-clang:powerpc64le = " \ - file://0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch \ - " -SRC_URI[sha256sum] = "f215cf03d0f00f07ac0b674c6819f804c1542e16f152da04980022aeccf5e65a" - -S = "${WORKDIR}/node-v${PV}" - -# v8 errors out if you have set CCACHE -CCACHE = "" - -def map_nodejs_arch(a, d): - import re - - if re.match('i.86$', a): return 'ia32' - elif re.match('x86_64$', a): return 'x64' - elif re.match('aarch64$', a): return 'arm64' - elif re.match('(powerpc64|powerpc64le|ppc64le)$', a): return 'ppc64' - elif re.match('powerpc$', a): return 'ppc' - return a - -ARCHFLAGS:arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \ - ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \ - bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \ - bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \ - '--with-arm-fpu=vfp', d), d), d)}" -ARCHFLAGS:append:mips = " --v8-lite-mode" -ARCHFLAGS:append:mipsel = " --v8-lite-mode" -ARCHFLAGS ?= "" - -PACKAGECONFIG ??= "ares brotli icu zlib" - -PACKAGECONFIG[ares] = "--shared-cares,,c-ares" -PACKAGECONFIG[brotli] = "--shared-brotli,,brotli" -PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" -PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" -PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" -PACKAGECONFIG[shared] = "--shared" -PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" - -# We don't want to cross-compile during target compile, -# and we need to use the right flags during host compile, -# too. -EXTRA_OEMAKE = "\ - CC.host='${CC} -pie -fPIE' \ - CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ - CXX.host='${CXX} -pie -fPIE' \ - CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ - LDFLAGS.host='${LDFLAGS}' \ - AR.host='${AR}' \ - \ - builddir_name=./ \ -" - -EXTRANATIVEPATH += "file-native" - -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" - -# V8's JIT infrastructure requires binaries such as mksnapshot and -# mkpeephole to be run in the host during the build. However, these -# binaries must have the same bit-width as the target (e.g. a x86_64 -# host targeting ARMv6 needs to produce a 32-bit binary). Instead of -# depending on a third Yocto toolchain, we just build those binaries -# for the target and run them on the host with QEMU. -python do_create_v8_qemu_wrapper () { - """Creates a small wrapper that invokes QEMU to run some target V8 binaries - on the host.""" - qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'), - d.expand('${STAGING_DIR_HOST}${base_libdir}')] - qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), - qemu_libdirs) - wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh') - with open(wrapper_path, 'w') as wrapper_file: - wrapper_file.write("""#!/bin/sh - -# This file has been generated automatically. -# It invokes QEMU to run binaries built for the target in the host during the -# build process. - -%s "$@" -""" % qemu_cmd) - os.chmod(wrapper_path, 0o755) -} - -do_create_v8_qemu_wrapper[dirs] = "${B}" -addtask create_v8_qemu_wrapper after do_configure before do_compile - -LDFLAGS:append:x86 = " -latomic" - -CROSS_FLAGS = "--cross-compiling" -CROSS_FLAGS:class-native = "--no-cross-compiling" - -# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi -do_configure () { - GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES - # $TARGET_ARCH settings don't match --dest-cpu settings - python3 configure.py --verbose --prefix=${prefix} \ - --shared-openssl \ - --without-dtrace \ - --without-etw \ - --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \ - --dest-os=linux \ - --libdir=${baselib} \ - ${CROSS_FLAGS} \ - ${ARCHFLAGS} \ - ${PACKAGECONFIG_CONFARGS} -} - -do_compile () { - install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf - install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh - oe_runmake BUILDTYPE=Release -} - -do_install () { - oe_runmake install DESTDIR=${D} -} - -do_install_ptest () { - cp -r ${B}/out/Release/cctest ${D}${PTEST_PATH}/ - cp -r ${B}/test ${D}${PTEST_PATH} - chown -R root:root ${D}${PTEST_PATH} -} - -PACKAGES =+ "${PN}-npm" -FILES:${PN}-npm = "${nonarch_libdir}/node_modules ${bindir}/npm ${bindir}/npx ${bindir}/corepack" -RDEPENDS:${PN}-npm = "bash python3-core python3-shell python3-datetime \ - python3-misc python3-multiprocessing" - -PACKAGES =+ "${PN}-systemtap" -FILES:${PN}-systemtap = "${datadir}/systemtap" - -BBCLASSEXTEND = "native" diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_20.5.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_20.5.1.bb new file mode 100644 index 0000000000..6bb0f7fabd --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs_20.5.1.bb @@ -0,0 +1,180 @@ +DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" +HOMEPAGE = "http://nodejs.org" +LICENSE = "MIT & ISC & BSD-2-Clause & BSD-3-Clause & Artistic-2.0 & Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=059ecf3a6f87111685e51b611b9563e5" + +CVE_PRODUCT = "nodejs node.js" + +DEPENDS = "openssl file-replacement-native" +DEPENDS:append:class-target = " qemu-native" +DEPENDS:append:class-native = " c-ares-native" + +inherit pkgconfig python3native qemu ptest + +COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*" +COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*" +COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*" + +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:riscv32 = "null" +COMPATIBLE_HOST:powerpc = "null" + +SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ + file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ + file://0004-v8-don-t-override-ARM-CFLAGS.patch \ + file://system-c-ares.patch \ + file://0001-liftoff-Correct-function-signatures.patch \ + file://run-ptest \ + " + +SRC_URI:append:class-target = " \ + file://0001-Using-native-binaries.patch \ + " +SRC_URI:append:toolchain-clang:x86 = " \ + file://libatomic.patch \ + " +SRC_URI:append:toolchain-clang:powerpc64le = " \ + file://0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch \ + " +SRC_URI[sha256sum] = "439c71aa2f38c2861657bfa538e99191a571258066cbfd4548586049c8134190" + +S = "${WORKDIR}/node-v${PV}" + +# v8 errors out if you have set CCACHE +CCACHE = "" + +def map_nodejs_arch(a, d): + import re + + if re.match('i.86$', a): return 'ia32' + elif re.match('x86_64$', a): return 'x64' + elif re.match('aarch64$', a): return 'arm64' + elif re.match('(powerpc64|powerpc64le|ppc64le)$', a): return 'ppc64' + elif re.match('powerpc$', a): return 'ppc' + return a + +ARCHFLAGS:arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \ + ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \ + bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \ + bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \ + '--with-arm-fpu=vfp', d), d), d)}" +ARCHFLAGS:append:mips = " --v8-lite-mode" +ARCHFLAGS:append:mipsel = " --v8-lite-mode" +ARCHFLAGS ?= "" + +PACKAGECONFIG ??= "ares brotli icu zlib" + +PACKAGECONFIG[ares] = "--shared-cares,,c-ares" +PACKAGECONFIG[brotli] = "--shared-brotli,,brotli" +PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" +PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" +PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" +PACKAGECONFIG[shared] = "--shared" +PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" + +# We don't want to cross-compile during target compile, +# and we need to use the right flags during host compile, +# too. +EXTRA_OEMAKE = "\ + CC.host='${CC} -pie -fPIE' \ + CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ + CXX.host='${CXX} -pie -fPIE' \ + CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ + LDFLAGS.host='${LDFLAGS}' \ + AR.host='${AR}' \ + \ + builddir_name=./ \ +" + +EXTRANATIVEPATH += "file-native" + +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" + +# V8's JIT infrastructure requires binaries such as mksnapshot and +# mkpeephole to be run in the host during the build. However, these +# binaries must have the same bit-width as the target (e.g. a x86_64 +# host targeting ARMv6 needs to produce a 32-bit binary). Instead of +# depending on a third Yocto toolchain, we just build those binaries +# for the target and run them on the host with QEMU. +python do_create_v8_qemu_wrapper () { + """Creates a small wrapper that invokes QEMU to run some target V8 binaries + on the host.""" + qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'), + d.expand('${STAGING_DIR_HOST}${base_libdir}')] + qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), + qemu_libdirs) + wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh') + with open(wrapper_path, 'w') as wrapper_file: + wrapper_file.write("""#!/bin/sh + +# This file has been generated automatically. +# It invokes QEMU to run binaries built for the target in the host during the +# build process. + +%s "$@" +""" % qemu_cmd) + os.chmod(wrapper_path, 0o755) +} + +do_create_v8_qemu_wrapper[dirs] = "${B}" +addtask create_v8_qemu_wrapper after do_configure before do_compile + +LDFLAGS:append:x86 = " -latomic" + +CROSS_FLAGS = "--cross-compiling" +CROSS_FLAGS:class-native = "--no-cross-compiling" + +# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi +do_configure () { + GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES + # $TARGET_ARCH settings don't match --dest-cpu settings + python3 configure.py --verbose --prefix=${prefix} \ + --shared-openssl \ + --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \ + --dest-os=linux \ + --libdir=${baselib} \ + ${CROSS_FLAGS} \ + ${ARCHFLAGS} \ + ${PACKAGECONFIG_CONFARGS} +} + +do_compile () { + install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf + install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh + oe_runmake BUILDTYPE=Release +} + +do_install () { + oe_runmake install DESTDIR=${D} +} + +do_install_ptest () { + cp -r ${B}/out/Release/cctest ${D}${PTEST_PATH}/ + cp -r ${B}/test ${D}${PTEST_PATH} + chown -R root:root ${D}${PTEST_PATH} +} + +PACKAGES =+ "${PN}-npm" +FILES:${PN}-npm = "${nonarch_libdir}/node_modules ${bindir}/npm ${bindir}/npx ${bindir}/corepack" +RDEPENDS:${PN}-npm = "bash python3-core python3-shell python3-datetime \ + python3-misc python3-multiprocessing" + +PACKAGES =+ "${PN}-systemtap" +FILES:${PN}-systemtap = "${datadir}/systemtap" + +BBCLASSEXTEND = "native" -- cgit v1.2.3-54-g00ecf