1 DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
2 HOMEPAGE = "http://nodejs.org"
3 LICENSE = "MIT & BSD & Artistic-2.0"
4 LIC_FILES_CHKSUM = "file://LICENSE;md5=14115ff11211df04b031ec7d40b6d31b"
8 SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \
9 file://enable-armv5e-build.patch \
10 file://no-registry.patch \
12 file://nodejs.service \
14 SRC_URI[md5sum] = "5523ec4347d7fe6b0f6dda1d1c7799d5"
15 SRC_URI[sha256sum] = "b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d"
17 S = "${WORKDIR}/node-v${PV}"
20 NPM_INSTALL ?= "mqtt onoff request"
21 NPM_INSTALL_FLAGS ?= ""
23 # v8 errors out if you have set CCACHE
26 def map_nodejs_arch(a, d):
29 if re.match('p(pc|owerpc)(|64)', a): return 'ppc'
30 elif re.match('i.86$', a): return 'ia32'
31 elif re.match('x86_64$', a): return 'x64'
32 elif re.match('arm64$', a): return 'arm'
35 ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)}"
36 GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
39 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
42 GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
43 # $TARGET_ARCH settings don't match --dest-cpu settings
44 ./configure --prefix=${prefix} --without-snapshot --shared-openssl \
45 --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH', True), d)}" \
52 oe_runmake BUILDTYPE=Release
56 oe_runmake install DESTDIR=${D}
59 oe_runnpm config set registry=http://registry.npmjs.org/
60 oe_runnpm ${NPM_INSTALL_FLAGS} install ${NPM_INSTALL}
62 for i in ${NPM_INSTALL};
64 rm -rf ${D}/usr/lib/node_modules/$i/doc
65 rm -rf ${D}/usr/lib/node_modules/$i/example*
66 rm -rf ${D}/usr/lib/node_modules/$i/test
69 install -d ${D}${sysconfdir}/init.d
70 install -m 0755 ${WORKDIR}/nodejs.sh ${D}${sysconfdir}/init.d
71 update-rc.d -r ${D} nodejs.sh start 92 5 .
73 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
74 install -d ${D}${systemd_unitdir}/system
75 install -m 0644 ${WORKDIR}/nodejs.service ${D}${systemd_unitdir}/system/
77 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
78 cd ${D}${systemd_unitdir}/system/multi-user.target.wants/
79 ln -sf ../nodejs.service ${D}${systemd_unitdir}/system/multi-user.target.wants/nodejs.service
82 rm -rf ${D}/usr/lib/node_modules/npm
85 do_install_append_class-native() {
86 # use node from PATH instead of absolute path to sysroot
87 # node-v0.10.25/tools/install.py is using:
88 # shebang = os.path.join(node_prefix, 'bin/node')
89 # update_shebang(link_path, shebang)
90 # and node_prefix can be very long path to bindir in native sysroot and
91 # when it exceeds 128 character shebang limit it's stripped to incorrect path
92 # and npm fails to execute like in this case with 133 characters show in log.do_install:
93 # 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
94 # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
95 # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
96 # npm-cli.js continues to use old shebang
97 # sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
100 do_install_append_class-target() {
101 # sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
104 PACKAGES =+ "${PN}-npm"
105 FILES_${PN}-npm = "${bindir}/npm"
106 RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils"
108 PACKAGES =+ "${PN}-systemtap"
109 FILES_${PN}-systemtap = "${datadir}/systemtap"
111 FILES_${PN} += "${systemd_unitdir}/system/nodejs.service \
112 ${systemd_unitdir}/system/multi-user.target.wants/nodejs.service \
113 ${exec_prefix}/lib/node_modules \
116 BBCLASSEXTEND = "native"