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