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