diff options
8 files changed, 493 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps-nodejs14.patch new file mode 100644 index 0000000000..c719c9c3b0 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps-nodejs14.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | From 7d94bfe53beeb2d25eb5f2ff6b1d509df7e6ab80 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Zuzana Svetlikova <zsvetlik@redhat.com> | ||
| 3 | Date: Thu, 27 Apr 2017 14:25:42 +0200 | ||
| 4 | Subject: [PATCH] Disable running gyp on shared deps | ||
| 5 | |||
| 6 | --- | ||
| 7 | Makefile | 2 +- | ||
| 8 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 9 | |||
| 10 | diff --git a/Makefile b/Makefile | ||
| 11 | index 93d63110..79caaec2 100644 | ||
| 12 | --- a/Makefile | ||
| 13 | +++ b/Makefile | ||
| 14 | @@ -138,7 +138,7 @@ with-code-cache test-code-cache: | ||
| 15 | $(warning '$@' target is a noop) | ||
| 16 | |||
| 17 | out/Makefile: config.gypi common.gypi node.gyp \ | ||
| 18 | - deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \ | ||
| 19 | + deps/llhttp/llhttp.gyp \ | ||
| 20 | tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ | ||
| 21 | tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp | ||
| 22 | $(PYTHON) tools/gyp_node.py -f make | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-jinja-tests.py-add-py-3.10-fix-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-jinja-tests.py-add-py-3.10-fix-nodejs14.patch new file mode 100644 index 0000000000..8c5f75112d --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-jinja-tests.py-add-py-3.10-fix-nodejs14.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From e1d838089cd461d9efcf4d29d9f18f65994d2d6b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex@linutronix.de> | ||
| 3 | Date: Sun, 3 Oct 2021 22:48:39 +0200 | ||
| 4 | Subject: [PATCH] jinja/tests.py: add py 3.10 fix | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
| 8 | --- | ||
| 9 | deps/v8/third_party/jinja2/tests.py | 2 +- | ||
| 10 | tools/inspector_protocol/jinja2/tests.py | 2 +- | ||
| 11 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/deps/v8/third_party/jinja2/tests.py b/deps/v8/third_party/jinja2/tests.py | ||
| 14 | index 0adc3d4..b14f85f 100644 | ||
| 15 | --- a/deps/v8/third_party/jinja2/tests.py | ||
| 16 | +++ b/deps/v8/third_party/jinja2/tests.py | ||
| 17 | @@ -10,7 +10,7 @@ | ||
| 18 | """ | ||
| 19 | import operator | ||
| 20 | import re | ||
| 21 | -from collections import Mapping | ||
| 22 | +from collections.abc import Mapping | ||
| 23 | from jinja2.runtime import Undefined | ||
| 24 | from jinja2._compat import text_type, string_types, integer_types | ||
| 25 | import decimal | ||
| 26 | diff --git a/tools/inspector_protocol/jinja2/tests.py b/tools/inspector_protocol/jinja2/tests.py | ||
| 27 | index 0adc3d4..b14f85f 100644 | ||
| 28 | --- a/tools/inspector_protocol/jinja2/tests.py | ||
| 29 | +++ b/tools/inspector_protocol/jinja2/tests.py | ||
| 30 | @@ -10,7 +10,7 @@ | ||
| 31 | """ | ||
| 32 | import operator | ||
| 33 | import re | ||
| 34 | -from collections import Mapping | ||
| 35 | +from collections.abc import Mapping | ||
| 36 | from jinja2.runtime import Undefined | ||
| 37 | from jinja2._compat import text_type, string_types, integer_types | ||
| 38 | import decimal | ||
| 39 | -- | ||
| 40 | 2.20.1 | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang-nodejs14.patch new file mode 100644 index 0000000000..ee287bf94a --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-ppc64-Do-not-use-mminimal-toc-with-clang-nodejs14.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | From 0976af0f3b328436ea44a74a406f311adb2ab211 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 15 Jun 2021 19:01:31 -0700 | ||
| 4 | Subject: [PATCH] ppc64: Do not use -mminimal-toc with clang | ||
| 5 | |||
| 6 | clang does not support this option | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | common.gypi | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/common.gypi b/common.gypi | ||
| 14 | index ee91fb1d..049c8f8c 100644 | ||
| 15 | --- a/common.gypi | ||
| 16 | +++ b/common.gypi | ||
| 17 | @@ -413,7 +413,7 @@ | ||
| 18 | 'ldflags': [ '-m32' ], | ||
| 19 | }], | ||
| 20 | [ 'target_arch=="ppc64" and OS!="aix"', { | ||
| 21 | - 'cflags': [ '-m64', '-mminimal-toc' ], | ||
| 22 | + 'cflags': [ '-m64' ], | ||
| 23 | 'ldflags': [ '-m64' ], | ||
| 24 | }], | ||
| 25 | [ 'target_arch=="s390x"', { | ||
| 26 | -- | ||
| 27 | 2.32.0 | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries-nodejs14.patch new file mode 100644 index 0000000000..c6fc2dcd76 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries-nodejs14.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | From 6c3ac20477a4bac643088f24df3c042e627fafa9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Guillaume Burel <guillaume.burel@stormshield.eu> | ||
| 3 | Date: Fri, 3 Jan 2020 11:25:54 +0100 | ||
| 4 | Subject: [PATCH] Using native binaries | ||
| 5 | |||
| 6 | --- | ||
| 7 | node.gyp | 4 ++-- | ||
| 8 | tools/v8_gypfiles/v8.gyp | 11 ++++------- | ||
| 9 | 2 files changed, 6 insertions(+), 9 deletions(-) | ||
| 10 | |||
| 11 | --- a/node.gyp | ||
| 12 | +++ b/node.gyp | ||
| 13 | @@ -487,6 +487,7 @@ | ||
| 14 | 'action_name': 'run_mkcodecache', | ||
| 15 | 'process_outputs_as_sources': 1, | ||
| 16 | 'inputs': [ | ||
| 17 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 18 | '<(mkcodecache_exec)', | ||
| 19 | ], | ||
| 20 | 'outputs': [ | ||
| 21 | @@ -512,6 +513,7 @@ | ||
| 22 | 'action_name': 'node_mksnapshot', | ||
| 23 | 'process_outputs_as_sources': 1, | ||
| 24 | 'inputs': [ | ||
| 25 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 26 | '<(node_mksnapshot_exec)', | ||
| 27 | ], | ||
| 28 | 'outputs': [ | ||
| 29 | --- a/tools/v8_gypfiles/v8.gyp | ||
| 30 | +++ b/tools/v8_gypfiles/v8.gyp | ||
| 31 | @@ -220,6 +220,7 @@ | ||
| 32 | { | ||
| 33 | 'action_name': 'run_torque_action', | ||
| 34 | 'inputs': [ # Order matters. | ||
| 35 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 36 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', | ||
| 37 | '<@(torque_files)', | ||
| 38 | ], | ||
| 39 | @@ -351,6 +352,7 @@ | ||
| 40 | { | ||
| 41 | 'action_name': 'generate_bytecode_builtins_list_action', | ||
| 42 | 'inputs': [ | ||
| 43 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 44 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', | ||
| 45 | ], | ||
| 46 | 'outputs': [ | ||
| 47 | @@ -533,6 +535,7 @@ | ||
| 48 | ], | ||
| 49 | }, | ||
| 50 | 'inputs': [ | ||
| 51 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 52 | '<(mksnapshot_exec)', | ||
| 53 | ], | ||
| 54 | 'outputs': [ | ||
| 55 | @@ -1448,6 +1451,7 @@ | ||
| 56 | { | ||
| 57 | 'action_name': 'run_gen-regexp-special-case_action', | ||
| 58 | 'inputs': [ | ||
| 59 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 60 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', | ||
| 61 | ], | ||
| 62 | 'outputs': [ | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir-nodejs14.patch new file mode 100644 index 0000000000..3c4b2317d8 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir-nodejs14.patch | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | From 5b22fac923d1ca3e9fefb97f5a171124a88f5e22 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Elliott Sales de Andrade <quantum.analyst@gmail.com> | ||
| 3 | Date: Tue, 19 Mar 2019 23:22:40 -0400 | ||
| 4 | Subject: [PATCH] Install both binaries and use libdir. | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | This allows us to build with a shared library for other users while | ||
| 10 | still providing the normal executable. | ||
| 11 | |||
| 12 | Taken from - https://src.fedoraproject.org/rpms/nodejs/raw/rawhide/f/0002-Install-both-binaries-and-use-libdir.patch | ||
| 13 | |||
| 14 | Upstream-Status: Pending | ||
| 15 | |||
| 16 | Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> | ||
| 17 | Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> | ||
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 19 | --- | ||
| 20 | configure.py | 7 +++++++ | ||
| 21 | tools/install.py | 21 +++++++++------------ | ||
| 22 | 2 files changed, 16 insertions(+), 12 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/configure.py b/configure.py | ||
| 25 | index e6f7e4db..6cf5c45d 100755 | ||
| 26 | --- a/configure.py | ||
| 27 | +++ b/configure.py | ||
| 28 | @@ -626,6 +626,12 @@ parser.add_option('--shared', | ||
| 29 | help='compile shared library for embedding node in another project. ' + | ||
| 30 | '(This mode is not officially supported for regular applications)') | ||
| 31 | |||
| 32 | +parser.add_option('--libdir', | ||
| 33 | + action='store', | ||
| 34 | + dest='libdir', | ||
| 35 | + default='lib', | ||
| 36 | + help='a directory to install the shared library into') | ||
| 37 | + | ||
| 38 | parser.add_option('--without-v8-platform', | ||
| 39 | action='store_true', | ||
| 40 | dest='without_v8_platform', | ||
| 41 | @@ -1202,6 +1208,7 @@ def configure_node(o): | ||
| 42 | o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) | ||
| 43 | |||
| 44 | o['variables']['node_shared'] = b(options.shared) | ||
| 45 | + o['variables']['libdir'] = options.libdir | ||
| 46 | node_module_version = getmoduleversion.get_version() | ||
| 47 | |||
| 48 | if options.dest_os == 'android': | ||
| 49 | diff --git a/tools/install.py b/tools/install.py | ||
| 50 | index 729b416f..9bfc6234 100755 | ||
| 51 | --- a/tools/install.py | ||
| 52 | +++ b/tools/install.py | ||
| 53 | @@ -121,22 +121,19 @@ def subdir_files(path, dest, action): | ||
| 54 | |||
| 55 | def files(action): | ||
| 56 | is_windows = sys.platform == 'win32' | ||
| 57 | - output_file = 'node' | ||
| 58 | output_prefix = 'out/Release/' | ||
| 59 | + output_libprefix = output_prefix | ||
| 60 | |||
| 61 | - if 'false' == variables.get('node_shared'): | ||
| 62 | - if is_windows: | ||
| 63 | - output_file += '.exe' | ||
| 64 | + if is_windows: | ||
| 65 | + output_bin = 'node.exe' | ||
| 66 | + output_lib = 'node.dll' | ||
| 67 | else: | ||
| 68 | - if is_windows: | ||
| 69 | - output_file += '.dll' | ||
| 70 | - else: | ||
| 71 | - output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix') | ||
| 72 | + output_bin = 'node' | ||
| 73 | + output_lib = 'libnode.' + variables.get('shlib_suffix') | ||
| 74 | |||
| 75 | - if 'false' == variables.get('node_shared'): | ||
| 76 | - action([output_prefix + output_file], 'bin/' + output_file) | ||
| 77 | - else: | ||
| 78 | - action([output_prefix + output_file], 'lib/' + output_file) | ||
| 79 | + action([output_prefix + output_bin], 'bin/' + output_bin) | ||
| 80 | + if 'true' == variables.get('node_shared'): | ||
| 81 | + action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib) | ||
| 82 | |||
| 83 | if 'true' == variables.get('node_use_dtrace'): | ||
| 84 | action(['out/Release/node.d'], 'lib/dtrace/node.d') | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic-nodejs14.patch new file mode 100644 index 0000000000..cdf6bc8e23 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic-nodejs14.patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | Link mksnapshot with libatomic on x86 | ||
| 2 | |||
| 3 | Clang-12 on x86 emits atomic builtins | ||
| 4 | |||
| 5 | Fixes | ||
| 6 | | module-compiler.cc:(.text._ZN2v88internal4wasm12_GLOBAL__N_123ExecuteCompilationUnitsERKSt10shared_ptrINS2_22BackgroundCompileTokenEEPNS0_8CountersEiNS2_19CompileBaselineOnlyE+0x558): un | ||
| 7 | defined reference to `__atomic_load' | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | |||
| 12 | --- a/tools/v8_gypfiles/v8.gyp | ||
| 13 | +++ b/tools/v8_gypfiles/v8.gyp | ||
| 14 | @@ -1336,6 +1336,7 @@ | ||
| 15 | { | ||
| 16 | 'target_name': 'mksnapshot', | ||
| 17 | 'type': 'executable', | ||
| 18 | + 'libraries': [ '-latomic' ], | ||
| 19 | 'dependencies': [ | ||
| 20 | 'v8_base_without_compiler', | ||
| 21 | 'v8_compiler_for_mksnapshot', | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory-nodejs14.patch b/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory-nodejs14.patch new file mode 100644 index 0000000000..21a2281231 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/mips-less-memory-nodejs14.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | Description: mksnapshot uses too much memory on 32-bit mipsel | ||
| 2 | Author: Jérémy Lal <kapouer@melix.org> | ||
| 3 | Last-Update: 2020-06-03 | ||
| 4 | Forwarded: https://bugs.chromium.org/p/v8/issues/detail?id=10586 | ||
| 5 | |||
| 6 | This ensures that we reserve 500M instead of 2G range for codegen | ||
| 7 | ensures that qemu-mips can allocate such large ranges | ||
| 8 | |||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | |||
| 11 | --- a/deps/v8/src/common/globals.h | ||
| 12 | +++ b/deps/v8/src/common/globals.h | ||
| 13 | @@ -224,7 +224,7 @@ constexpr size_t kMinimumCodeRangeSize = | ||
| 14 | constexpr size_t kMinExpectedOSPageSize = 64 * KB; // OS page on PPC Linux | ||
| 15 | #elif V8_TARGET_ARCH_MIPS | ||
| 16 | constexpr bool kPlatformRequiresCodeRange = false; | ||
| 17 | -constexpr size_t kMaximalCodeRangeSize = 2048LL * MB; | ||
| 18 | +constexpr size_t kMaximalCodeRangeSize = 512 * MB; | ||
| 19 | constexpr size_t kMinimumCodeRangeSize = 0 * MB; | ||
| 20 | constexpr size_t kMinExpectedOSPageSize = 4 * KB; // OS page. | ||
| 21 | #else | ||
| 22 | --- a/deps/v8/src/codegen/mips/constants-mips.h | ||
| 23 | +++ b/deps/v8/src/codegen/mips/constants-mips.h | ||
| 24 | @@ -140,7 +140,7 @@ const uint32_t kLeastSignificantByteInIn | ||
| 25 | namespace v8 { | ||
| 26 | namespace internal { | ||
| 27 | |||
| 28 | -constexpr size_t kMaxPCRelativeCodeRangeInMB = 4096; | ||
| 29 | +constexpr size_t kMaxPCRelativeCodeRangeInMB = 1024; | ||
| 30 | |||
| 31 | // ----------------------------------------------------------------------------- | ||
| 32 | // Registers and FPURegisters. | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_14.18.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_14.18.1.bb new file mode 100644 index 0000000000..fc886817ac --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs_14.18.1.bb | |||
| @@ -0,0 +1,205 @@ | |||
| 1 | DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" | ||
| 2 | HOMEPAGE = "http://nodejs.org" | ||
| 3 | LICENSE = "MIT & BSD & Artistic-2.0" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=6768abdfc4dae4fde59d6b4df96930f3" | ||
| 5 | |||
| 6 | DEFAULT_PREFERENCE = "-1" | ||
| 7 | |||
| 8 | DEPENDS = "openssl" | ||
| 9 | DEPENDS:append:class-target = " qemu-native" | ||
| 10 | DEPENDS:append:class-native = " c-ares-native" | ||
| 11 | |||
| 12 | inherit pkgconfig python3native qemu | ||
| 13 | |||
| 14 | COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*" | ||
| 15 | COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*" | ||
| 16 | COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*" | ||
| 17 | |||
| 18 | COMPATIBLE_HOST:riscv64 = "null" | ||
| 19 | COMPATIBLE_HOST:riscv32 = "null" | ||
| 20 | |||
| 21 | SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ | ||
| 22 | file://0001-Disable-running-gyp-files-for-bundled-deps-nodejs14.patch \ | ||
| 23 | file://0003-Install-both-binaries-and-use-libdir-nodejs14.patch \ | ||
| 24 | file://0004-v8-don-t-override-ARM-CFLAGS.patch \ | ||
| 25 | file://big-endian.patch \ | ||
| 26 | file://mips-warnings.patch \ | ||
| 27 | file://mips-less-memory-nodejs14.patch \ | ||
| 28 | file://0001-jinja-tests.py-add-py-3.10-fix-nodejs14.patch \ | ||
| 29 | file://CVE-2022-32212.patch \ | ||
| 30 | file://CVE-2022-35255.patch \ | ||
| 31 | file://CVE-2022-43548.patch \ | ||
| 32 | " | ||
| 33 | SRC_URI:append:class-target = " \ | ||
| 34 | file://0002-Using-native-binaries-nodejs14.patch \ | ||
| 35 | " | ||
| 36 | SRC_URI:append:toolchain-clang:x86 = " \ | ||
| 37 | file://libatomic-nodejs14.patch \ | ||
| 38 | " | ||
| 39 | SRC_URI:append:toolchain-clang:powerpc64le = " \ | ||
| 40 | file://0001-ppc64-Do-not-use-mminimal-toc-with-clang-nodejs14.patch \ | ||
| 41 | " | ||
| 42 | SRC_URI[sha256sum] = "3fa1d71adddfab2f5e3e41874b4eddbdf92b65cade4a43922fb1e437afcf89ed" | ||
| 43 | |||
| 44 | S = "${WORKDIR}/node-v${PV}" | ||
| 45 | |||
| 46 | # v8 errors out if you have set CCACHE | ||
| 47 | CCACHE = "" | ||
| 48 | |||
| 49 | def map_nodejs_arch(a, d): | ||
| 50 | import re | ||
| 51 | |||
| 52 | if re.match('i.86$', a): return 'ia32' | ||
| 53 | elif re.match('x86_64$', a): return 'x64' | ||
| 54 | elif re.match('aarch64$', a): return 'arm64' | ||
| 55 | elif re.match('(powerpc64|powerpc64le|ppc64le)$', a): return 'ppc64' | ||
| 56 | elif re.match('powerpc$', a): return 'ppc' | ||
| 57 | return a | ||
| 58 | |||
| 59 | ARCHFLAGS:arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \ | ||
| 60 | ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \ | ||
| 61 | bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \ | ||
| 62 | bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \ | ||
| 63 | '--with-arm-fpu=vfp', d), d), d)}" | ||
| 64 | GYP_DEFINES:append:mipsel = " mips_arch_variant='r1' " | ||
| 65 | ARCHFLAGS ?= "" | ||
| 66 | |||
| 67 | PACKAGECONFIG ??= "brotli icu zlib" | ||
| 68 | |||
| 69 | PACKAGECONFIG[ares] = "--shared-cares,,c-ares" | ||
| 70 | PACKAGECONFIG[brotli] = "--shared-brotli,,brotli" | ||
| 71 | PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" | ||
| 72 | PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" | ||
| 73 | PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" | ||
| 74 | PACKAGECONFIG[shared] = "--shared" | ||
| 75 | PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" | ||
| 76 | |||
| 77 | # We don't want to cross-compile during target compile, | ||
| 78 | # and we need to use the right flags during host compile, | ||
| 79 | # too. | ||
| 80 | EXTRA_OEMAKE = "\ | ||
| 81 | CC.host='${CC}' \ | ||
| 82 | CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ | ||
| 83 | CXX.host='${CXX}' \ | ||
| 84 | CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ | ||
| 85 | LDFLAGS.host='${LDFLAGS}' \ | ||
| 86 | AR.host='${AR}' \ | ||
| 87 | \ | ||
| 88 | builddir_name=./ \ | ||
| 89 | " | ||
| 90 | |||
| 91 | python do_unpack() { | ||
| 92 | import shutil | ||
| 93 | |||
| 94 | bb.build.exec_func('base_do_unpack', d) | ||
| 95 | |||
| 96 | if 'ares' in d.getVar('PACKAGECONFIG'): | ||
| 97 | shutil.rmtree(d.getVar('S') + '/deps/cares', True) | ||
| 98 | if 'brotli' in d.getVar('PACKAGECONFIG'): | ||
| 99 | shutil.rmtree(d.getVar('S') + '/deps/brotli', True) | ||
| 100 | if 'libuv' in d.getVar('PACKAGECONFIG'): | ||
| 101 | shutil.rmtree(d.getVar('S') + '/deps/uv', True) | ||
| 102 | if 'nghttp2' in d.getVar('PACKAGECONFIG'): | ||
| 103 | shutil.rmtree(d.getVar('S') + '/deps/nghttp2', True) | ||
| 104 | if 'zlib' in d.getVar('PACKAGECONFIG'): | ||
| 105 | shutil.rmtree(d.getVar('S') + '/deps/zlib', True) | ||
| 106 | } | ||
| 107 | |||
| 108 | # V8's JIT infrastructure requires binaries such as mksnapshot and | ||
| 109 | # mkpeephole to be run in the host during the build. However, these | ||
| 110 | # binaries must have the same bit-width as the target (e.g. a x86_64 | ||
| 111 | # host targeting ARMv6 needs to produce a 32-bit binary). Instead of | ||
| 112 | # depending on a third Yocto toolchain, we just build those binaries | ||
| 113 | # for the target and run them on the host with QEMU. | ||
| 114 | python do_create_v8_qemu_wrapper () { | ||
| 115 | """Creates a small wrapper that invokes QEMU to run some target V8 binaries | ||
| 116 | on the host.""" | ||
| 117 | qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'), | ||
| 118 | d.expand('${STAGING_DIR_HOST}${base_libdir}')] | ||
| 119 | qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST', True), | ||
| 120 | qemu_libdirs) | ||
| 121 | wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh') | ||
| 122 | with open(wrapper_path, 'w') as wrapper_file: | ||
| 123 | wrapper_file.write("""#!/bin/sh | ||
| 124 | |||
| 125 | # This file has been generated automatically. | ||
| 126 | # It invokes QEMU to run binaries built for the target in the host during the | ||
| 127 | # build process. | ||
| 128 | |||
| 129 | %s "$@" | ||
| 130 | """ % qemu_cmd) | ||
| 131 | os.chmod(wrapper_path, 0o755) | ||
| 132 | } | ||
| 133 | |||
| 134 | do_create_v8_qemu_wrapper[dirs] = "${B}" | ||
| 135 | addtask create_v8_qemu_wrapper after do_configure before do_compile | ||
| 136 | |||
| 137 | LDFLAGS:append:x86 = " -latomic" | ||
| 138 | |||
| 139 | # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi | ||
| 140 | do_configure () { | ||
| 141 | export LD="${CXX}" | ||
| 142 | GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES | ||
| 143 | # $TARGET_ARCH settings don't match --dest-cpu settings | ||
| 144 | python3 configure.py --prefix=${prefix} --cross-compiling \ | ||
| 145 | --without-dtrace \ | ||
| 146 | --without-etw \ | ||
| 147 | --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \ | ||
| 148 | --dest-os=linux \ | ||
| 149 | --libdir=${D}${libdir} \ | ||
| 150 | ${ARCHFLAGS} \ | ||
| 151 | ${PACKAGECONFIG_CONFARGS} | ||
| 152 | } | ||
| 153 | |||
| 154 | do_compile () { | ||
| 155 | export LD="${CXX}" | ||
| 156 | install -Dm 0755 ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh | ||
| 157 | oe_runmake BUILDTYPE=Release | ||
| 158 | } | ||
| 159 | |||
| 160 | do_install () { | ||
| 161 | oe_runmake install DESTDIR=${D} | ||
| 162 | |||
| 163 | # wasn't updated since 2009 and is the only thing requiring python2 in runtime | ||
| 164 | # ERROR: nodejs-12.14.1-r0 do_package_qa: QA Issue: /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples contained in package nodejs-npm requires /usr/bin/python, but no providers found in RDEPENDS:nodejs-npm? [file-rdeps] | ||
| 165 | rm -f ${D}${exec_prefix}/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples | ||
| 166 | } | ||
| 167 | |||
| 168 | do_install:append:class-native() { | ||
| 169 | # use node from PATH instead of absolute path to sysroot | ||
| 170 | # node-v0.10.25/tools/install.py is using: | ||
| 171 | # shebang = os.path.join(node_prefix, 'bin/node') | ||
| 172 | # update_shebang(link_path, shebang) | ||
| 173 | # and node_prefix can be very long path to bindir in native sysroot and | ||
| 174 | # when it exceeds 128 character shebang limit it's stripped to incorrect path | ||
| 175 | # and npm fails to execute like in this case with 133 characters show in log.do_install: | ||
| 176 | # updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node | ||
| 177 | # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js | ||
| 178 | # use sed on npm-cli.js because otherwise symlink is replaced with normal file and | ||
| 179 | # npm-cli.js continues to use old shebang | ||
| 180 | sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js | ||
| 181 | |||
| 182 | # Install the native binaries to provide it within sysroot for the target compilation | ||
| 183 | install -d ${D}${bindir} | ||
| 184 | install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque | ||
| 185 | install -m 0755 ${S}/out/Release/bytecode_builtins_list_generator ${D}${bindir}/bytecode_builtins_list_generator | ||
| 186 | if ${@bb.utils.contains('PACKAGECONFIG','icu','true','false',d)}; then | ||
| 187 | install -m 0755 ${S}/out/Release/gen-regexp-special-case ${D}${bindir}/gen-regexp-special-case | ||
| 188 | fi | ||
| 189 | install -m 0755 ${S}/out/Release/mkcodecache ${D}${bindir}/mkcodecache | ||
| 190 | install -m 0755 ${S}/out/Release/node_mksnapshot ${D}${bindir}/node_mksnapshot | ||
| 191 | } | ||
| 192 | |||
| 193 | do_install:append:class-target() { | ||
| 194 | sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js | ||
| 195 | } | ||
| 196 | |||
| 197 | PACKAGES =+ "${PN}-npm" | ||
| 198 | FILES:${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx" | ||
| 199 | RDEPENDS:${PN}-npm = "bash python3-core python3-shell python3-datetime \ | ||
| 200 | python3-misc python3-multiprocessing" | ||
| 201 | |||
| 202 | PACKAGES =+ "${PN}-systemtap" | ||
| 203 | FILES:${PN}-systemtap = "${datadir}/systemtap" | ||
| 204 | |||
| 205 | BBCLASSEXTEND = "native" | ||
