Description : Creating and Adding new layer for tizen micro profile base.
[scm/bb/meta-tizen.git] / meta-tizen-micro / recipes-devtools / nodejs / nodejs_0.12.7.bb
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"
5
6 DEPENDS = "openssl"
7
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 \
11 "
12 SRC_URI[md5sum] = "5523ec4347d7fe6b0f6dda1d1c7799d5"
13 SRC_URI[sha256sum] = "b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d"
14
15 S = "${WORKDIR}/node-v${PV}"
16
17 # v8 errors out if you have set CCACHE
18 CCACHE = ""
19
20 def map_nodejs_arch(a, d):
21     import re
22
23     if   re.match('p(pc|owerpc)(|64)', a): return 'ppc'
24     elif re.match('i.86$', a): return 'ia32'
25     elif re.match('x86_64$', a): return 'x64'
26     elif re.match('arm64$', a): return 'arm'
27     return a
28
29 ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)}"
30 GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
31 ARCHFLAGS ?= ""
32
33 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
34 do_configure () {
35     export LD="${CXX}"
36     GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
37     # $TARGET_ARCH settings don't match --dest-cpu settings
38    ./configure --prefix=${prefix} --without-snapshot --shared-openssl \
39                --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH', True), d)}" \
40                --dest-os=linux \
41                ${ARCHFLAGS}
42 }
43
44 do_compile () {
45     export LD="${CXX}"
46     oe_runmake BUILDTYPE=Release
47 }
48
49 do_install () {
50     oe_runmake install DESTDIR=${D}
51 }
52
53 do_install_append_class-native() {
54     # use node from PATH instead of absolute path to sysroot
55     # node-v0.10.25/tools/install.py is using:
56     # shebang = os.path.join(node_prefix, 'bin/node')
57     # update_shebang(link_path, shebang)
58     # and node_prefix can be very long path to bindir in native sysroot and
59     # when it exceeds 128 character shebang limit it's stripped to incorrect path
60     # and npm fails to execute like in this case with 133 characters show in log.do_install:
61     # 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
62     # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
63     # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
64     # npm-cli.js continues to use old shebang
65     sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
66 }
67
68 do_install_append_class-target() {
69     sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
70 }
71
72 PACKAGES =+ "${PN}-npm"
73 FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm"
74 RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils"
75
76 PACKAGES =+ "${PN}-systemtap"
77 FILES_${PN}-systemtap = "${datadir}/systemtap"
78
79
80 BBCLASSEXTEND = "native"