blob: 4013c6931eab4d81742565e6b7266cc000f31623 [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"
Brad Bishop26bdd442019-08-16 17:08:17 -04004LIC_FILES_CHKSUM = "file://LICENSE;md5=be980eb7ccafe287cb438076a65e888c"
Brad Bishop19323692019-04-05 15:28:33 -04005
Brad Bishop26bdd442019-08-16 17:08:17 -04006DEPENDS = "openssl"
Brad Bishop19323692019-04-05 15:28:33 -04007DEPENDS_append_class-target = " nodejs-native"
8
9inherit pkgconfig
10
11COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
12COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
13COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
14
Brad Bishopc1d34332019-09-09 14:56:00 -040015COMPATIBLE_HOST_riscv64 = "null"
16COMPATIBLE_HOST_riscv32 = "null"
17
Brad Bishop19323692019-04-05 15:28:33 -040018SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
19 file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
Brad Bishop19323692019-04-05 15:28:33 -040020 file://0004-Make-compatibility-with-gcc-4.8.patch \
21 file://0005-Link-atomic-library.patch \
22 file://0006-Use-target-ldflags.patch \
23 "
24SRC_URI_append_class-target = " \
25 file://0002-Using-native-torque.patch \
26 "
27
Brad Bishop868407c2019-11-04 13:24:47 -050028SRC_URI[md5sum] = "d5a56d0abf764a91f627f0690cd4b9f3"
29SRC_URI[sha256sum] = "412667d76bd5273c07cb69c215998109fd5bb35c874654f93e6a0132d666c58e"
Brad Bishop19323692019-04-05 15:28:33 -040030
31S = "${WORKDIR}/node-v${PV}"
32
33# v8 errors out if you have set CCACHE
34CCACHE = ""
35
36def map_nodejs_arch(a, d):
37 import re
38
39 if re.match('i.86$', a): return 'ia32'
40 elif re.match('x86_64$', a): return 'x64'
41 elif re.match('aarch64$', a): return 'arm64'
42 elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64'
43 elif re.match('powerpc$', a): return 'ppc'
44 return a
45
46ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \
47 ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \
48 bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \
49 bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \
50 '--with-arm-fpu=vfp', d), d), d)}"
51GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
52ARCHFLAGS ?= ""
53
Brad Bishop868407c2019-11-04 13:24:47 -050054PACKAGECONFIG ??= "ares icu libuv zlib"
55PACKAGECONFIG[ares] = "--shared-cares,,c-ares"
Brad Bishop26bdd442019-08-16 17:08:17 -040056PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu"
Brad Bishop868407c2019-11-04 13:24:47 -050057PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
Brad Bishop2f973922019-11-11 07:58:48 -050058PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
Brad Bishop868407c2019-11-04 13:24:47 -050059PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
Brad Bishop26bdd442019-08-16 17:08:17 -040060
Brad Bishop19323692019-04-05 15:28:33 -040061# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
62do_configure () {
63 rm -rf ${S}/deps/openssl
64 export LD="${CXX}"
65 GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
66 # $TARGET_ARCH settings don't match --dest-cpu settings
Brad Bishop26bdd442019-08-16 17:08:17 -040067 ./configure --prefix=${prefix} --without-snapshot --shared-openssl \
Brad Bishop19323692019-04-05 15:28:33 -040068 --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
69 --dest-os=linux \
Brad Bishop26bdd442019-08-16 17:08:17 -040070 ${ARCHFLAGS} \
71 ${PACKAGECONFIG_CONFARGS}
Brad Bishop19323692019-04-05 15:28:33 -040072}
73
74do_compile () {
75 export LD="${CXX}"
76 oe_runmake BUILDTYPE=Release
77}
78
79do_install () {
80 oe_runmake install DESTDIR=${D}
81}
82
83do_install_append_class-native() {
84 # use node from PATH instead of absolute path to sysroot
85 # node-v0.10.25/tools/install.py is using:
86 # shebang = os.path.join(node_prefix, 'bin/node')
87 # update_shebang(link_path, shebang)
88 # and node_prefix can be very long path to bindir in native sysroot and
89 # when it exceeds 128 character shebang limit it's stripped to incorrect path
90 # and npm fails to execute like in this case with 133 characters show in log.do_install:
91 # 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
92 # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
93 # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
94 # npm-cli.js continues to use old shebang
95 sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
96
97 # Install the native torque to provide it within sysroot for the target compilation
98 install -d ${D}${bindir}
99 install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque
100}
101
102do_install_append_class-target() {
103 sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
104}
105
106PACKAGES =+ "${PN}-npm"
107FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx"
Brad Bishop90ca7472019-08-20 09:15:15 -0400108RDEPENDS_${PN}-npm = "bash python-core python-shell python-datetime python-subprocess python-textutils \
Brad Bishop19323692019-04-05 15:28:33 -0400109 python-compiler python-misc python-multiprocessing"
110
111PACKAGES =+ "${PN}-systemtap"
112FILES_${PN}-systemtap = "${datadir}/systemtap"
113
114
115BBCLASSEXTEND = "native"