This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
/
iotivity-node_1.2.1-1.bb
93 lines (74 loc) · 2.98 KB
/
iotivity-node_1.2.1-1.bb
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
DESCRIPTION = "This project provides iotivity node.js bindings."
HOMEPAGE = "https://github.com/otcshare/iotivity-node"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
DEPENDS = "nodejs-native glib-2.0 iotivity"
RDEPENDS_${PN} += "iotivity-resource"
SRC_URI = "git://github.com/otcshare/iotivity-node.git;protocol=https"
SRCREV = "63587a0d365fc66ec40dc6d4354329d0c1ff092f"
S = "${WORKDIR}/git"
INSANE_SKIP_${PN} += "ldflags staticdev"
do_compile_prepend() {
OCTBDIR="${STAGING_DIR_TARGET}${includedir}/iotivity/resource"
export OCTBSTACK_CFLAGS="-I${OCTBDIR} -I${OCTBDIR}/stack -I${OCTBDIR}/ocrandom -DROUTING_EP"
export OCTBSTACK_LIBS="-loctbstack"
export CFLAGS="$CFLAGS -fPIC"
export CXXFLAGS="$CXXFLAGS -fPIC"
}
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
case ${TARGET_ARCH} in
i?86) targetArch="ia32"
echo "targetArch = 32"
;;
x86_64) targetArch="x64"
echo "targetArch = 64"
;;
arm) targetArch="arm"
;;
aarch64) targetArch="arm64"
;;
mips) targetArch="mips"
;;
sparc) targetArch="sparc"
;;
*) echo "unknown architecture"
exit 1
;;
esac
# Compile and install node modules in source directory
npm --arch=${targetArch} --production --verbose install
}
do_install () {
install -d ${D}${libdir}/node_modules/iotivity-node/
install -m 0644 ${S}/AUTHORS.txt ${D}${libdir}/node_modules/iotivity-node/AUTHORS.txt
install -m 0644 ${S}/index.js ${D}${libdir}/node_modules/iotivity-node/index.js
install -m 0644 ${S}/lowlevel.js ${D}${libdir}/node_modules/iotivity-node/lowlevel.js
install -m 0644 ${S}/README.md ${D}${libdir}/node_modules/iotivity-node/README.md
install -m 0644 ${S}/package.json ${D}${libdir}/node_modules/iotivity-node/package.json
cp -r ${S}/lib/ ${D}${libdir}/node_modules/iotivity-node/
cp -r ${S}/node_modules/ ${D}${libdir}/node_modules/iotivity-node/
install -d ${D}${libdir}/node_modules/iotivity-node/build/Release/
install -m 0755 ${S}/build/Release/iotivity.node ${D}${libdir}/node_modules/iotivity-node/build/Release/
}
FILES_${PN} = "${libdir}/node_modules/iotivity-node/ \
"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
PACKAGES = "${PN}"