From 6b4c82f4657bdb56e6b7a56651d6d4bb91a35b8f Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 26 Jun 2014 13:29:32 +0200 Subject: initial commit for Enea Linux 4.0 Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau --- meta-iot/conf/layer.conf | 12 ++ .../avahi/avahi-daemon-init.bb | 31 +++++ .../avahi-daemon-init/LICENSE.avahi-daemon-init | 9 ++ .../avahi-daemon-init-settings.sh | 20 ++++ .../avahi-daemon-init/avahi-daemon-init.service | 12 ++ .../avahi/avahi_0.6.31.bbappend | 10 ++ .../recipes-web/the-thing-system/steward-init.bb | 40 +++++++ .../steward-init/LICENSE.steward-init | 9 ++ .../steward-init/steward-init-settings.sh | 62 ++++++++++ .../steward-init/steward-init.service.in | 14 +++ .../steward/npm-setup-proxies.example | 5 + .../the-thing-system/steward/package.json | 90 ++++++++++++++ .../the-thing-system/steward/server.js.in | 3 + .../the-thing-system/steward/start-steward | 22 ++++ .../the-thing-system/steward/start-steward.debug | 22 ++++ .../the-thing-system/steward/steward.service.in | 12 ++ .../recipes-web/the-thing-system/steward_git.bb | 131 +++++++++++++++++++++ .../recipes-web/the-thing-system/tts-nodejs_git.bb | 49 ++++++++ 18 files changed, 553 insertions(+) create mode 100644 meta-iot/conf/layer.conf create mode 100644 meta-iot/recipes-connectivity/avahi/avahi-daemon-init.bb create mode 100644 meta-iot/recipes-connectivity/avahi/avahi-daemon-init/LICENSE.avahi-daemon-init create mode 100755 meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init-settings.sh create mode 100644 meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init.service create mode 100644 meta-iot/recipes-connectivity/avahi/avahi_0.6.31.bbappend create mode 100644 meta-iot/recipes-web/the-thing-system/steward-init.bb create mode 100644 meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init create mode 100755 meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh create mode 100644 meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in create mode 100644 meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example create mode 100644 meta-iot/recipes-web/the-thing-system/steward/package.json create mode 100644 meta-iot/recipes-web/the-thing-system/steward/server.js.in create mode 100755 meta-iot/recipes-web/the-thing-system/steward/start-steward create mode 100755 meta-iot/recipes-web/the-thing-system/steward/start-steward.debug create mode 100644 meta-iot/recipes-web/the-thing-system/steward/steward.service.in create mode 100644 meta-iot/recipes-web/the-thing-system/steward_git.bb create mode 100644 meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb (limited to 'meta-iot') diff --git a/meta-iot/conf/layer.conf b/meta-iot/conf/layer.conf new file mode 100644 index 0000000..b393f3d --- /dev/null +++ b/meta-iot/conf/layer.conf @@ -0,0 +1,12 @@ +BBPATH ?= "" +# We add conf directory to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a recipes directory containing .bb and .bbappend files, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "iot" +BBFILE_PATTERN_iot := "^${LAYERDIR}/" +BBFILE_PRIORITY_iot = "7" + diff --git a/meta-iot/recipes-connectivity/avahi/avahi-daemon-init.bb b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init.bb new file mode 100644 index 0000000..767ba18 --- /dev/null +++ b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init.bb @@ -0,0 +1,31 @@ +SUMMARY = "Initialization service for Avahi daemon" +DESCRIPTION = "Initializes Avahi daemon service." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.avahi-daemon-init;md5=2fe93140f8c4e56b56fbcd64730767a4" + +FILESEXTRAPATHS := "${THISDIR}/${PN}" +SRC_URI = "\ + file://avahi-daemon-init-settings.sh \ + file://avahi-daemon-init.service \ + file://LICENSE.avahi-daemon-init \ +" + +S = "${WORKDIR}" +PR = "r2" + +inherit systemd +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = " avahi-daemon-init.service" + +FILES_${PN} = "\ + avahi-daemon-init.service \ + ${bindir}/avahi-daemon-init-settings.sh \ +" + +do_install() { + install -d ${D}${bindir} + install -d ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/avahi-daemon-init-settings.sh ${D}${bindir}/ + install -m 0755 ${WORKDIR}/avahi-daemon-init.service ${D}${systemd_unitdir}/system +} diff --git a/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/LICENSE.avahi-daemon-init b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/LICENSE.avahi-daemon-init new file mode 100644 index 0000000..0388698 --- /dev/null +++ b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/LICENSE.avahi-daemon-init @@ -0,0 +1,9 @@ +# LICENSE + +[MIT](http://en.wikipedia.org/wiki/MIT_License) license. Freely have you received, freely give. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init-settings.sh b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init-settings.sh new file mode 100755 index 0000000..3a12e9c --- /dev/null +++ b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init-settings.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +KERNEL_VERSION=`uname -r | cut -d . -f 1-2` +MAJOR=`echo $KERNEL_VERSION | cut -d . -f 1` +MINOR=`echo $KERNEL_VERSION | cut -d . -f 2` + +if [ "${MAJOR}.`printf '%02d' $MINOR`" \< "3.09" ]; then + # avahi might not start because SO_REUSEPORT might be missing during + # runtime. The symbol is only available from kernel 3.9 onwards. + AVAHI_CONF=/etc/avahi/avahi-daemon.conf + if [ -f $AVAHI_CONF ]; then + sed -i -e "s|^#disallow-other-stacks=.*|disallow-other-stacks=yes|" $AVAHI_CONF + else + echo "[server]" > $AVAHI_CONF + echo "disallow-other-stacks=yes" >> $AVAHI_CONF + fi +fi + +exit 0 + diff --git a/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init.service b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init.service new file mode 100644 index 0000000..78b3ab3 --- /dev/null +++ b/meta-iot/recipes-connectivity/avahi/avahi-daemon-init/avahi-daemon-init.service @@ -0,0 +1,12 @@ +[Unit] +Description=Initialize avahi-daemon settings +After=syslog.target +Before=avahi-daemon.service + +[Service] +Type=oneshot +ExecStart=-/usr/bin/avahi-daemon-init-settings.sh +StandardOutput=null + +[Install] +WantedBy=steward.service diff --git a/meta-iot/recipes-connectivity/avahi/avahi_0.6.31.bbappend b/meta-iot/recipes-connectivity/avahi/avahi_0.6.31.bbappend new file mode 100644 index 0000000..bff31b6 --- /dev/null +++ b/meta-iot/recipes-connectivity/avahi/avahi_0.6.31.bbappend @@ -0,0 +1,10 @@ +# TheThingSystem steward needs avahi compat headers +EXTRA_OECONF += "\ + --enable-compat-libdns_sd \ +" + +# node.js npm needs dns_sd.h but it's components do not search +# the header from correct place +do_install_append() { + cp ${D}/usr/include/avahi-compat-libdns_sd/dns_sd.h ${D}/usr/include/dns_sd.h +} diff --git a/meta-iot/recipes-web/the-thing-system/steward-init.bb b/meta-iot/recipes-web/the-thing-system/steward-init.bb new file mode 100644 index 0000000..3f58251 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init.bb @@ -0,0 +1,40 @@ +SUMMARY = "Initialization service for TheThingSystem steward" +DESCRIPTION = "Initializes TheThingSystem steward services." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.steward-init;md5=2fe93140f8c4e56b56fbcd64730767a4" + +SRC_URI = "\ + file://steward-init-settings.sh \ + file://steward-init.service.in \ + file://LICENSE.steward-init \ +" + +S = "${WORKDIR}" +PR = "r2" + +THE_THING_SYSTEM ?= "/opt/TheThingSystem" + +inherit systemd +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "steward-init.service" + +FILES_${PN} = "\ + ${THE_THING_SYSTEM}/steward/* \ + ${sysconfdir}/TheThingSystem/* \ +" + +do_install() { + install -d ${D}${THE_THING_SYSTEM}/steward + install -d ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/steward-init-settings.sh ${D}${THE_THING_SYSTEM}/steward + + sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' < ${WORKDIR}/steward-init.service.in \ + > ${D}${systemd_unitdir}/system/steward-init.service + + install -d ${D}/etc/TheThingSystem + echo "# Configuration options for TheThingSystem/steward" > ${D}/etc/TheThingSystem/config + echo "# Generated `date`" >> ${D}/etc/TheThingSystem/config + echo "THE_THING_SYSTEM=${THE_THING_SYSTEM}" >> ${D}/etc/TheThingSystem/config + echo "NODE_PATH=${THE_THING_SYSTEM}/steward" >> ${D}/etc/TheThingSystem/config +} diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init new file mode 100644 index 0000000..0388698 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init @@ -0,0 +1,9 @@ +# LICENSE + +[MIT](http://en.wikipedia.org/wiki/MIT_License) license. Freely have you received, freely give. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh new file mode 100755 index 0000000..40f75ee --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +if [ -z "$THE_THING_SYSTEM" ]; then + THE_THING_SYSTEM=/opt/TheThingSystem + export THE_THING_SYSTEM +fi + +STEWARD_DIR=${THE_THING_SYSTEM}/steward +STEWARD_SETTINGS=$STEWARD_DIR/db/server.key + +RET=0 + +if [ -s $STEWARD_SETTINGS ]; then + exit 0 +fi + +# Change the port of the eca-web so that steward web-ui can live in +# port 80. Eca-web will be moved to HTTP port 8080. +sed -i 's/PORT=80$/PORT=8080/' /etc/eca-web/config + +if [ ! -d $STEWARD_DIR/sandbox ]; then + mkdir -p $STEWARD_DIR/sandbox +fi +if [ ! -d $STEWARD_DIR/db ]; then + mkdir -p $STEWARD_DIR/db +fi + +if [ -z "$NODE_PATH" ]; then + NODE_PATH=${THE_THING_SYSTEM}/steward + export NODE_PATH +fi + +cd $THE_THING_SYSTEM/steward + +echo -n "Creating server key..." +rm -f ${STEWARD_DIR}/sandbox/server.crt ${STEWARD_DIR}/sandbox/server.sha1 + +node <&2 + RET=1 +fi + +exit $RET diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in new file mode 100644 index 0000000..feed7f5 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=Initialize TheThingSystem steward settings +After=syslog.target +Before=eca-web.service +ConditionFileNotEmpty=!@the_thing_system_dir@/steward/db/server.key + +[Service] +Type=oneshot +EnvironmentFile=-/etc/TheThingSystem/config +ExecStart=-@the_thing_system_dir@/steward/steward-init-settings.sh +StandardOutput=null + +[Install] +WantedBy=steward.service diff --git a/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example b/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example new file mode 100644 index 0000000..e52bf27 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example @@ -0,0 +1,5 @@ +#!/bin/sh + +# Setup proxies +npm config set proxy http://proxy.example.com:8080 +npm config set https-proxy http://proxy.example.com:8080 diff --git a/meta-iot/recipes-web/the-thing-system/steward/package.json b/meta-iot/recipes-web/the-thing-system/steward/package.json new file mode 100644 index 0000000..ff865f2 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/package.json @@ -0,0 +1,90 @@ +{ "name" : "node-steward" + , "readmeFilename" : "README.md" + , "version" : "1.5.1" + , "private" : true + , "engines" : + { "node" : ">=0.10.22" + } + , "license" : "MIT" + , "dependencies" : + { "MD5" : "1.0.3" + , "aerogel" : "git://github.com/TheThingSystem/aerogel.git" + , "airplay" : "git://github.com/TheThingSystem/node-airplay.git" + , "arp-a" : "0.3.0" + , "async" : "0.2.9" + , "axiscam" : "0.0.4" + , "automatic-api" : "0.9.3" + , "avahi_pub" : "git://github.com/TheThingSystem/node_avahi_pub.git" + , "blinkstick" : "git://github.com/TheThingSystem/blinkstick-node.git" + , "color-convert" : "0.3.1" + , "colors" : "0.6.2" + , "cosm" : "git://github.com/TheThingSystem/node-cosm.git" + , "cron-parser" : "git://github.com/TheThingSystem/node-cron-parser.git" + , "cycle" : "1.0.2" + , "eureka-dongle" : "0.1.0" + , "flower-power-cloud" : "0.2.0" + , "geocoder" : "0.1.0" + , "greenwave-gop" : "0.0.2" + , "grovestreams-api" : "0.2.3" + , "irobot" : "git://github.com/TheThingSystem/irobot.git" + , "json-stringify-safe" : "4.0.0" + , "koubachi" : "0.0.4" + , "lifx" : "git://github.com/TheThingSystem/lifxjs.git" + , "line-reader" : "0.2.3" + , "lockitron-api" : "0.3.1" + , "longjohn" : "0.2.0" + , "lumen" : "git://github.com/TheThingSystem/node-lumen.git" + , "mdns" : "git://github.com/TheThingSystem/node_mdns.git" + , "mime" : "1.2.9" + , "mqtt" : "git://github.com/TheThingSystem/MQTT.js.git" + , "netmask" : "1.0.4" + , "noble" : "git://github.com/jukkar/noble.git" + , "node-blink1" : "0.1.0" + , "node-cassandra-cql" : "git://github.com/TheThingSystem/node-cassandra-cql.git" + , "node-dweetio" : "0.0.8" + , "node-hid" : "0.2.3" + , "node-lsof" : "git://github.com/TheThingSystem/node-lsof.git" + , "node-netatmo" : "git://github.com/TheThingSystem/node-netatmo.git" + , "notify-my-android" : "0.0.1" + , "node-prowl" : "git://github.com/TheThingSystem/node-prowl.git" + , "node-ssdp" : "git://github.com/TheThingSystem/node-ssdp.git" + , "node-ssh-fingerprint" : "git://github.com/TheThingSystem/node-ssh-fingerprint.git" + , "node-uuid" : "1.4.0" + , "node-winkapi" : "0.1.2" + , "observer" : "1.1.0" + , "openzwave" : "0.0.32" + , "pcap" : "1.2.0" + , "pkginfo" : "0.3.0" + , "pixelpusher" : "0.1.1" + , "polyline-encoded" : "0.0.4" + , "portfinder" : "0.2.1" + , "rfxcom" : "git://github.com/TheThingSystem/node-rfxcom.git" + , "robosmart" : "0.1.1" + , "roku" : "0.2.0" + , "samsung-airconditioner" : "git://github.com/TheThingSystem/node-samsung-airconditioner.git" + , "sensortag" : "git://github.com/sandeepmistry/node-sensortag.git" + , "serialport" : "~1.1.0" + , "soap" : "0.2.7" + , "sonos" : "git://github.com/TheThingSystem/node-sonos.git" + , "speakeasy" : "git://github.com/TheThingSystem/speakeasy.git" + , "sqlite3" : "2.1.7" + , "ssh-keygen" : "git://github.com/TheThingSystem/ssh-keygen.git" + , "stack-trace" : "0.0.6" + , "suncalc" : "1.2.1" + , "teslams" : "0.8.6" + , "underscore" : "1.5.1" + , "unofficial-nest-api" : "git://github.com/TheThingSystem/unofficial_nodejs_nest.git" + , "validator" : "1.1.3" + , "wake_on_lan" : "0.0.3" + , "winston" : "0.6.2" + , "ws" : "git://github.com/TheThingSystem/ws.git" + , "x509-keygen" : "0.2.2" + , "xml2js" : "0.2.7" + , "xml2json" : "0.3.2" + , "xmlbuilder" : "0.4.x" + , "xmldom" : "0.1.x" + , "xmlhttprequest" : "git://github.com/TheThingSystem/node-XMLHttpRequest.git" + , "yoctolib" : "git://github.com/TheThingSystem/yoctolib_nodejs.git" + , "yql" : "git://github.com/TheThingSystem/node-yql.git" + } +} diff --git a/meta-iot/recipes-web/the-thing-system/steward/server.js.in b/meta-iot/recipes-web/the-thing-system/steward/server.js.in new file mode 100644 index 0000000..32f6b82 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/server.js.in @@ -0,0 +1,3 @@ +require('@the_thing_system_dir@/steward/core/utility').start(); +require('@the_thing_system_dir@/steward/core/database').start(); +require('@the_thing_system_dir@/steward/core/steward').start(); diff --git a/meta-iot/recipes-web/the-thing-system/steward/start-steward b/meta-iot/recipes-web/the-thing-system/steward/start-steward new file mode 100755 index 0000000..1022656 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/start-steward @@ -0,0 +1,22 @@ +#!/bin/sh + +DIR=`dirname $0` + +if [ ! -f $DIR/server.js ]; then + echo "$0: Cannot find $DIR/server.js" + exit -1 +fi + +if [ -z "$THE_THING_SYSTEM" ]; then + THE_THING_SYSTEM=/opt/TheThingSystem + export THE_THING_SYSTEM +fi + +if [ -z "$NODE_PATH" ]; then + NODE_PATH=${THE_THING_SYSTEM}/steward + export NODE_PATH +fi + +cd $DIR +node $DIR/server.js $@ +exit $? diff --git a/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug b/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug new file mode 100755 index 0000000..12c89dc --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug @@ -0,0 +1,22 @@ +#!/bin/sh + +DIR=`dirname $0` + +if [ ! -f $DIR/server.js ]; then + echo "$0: Cannot find $DIR/server.js" + exit -1 +fi + +if [ -z "$THE_THING_SYSTEM" ]; then + THE_THING_SYSTEM=/opt/TheThingSystem + export THE_THING_SYSTEM +fi + +if [ -z "$NODE_PATH" ]; then + NODE_PATH=${THE_THING_SYSTEM}/steward + export NODE_PATH +fi + +cd $DIR +DEBUG=hci-ble node $DIR/server.js $@ +exit $? diff --git a/meta-iot/recipes-web/the-thing-system/steward/steward.service.in b/meta-iot/recipes-web/the-thing-system/steward/steward.service.in new file mode 100644 index 0000000..894f29a --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/steward.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Steward for TheThingSystem +After=steward-init.service + +[Service] +Type=simple +EnvironmentFile=-/etc/TheThingSystem/config +ExecStart=@the_thing_system_dir@/steward/start-steward +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/meta-iot/recipes-web/the-thing-system/steward_git.bb b/meta-iot/recipes-web/the-thing-system/steward_git.bb new file mode 100644 index 0000000..616435c --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward_git.bb @@ -0,0 +1,131 @@ +DESCRIPTION = "The Thing System steward" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=2fe93140f8c4e56b56fbcd64730767a4" + +SRC_URI = "\ + git://github.com/TheThingSystem/steward.git \ + file://steward.service.in \ + file://start-steward \ + file://start-steward.debug \ + file://server.js.in \ + file://package.json \ +" + +SRCREV = "cc38554aea4bdebcf55d11ca516711abbfc7ec73" +S = "${WORKDIR}/git" +PR = "r9" +PV = "1.7+git${SRCPV}" + +DEPENDS = "tts-nodejs-native" +DEPENDS_${PN} = "\ + libdns-sd-dev \ + libpcap-dev \ + libusb1 \ + libbluetooth-dev \ + ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd-dev', 'libudev-dev', d)} \ +" + +THE_THING_SYSTEM ?= "/opt/TheThingSystem" + +inherit systemd + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "steward.service" + +FILES_${PN} = "\ + ${THE_THING_SYSTEM}/* \ + ${libdir} \ +" + +FILES_${PN}-dbg += "\ + ${THE_THING_SYSTEM}/steward/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/*/.debug \ + ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/*/*/.debug \ +" + +RDEPENDS_${PN} = "openssl tts-nodejs steward-init ruby" + +def get_arch(bb, d): + val = (bb.data.getVar("MACHINEOVERRIDES", d) or "") + if val.find("genericx86") > 0: + return "--arch=i686" + elif val.find("x86") > 0: + return "--arch=i686" + elif val.find("arm") > 0: + return "--arch=arm" + else: + return "" + +# Always compile 32-bit in npm because many modules that npm +# compiles do not support 64 bit in x86. +TTS_ARCH := "${@get_arch(bb, d)}" + +do_install_append() { + # Some python issue prevents installation if the current + # user id is not in sysroots /etc/passwd file. So add user + # information there (this is actually quite ugly hack) + # See http://bugs.python.org/issue10496 for details. + PASSLINE=`grep \`echo ${HOME}|cut -d / -f 3\` /etc/passwd`; \ + grep "'${PASSLINE}'" ${PKG_CONFIG_SYSROOT_DIR}/etc/passwd || \ + echo "${PASSLINE}" >> ${PKG_CONFIG_SYSROOT_DIR}/etc/passwd + + install -d ${D}${THE_THING_SYSTEM}/steward + install -d ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/start-steward ${D}${THE_THING_SYSTEM}/steward + install -m 0755 ${WORKDIR}/start-steward.debug ${D}${THE_THING_SYSTEM}/steward + + sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' \ + < ${WORKDIR}/steward.service.in \ + > ${D}${systemd_unitdir}/system/steward.service + sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' \ + < ${WORKDIR}/server.js.in \ + > ${D}${THE_THING_SYSTEM}/steward/server.js + + cp -pR ${S}/steward/* ${D}${THE_THING_SYSTEM}/steward/ + install -m 0644 ${WORKDIR}/package.json ${D}${THE_THING_SYSTEM}/steward + rm -rf ${D}${THE_THING_SYSTEM}/steward/sandbox/js-beautify-master/tests + rm ${D}${THE_THING_SYSTEM}/steward/run.sh + find ${D}${THE_THING_SYSTEM} -name .gitignore -exec rm '{}' \; + + # Setup the node.js environment + cd ${D}${THE_THING_SYSTEM}/steward + + # There seems to be some issues (npm hanging) if you try to run + # install when behind the proxy. So we try to setup proxies for npm + # See README.iot file for details. + if [ -x ~/npm-setup-proxies ]; then ~/npm-setup-proxies; fi + + # Cleaning cache should help to some weird compilation errors + npm cache clean + + # Do a fresh start + rm -rf node_modules + + # Telling npm to use known registrars will prevent this error + # | npm ERR! Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN + # when running npm + npm config set ca "" + + # Some of the node.js packages put -pthreads into ld params and ld + # does not understand it. So install packages using gcc as a linker. + LD=${TARGET_PREFIX}gcc npm install --production -l ${TTS_ARCH} + + # No need for static libraries + find ${D}${THE_THING_SYSTEM} -name '*.a' -exec rm '{}' \; + + # Remove not used files + rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/xml2js/node_modules/sax/examples + rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/openzwave/deps/open-zwave/debian + + # Remove some garbage files that prevent image creation + rm -f ${D}${THE_THING_SYSTEM}/steward/node_modules/pcap/*%* + + # Blinkstick does not load in this version so just remove it + rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/blinkstick + rm -rf ${D}${THE_THING_SYSTEM}/steward/devices/devices-lighting/lighting-blinkstick-led.js + +} diff --git a/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb b/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb new file mode 100644 index 0000000..813526e --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb @@ -0,0 +1,49 @@ +DESCRIPTION = "Node.js is a server-side JavaScript environment for TheThingSystem" +LICENSE = "MIT & BSD" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4a31e6c424761191227143b86f58a1ef" + +S = "${WORKDIR}/git" +SRCREV = "cc56c62ed879ad4f93b1fdab3235c43e60f48b7e" +PV = "0.10.26" + +SRC_URI = "\ + git://github.com/joyent/node.git;branch=v0.10.26-release \ +" + +THE_THING_SYSTEM ?= "/opt/TheThingSystem" + +DEPENDS = "openssl ninja-native" + +# v8 errors out if you have set CCACHE +CCACHE = "" + +ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard',\ + '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)}" +ARCHFLAGS ?= "" + +do_configure() { + export LD="${CXX}" + ./configure --ninja --prefix=${prefix} --without-snapshot ${ARCHFLAGS} +} + +do_compile() { + export LD="${CXX}" + make BUILDTYPE=Release +} + +do_install() { + oe_runmake install DESTDIR=${D} +} + +FILES_${PN} = "\ + ${libdir} \ + ${bindir} \ +" + +RDEPENDS_${PN} = "curl python-shell python-datetime python-subprocess \ + python-crypt python-textutils python-netclient \ + python-misc python-multiprocessing \ +" +RDEPENDS_${PN}_class-native = "" + +BBCLASSEXTEND = "native" -- cgit v1.2.3-54-g00ecf