summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb
diff options
context:
space:
mode:
authorJason Schonberg <schonm@gmail.com>2025-03-18 13:53:42 -0400
committerKhem Raj <raj.khem@gmail.com>2025-03-18 11:30:45 -0700
commit3989427ca7e348627f9a66e45d3652596b66fe94 (patch)
tree21a5b92d3fd9c93970e2c1be8904a1d158c3675b /meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb
parent134978803ec5f4e4ae5c1d3311896ccd52827851 (diff)
downloadmeta-openembedded-3989427ca7e348627f9a66e45d3652596b66fe94.tar.gz
nodejs: upgrade 22.13.0 -> 22.14.0
License-Update: Change the location of the inspector_protocol https://github.com/nodejs/node/commit/a48430d4d34eb9f598522410dd7723f069c574d0 Changelog: https://github.com/nodejs/node/releases/tag/v22.14.0 Signed-off-by: Jason Schonberg <schonm@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb')
-rw-r--r--meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb215
1 files changed, 215 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb
new file mode 100644
index 0000000000..dee4c9df4f
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_22.14.0.bb
@@ -0,0 +1,215 @@
1DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
2HOMEPAGE = "http://nodejs.org"
3LICENSE = "MIT & ISC & BSD-2-Clause & BSD-3-Clause & Artistic-2.0 & Apache-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=da350b022352bee62fe22feb6ad681c8"
5
6CVE_PRODUCT = "nodejs node.js"
7
8DEPENDS = "openssl openssl-native file-replacement-native python3-packaging-native"
9DEPENDS:append:class-target = " qemu-native"
10DEPENDS:append:class-native = " c-ares-native"
11
12inherit pkgconfig python3native qemu ptest siteinfo
13
14COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*"
15COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*"
16COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*"
17
18COMPATIBLE_HOST:riscv64 = "null"
19COMPATIBLE_HOST:riscv32 = "null"
20COMPATIBLE_HOST:powerpc = "null"
21
22SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
23 file://0001-Do-not-use-glob-in-deps.patch \
24 file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
25 file://0004-v8-don-t-override-ARM-CFLAGS.patch \
26 file://system-c-ares.patch \
27 file://0001-liftoff-Correct-function-signatures.patch \
28 file://libatomic.patch \
29 file://0001-deps-disable-io_uring-support-in-libuv.patch \
30 file://0001-positional-args.patch \
31 file://0001-custom-env.patch \
32 file://run-ptest \
33 "
34SRC_URI:append:class-target = " \
35 file://0001-Using-native-binaries.patch \
36 "
37SRC_URI:append:toolchain-clang:powerpc64le = " \
38 file://0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch \
39 "
40SRC_URI[sha256sum] = "c609946bf793b55c7954c26582760808d54c16185d79cb2fb88065e52de21914"
41
42S = "${WORKDIR}/node-v${PV}"
43
44CVE_PRODUCT += "node.js"
45
46# v8 errors out if you have set CCACHE
47CCACHE = ""
48
49def 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
59ARCHFLAGS: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)}"
64ARCHFLAGS:append:mips = " --v8-lite-mode"
65ARCHFLAGS:append:mipsel = " --v8-lite-mode"
66ARCHFLAGS ?= ""
67
68PACKAGECONFIG ??= "ares brotli icu zlib"
69
70PACKAGECONFIG[ares] = "--shared-cares,,c-ares c-ares-native"
71PACKAGECONFIG[brotli] = "--shared-brotli,,brotli brotli-native"
72PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu icu-native"
73PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
74PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
75PACKAGECONFIG[shared] = "--shared"
76PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
77
78EXTRANATIVEPATH += "file-native"
79
80python prune_sources() {
81 import shutil
82
83 shutil.rmtree(d.getVar('S') + '/deps/openssl')
84 if 'ares' in d.getVar('PACKAGECONFIG'):
85 shutil.rmtree(d.getVar('S') + '/deps/cares')
86 if 'brotli' in d.getVar('PACKAGECONFIG'):
87 shutil.rmtree(d.getVar('S') + '/deps/brotli')
88 if 'libuv' in d.getVar('PACKAGECONFIG'):
89 shutil.rmtree(d.getVar('S') + '/deps/uv')
90 if 'nghttp2' in d.getVar('PACKAGECONFIG'):
91 shutil.rmtree(d.getVar('S') + '/deps/nghttp2')
92 if 'zlib' in d.getVar('PACKAGECONFIG'):
93 shutil.rmtree(d.getVar('S') + '/deps/zlib')
94}
95do_unpack[postfuncs] += "prune_sources"
96
97# V8's JIT infrastructure requires binaries such as mksnapshot and
98# mkpeephole to be run in the host during the build. However, these
99# binaries must have the same bit-width as the target (e.g. a x86_64
100# host targeting ARMv6 needs to produce a 32-bit binary).
101# 1. If host and target have the different bit width, run those
102# binaries for the target and run them on the host with QEMU.
103# 2. If host and target have the same bit width, enable upstream
104# cross compile support and no QEMU
105python do_create_v8_qemu_wrapper () {
106 """Creates a small wrapper that invokes QEMU to run some target V8 binaries
107 on the host."""
108 qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'),
109 d.expand('${STAGING_DIR_HOST}${base_libdir}')]
110 qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'),
111 qemu_libdirs)
112
113 if d.getVar("HOST_AND_TARGET_SAME_WIDTH") == "1":
114 qemu_cmd = ""
115
116 wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh')
117 with open(wrapper_path, 'w') as wrapper_file:
118 wrapper_file.write("""#!/bin/sh
119
120# This file has been generated automatically.
121# It invokes QEMU to run binaries built for the target in the host during the
122# build process.
123
124%s "$@"
125""" % qemu_cmd)
126 os.chmod(wrapper_path, 0o755)
127}
128
129do_create_v8_qemu_wrapper[dirs] = "${B}"
130addtask create_v8_qemu_wrapper after do_configure before do_compile
131
132LDFLAGS:append:x86 = " -latomic"
133
134export CC_host
135export CFLAGS_host
136export CXX_host
137export CXXFLAGS_host
138export LDFLAGS_host
139export AR_host
140export HOST_AND_TARGET_SAME_WIDTH
141
142CROSS_FLAGS = "--cross-compiling"
143CROSS_FLAGS:class-native = "--no-cross-compiling"
144
145# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
146do_configure () {
147 GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
148 # $TARGET_ARCH settings don't match --dest-cpu settings
149 python3 configure.py --verbose --prefix=${prefix} \
150 --shared-openssl \
151 --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
152 --dest-os=linux \
153 --libdir=${baselib} \
154 ${CROSS_FLAGS} \
155 ${ARCHFLAGS} \
156 ${PACKAGECONFIG_CONFARGS}
157}
158
159do_compile () {
160 install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf
161 install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh
162 oe_runmake BUILDTYPE=Release
163}
164
165do_install () {
166 oe_runmake install DESTDIR=${D}
167}
168
169do_install_ptest () {
170 cp -r ${B}/out/Release/cctest ${D}${PTEST_PATH}/
171 cp -r ${B}/test ${D}${PTEST_PATH}
172 chown -R root:root ${D}${PTEST_PATH}
173}
174
175PACKAGES =+ "${PN}-npm"
176FILES:${PN}-npm = "${nonarch_libdir}/node_modules ${bindir}/npm ${bindir}/npx ${bindir}/corepack"
177RDEPENDS:${PN}-npm = "bash python3-core python3-shell python3-datetime \
178 python3-misc python3-multiprocessing"
179
180PACKAGES =+ "${PN}-systemtap"
181FILES:${PN}-systemtap = "${datadir}/systemtap"
182
183do_configure[prefuncs] += "set_gyp_variables"
184do_compile[prefuncs] += "set_gyp_variables"
185do_install[prefuncs] += "set_gyp_variables"
186python set_gyp_variables () {
187 if d.getVar("HOST_AND_TARGET_SAME_WIDTH") == "0":
188 # We don't want to cross-compile during target compile,
189 # and we need to use the right flags during host compile,
190 # too.
191 d.setVar("CC_host", d.getVar("CC") + " -pie -fPIE")
192 d.setVar("CFLAGS_host", d.getVar("CFLAGS"))
193 d.setVar("CXX_host", d.getVar("CXX") + " -pie -fPIE")
194 d.setVar("CXXFLAGS_host", d.getVar("CXXFLAGS"))
195 d.setVar("LDFLAGS_host", d.getVar("LDFLAGS"))
196 d.setVar("AR_host", d.getVar("AR"))
197 elif d.getVar("HOST_AND_TARGET_SAME_WIDTH") == "1":
198 # Enable upstream cross compile support
199 d.setVar("CC_host", d.getVar("BUILD_CC"))
200 d.setVar("CFLAGS_host", d.getVar("BUILD_CFLAGS"))
201 d.setVar("CXX_host", d.getVar("BUILD_CXX"))
202 d.setVar("CXXFLAGS_host", d.getVar("BUILD_CXXFLAGS"))
203 d.setVar("LDFLAGS_host", d.getVar("BUILD_LDFLAGS"))
204 d.setVar("AR_host", d.getVar("BUILD_AR"))
205}
206
207python __anonymous () {
208 # 32 bit target and 64 bit host (x86-64 or aarch64) have different bit width
209 if d.getVar("SITEINFO_BITS") == "32" and "64" in d.getVar("BUILD_ARCH"):
210 d.setVar("HOST_AND_TARGET_SAME_WIDTH", "0")
211 else:
212 d.setVar("HOST_AND_TARGET_SAME_WIDTH", "1")
213}
214
215BBCLASSEXTEND = "native"