aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/iotkit-comm-js/iotkit-comm-js_0.1.1.bb
blob: b7ea5057691bd0c0bc626dd2735b233d97db64ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
DESCRIPTION = "Inter of Things communication library for device-to-device and device-to-cloud messaging"
LICENSE = "MIT"

PR = "r2"

SRC_URI = "git://github.com/intel-iot-devkit/iotkit-comm-js.git;protocol=https"
SRCREV = "3d78d3cf097dfbbb5a9f554497dec5ba8456a35c"

LIC_FILES_CHKSUM = " \
        file://COPYING;md5=e8db6501ed294e65418a933925d12058 \
"

S = "${WORKDIR}/git"

DEPENDS = "nodejs-native zeromq mdns paho-mqtt iotkit-lib-c"

do_compile () {
    # changing the home directory to the working directory, the .npmrc will be created in this directory
    export HOME=${WORKDIR}

    # does not build dev packages
    npm config set dev false

    # access npm registry using http
    npm set strict-ssl false
    npm config set registry http://registry.npmjs.org/

    # configure http proxy if neccessary
    if [ -n "${http_proxy}" ]; then
        npm config set proxy ${http_proxy}
    fi
    if [ -n "${HTTP_PROXY}" ]; then
        npm config set proxy ${HTTP_PROXY}
    fi

    # configure cache to be in working directory
    npm set cache ${WORKDIR}/npm_cache

    # clear local cache prior to each compile
    npm cache clear

    # compile and install  node modules in source directory
    npm --arch=${TARGET_ARCH} --verbose install
}

do_install () {
    install -d ${D}${libdir}/node_modules/iotkit-comm/
    cp -r ${S}/node_modules ${D}${libdir}/node_modules/iotkit-comm/
    install -m 644 ${S}/package.json ${D}${libdir}/node_modules/iotkit-comm/
    install -m 644 ${S}/COPYING ${D}${libdir}/node_modules/iotkit-comm/
    install -m 644 ${S}/README.md ${D}${libdir}/node_modules/iotkit-comm/
    install -m 644 ${S}/jsdoc-conf.json ${D}${libdir}/node_modules/iotkit-comm/
    cp -r ${S}/lib ${D}${libdir}/node_modules/iotkit-comm/
    cp -r ${S}/test ${D}${libdir}/node_modules/iotkit-comm/
    cp -r ${S}/doc ${D}${libdir}/node_modules/iotkit-comm/
    install -d ${D}${datadir}/iotkit-comm/examples/node
    cp -r ${S}/example/* ${D}${datadir}/iotkit-comm/examples/node

    chmod 755 ${D}${libdir}/node_modules/iotkit-comm/lib/setup.js
    install -d ${D}${bindir}
    ln -s ../lib/node_modules/iotkit-comm/lib/setup.js ${D}${bindir}/iotkit-comm
}

INHIBIT_PACKAGE_STRIP = "1"

PACKAGES = "${PN} ${PN}-test-dependencies"

FILES_${PN}-test-dependencies = " \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/istanbul \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/jsdoc \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/mocha \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/_mocha \
        ${libdir}/node_modules/iotkit-comm/node_modules/chai/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/istanbul/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/jsdoc/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/mocha/ \
"

FILES_${PN} = " \
        ${libdir}/node_modules/iotkit-comm/doc/ \
        ${libdir}/node_modules/iotkit-comm/jsdoc-conf.json \
        ${libdir}/node_modules/iotkit-comm/COPYING \
        ${libdir}/node_modules/iotkit-comm/lib/ \
        ${libdir}/node_modules/iotkit-comm/package.json \
        ${libdir}/node_modules/iotkit-comm/README.md \
        ${libdir}/node_modules/iotkit-comm/test \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/mqtt_pub \
        ${libdir}/node_modules/iotkit-comm/node_modules/.bin/mqtt_sub \
        ${libdir}/node_modules/iotkit-comm/node_modules/async/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/commander/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/mdns2/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/mqtt/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/read/ \
        ${libdir}/node_modules/iotkit-comm/node_modules/zmq/ \
        ${datadir}/iotkit-comm/examples/ \
        ${bindir}/iotkit-comm \
"

RDEPENDS_${PN} = "nodejs zeromq mdns paho-mqtt mosquitto sshpass iotkit-lib-c"
RDEPENDS_${PN}-test-dependencies = "${PN}"