blob: d2e77ea0df7d05e308f82848d4405412eab36bb4 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
2HOMEPAGE = "http://nodejs.org"
3LICENSE = "MIT & BSD & Artistic-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=9ceeba79eb2ea1067b7b3ed16fff8bab"
5
6DEPENDS = "openssl zlib icu"
7DEPENDS_append_class-target = " nodejs-native"
8
9inherit pkgconfig
10
11COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
12COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
13COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
14
15SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
16 file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
17 file://0003-Crypto-reduce-memory-usage-of-SignFinal.patch \
18 file://0004-Make-compatibility-with-gcc-4.8.patch \
19 file://0005-Link-atomic-library.patch \
20 file://0006-Use-target-ldflags.patch \
21 "
22SRC_URI_append_class-target = " \
23 file://0002-Using-native-torque.patch \
24 "
25
26SRC_URI[md5sum] = "d76210a6ae1ea73d10254947684836fb"
27SRC_URI[sha256sum] = "4e22d926f054150002055474e452ed6cbb85860aa7dc5422213a2002ed9791d5"
28
29S = "${WORKDIR}/node-v${PV}"
30
31# v8 errors out if you have set CCACHE
32CCACHE = ""
33
34def map_nodejs_arch(a, d):
35 import re
36
37 if re.match('i.86$', a): return 'ia32'
38 elif re.match('x86_64$', a): return 'x64'
39 elif re.match('aarch64$', a): return 'arm64'
40 elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64'
41 elif re.match('powerpc$', a): return 'ppc'
42 return a
43
44ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \
45 ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \
46 bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \
47 bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \
48 '--with-arm-fpu=vfp', d), d), d)}"
49GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
50ARCHFLAGS ?= ""
51
52# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
53do_configure () {
54 rm -rf ${S}/deps/openssl
55 export LD="${CXX}"
56 GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
57 # $TARGET_ARCH settings don't match --dest-cpu settings
58 ./configure --prefix=${prefix} --with-intl=system-icu --without-snapshot --shared-openssl --shared-zlib \
59 --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
60 --dest-os=linux \
61 ${ARCHFLAGS}
62}
63
64do_compile () {
65 export LD="${CXX}"
66 oe_runmake BUILDTYPE=Release
67}
68
69do_install () {
70 oe_runmake install DESTDIR=${D}
71}
72
73do_install_append_class-native() {
74 # use node from PATH instead of absolute path to sysroot
75 # node-v0.10.25/tools/install.py is using:
76 # shebang = os.path.join(node_prefix, 'bin/node')
77 # update_shebang(link_path, shebang)
78 # and node_prefix can be very long path to bindir in native sysroot and
79 # when it exceeds 128 character shebang limit it's stripped to incorrect path
80 # and npm fails to execute like in this case with 133 characters show in log.do_install:
81 # 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
82 # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
83 # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
84 # npm-cli.js continues to use old shebang
85 sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
86
87 # Install the native torque to provide it within sysroot for the target compilation
88 install -d ${D}${bindir}
89 install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque
90}
91
92do_install_append_class-target() {
93 sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
94}
95
96PACKAGES =+ "${PN}-npm"
97FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx"
98RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils \
99 python-compiler python-misc python-multiprocessing"
100
101PACKAGES =+ "${PN}-systemtap"
102FILES_${PN}-systemtap = "${datadir}/systemtap"
103
104
105BBCLASSEXTEND = "native"