summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-03-03 17:06:56 -0800
committerKhem Raj <raj.khem@gmail.com>2023-03-04 13:41:13 -0800
commita4491a3e3ef0a73a3b3036808c1d244d43f925f0 (patch)
treee4487dbb8886724826ee1a7d96eb989965ae3bf0 /meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb
parentcbec25e1bc62f4fc45f5aaebd7bb0cc037153fec (diff)
downloadmeta-openembedded-a4491a3e3ef0a73a3b3036808c1d244d43f925f0.tar.gz
nodejs: Upgrade to 18.14.2
License-Update: Add base64 license information [1] and postject [2] [1] https://github.com/nodejs/node/commit/2ec8092e2cf70267e765dfe4baf13d72838a58ed [2] https://github.com/nodejs/node/commit/4aaec0726694ad0d3cb05d7f2593a90363c32f32 Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb')
-rw-r--r--meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb182
1 files changed, 182 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb b/meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb
new file mode 100644
index 0000000000..c92c373746
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_18.14.2.bb
@@ -0,0 +1,182 @@
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=2dff1ccca11e333f1388e34f7e2d1de3"
5
6CVE_PRODUCT = "nodejs node.js"
7
8DEPENDS = "openssl"
9DEPENDS:append:class-target = " qemu-native"
10DEPENDS:append:class-native = " c-ares-native"
11
12inherit pkgconfig python3native qemu ptest
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-Disable-running-gyp-files-for-bundled-deps.patch \
24 file://0004-v8-don-t-override-ARM-CFLAGS.patch \
25 file://big-endian.patch \
26 file://mips-less-memory.patch \
27 file://system-c-ares.patch \
28 file://0001-liftoff-Correct-function-signatures.patch \
29 file://0001-mips-Use-32bit-cast-for-operand-on-mips32.patch \
30 "
31
32SRC_URI:append:class-target = " \
33 file://0001-Using-native-binaries.patch \
34 "
35SRC_URI:append:toolchain-clang:x86 = " \
36 file://libatomic.patch \
37 "
38SRC_URI:append:toolchain-clang:powerpc64le = " \
39 file://0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch \
40 "
41SRC_URI[sha256sum] = "fbc364dd25fee2cacc0f2033db2d86115fc07575310ea0e64408b8170d09c685"
42
43S = "${WORKDIR}/node-v${PV}"
44
45# v8 errors out if you have set CCACHE
46CCACHE = ""
47
48def map_nodejs_arch(a, d):
49 import re
50
51 if re.match('i.86$', a): return 'ia32'
52 elif re.match('x86_64$', a): return 'x64'
53 elif re.match('aarch64$', a): return 'arm64'
54 elif re.match('(powerpc64|powerpc64le|ppc64le)$', a): return 'ppc64'
55 elif re.match('powerpc$', a): return 'ppc'
56 return a
57
58ARCHFLAGS:arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \
59 ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \
60 bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \
61 bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \
62 '--with-arm-fpu=vfp', d), d), d)}"
63ARCHFLAGS:append:mips = " --v8-lite-mode"
64ARCHFLAGS:append:mipsel = " --v8-lite-mode"
65ARCHFLAGS ?= ""
66
67PACKAGECONFIG ??= "ares brotli icu zlib"
68
69PACKAGECONFIG[ares] = "--shared-cares,,c-ares"
70PACKAGECONFIG[brotli] = "--shared-brotli,,brotli"
71PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu"
72PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
73PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
74PACKAGECONFIG[shared] = "--shared"
75PACKAGECONFIG[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.
80EXTRA_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
91python prune_sources() {
92 import shutil
93
94 shutil.rmtree(d.getVar('S') + '/deps/openssl')
95 if 'ares' in d.getVar('PACKAGECONFIG'):
96 shutil.rmtree(d.getVar('S') + '/deps/cares')
97 if 'brotli' in d.getVar('PACKAGECONFIG'):
98 shutil.rmtree(d.getVar('S') + '/deps/brotli')
99 if 'libuv' in d.getVar('PACKAGECONFIG'):
100 shutil.rmtree(d.getVar('S') + '/deps/uv')
101 if 'nghttp2' in d.getVar('PACKAGECONFIG'):
102 shutil.rmtree(d.getVar('S') + '/deps/nghttp2')
103 if 'zlib' in d.getVar('PACKAGECONFIG'):
104 shutil.rmtree(d.getVar('S') + '/deps/zlib')
105}
106do_unpack[postfuncs] += "prune_sources"
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.
114python 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'),
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
134do_create_v8_qemu_wrapper[dirs] = "${B}"
135addtask create_v8_qemu_wrapper after do_configure before do_compile
136
137LDFLAGS:append:x86 = " -latomic"
138
139CROSS_FLAGS = "--cross-compiling"
140CROSS_FLAGS:class-native = "--no-cross-compiling"
141
142# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
143do_configure () {
144 GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
145 # $TARGET_ARCH settings don't match --dest-cpu settings
146 python3 configure.py --verbose --prefix=${prefix} \
147 --shared-openssl \
148 --without-dtrace \
149 --without-etw \
150 --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
151 --dest-os=linux \
152 --libdir=${baselib} \
153 ${CROSS_FLAGS} \
154 ${ARCHFLAGS} \
155 ${PACKAGECONFIG_CONFARGS}
156}
157
158do_compile () {
159 install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf
160 install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh
161 oe_runmake BUILDTYPE=Release
162}
163
164do_install () {
165 oe_runmake install DESTDIR=${D}
166}
167
168do_install_ptest () {
169 cp -r ${B}/out/Release/cctest ${D}${PTEST_PATH}/
170 cp -r ${B}/test ${D}${PTEST_PATH}
171 chown -R root:root ${D}${PTEST_PATH}
172}
173
174PACKAGES =+ "${PN}-npm"
175FILES:${PN}-npm = "${nonarch_libdir}/node_modules ${bindir}/npm ${bindir}/npx"
176RDEPENDS:${PN}-npm = "bash python3-core python3-shell python3-datetime \
177 python3-misc python3-multiprocessing"
178
179PACKAGES =+ "${PN}-systemtap"
180FILES:${PN}-systemtap = "${datadir}/systemtap"
181
182BBCLASSEXTEND = "native"