--- /dev/null
+#DEPENDS += " node-native"
+
+#RDEPENDS_${PN} += " node"
+
+PACKAGE_DEBUG_SPLIT_STYLE = "debug-file-directory"
+
+CCACHE = ""
+
+NPM ?= "npm"
+NPM_CACHE_DIR = "${WORKDIR}/npm_cache"
+NPM_ARCH ?= "${TARGET_ARCH}"
+NPM_LD ?= "${CXX}"
+NPM_FLAGS ?= ""
+
+# Target npm
+
+oe_runnpm() {
+
+ export NPM_CONFIG_CACHE="${NPM_CACHE_DIR}"
+
+ [ -n "${http_proxy}" ] && export NPM_CONFIG_PROXY="${http_proxy}"
+ [ -n "${https_proxy}" ] && export NPM_CONFIG_HTTPS_PROXY="${https_proxy}"
+ [ -n "${HTTP_PROXY}" ] && export NPM_CONFIG_PROXY="${HTTP_PROXY}"
+ [ -n "${HTTPS_PROXY}" ] && export NPM_CONFIG_HTTPS_PROXY="${HTTPS_PROXY}"
+
+ bbnote NPM target architecture: ${NPM_ARCH}
+ bbnote NPM cache directory: ${NPM_CONFIG_CACHE}
+ bbnote NPM HTTP proxy: ${NPM_CONFIG_PROXY}
+ bbnote NPM HTTPS proxy: ${NPM_CONFIG_HTTPS_PROXY}
+
+ bbnote ${NPM} --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} ${NPM_FLAGS} "$@"
+
+ LD="${NPM_LD}" ${NPM} --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} ${NPM_FLAGS} "$@" || die "oe_runnpm failed"
+
+}
+
+# Native npm
+
+NPM_NATIVE ?= "npm"
+NPM_CACHE_DIR_NATIVE = "${WORKDIR}/npm_cache"
+NPM_ARCH_NATIVE ?= "${BUILD_ARCH}"
+NPM_LD_NATIVE ?= "${BUILD_CXX}"
+NPM_FLAGS_NATIVE ?= ""
+
+oe_runnpm_native() {
+
+ export NPM_CONFIG_CACHE="${NPM_CACHE_DIR_NATIVE}"
+
+ [ -n "${http_proxy}" ] && export NPM_CONFIG_PROXY="${http_proxy}"
+ [ -n "${https_proxy}" ] && export NPM_CONFIG_HTTPS_PROXY="${https_proxy}"
+ [ -n "${HTTP_PROXY}" ] && export NPM_CONFIG_PROXY="${HTTP_PROXY}"
+ [ -n "${HTTPS_PROXY}" ] && export NPM_CONFIG_HTTPS_PROXY="${HTTPS_PROXY}"
+
+ bbnote NPM native architecture: ${NPM_ARCH_NATIVE}
+ bbnote NPM cache directory: ${NPM_CONFIG_CACHE}
+ bbnote NPM HTTP proxy: ${NPM_CONFIG_PROXY}
+ bbnote NPM HTTPS proxy: ${NPM_CONFIG_HTTPS_PROXY}
+
+ bbnote ${NPM_NATIVE} --arch=${NPM_ARCH_NATIVE} --target_arch=${NPM_ARCH_NATIVE} ${NPM_FLAGS_NATIVE} "$@"
+
+ LD="${NPM_LD_NATIVE}" ${NPM_NATIVE} --arch=${NPM_ARCH_NATIVE} --target_arch=${NPM_ARCH_NATIVE} ${NPM_FLAGS_NATIVE} "$@" || die "oe_runnpm_native failed"
+
+}
SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \
file://enable-armv5e-build.patch \
file://no-registry.patch \
+ file://nodejs.sh \
+ file://nodejs.service \
"
SRC_URI[md5sum] = "5523ec4347d7fe6b0f6dda1d1c7799d5"
SRC_URI[sha256sum] = "b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d"
S = "${WORKDIR}/node-v${PV}"
+inherit npm
+NPM_INSTALL ?= "mqtt onoff request"
+NPM_INSTALL_FLAGS ?= ""
+
# v8 errors out if you have set CCACHE
CCACHE = ""
do_install () {
oe_runmake install DESTDIR=${D}
+
+ cd ${D}/usr/lib
+ oe_runnpm config set registry=http://registry.npmjs.org/
+ oe_runnpm ${NPM_INSTALL_FLAGS} install ${NPM_INSTALL}
+
+ for i in ${NPM_INSTALL};
+ do
+ rm -rf ${D}/usr/lib/node_modules/$i/doc
+ rm -rf ${D}/usr/lib/node_modules/$i/example*
+ rm -rf ${D}/usr/lib/node_modules/$i/test
+ done
+
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/nodejs.sh ${D}${sysconfdir}/init.d
+ update-rc.d -r ${D} nodejs.sh start 92 5 .
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/nodejs.service ${D}${systemd_unitdir}/system/
+
+ install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
+ cd ${D}${systemd_unitdir}/system/multi-user.target.wants/
+ ln -sf ../nodejs.service ${D}${systemd_unitdir}/system/multi-user.target.wants/nodejs.service
+ fi
+
+ rm -rf ${D}/usr/lib/node_modules/npm
}
do_install_append_class-native() {
# /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
# use sed on npm-cli.js because otherwise symlink is replaced with normal file and
# npm-cli.js continues to use old shebang
- sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+# sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
}
do_install_append_class-target() {
- sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+# sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
}
PACKAGES =+ "${PN}-npm"
-FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm"
+FILES_${PN}-npm = "${bindir}/npm"
RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils"
PACKAGES =+ "${PN}-systemtap"
FILES_${PN}-systemtap = "${datadir}/systemtap"
+FILES_${PN} += "${systemd_unitdir}/system/nodejs.service \
+ ${systemd_unitdir}/system/multi-user.target.wants/nodejs.service \
+ ${exec_prefix}/lib/node_modules \
+ "
BBCLASSEXTEND = "native"