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