Merge pull request #1833 from commodo/keepalived-libnl
authorSteven Barth <steven@midlink.org>
Thu, 22 Oct 2015 08:43:43 +0000 (10:43 +0200)
committerSteven Barth <steven@midlink.org>
Thu, 22 Oct 2015 08:43:43 +0000 (10:43 +0200)
keepalived: update to use only libnl-genl

145 files changed:
admin/zabbix/Makefile
ipv6/aiccu/Makefile
ipv6/aiccu/patches/500-gnutls_3.4.patch [new file with mode: 0644]
ipv6/tayga/Makefile
lang/node-arduino-firmata/Makefile [new file with mode: 0644]
lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js [new file with mode: 0644]
lang/node-arduino-firmata/patches/000-new-serialport.patch [new file with mode: 0644]
lang/node-cylon/Makefile [new file with mode: 0644]
lang/node-cylon/patches/0001-serialport.patch [new file with mode: 0644]
lang/node-hid/Makefile [new file with mode: 0644]
lang/node-hid/patches/000-compile.patch [new file with mode: 0644]
lang/node-serialport/Makefile [new file with mode: 0644]
lang/node-serialport/patches/package.json.patch [new file with mode: 0644]
lang/node/Makefile [new file with mode: 0644]
lang/node/patches/001-mips-no-fpu.patch [new file with mode: 0644]
lang/node/patches/002-addr_info.patch [new file with mode: 0644]
lang/node/patches/003-path.patch [new file with mode: 0644]
lang/perl-parse-recdescent/Makefile
lang/php5/Makefile
libs/glib2/Makefile
libs/glib2/patches/001-automake-compat.patch
libs/glib2/patches/100-fix-gio-linking.patch
libs/gnutls/Makefile
libs/libcoap/Makefile
libs/libdmapsharing/Makefile
libs/libgee/Makefile [new file with mode: 0644]
libs/libgee/patches/libgee-0.18.0-no-introspection.patch [new file with mode: 0644]
libs/libmraa/Makefile [new file with mode: 0644]
libs/libmraa/patches/0001-base.patch [new file with mode: 0644]
libs/libmraa/patches/0002-add-mips-support.patch [new file with mode: 0644]
libs/libmraa/patches/0003-uart.patch [new file with mode: 0644]
libs/libmraa/patches/0004-fixes.patch [new file with mode: 0644]
libs/libupm/Makefile [new file with mode: 0644]
libs/libupm/patches/001-version.patch [new file with mode: 0644]
libs/libupm/patches/002-at42qt1070-id.patch [new file with mode: 0644]
libs/libupm/patches/003-lsm303-args.patch [new file with mode: 0644]
libs/libwebsockets/Makefile
multimedia/grilo-plugins/Makefile [new file with mode: 0644]
multimedia/grilo/Makefile [new file with mode: 0644]
multimedia/lcdgrilo/Makefile [new file with mode: 0644]
multimedia/lcdgrilo/files/lcdgrilo.init [new file with mode: 0644]
multimedia/mjpg-streamer/Makefile
multimedia/motion/Makefile
multimedia/motion/patches/100-musl-compat.patch [new file with mode: 0644]
net/aircrack-ng/Makefile
net/bmon/Makefile
net/cgi-io/Makefile [new file with mode: 0644]
net/cgi-io/src/CMakeLists.txt [new file with mode: 0644]
net/cgi-io/src/main.c [new file with mode: 0644]
net/cgi-io/src/multipart_parser.c [new file with mode: 0644]
net/cgi-io/src/multipart_parser.h [new file with mode: 0644]
net/chaosvpn/Makefile [new file with mode: 0644]
net/chaosvpn/files/chaosvpn.hotplug [new file with mode: 0755]
net/chaosvpn/files/chaosvpn.init [new file with mode: 0755]
net/chrony/Makefile [new file with mode: 0644]
net/chrony/files/chrony.conf [new file with mode: 0644]
net/chrony/files/chrony.config [new file with mode: 0644]
net/chrony/files/chrony.hotplug [new file with mode: 0644]
net/chrony/files/chronyd.init [new file with mode: 0644]
net/ddns-scripts/Makefile
net/ddns-scripts/files/services
net/ethtool/Makefile
net/freeradius2/files/radiusd.init
net/fwknop/Makefile
net/fwknop/files/fwknopd.init
net/git/Makefile
net/lispmob/Makefile
net/mwan3/Makefile
net/mwan3/files/etc/hotplug.d/iface/15-mwan3
net/mwan3/files/usr/sbin/mwan3
net/nfs-kernel-server/Makefile
net/nut/Config.in
net/nut/Makefile
net/nut/files/nut.service [new file with mode: 0644]
net/ocserv/Makefile
net/openvswitch/Makefile
net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch [deleted file]
net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch [new file with mode: 0644]
net/openvswitch/patches/0006-force-kernel-4-1.patch [new file with mode: 0644]
net/openvswitch/patches/0007-add-netns-compat.patch [new file with mode: 0644]
net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch [new file with mode: 0644]
net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch [new file with mode: 0644]
net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch [new file with mode: 0644]
net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch [new file with mode: 0644]
net/u2pnpd/Makefile [new file with mode: 0644]
net/u2pnpd/files/u2pnpd.config [new file with mode: 0644]
net/u2pnpd/files/u2pnpd.defaults [new file with mode: 0644]
net/u2pnpd/files/u2pnpd.init [new file with mode: 0644]
net/unbound/Makefile
net/xl2tpd/Makefile
sound/madplay/Makefile
sound/madplay/patches/0001-switch-to-new-alsa-api.patch [new file with mode: 0644]
sound/mpg123/Makefile
sound/pianod/Makefile
sound/pianod/patches/005-Fix_IPV6_socket_handling.patch [deleted file]
sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch
sound/pianod/patches/030-Waitress_add_polarssl_variant.patch
sound/pulseaudio/Makefile
sound/pulseaudio/patches/002-xlocale.patch [new file with mode: 0644]
sound/shairport-sync/Makefile
sound/shairport-sync/files/shairport-sync.config
sound/shairport-sync/files/shairport-sync.init [changed mode: 0755->0644]
utils/bandwidthd/Makefile [new file with mode: 0644]
utils/bandwidthd/files/bandwidthd.config [new file with mode: 0644]
utils/bandwidthd/files/bandwidthd.init [new file with mode: 0644]
utils/bandwidthd/files/logo.gif [new file with mode: 0644]
utils/bandwidthd/patches/010-dont-add-host-paths.patch [new file with mode: 0644]
utils/bandwidthd/patches/100-fix_config_file_location [new file with mode: 0644]
utils/collectd/Makefile
utils/collectd/patches/300-delay-first-read-cycle.patch [new file with mode: 0644]
utils/collectd/patches/500-upstream-parallel-build-fix.patch [new file with mode: 0644]
utils/dbus/Makefile
utils/dfu-programmer/Makefile [new file with mode: 0644]
utils/dump1090/Makefile
utils/flashrom/Config.in [deleted file]
utils/flashrom/Makefile
utils/flashrom/flashrom.mk
utils/gammu/Makefile
utils/less/Makefile
utils/lvm2/Makefile
utils/lvm2/patches/002-const-stdio.patch
utils/open2300/Makefile [new file with mode: 0644]
utils/open2300/files/open2300.conf [new file with mode: 0644]
utils/open2300/patches/001-crosscompile.patch [new file with mode: 0644]
utils/sane-backends/Makefile [new file with mode: 0644]
utils/sane-backends/files/xinet.d_sane-port [new file with mode: 0644]
utils/sane-backends/patches/002-remove-uneeded.patch [new file with mode: 0644]
utils/sane-backends/patches/020-fix_pieusb.patch [new file with mode: 0644]
utils/sane-backends/patches/030-musl.patch [new file with mode: 0644]
utils/sane-backends/patches/031-fix_uclibc.patch [new file with mode: 0644]
utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch [new file with mode: 0644]
utils/smstools3/Makefile
utils/spi-tools/Makefile [new file with mode: 0644]
utils/swig/Makefile [new file with mode: 0644]
utils/unrar/Makefile
utils/yunbridge/Makefile [new file with mode: 0644]
utils/yunbridge/files/etc/config/yunbridge [new file with mode: 0644]
utils/yunbridge/files/etc/init.d/yunbridge [new file with mode: 0755]
utils/yunbridge/files/sbin/yunbridge [new file with mode: 0755]
utils/yunbridge/files/usr/bin/pretty-wifi-info.lua [new file with mode: 0755]
utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua [new file with mode: 0644]
utils/yunbridge/files/usr/lib/lua/luci/sha256.lua [new file with mode: 0644]
utils/yunbridge/patches/000-scripts.patch [new file with mode: 0644]
utils/zoneinfo/Makefile
utils/zsh/Makefile

index 098f3e3414efac3d427b761a021a51f30dadee8c..424779ef987c6f552510fb41923ea6dde4675a9b 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zabbix
 PKG_VERSION:=2.4.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/zabbix
@@ -107,6 +107,7 @@ CONFIGURE_ARGS+= \
        --enable-agent \
        --enable-server \
        --enable-proxy \
+       $(call autoconf_bool,CONFIG_IPV6,ipv6) \
        --disable-java \
        --with-sqlite3="$(STAGING_DIR)/usr"
 
index dae693839d27ac30acb6fae95b366f52e6eb5500..4b81e10df8670160fee22b180a9a043255207d72 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=aiccu
 PKG_VERSION:=20070115
-PKG_RELEASE:=14
+PKG_RELEASE:=16
 
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.sixxs.net/archive/sixxs/aiccu/unix
@@ -17,28 +17,37 @@ PKG_MD5SUM:=c9bcc83644ed788e22a7c3f3d4021350
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=doc/LICENSE
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/aiccu
+define Package/aiccu/Default
+  TITLE:=SixXS IPv6 Connectivity Client ($(1))
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libpthread +ip +kmod-sit +kmod-tun
-  TITLE:=SixXS Automatic IPv6 Connectivity Client Utility
+  VARIANT:=$(2)
+  DEPENDS:=+libpthread +ip +kmod-sit +kmod-tun $(3)
   URL:=http://www.sixxs.net/tools/aiccu/
   MAINTAINER:=Ondrej Caletka <ondrej@caletka.cz>
 endef
 
+Package/aiccu=$(call Package/aiccu/Default,without GNUTLS support,default)
+Package/aiccu-gnutls=$(call Package/aiccu/Default,with GNUTLS support,gnutls,+libgnutls)
+
 define Build/Configure
        $(SED) "s,strip,/bin/true," $(PKG_BUILD_DIR)/unix-console/Makefile
 endef
 
+ifeq ($(BUILD_VARIANT),gnutls)
+CONFIG_AICCU_GNUTLS:=y
+endif
+
 define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" OS_NAME="Linux" OS_VERSION="$(LINUX_VERSION)" \
                EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
                EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -pthread" \
+               $(if $(CONFIG_AICCU_GNUTLS),HAVE_GNUTLS=1) \
                DEBUG=0
 endef
 
@@ -46,6 +55,8 @@ define Package/aiccu/conffiles
 /etc/config/aiccu
 endef
 
+Package/aiccu-gnutls/conffiles=$(call Package/aiccu/conffiles)
+
 define Package/aiccu/install
        $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/netifd/proto $(1)/etc/hotplug.d/ntp
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix-console/$(PKG_NAME) $(1)/usr/sbin/
@@ -53,4 +64,7 @@ define Package/aiccu/install
        $(INSTALL_DATA) ./files/aiccu.hotplug $(1)/etc/hotplug.d/ntp/10-aiccu
 endef
 
+Package/aiccu-gnutls/install=$(call Package/aiccu/install,$(1))
+
 $(eval $(call BuildPackage,aiccu))
+$(eval $(call BuildPackage,aiccu-gnutls))
diff --git a/ipv6/aiccu/patches/500-gnutls_3.4.patch b/ipv6/aiccu/patches/500-gnutls_3.4.patch
new file mode 100644 (file)
index 0000000..a314784
--- /dev/null
@@ -0,0 +1,22 @@
+--- aiccu/common/common.c
++++ aiccu/common/common.c
+@@ -271,8 +271,6 @@
+ TLSSOCKET sock_alloc(void)
+ {
+ #ifdef AICCU_GNUTLS
+-      /* Allow connections to servers that have OpenPGP keys as well */
+-      const int       cert_type_priority[3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
+       int             ret;
+ #endif /* AICCU_GNUTLS*/
+@@ -300,7 +298,8 @@
+       gnutls_set_default_priority(sock->session);
+       /* XXX: Return value is not documented in GNUTLS documentation! */
+-      gnutls_certificate_type_set_priority(sock->session, cert_type_priority);
++      /* Allow connections to servers that have OpenPGP keys as well */
++      gnutls_priority_set_direct(sock->session, "NORMAL:+CTYPE-OPENPGP", NULL);
+       /* XXX: Return value is not documented in GNUTLS documentation! */
+       /* Configure the x509 credentials for the current session */
+
index ba0d196c1d961c13b387f38d44a67d917ea1212b..d68a271d279e7a5b01cf86c6d3d5f4052795562f 100644 (file)
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/tayga
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+ip +kmod-ipv6 +kmod-tun
+  DEPENDS:=+ip @IPV6 +kmod-tun
   TITLE:=Out-of-kernel stateless NAT64 implementation for Linux
   URL:=http://www.litech.org/tayga/
   MAINTAINER:=Ondrej Caletka <ondrej@caletka.cz>
diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile
new file mode 100644 (file)
index 0000000..aced070
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2014 Arduino LLC
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NPM_NAME:=arduino-firmata
+PKG_NAME:=node-$(PKG_NPM_NAME)
+PKG_VERSION:=0.3.3
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git
+PKG_SOURCE_VERSION:=16e76007edf218d72df590adbd711ac6b7432845
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_DEPENDS:=node
+PKG_NODE_VERSION:=0.12.7
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILE:=LICENSE.txt
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node-arduino-firmata
+  DEPENDS:=+node
+  SUBMENU:=Node.js
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+node +node-serialport
+  TITLE:=Node.js package to access serial ports for reading and writing
+  URL:=https://www.npmjs.org/package/serialport
+endef
+
+define Package/node-arduino-firmata/description
+ Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
+endef
+
+define Build/Prepare
+       /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
+       $(Build/Patch)
+endef
+
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
+
+define Build/Compile
+       $(MAKE_FLAGS) \
+       npm_config_arch=$(CONFIG_ARCH) \
+       npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
+       PREFIX="$(PKG_INSTALL_DIR)/usr/" \
+       $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
+endef
+
+define Package/node-arduino-firmata/install
+       mkdir -p $(1)/usr/lib/node
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node
+       rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/ 
+       $(CP) -r ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,node-arduino-firmata))
+
diff --git a/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js
new file mode 100644 (file)
index 0000000..578bd40
--- /dev/null
@@ -0,0 +1,306 @@
+(function() {
+  'use strict';
+  var ArduinoFirmata, SerialPort, debug, events, exports, serialport,
+    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+    hasProp = {}.hasOwnProperty;
+
+  events = require('eventemitter2');
+
+  SerialPort = (serialport = require('serialport')).SerialPort;
+
+  debug = require('debug')('arduino-firmata');
+
+  exports = module.exports = ArduinoFirmata = (function(superClass) {
+    extend(ArduinoFirmata, superClass);
+
+    ArduinoFirmata.Status = {
+      CLOSE: 0,
+      OPEN: 1
+    };
+
+    ArduinoFirmata.INPUT = 0;
+
+    ArduinoFirmata.OUTPUT = 1;
+
+    ArduinoFirmata.ANALOG = 2;
+
+    ArduinoFirmata.PWM = 3;
+
+    ArduinoFirmata.SERVO = 4;
+
+    ArduinoFirmata.SHIFT = 5;
+
+    ArduinoFirmata.I2C = 6;
+
+    ArduinoFirmata.LOW = 0;
+
+    ArduinoFirmata.HIGH = 1;
+
+    ArduinoFirmata.MAX_DATA_BYTES = 32;
+
+    ArduinoFirmata.DIGITAL_MESSAGE = 0x90;
+
+    ArduinoFirmata.ANALOG_MESSAGE = 0xE0;
+
+    ArduinoFirmata.REPORT_ANALOG = 0xC0;
+
+    ArduinoFirmata.REPORT_DIGITAL = 0xD0;
+
+    ArduinoFirmata.SET_PIN_MODE = 0xF4;
+
+    ArduinoFirmata.REPORT_VERSION = 0xF9;
+
+    ArduinoFirmata.SYSTEM_RESET = 0xFF;
+
+    ArduinoFirmata.START_SYSEX = 0xF0;
+
+    ArduinoFirmata.END_SYSEX = 0xF7;
+
+    ArduinoFirmata.list = function(callback) {
+      return serialport.list(function(err, ports) {
+        var devices, j, len, port;
+        if (err) {
+          return callback(err);
+        }
+        devices = [];
+        for (j = 0, len = ports.length; j < len; j++) {
+          port = ports[j];
+          if (/usb|acm|com\d+/i.test(port.comName)) {
+            devices.push(port.comName);
+          }
+        }
+        return callback(null, devices);
+      });
+    };
+
+    function ArduinoFirmata() {
+      this.status = ArduinoFirmata.Status.CLOSE;
+      this.wait_for_data = 0;
+      this.execute_multi_byte_command = 0;
+      this.multi_byte_channel = 0;
+      this.stored_input_data = [];
+      this.parsing_sysex = false;
+      this.sysex_bytes_read = 0;
+      this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+      this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+      this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+      this.boardVersion = null;
+    }
+
+    ArduinoFirmata.prototype.isOldArduinoDevice = function() {
+      return /usbserial|USB/.test(this.serialport_name);
+    };
+
+    ArduinoFirmata.prototype.connect = function(serialport_name, opts) {
+      this.serialport_name = serialport_name;
+      if (opts == null) {
+        opts = {
+          baudrate: 57600
+        };
+      }
+      opts.parser = serialport.parsers.raw;
+      if (!this.serialport_name) {
+        ArduinoFirmata.list((function(_this) {
+          return function(err, devices) {
+            return _this.connect(devices[0], opts);
+          };
+        })(this));
+        return this;
+      }
+      this.once('boardReady', function() {
+        var io_init_wait;
+        debug('boardReady');
+        io_init_wait = this.isOldArduinoDevice() ? (debug("old arduino device found " + this.serialport_name), 3000) : (debug("new arduino device found " + this.serialport_name), 100);
+        debug("wait " + io_init_wait + "(msec)");
+        return setTimeout((function(_this) {
+          return function() {
+            var i, j, k;
+            for (i = j = 0; j < 6; i = ++j) {
+              _this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]);
+            }
+            for (i = k = 0; k < 2; i = ++k) {
+              _this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]);
+            }
+            debug('init IO ports');
+            return _this.emit('connect');
+          };
+        })(this), io_init_wait);
+      });
+      this.serialport = new SerialPort(this.serialport_name, opts);
+      this.serialport.once('open', (function(_this) {
+        return function() {
+          var cid;
+          cid = setInterval(function() {
+            debug('request REPORT_VERSION');
+            return _this.write([ArduinoFirmata.REPORT_VERSION]);
+          }, 500);
+          _this.once('boardVersion', function(version) {
+            clearInterval(cid);
+            _this.status = ArduinoFirmata.Status.OPEN;
+            return _this.emit('boardReady');
+          });
+          return _this.serialport.on('data', function(data) {
+            var byte, j, len, results;
+            results = [];
+            for (j = 0, len = data.length; j < len; j++) {
+              byte = data[j];
+              results.push(_this.process_input(byte));
+            }
+            return results;
+          });
+        };
+      })(this));
+      return this;
+    };
+
+    ArduinoFirmata.prototype.isOpen = function() {
+      return this.status === ArduinoFirmata.Status.OPEN;
+    };
+
+    ArduinoFirmata.prototype.close = function(callback) {
+      this.status = ArduinoFirmata.Status.CLOSE;
+      return this.serialport.close(callback);
+    };
+
+    ArduinoFirmata.prototype.reset = function(callback) {
+      return this.write([ArduinoFirmata.SYSTEM_RESET], callback);
+    };
+
+    ArduinoFirmata.prototype.write = function(bytes, callback) {
+      return this.serialport.write(bytes, callback);
+    };
+
+    ArduinoFirmata.prototype.sysex = function(command, data, callback) {
+      var write_data;
+      if (data == null) {
+        data = [];
+      }
+      data = data.map(function(i) {
+        return i & 0x7f;
+      });
+      write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]);
+      return this.write(write_data, callback);
+    };
+
+    ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) {
+      switch (mode) {
+        case true:
+          mode = ArduinoFirmata.OUTPUT;
+          break;
+        case false:
+          mode = ArduinoFirmata.INPUT;
+      }
+      return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback);
+    };
+
+    ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) {
+      var port_num;
+      this.pinMode(pin, ArduinoFirmata.OUTPUT);
+      port_num = (pin >>> 3) & 0x0F;
+      if (value === 0 || value === false) {
+        this.digital_output_data[port_num] &= ~(1 << (pin & 0x07));
+      } else {
+        this.digital_output_data[port_num] |= 1 << (pin & 0x07);
+      }
+      return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback);
+    };
+
+    ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) {
+      value = Math.floor(value);
+      this.pinMode(pin, ArduinoFirmata.PWM);
+      return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback);
+    };
+
+    ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) {
+      this.pinMode(pin, ArduinoFirmata.SERVO);
+      return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback);
+    };
+
+    ArduinoFirmata.prototype.digitalRead = function(pin) {
+      return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0;
+    };
+
+    ArduinoFirmata.prototype.analogRead = function(pin) {
+      return this.analog_input_data[pin];
+    };
+
+    ArduinoFirmata.prototype.process_input = function(input_data) {
+      var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data;
+      if (this.parsing_sysex) {
+        if (input_data === ArduinoFirmata.END_SYSEX) {
+          this.parsing_sysex = false;
+          sysex_command = this.stored_input_data[0];
+          sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read);
+          return this.emit('sysex', {
+            command: sysex_command,
+            data: sysex_data
+          });
+        } else {
+          this.stored_input_data[this.sysex_bytes_read] = input_data;
+          return this.sysex_bytes_read += 1;
+        }
+      } else if (this.wait_for_data > 0 && input_data < 128) {
+        this.wait_for_data -= 1;
+        this.stored_input_data[this.wait_for_data] = input_data;
+        if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) {
+          switch (this.execute_multi_byte_command) {
+            case ArduinoFirmata.DIGITAL_MESSAGE:
+              input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1];
+              diff = this.digital_input_data[this.multi_byte_channel] ^ input_data;
+              this.digital_input_data[this.multi_byte_channel] = input_data;
+              if (this.listeners('digitalChange').length > 0) {
+                results = [];
+                for (i = j = 0; j <= 13; i = ++j) {
+                  if (((0x01 << i) & diff) > 0) {
+                    stat = (input_data & diff) > 0;
+                    results.push(this.emit('digitalChange', {
+                      pin: i + this.multi_byte_channel * 8,
+                      value: stat,
+                      old_value: !stat
+                    }));
+                  } else {
+                    results.push(void 0);
+                  }
+                }
+                return results;
+              }
+              break;
+            case ArduinoFirmata.ANALOG_MESSAGE:
+              analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1];
+              old_analog_value = this.analogRead(this.multi_byte_channel);
+              this.analog_input_data[this.multi_byte_channel] = analog_value;
+              if (old_analog_value !== analog_value) {
+                return this.emit('analogChange', {
+                  pin: this.multi_byte_channel,
+                  value: analog_value,
+                  old_value: old_analog_value
+                });
+              }
+              break;
+            case ArduinoFirmata.REPORT_VERSION:
+              this.boardVersion = this.stored_input_data[1] + "." + this.stored_input_data[0];
+              return this.emit('boardVersion', this.boardVersion);
+          }
+        }
+      } else {
+        if (input_data < 0xF0) {
+          command = input_data & 0xF0;
+          this.multi_byte_channel = input_data & 0x0F;
+        } else {
+          command = input_data;
+        }
+        if (command === ArduinoFirmata.START_SYSEX) {
+          this.parsing_sysex = true;
+          return this.sysex_bytes_read = 0;
+        } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) {
+          this.wait_for_data = 2;
+          return this.execute_multi_byte_command = command;
+        }
+      }
+    };
+
+    return ArduinoFirmata;
+
+  })(events.EventEmitter2);
+
+}).call(this);
diff --git a/lang/node-arduino-firmata/patches/000-new-serialport.patch b/lang/node-arduino-firmata/patches/000-new-serialport.patch
new file mode 100644 (file)
index 0000000..10eab64
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/package.json
++++ b/package.json
+@@ -30,7 +30,6 @@
+   "author": "Sho Hashimoto <hashimoto@shokai.org>",
+   "license": "MIT",
+   "dependencies": {
+-    "serialport": "*",
+     "eventemitter2": "*",
+     "debug": "*"
+   },
diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile
new file mode 100644 (file)
index 0000000..753ae23
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2014 Arduino LLC
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NPM_NAME:=cylon
+PKG_NAME:=node-$(PKG_NPM_NAME)
+PKG_VERSION:=0.22.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git
+PKG_SOURCE_VERSION:=0c37da77e48b3e2cc3a8d566822a17689de91b40
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_DEPENDS:=node
+PKG_NODE_VERSION:=0.12.7
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILE:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node-cylon/default
+  DEPENDS:=+node $(2)
+  SUBMENU:=Node.js
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=CylonJS - $(1)
+  URL:=https://www.npmjs.org/package/cylon
+endef
+
+define Package/node-cylon
+  $(call Package/node-cylon/default,Core)
+endef
+
+define Package/node-cylon-i2c
+  $(call Package/node-cylon/default,I2C,+node-cylon)
+endef
+
+define Package/node-cylon-gpio
+  $(call Package/node-cylon/default,GPIO,+node-cylon)
+endef
+
+define Package/node-cylon-firmata
+  $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata)
+endef
+
+define Package/node-cylon/description
+       JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started
+endef
+
+define Build/Prepare
+       /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
+       $(Build/Patch)
+endef
+
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
+
+define Build/Compile
+       $(MAKE_FLAGS) \
+       npm_config_arch=$(CONFIG_ARCH) \
+       npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
+       PREFIX="$(PKG_INSTALL_DIR)/usr/" \
+       $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
+endef
+
+define Package/node-cylon/install
+       mkdir -p $(1)/usr/lib/node/cylon
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
+endef
+
+define Package/node-cylon-i2c/install
+       mkdir -p $(1)/usr/lib/node/cylon-i2c
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
+endef
+
+define Package/node-cylon-gpio/install
+       mkdir -p $(1)/usr/lib/node/cylon-gpio
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
+endef
+
+define Package/node-cylon-firmata/install
+       mkdir -p $(1)/usr/lib/node/cylon-firmata
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/{index.js,lib,LICENSE,package.json,README.md,RELEASES.md,spec} $(1)/usr/lib/node/cylon-firmata/
+endef
+
+$(eval $(call BuildPackage,node-cylon))
+$(eval $(call BuildPackage,node-cylon-i2c))
+$(eval $(call BuildPackage,node-cylon-gpio))
+$(eval $(call BuildPackage,node-cylon-firmata))
+
diff --git a/lang/node-cylon/patches/0001-serialport.patch b/lang/node-cylon/patches/0001-serialport.patch
new file mode 100644 (file)
index 0000000..08d579c
--- /dev/null
@@ -0,0 +1,12 @@
+Index: node-cylon-0.22.0/package.json
+===================================================================
+--- node-cylon-0.22.0.orig/package.json        2015-10-20 20:32:48.000000000 +0200
++++ node-cylon-0.22.0/package.json     2015-10-21 10:42:20.616109122 +0200
+@@ -38,7 +38,6 @@
+   },
+   "dependencies": {
+-    "firmata":    ">= 0.3.2",
+     "cylon":      "1.1.0",
+     "cylon-gpio": "0.26.0",
+     "cylon-i2c":  "0.22.0"
diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile
new file mode 100644 (file)
index 0000000..911e2a4
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NPM_NAME:=hid
+PKG_NAME:=node-$(PKG_NPM_NAME)
+PKG_VERSION:=0.4.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=c56c8aa5d113c6f2574d1f7e64d41745702965bb
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_DEPENDS:=node
+PKG_NODE_VERSION:=0.12.7
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=Custom
+PKG_LICENSE_FILE:=
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node-hid
+  DEPENDS:=+node
+  SUBMENU:=Node.js
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+libusb-1.0 +hidapi +libstdcpp
+  TITLE:=Node.js package to access HID devices
+  URL:=https://github.com/node-hid/node-hid
+endef
+
+define Package/node-hid/description
+ Node.js package to access HID devices
+endef
+
+EXTRA_LDFLAGS+="-lhidapi-libusb"
+EXTRA_CFLAGS+="-I$(STAGING_DIR)/usr/include/hidapi/"
+
+define Build/Compile
+       $(MAKE_VARS) \
+       $(MAKE_FLAGS) \
+       npm_config_arch=$(CONFIG_ARCH) \
+       npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
+       PREFIX="$(PKG_INSTALL_DIR)/usr/" \
+       $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
+endef
+
+define Package/node-hid/install
+       mkdir -p $(1)/usr/lib/node/node-hid/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/node-hid/{index.js,package.json,build,node_modules} $(1)/usr/lib/node/node-hid/
+endef
+
+$(eval $(call BuildPackage,node-hid))
+
diff --git a/lang/node-hid/patches/000-compile.patch b/lang/node-hid/patches/000-compile.patch
new file mode 100644 (file)
index 0000000..d44e9b3
--- /dev/null
@@ -0,0 +1,2457 @@
+--- a/package.json
++++ b/package.json
+@@ -14,9 +14,6 @@
+     "type": "git",
+     "url": "git://github.com/hanshuebner/node-hid.git"
+   },
+-  "scripts": {
+-    "prepublish": "git submodule update --init"
+-  },
+   "main": "./index.js",
+   "engines": {
+     "node": ">=0.8.0"
+--- a/src/wscript
++++ b/src/wscript
+@@ -3,10 +3,8 @@
+ import sys;
+ import os;
+-hidapi_home='../hidapi'
+ cflags=["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall", "-fPIC" ]
+-includes=[ hidapi_home + "/hidapi" ]
+ def set_options(opt):
+   opt.tool_options("compiler_cxx")
+@@ -16,24 +14,10 @@
+   conf.check_tool("compiler_cxx")
+   conf.check_tool("node_addon")
+   conf.check_tool("compiler_cc")
+-  if sys.platform == 'darwin':
+-    conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-framework', 'IOKit', '-framework', 'CoreFoundation'])
+-  else:
+-    conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-ludev' ])
+-  
+-def build(bld):
+-    bld.add_group("hidapi")
+-    hidapi = bld.new_task_gen("cc", "staticlib")
+-    hidapi.includes = includes
+-    hidapi.cflags = cflags
+-    if sys.platform == 'darwin':
+-      hidapi.source = "../hidapi/mac/hid.c"
+-    else:
+-      hidapi.source = "../hidapi/linux/hid.c"
+-    hidapi.target = "hidapi"
++def build(bld):
+     bld.add_group("adapter")
+-    adapter = bld.new_task_gen("cxx", "shlib", "node_addon", use = ['hidapi'])
++    adapter = bld.new_task_gen("cxx", "shlib", "node_addon")
+     adapter.includes = includes
+     adapter.cxxflags = cflags
+     adapter.target = "HID"
+--- a/binding.gyp
++++ b/binding.gyp
+@@ -4,61 +4,8 @@
+   },\r
+   'targets': [\r
+     {\r
+-      'target_name': 'hidapi',\r
+-      'type': 'static_library',\r
+-      'conditions': [\r
+-        [ 'OS=="mac"', {\r
+-          'sources': [ 'hidapi/mac/hid.c' ],\r
+-          'include_dirs+': [\r
+-            '/usr/include/libusb-1.0/'\r
+-          ]\r
+-        }],\r
+-        [ 'OS=="linux"', {\r
+-          'conditions': [\r
+-            [ 'driver=="libusb"', {\r
+-              'sources': [ 'hidapi/libusb/hid.c' ],\r
+-              'include_dirs+': [\r
+-                '/usr/include/libusb-1.0/'\r
+-              ]\r
+-            }],\r
+-            [ 'driver=="hidraw"', {\r
+-              'sources': [ 'hidapi/linux/hid.c' ]\r
+-            }]\r
+-          ]\r
+-        }],\r
+-        [ 'OS=="win"', {\r
+-          'sources': [ 'hidapi/windows/hid.c' ],\r
+-          'msvs_settings': {\r
+-            'VCLinkerTool': {\r
+-              'AdditionalDependencies': [\r
+-                'setupapi.lib',\r
+-              ]\r
+-            }\r
+-          }\r
+-        }]\r
+-      ],\r
+-      'direct_dependent_settings': {\r
+-        'include_dirs': [\r
+-          'hidapi/hidapi',\r
+-          "<!(node -e \"require('nan')\")"\r
+-        ]\r
+-      },\r
+-      'include_dirs': [\r
+-        'hidapi/hidapi'\r
+-      ],\r
+-      'defines': [\r
+-        '_LARGEFILE_SOURCE',\r
+-        '_FILE_OFFSET_BITS=64',\r
+-      ],\r
+-      'cflags': ['-g'],\r
+-      'cflags!': [\r
+-        '-ansi'\r
+-      ]\r
+-    },\r
+-    {\r
+       'target_name': 'HID',\r
+       'sources': [ 'src/HID.cc' ],\r
+-      'dependencies': ['hidapi'],\r
+       'defines': [\r
+         '_LARGEFILE_SOURCE',\r
+         '_FILE_OFFSET_BITS=64',\r
+@@ -108,4 +55,4 @@
+       'cflags_cc': ['-g', '-exceptions']\r
+     }\r
+   ]\r
+-}
+\ No newline at end of file
++}\r
+--- /dev/null
++++ b/src/nan.h
+@@ -0,0 +1,2331 @@
++/**********************************************************************************
++ * NAN - Native Abstractions for Node.js
++ *
++ * Copyright (c) 2014 NAN contributors:
++ *   - Rod Vagg <https://github.com/rvagg>
++ *   - Benjamin Byholm <https://github.com/kkoopa>
++ *   - Trevor Norris <https://github.com/trevnorris>
++ *   - Nathan Rajlich <https://github.com/TooTallNate>
++ *   - Brett Lawson <https://github.com/brett19>
++ *   - Ben Noordhuis <https://github.com/bnoordhuis>
++ *
++ * MIT +no-false-attribs License <https://github.com/rvagg/nan/blob/master/LICENSE>
++ *
++ * Version 1.3.0: current Node unstable: 0.11.13, Node stable: 0.10.30
++ *
++ * See https://github.com/rvagg/nan for the latest update to this file
++ **********************************************************************************/
++
++#ifndef NAN_H_
++#define NAN_H_
++
++#include <uv.h>
++#include <node.h>
++#include <node_buffer.h>
++#include <node_version.h>
++#include <node_object_wrap.h>
++#include <string.h>
++#include <limits.h>
++#include <string>
++
++#if defined(__GNUC__) && !defined(DEBUG)
++# define NAN_INLINE inline __attribute__((always_inline))
++#elif defined(_MSC_VER) && !defined(DEBUG)
++# define NAN_INLINE __forceinline
++#else
++# define NAN_INLINE inline
++#endif
++
++#if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS
++# define NAN_DEPRECATED __attribute__((deprecated))
++#elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS
++# define NAN_DEPRECATED __declspec(deprecated)
++#else
++# define NAN_DEPRECATED
++#endif
++
++// some generic helpers
++
++template<typename T> NAN_INLINE bool NanSetPointerSafe(
++    T *var
++  , T val
++) {
++  if (var) {
++    *var = val;
++    return true;
++  } else {
++    return false;
++  }
++}
++
++template<typename T> NAN_INLINE T NanGetPointerSafe(
++    T *var
++  , T fallback = reinterpret_cast<T>(0)
++) {
++  if (var) {
++    return *var;
++  } else {
++    return fallback;
++  }
++}
++
++NAN_INLINE bool NanBooleanOptionValue(
++    v8::Local<v8::Object> optionsObj
++  , v8::Handle<v8::String> opt, bool def
++) {
++  if (def) {
++    return optionsObj.IsEmpty()
++      || !optionsObj->Has(opt)
++      || optionsObj->Get(opt)->BooleanValue();
++  } else {
++    return !optionsObj.IsEmpty()
++      && optionsObj->Has(opt)
++      && optionsObj->Get(opt)->BooleanValue();
++  }
++}
++
++NAN_INLINE bool NanBooleanOptionValue(
++    v8::Local<v8::Object> optionsObj
++  , v8::Handle<v8::String> opt
++) {
++  return NanBooleanOptionValue(optionsObj, opt, false);
++}
++
++NAN_INLINE uint32_t NanUInt32OptionValue(
++    v8::Local<v8::Object> optionsObj
++  , v8::Handle<v8::String> opt
++  , uint32_t def
++) {
++  return !optionsObj.IsEmpty()
++    && optionsObj->Has(opt)
++    && optionsObj->Get(opt)->IsNumber()
++      ? optionsObj->Get(opt)->Uint32Value()
++      : def;
++}
++
++#if (NODE_MODULE_VERSION > 0x000B)
++// Node 0.11+ (0.11.3 and below won't compile with these)
++
++# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo<v8::Value>&
++# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
++# define _NAN_METHOD_RETURN_TYPE void
++
++# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo<v8::Value>&
++# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
++# define _NAN_GETTER_RETURN_TYPE void
++
++# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo<void>&
++# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
++# define _NAN_SETTER_RETURN_TYPE void
++
++# define _NAN_PROPERTY_GETTER_ARGS_TYPE                                        \
++    const v8::PropertyCallbackInfo<v8::Value>&
++# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
++# define _NAN_PROPERTY_GETTER_RETURN_TYPE void
++
++# define _NAN_PROPERTY_SETTER_ARGS_TYPE                                        \
++    const v8::PropertyCallbackInfo<v8::Value>&
++# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
++# define _NAN_PROPERTY_SETTER_RETURN_TYPE void
++
++# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE                                    \
++    const v8::PropertyCallbackInfo<v8::Array>&
++# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
++# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void
++
++# define _NAN_PROPERTY_DELETER_ARGS_TYPE                                       \
++    const v8::PropertyCallbackInfo<v8::Boolean>&
++# define _NAN_PROPERTY_DELETER_ARGS                                            \
++    _NAN_PROPERTY_DELETER_ARGS_TYPE args
++# define _NAN_PROPERTY_DELETER_RETURN_TYPE void
++
++# define _NAN_PROPERTY_QUERY_ARGS_TYPE                                         \
++    const v8::PropertyCallbackInfo<v8::Integer>&
++# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
++# define _NAN_PROPERTY_QUERY_RETURN_TYPE void
++
++# define _NAN_INDEX_GETTER_ARGS_TYPE                                           \
++    const v8::PropertyCallbackInfo<v8::Value>&
++# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
++# define _NAN_INDEX_GETTER_RETURN_TYPE void
++
++# define _NAN_INDEX_SETTER_ARGS_TYPE                                           \
++    const v8::PropertyCallbackInfo<v8::Value>&
++# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
++# define _NAN_INDEX_SETTER_RETURN_TYPE void
++
++# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE                                       \
++    const v8::PropertyCallbackInfo<v8::Array>&
++# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
++# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void
++
++# define _NAN_INDEX_DELETER_ARGS_TYPE                                          \
++    const v8::PropertyCallbackInfo<v8::Boolean>&
++# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
++# define _NAN_INDEX_DELETER_RETURN_TYPE void
++
++# define _NAN_INDEX_QUERY_ARGS_TYPE                                            \
++    const v8::PropertyCallbackInfo<v8::Integer>&
++# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
++# define _NAN_INDEX_QUERY_RETURN_TYPE void
++
++  typedef v8::FunctionCallback NanFunctionCallback;
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew() {
++    return T::New(v8::Isolate::GetCurrent());
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(P arg1) {
++    return T::New(v8::Isolate::GetCurrent(), arg1);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::Signature> NanNew(
++      v8::Handle<v8::FunctionTemplate> receiver
++    , int argc
++    , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
++    return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
++      NanFunctionCallback callback
++    , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
++    , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
++    return T::New(v8::Isolate::GetCurrent(), callback, data, signature);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg1) {
++    return v8::Local<T>::New(v8::Isolate::GetCurrent(), arg1);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg1) {
++    return v8::Local<T>::New(v8::Isolate::GetCurrent(), arg1);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(P arg1, int arg2) {
++    return T::New(v8::Isolate::GetCurrent(), arg1, arg2);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
++    return v8::Array::New(v8::Isolate::GetCurrent());
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
++    return v8::Array::New(v8::Isolate::GetCurrent(), length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
++    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
++    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
++  }
++
++  typedef v8::UnboundScript NanUnboundScript;
++  typedef v8::Script NanBoundScript;
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(
++      P s
++    , const v8::ScriptOrigin& origin
++  ) {
++    v8::ScriptCompiler::Source source(s, origin);
++    return v8::ScriptCompiler::CompileUnbound(
++        v8::Isolate::GetCurrent(), &source);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
++      v8::Local<v8::String> s
++  ) {
++    v8::ScriptCompiler::Source source(s);
++    return v8::ScriptCompiler::CompileUnbound(
++        v8::Isolate::GetCurrent(), &source);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
++    return v8::BooleanObject::New(value).As<v8::BooleanObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::StringObject>
++  NanNew<v8::StringObject, v8::Local<v8::String> >(
++      v8::Local<v8::String> value) {
++    return v8::StringObject::New(value).As<v8::StringObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::StringObject>
++  NanNew<v8::StringObject, v8::Handle<v8::String> >(
++      v8::Handle<v8::String> value) {
++    return v8::StringObject::New(value).As<v8::StringObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
++    return v8::NumberObject::New(
++        v8::Isolate::GetCurrent(), val).As<v8::NumberObject>();
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
++    return v8::Uint32::NewFromUnsigned(
++        v8::Isolate::GetCurrent(), val)->ToUint32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
++    return v8::Uint32::NewFromUnsigned(
++        v8::Isolate::GetCurrent(), val)->ToUint32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
++    return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
++    return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(
++      char *arg
++    , int length) {
++    return v8::String::NewFromUtf8(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
++      const char *arg
++    , int length) {
++    return v8::String::NewFromUtf8(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(char *arg) {
++    return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
++      const char *arg) {
++    return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
++      uint8_t *arg
++    , int length) {
++    return v8::String::NewFromOneByte(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
++      const uint8_t *arg
++    , int length) {
++    return v8::String::NewFromOneByte(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
++    return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
++      const uint8_t *arg) {
++    return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
++      uint16_t *arg
++    , int length) {
++    return v8::String::NewFromTwoByte(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
++      const uint16_t *arg
++    , int length) {
++    return v8::String::NewFromTwoByte(
++        v8::Isolate::GetCurrent()
++      , arg
++      , v8::String::kNormalString
++      , length);
++  }
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
++      uint16_t *arg) {
++    return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
++      const uint16_t *arg) {
++    return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, std::string>(
++      std::string arg) {
++    return NanNew<v8::String>(arg.c_str(), arg.size());
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
++    return v8::String::Empty(v8::Isolate::GetCurrent());
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(const char* arg, int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      const uint8_t* arg
++    , int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      const uint16_t* arg
++    , int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      const std::string& arg) {
++    return NanNew<v8::String>(arg.c_str(), arg.size());
++  }
++
++  NAN_INLINE v8::Local<v8::Number> NanNew(double val) {
++    return NanNew<v8::Number>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Integer> NanNew(int val) {
++    return NanNew<v8::Integer>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Uint32> NanNew(unsigned int val) {
++    return NanNew<v8::Uint32>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanNew(bool val) {
++    return NanNew<v8::Boolean>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      v8::String::ExternalStringResource *resource) {
++    return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      v8::String::ExternalAsciiStringResource *resource) {
++    return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource);
++  }
++
++# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent())
++# define NanEscapableScope()                                                   \
++  v8::EscapableHandleScope scope(v8::Isolate::GetCurrent())
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> _NanEscapeScopeHelper(v8::Handle<T> val) {
++    return NanNew(val);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> _NanEscapeScopeHelper(v8::Local<T> val) {
++    return val;
++  }
++
++# define NanEscapeScope(val) scope.Escape(_NanEscapeScopeHelper(val))
++# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent())
++# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent())
++# define NanReturnValue(value) return args.GetReturnValue().Set(value)
++# define NanReturnUndefined() return
++# define NanReturnNull() return args.GetReturnValue().SetNull()
++# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString()
++
++# define NanObjectWrapHandle(obj) obj->handle()
++
++  NAN_INLINE v8::Local<v8::Primitive> NanUndefined() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
++  }
++
++  NAN_INLINE v8::Local<v8::Primitive> NanNull() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent())));
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanTrue() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanFalse() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent())));
++  }
++
++  NAN_INLINE int NanAdjustExternalMemory(int bc) {
++    return static_cast<int>(
++        v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
++  }
++
++  NAN_INLINE void NanSetTemplate(
++      v8::Handle<v8::Template> templ
++    , const char *name
++    , v8::Handle<v8::Data> value) {
++    templ->Set(v8::Isolate::GetCurrent(), name, value);
++  }
++
++  NAN_INLINE void NanSetTemplate(
++      v8::Handle<v8::Template> templ
++    , v8::Handle<v8::String> name
++    , v8::Handle<v8::Data> value
++    , v8::PropertyAttribute attributes) {
++    templ->Set(name, value, attributes);
++  }
++
++  NAN_INLINE v8::Local<v8::Context> NanGetCurrentContext() {
++    return v8::Isolate::GetCurrent()->GetCurrentContext();
++  }
++
++  NAN_INLINE void* NanGetInternalFieldPointer(
++      v8::Handle<v8::Object> object
++    , int index) {
++    return object->GetAlignedPointerFromInternalField(index);
++  }
++
++  NAN_INLINE void NanSetInternalFieldPointer(
++      v8::Handle<v8::Object> object
++    , int index
++    , void* value) {
++    object->SetAlignedPointerInInternalField(index, value);
++  }
++
++  NAN_INLINE void NanAddGCEpilogueCallback(
++      v8::Isolate::GCEpilogueCallback callback
++    , v8::GCType gc_type_filter = v8::kGCTypeAll) {
++    v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter);
++  }
++
++  NAN_INLINE void NanRemoveGCEpilogueCallback(
++      v8::Isolate::GCEpilogueCallback callback) {
++    v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback);
++  }
++
++  NAN_INLINE void NanAddGCPrologueCallback(
++      v8::Isolate::GCPrologueCallback callback
++    , v8::GCType gc_type_filter = v8::kGCTypeAll) {
++    v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter);
++  }
++
++  NAN_INLINE void NanRemoveGCPrologueCallback(
++      v8::Isolate::GCPrologueCallback callback) {
++    v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback);
++  }
++
++  NAN_INLINE void NanGetHeapStatistics(
++      v8::HeapStatistics *heap_statistics) {
++    v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics);
++  }
++
++  NAN_DEPRECATED NAN_INLINE v8::Local<v8::String> NanSymbol(
++      const char* data, int length = -1) {
++    return NanNew<v8::String>(data, length);
++  }
++
++  template<typename T>
++  NAN_INLINE void NanAssignPersistent(
++      v8::Persistent<T>& handle
++    , v8::Handle<T> obj) {
++      handle.Reset(v8::Isolate::GetCurrent(), obj);
++  }
++
++  template<typename T>
++  NAN_INLINE void NanAssignPersistent(
++      v8::Persistent<T>& handle
++    , const v8::Persistent<T>& obj) {
++      handle.Reset(v8::Isolate::GetCurrent(), obj);
++  }
++
++  template<typename T, typename P>
++  class _NanWeakCallbackData;
++
++  template<typename T, typename P>
++  struct _NanWeakCallbackInfo {
++    typedef void (*Callback)(const _NanWeakCallbackData<T, P>& data);
++    NAN_INLINE _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb)
++      : parameter(param), callback(cb) {
++       NanAssignPersistent(persistent, handle);
++    }
++
++    NAN_INLINE ~_NanWeakCallbackInfo() {
++      persistent.Reset();
++    }
++
++    P* const parameter;
++    Callback const callback;
++    v8::Persistent<T> persistent;
++  };
++
++  template<typename T, typename P>
++  class _NanWeakCallbackData {
++   public:
++    NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
++      : info_(info) { }
++
++    NAN_INLINE v8::Local<T> GetValue() const {
++      return NanNew(info_->persistent);
++    }
++
++    NAN_INLINE P* GetParameter() const { return info_->parameter; }
++
++    NAN_INLINE bool IsNearDeath() const {
++      return info_->persistent.IsNearDeath();
++    }
++
++    NAN_INLINE void Revive() const;
++
++    NAN_INLINE _NanWeakCallbackInfo<T, P>* GetCallbackInfo() const {
++      return info_;
++    }
++
++    NAN_DEPRECATED NAN_INLINE void Dispose() const {
++    }
++
++   private:
++    _NanWeakCallbackInfo<T, P>* info_;
++  };
++
++  template<typename T, typename P>
++  static void _NanWeakCallbackDispatcher(
++    const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> > &data) {
++      _NanWeakCallbackInfo<T, P> *info = data.GetParameter();
++      _NanWeakCallbackData<T, P> wcbd(info);
++      info->callback(wcbd);
++      if (wcbd.IsNearDeath()) {
++        delete wcbd.GetCallbackInfo();
++      }
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE void _NanWeakCallbackData<T, P>::Revive() const {
++      info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher<T, P>);
++  }
++
++template<typename T, typename P>
++NAN_INLINE _NanWeakCallbackInfo<T, P>* NanMakeWeakPersistent(
++    v8::Handle<T> handle
++  , P* parameter
++  , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
++    _NanWeakCallbackInfo<T, P> *cbinfo =
++     new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
++    cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher<T, P>);
++    return cbinfo;
++}
++
++# define NAN_WEAK_CALLBACK(name)                                               \
++    template<typename T, typename P>                                           \
++    static void name(const _NanWeakCallbackData<T, P> &data)
++
++# define _NAN_ERROR(fun, errmsg) fun(NanNew<v8::String>(errmsg))
++
++# define _NAN_THROW_ERROR(fun, errmsg)                                         \
++    do {                                                                       \
++      NanScope();                                                              \
++      v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg));      \
++    } while (0);
++
++  NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
++    return  _NAN_ERROR(v8::Exception::Error, errmsg);
++  }
++
++  NAN_INLINE void NanThrowError(const char* errmsg) {
++    _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
++  }
++
++  NAN_INLINE void NanThrowError(v8::Handle<v8::Value> error) {
++    NanScope();
++    v8::Isolate::GetCurrent()->ThrowException(error);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanError(
++      const char *msg
++    , const int errorNumber
++  ) {
++    v8::Local<v8::Value> err = v8::Exception::Error(NanNew<v8::String>(msg));
++    v8::Local<v8::Object> obj = err.As<v8::Object>();
++    obj->Set(NanNew<v8::String>("code"), NanNew<v8::Integer>(errorNumber));
++    return err;
++  }
++
++  NAN_INLINE void NanThrowError(
++      const char *msg
++    , const int errorNumber
++  ) {
++    NanThrowError(NanError(msg, errorNumber));
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
++    return _NAN_ERROR(v8::Exception::TypeError, errmsg);
++  }
++
++  NAN_INLINE void NanThrowTypeError(const char* errmsg) {
++    _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanRangeError(const char* errmsg) {
++    return _NAN_ERROR(v8::Exception::RangeError, errmsg);
++  }
++
++  NAN_INLINE void NanThrowRangeError(const char* errmsg) {
++    _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
++  }
++
++  template<typename T> NAN_INLINE void NanDisposePersistent(
++      v8::Persistent<T> &handle
++  ) {
++    handle.Reset();
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
++      char *data
++    , size_t length
++    , node::smalloc::FreeCallback callback
++    , void *hint
++  ) {
++    return node::Buffer::New(
++        v8::Isolate::GetCurrent(), data, length, callback, hint);
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
++      const char *data
++    , uint32_t size
++  ) {
++    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
++    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanBufferUse(
++      char* data
++    , uint32_t size
++  ) {
++    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
++  }
++
++  NAN_INLINE bool NanHasInstance(
++      v8::Persistent<v8::FunctionTemplate>& function_template
++    , v8::Handle<v8::Value> value
++  ) {
++    return NanNew(function_template)->HasInstance(value);
++  }
++
++  NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
++      v8::ExtensionConfiguration* extensions = NULL
++    , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
++    , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
++  ) {
++    v8::Isolate* isolate = v8::Isolate::GetCurrent();
++    return v8::Local<v8::Context>::New(
++        isolate
++      , v8::Context::New(isolate, extensions, tmpl, obj)
++    );
++  }
++
++  NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
++      v8::Local<v8::String> s
++    , const v8::ScriptOrigin& origin
++  ) {
++    v8::ScriptCompiler::Source source(s, origin);
++    return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source);
++  }
++
++  NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
++      v8::Local<v8::String> s
++  ) {
++    v8::ScriptCompiler::Source source(s);
++    return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanRunScript(
++      v8::Handle<NanUnboundScript> script
++  ) {
++    return script->BindToCurrentContext()->Run();
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanRunScript(
++      v8::Handle<NanBoundScript> script
++  ) {
++    return script->Run();
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , v8::Handle<v8::Function> func
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++    return NanNew(node::MakeCallback(
++        v8::Isolate::GetCurrent(), target, func, argc, argv));
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , v8::Handle<v8::String> symbol
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++    return NanNew(node::MakeCallback(
++        v8::Isolate::GetCurrent(), target, symbol, argc, argv));
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , const char* method
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++    return NanNew(node::MakeCallback(
++        v8::Isolate::GetCurrent(), target, method, argc, argv));
++  }
++
++  template<typename T>
++  NAN_INLINE void NanSetIsolateData(
++      v8::Isolate *isolate
++    , T *data
++  ) {
++      isolate->SetData(0, data);
++  }
++
++  template<typename T>
++  NAN_INLINE T *NanGetIsolateData(
++      v8::Isolate *isolate
++  ) {
++      return static_cast<T*>(isolate->GetData(0));
++  }
++
++  class NanAsciiString {
++   public:
++    NAN_INLINE explicit NanAsciiString(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Length() + 1;
++      buf = new char[buf_size];
++      size = toStr->WriteOneByte(
++          reinterpret_cast<unsigned char*>(buf), 0, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE char* operator*() { return buf; }
++
++    NAN_INLINE ~NanAsciiString() {
++      delete[] buf;
++    }
++
++   private:
++    char *buf;
++    int size;
++  };
++
++  class NanUtf8String {
++   public:
++    NAN_INLINE explicit NanUtf8String(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Utf8Length() + 1;
++      buf = new char[buf_size];
++      size = toStr->WriteUtf8(buf, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE char* operator*() { return buf; }
++
++    NAN_INLINE ~NanUtf8String() {
++      delete[] buf;
++    }
++
++   private:
++    char *buf;
++    int size;
++  };
++
++  class NanUcs2String {
++   public:
++    NAN_INLINE explicit NanUcs2String(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Length() + 1;
++      buf = new uint16_t[buf_size];
++      size = toStr->Write(buf, 0, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE uint16_t* operator*() { return buf; }
++
++    NAN_INLINE ~NanUcs2String() {
++      delete[] buf;
++    }
++
++   private:
++    uint16_t *buf;
++    int size;
++  };
++
++#else
++// Node 0.8 and 0.10
++
++# define _NAN_METHOD_ARGS_TYPE const v8::Arguments&
++# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
++# define _NAN_METHOD_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo &
++# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
++# define _NAN_GETTER_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo &
++# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
++# define _NAN_SETTER_RETURN_TYPE void
++
++# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
++# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
++# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
++# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
++
++# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args
++# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
++
++# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
++# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
++
++# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
++# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
++# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle<v8::Value>
++
++# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
++# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
++
++# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
++# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
++
++# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo&
++# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
++# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
++
++  typedef v8::InvocationCallback NanFunctionCallback;
++
++  NAN_DEPRECATED NAN_INLINE v8::Local<v8::String> NanSymbol(
++      const char* data, int length = -1) {
++    return v8::String::NewSymbol(data, length);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew() {
++    return v8::Local<T>::New(T::New());
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg) {
++    return v8::Local<T>::New(arg);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::Signature> NanNew(
++      v8::Handle<v8::FunctionTemplate> receiver
++    , int argc
++    , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
++    return v8::Signature::New(receiver, argc, argv);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
++      NanFunctionCallback callback
++    , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
++    , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
++    return T::New(callback, data, signature);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg) {
++    return v8::Local<T>::New(arg);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(P arg) {
++    return v8::Local<T>::New(T::New(arg));
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(P arg, int length) {
++    return v8::Local<T>::New(T::New(arg, length));
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<v8::RegExp> NanNew(
++      v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
++    return v8::RegExp::New(pattern, flags);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
++    return v8::Array::New();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
++    return v8::Array::New(length);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
++    return v8::Date::New(time).As<v8::Date>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
++    return v8::Date::New(time).As<v8::Date>();
++  }
++
++  typedef v8::Script NanUnboundScript;
++  typedef v8::Script NanBoundScript;
++
++  template<typename T, typename P>
++  NAN_INLINE v8::Local<T> NanNew(
++      P s
++    , const v8::ScriptOrigin& origin
++  ) {
++    return v8::Script::New(s, const_cast<v8::ScriptOrigin *>(&origin));
++  }
++
++  template<>
++  NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
++      v8::Local<v8::String> s
++  ) {
++    return v8::Script::New(s);
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
++    return v8::BooleanObject::New(value).As<v8::BooleanObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::StringObject>
++  NanNew<v8::StringObject, v8::Local<v8::String> >(
++      v8::Local<v8::String> value) {
++    return v8::StringObject::New(value).As<v8::StringObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::StringObject>
++  NanNew<v8::StringObject, v8::Handle<v8::String> >(
++      v8::Handle<v8::String> value) {
++    return v8::StringObject::New(value).As<v8::StringObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
++    return v8::NumberObject::New(val).As<v8::NumberObject>();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
++    return v8::Uint32::NewFromUnsigned(val)->ToUint32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
++    return v8::Uint32::NewFromUnsigned(val)->ToUint32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
++    return v8::Int32::New(val)->ToInt32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
++    return v8::Int32::New(val)->ToInt32();
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
++      uint8_t *arg
++    , int length) {
++    int len = length;
++    if (len < 0) {
++      size_t temp = strlen(reinterpret_cast<const char *>(arg));
++      assert(temp <= INT_MAX && "too long string");
++      len = static_cast<int>(temp);
++    }
++    uint16_t *warg = new uint16_t[len];
++    for (int i = 0; i < len; i++) {
++      warg[i] = arg[i];
++    }
++    v8::Local<v8::String> retval = v8::String::New(warg, len);
++    delete[] warg;
++    return retval;
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
++      const uint8_t *arg
++    , int length) {
++    int len = length;
++    if (len < 0) {
++      size_t temp = strlen(reinterpret_cast<const char *>(arg));
++      assert(temp <= INT_MAX && "too long string");
++      len = static_cast<int>(temp);
++    }
++    uint16_t *warg = new uint16_t[len];
++    for (int i = 0; i < len; i++) {
++      warg[i] = arg[i];
++    }
++    v8::Local<v8::String> retval = v8::String::New(warg, len);
++    delete[] warg;
++    return retval;
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
++    size_t temp = strlen(reinterpret_cast<char *>(arg));
++    assert(temp <= INT_MAX && "too long string");
++    int length = static_cast<int>(temp);
++    uint16_t *warg = new uint16_t[length];
++    for (int i = 0; i < length; i++) {
++      warg[i] = arg[i];
++    }
++
++    v8::Local<v8::String> retval = v8::String::New(warg, length);
++    delete[] warg;
++    return retval;
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
++      const uint8_t *arg) {
++    size_t temp = strlen(reinterpret_cast<const char *>(arg));
++    assert(temp <= INT_MAX && "too long string");
++    int length = static_cast<int>(temp);
++    uint16_t *warg = new uint16_t[length];
++    for (int i = 0; i < length; i++) {
++      warg[i] = arg[i];
++    }
++    v8::Local<v8::String> retval = v8::String::New(warg, length);
++    delete[] warg;
++    return retval;
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String, std::string>(
++      std::string arg) {
++    return NanNew<v8::String>(arg.c_str(), arg.size());
++  }
++
++  template<>
++  NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
++    return v8::String::Empty();
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(const char* arg, int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      const uint8_t* arg
++    , int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      const uint16_t* arg
++    , int length = -1) {
++    return NanNew<v8::String>(arg, length);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      std::string& arg) {
++    return NanNew<v8::String>(arg.c_str(), arg.size());
++  }
++
++  NAN_INLINE v8::Local<v8::Number> NanNew(double val) {
++    return NanNew<v8::Number>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Integer> NanNew(int val) {
++    return NanNew<v8::Integer>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Uint32> NanNew(unsigned int val) {
++    return NanNew<v8::Uint32>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanNew(bool val) {
++    return NanNew<v8::Boolean>(val);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      v8::String::ExternalStringResource *resource) {
++    return v8::String::NewExternal(resource);
++  }
++
++  NAN_INLINE v8::Local<v8::String> NanNew(
++      v8::String::ExternalAsciiStringResource *resource) {
++    return v8::String::NewExternal(resource);
++  }
++
++# define NanScope() v8::HandleScope scope
++# define NanEscapableScope() v8::HandleScope scope
++# define NanEscapeScope(val) scope.Close(val)
++# define NanLocker() v8::Locker locker
++# define NanUnlocker() v8::Unlocker unlocker
++# define NanReturnValue(value) return scope.Close(value)
++# define NanReturnUndefined() return v8::Undefined()
++# define NanReturnNull() return v8::Null()
++# define NanReturnEmptyString() return v8::String::Empty()
++# define NanObjectWrapHandle(obj) v8::Local<v8::Object>::New(obj->handle_)
++
++  NAN_INLINE v8::Local<v8::Primitive> NanUndefined() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::Undefined()));
++  }
++
++  NAN_INLINE v8::Local<v8::Primitive> NanNull() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::Null()));
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanTrue() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::True()));
++  }
++
++  NAN_INLINE v8::Local<v8::Boolean> NanFalse() {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(v8::False()));
++  }
++
++  NAN_INLINE int NanAdjustExternalMemory(int bc) {
++    return static_cast<int>(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc));
++  }
++
++  NAN_INLINE void NanSetTemplate(
++      v8::Handle<v8::Template> templ
++    , const char *name
++    , v8::Handle<v8::Data> value) {
++    templ->Set(name, value);
++  }
++
++  NAN_INLINE void NanSetTemplate(
++      v8::Handle<v8::Template> templ
++    , v8::Handle<v8::String> name
++    , v8::Handle<v8::Data> value
++    , v8::PropertyAttribute attributes) {
++    templ->Set(name, value, attributes);
++  }
++
++  NAN_INLINE v8::Local<v8::Context> NanGetCurrentContext() {
++    return v8::Context::GetCurrent();
++  }
++
++  NAN_INLINE void* NanGetInternalFieldPointer(
++      v8::Handle<v8::Object> object
++    , int index) {
++    return object->GetPointerFromInternalField(index);
++  }
++
++  NAN_INLINE void NanSetInternalFieldPointer(
++      v8::Handle<v8::Object> object
++    , int index
++    , void* value) {
++    object->SetPointerInInternalField(index, value);
++  }
++
++  NAN_INLINE void NanAddGCEpilogueCallback(
++    v8::GCEpilogueCallback callback
++  , v8::GCType gc_type_filter = v8::kGCTypeAll) {
++    v8::V8::AddGCEpilogueCallback(callback, gc_type_filter);
++  }
++  NAN_INLINE void NanRemoveGCEpilogueCallback(
++    v8::GCEpilogueCallback callback) {
++    v8::V8::RemoveGCEpilogueCallback(callback);
++  }
++  NAN_INLINE void NanAddGCPrologueCallback(
++    v8::GCPrologueCallback callback
++  , v8::GCType gc_type_filter = v8::kGCTypeAll) {
++    v8::V8::AddGCPrologueCallback(callback, gc_type_filter);
++  }
++  NAN_INLINE void NanRemoveGCPrologueCallback(
++    v8::GCPrologueCallback callback) {
++    v8::V8::RemoveGCPrologueCallback(callback);
++  }
++  NAN_INLINE void NanGetHeapStatistics(
++    v8::HeapStatistics *heap_statistics) {
++    v8::V8::GetHeapStatistics(heap_statistics);
++  }
++
++  template<typename T>
++  NAN_INLINE void NanAssignPersistent(
++      v8::Persistent<T>& handle
++    , v8::Handle<T> obj) {
++      handle.Dispose();
++      handle = v8::Persistent<T>::New(obj);
++  }
++
++  template<typename T, typename P>
++  class _NanWeakCallbackData;
++
++  template<typename T, typename P>
++  struct _NanWeakCallbackInfo {
++    typedef void (*Callback)(const _NanWeakCallbackData<T, P> &data);
++    NAN_INLINE _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb)
++      : parameter(param)
++      , callback(cb)
++      , persistent(v8::Persistent<T>::New(handle)) { }
++
++    NAN_INLINE ~_NanWeakCallbackInfo() {
++      persistent.Dispose();
++      persistent.Clear();
++    }
++
++    P* const parameter;
++    Callback const callback;
++    v8::Persistent<T> persistent;
++  };
++
++  template<typename T, typename P>
++  class _NanWeakCallbackData {
++   public:
++    NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
++      : info_(info) { }
++
++    NAN_INLINE v8::Local<T> GetValue() const {
++      return NanNew(info_->persistent);
++    }
++
++    NAN_INLINE P* GetParameter() const { return info_->parameter; }
++
++    NAN_INLINE bool IsNearDeath() const {
++      return info_->persistent.IsNearDeath();
++    }
++
++    NAN_INLINE void Revive() const;
++
++    NAN_INLINE _NanWeakCallbackInfo<T, P>* GetCallbackInfo() const {
++      return info_;
++    }
++
++    NAN_DEPRECATED NAN_INLINE void Dispose() const {
++    }
++
++   private:
++    _NanWeakCallbackInfo<T, P>* info_;
++  };
++
++  template<typename T, typename P>
++  static void _NanWeakPersistentDispatcher(
++      v8::Persistent<v8::Value> object, void *data) {
++    _NanWeakCallbackInfo<T, P>* info =
++        static_cast<_NanWeakCallbackInfo<T, P>*>(data);
++    _NanWeakCallbackData<T, P> wcbd(info);
++    info->callback(wcbd);
++    if (wcbd.IsNearDeath()) {
++      delete wcbd.GetCallbackInfo();
++    }
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE void _NanWeakCallbackData<T, P>::Revive() const {
++      info_->persistent.MakeWeak(
++          info_
++        , &_NanWeakPersistentDispatcher<T, P>);
++  }
++
++  template<typename T, typename P>
++  NAN_INLINE _NanWeakCallbackInfo<T, P>* NanMakeWeakPersistent(
++    v8::Handle<T> handle
++  , P* parameter
++  , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
++      _NanWeakCallbackInfo<T, P> *cbinfo =
++        new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
++      cbinfo->persistent.MakeWeak(
++          cbinfo
++        , &_NanWeakPersistentDispatcher<T, P>);
++      return cbinfo;
++  }
++
++# define NAN_WEAK_CALLBACK(name)                                               \
++    template<typename T, typename P>                                           \
++    static void name(const _NanWeakCallbackData<T, P> &data)
++
++# define _NAN_ERROR(fun, errmsg)                                               \
++    fun(v8::String::New(errmsg))
++
++# define _NAN_THROW_ERROR(fun, errmsg)                                         \
++    do {                                                                       \
++      NanScope();                                                              \
++      return v8::Local<v8::Value>::New(                                        \
++        v8::ThrowException(_NAN_ERROR(fun, errmsg)));                          \
++    } while (0);
++
++  NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
++    return _NAN_ERROR(v8::Exception::Error, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanThrowError(const char* errmsg) {
++    _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanThrowError(
++      v8::Handle<v8::Value> error
++  ) {
++    NanScope();
++    return v8::Local<v8::Value>::New(v8::ThrowException(error));
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanError(
++      const char *msg
++    , const int errorNumber
++  ) {
++    v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
++    v8::Local<v8::Object> obj = err.As<v8::Object>();
++    obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
++    return err;
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanThrowError(
++      const char *msg
++    , const int errorNumber
++  ) {
++    return NanThrowError(NanError(msg, errorNumber));
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
++    return _NAN_ERROR(v8::Exception::TypeError, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanThrowTypeError(
++      const char* errmsg
++  ) {
++    _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanRangeError(
++      const char* errmsg
++  ) {
++    return _NAN_ERROR(v8::Exception::RangeError, errmsg);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanThrowRangeError(
++      const char* errmsg
++  ) {
++    _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
++  }
++
++  template<typename T>
++  NAN_INLINE void NanDisposePersistent(
++      v8::Persistent<T> &handle) {  // NOLINT(runtime/references)
++    handle.Dispose();
++    handle.Clear();
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
++      char *data
++    , size_t length
++    , node::Buffer::free_callback callback
++    , void *hint
++  ) {
++    return NanNew(
++        node::Buffer::New(data, length, callback, hint)->handle_);
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
++      const char *data
++    , uint32_t size
++  ) {
++#if NODE_MODULE_VERSION >= 0x000B
++    return NanNew(node::Buffer::New(data, size)->handle_);
++#else
++    return NanNew(
++      node::Buffer::New(const_cast<char*>(data), size)->handle_);
++#endif
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
++    return NanNew(node::Buffer::New(size)->handle_);
++  }
++
++  NAN_INLINE void FreeData(char *data, void *hint) {
++    delete[] data;
++  }
++
++  NAN_INLINE v8::Local<v8::Object> NanBufferUse(
++      char* data
++    , uint32_t size
++  ) {
++    return NanNew(
++        node::Buffer::New(data, size, FreeData, NULL)->handle_);
++  }
++
++  NAN_INLINE bool NanHasInstance(
++      v8::Persistent<v8::FunctionTemplate>& function_template
++    , v8::Handle<v8::Value> value
++  ) {
++    return function_template->HasInstance(value);
++  }
++
++  NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
++      v8::ExtensionConfiguration* extensions = NULL
++    , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
++    , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
++  ) {
++    v8::Persistent<v8::Context> ctx = v8::Context::New(extensions, tmpl, obj);
++    v8::Local<v8::Context> lctx = NanNew(ctx);
++    ctx.Dispose();
++    return lctx;
++  }
++
++  NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
++      v8::Local<v8::String> s
++    , const v8::ScriptOrigin& origin
++  ) {
++    return v8::Script::Compile(s, const_cast<v8::ScriptOrigin *>(&origin));
++  }
++
++  NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
++    v8::Local<v8::String> s
++  ) {
++    return v8::Script::Compile(s);
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanRunScript(v8::Handle<v8::Script> script) {
++    return script->Run();
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , v8::Handle<v8::Function> func
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++# if NODE_VERSION_AT_LEAST(0, 8, 0)
++    return NanNew(node::MakeCallback(target, func, argc, argv));
++# else
++    v8::TryCatch try_catch;
++    v8::Local<v8::Value> result = NanNew(func->Call(target, argc, argv));
++    if (try_catch.HasCaught()) {
++        node::FatalException(try_catch);
++    }
++    return result;
++# endif
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , v8::Handle<v8::String> symbol
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++# if NODE_VERSION_AT_LEAST(0, 8, 0)
++    return NanNew(node::MakeCallback(target, symbol, argc, argv));
++# else
++    v8::Local<v8::Function> callback = target->Get(symbol).As<v8::Function>();
++    return NanMakeCallback(target, callback, argc, argv);
++# endif
++  }
++
++  NAN_INLINE v8::Local<v8::Value> NanMakeCallback(
++      v8::Handle<v8::Object> target
++    , const char* method
++    , int argc
++    , v8::Handle<v8::Value>* argv) {
++# if NODE_VERSION_AT_LEAST(0, 8, 0)
++    return NanNew(node::MakeCallback(target, method, argc, argv));
++# else
++    return NanMakeCallback(target, NanNew(method), argc, argv);
++# endif
++  }
++
++  template<typename T>
++  NAN_INLINE void NanSetIsolateData(
++      v8::Isolate *isolate
++    , T *data
++  ) {
++      isolate->SetData(data);
++  }
++
++  template<typename T>
++  NAN_INLINE T *NanGetIsolateData(
++      v8::Isolate *isolate
++  ) {
++      return static_cast<T*>(isolate->GetData());
++  }
++
++  class NanAsciiString {
++   public:
++    NAN_INLINE explicit NanAsciiString(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Length() + 1;
++      buf = new char[buf_size];
++      size = toStr->WriteAscii(buf, 0, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE char* operator*() { return buf; }
++
++    NAN_INLINE ~NanAsciiString() {
++      delete[] buf;
++    }
++
++   private:
++    char *buf;
++    int size;
++  };
++
++  class NanUtf8String {
++   public:
++    NAN_INLINE explicit NanUtf8String(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Utf8Length() + 1;
++      buf = new char[buf_size];
++      size = toStr->WriteUtf8(buf, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE char* operator*() { return buf; }
++
++    NAN_INLINE ~NanUtf8String() {
++      delete[] buf;
++    }
++
++   private:
++    char *buf;
++    int size;
++  };
++
++  class NanUcs2String {
++   public:
++    NAN_INLINE explicit NanUcs2String(v8::Handle<v8::Value> from) {
++      v8::Local<v8::String> toStr = from->ToString();
++      int buf_size = toStr->Length() + 1;
++      buf = new uint16_t[buf_size];
++      size = toStr->Write(buf, 0, buf_size);
++    }
++
++    NAN_INLINE int Size() const {
++      return size;
++    }
++
++    NAN_INLINE uint16_t* operator*() { return buf; }
++
++    NAN_INLINE ~NanUcs2String() {
++      delete[] buf;
++    }
++
++   private:
++    uint16_t *buf;
++    int size;
++  };
++
++#endif  // NODE_MODULE_VERSION
++
++typedef void (*NanFreeCallback)(char *data, void *hint);
++
++#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS)
++#define NAN_GETTER(name)                                                       \
++    _NAN_GETTER_RETURN_TYPE name(                                              \
++        v8::Local<v8::String> property                                         \
++      , _NAN_GETTER_ARGS)
++#define NAN_SETTER(name)                                                       \
++    _NAN_SETTER_RETURN_TYPE name(                                              \
++        v8::Local<v8::String> property                                         \
++      , v8::Local<v8::Value> value                                             \
++      , _NAN_SETTER_ARGS)
++#define NAN_PROPERTY_GETTER(name)                                              \
++    _NAN_PROPERTY_GETTER_RETURN_TYPE name(                                     \
++        v8::Local<v8::String> property                                         \
++      , _NAN_PROPERTY_GETTER_ARGS)
++#define NAN_PROPERTY_SETTER(name)                                              \
++    _NAN_PROPERTY_SETTER_RETURN_TYPE name(                                     \
++        v8::Local<v8::String> property                                         \
++      , v8::Local<v8::Value> value                                             \
++      , _NAN_PROPERTY_SETTER_ARGS)
++#define NAN_PROPERTY_ENUMERATOR(name)                                          \
++    _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS)
++#define NAN_PROPERTY_DELETER(name)                                             \
++    _NAN_PROPERTY_DELETER_RETURN_TYPE name(                                    \
++        v8::Local<v8::String> property                                         \
++      , _NAN_PROPERTY_DELETER_ARGS)
++#define NAN_PROPERTY_QUERY(name)                                               \
++    _NAN_PROPERTY_QUERY_RETURN_TYPE name(                                      \
++        v8::Local<v8::String> property                                         \
++      , _NAN_PROPERTY_QUERY_ARGS)
++# define NAN_INDEX_GETTER(name)                                                \
++    _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS)
++#define NAN_INDEX_SETTER(name)                                                 \
++    _NAN_INDEX_SETTER_RETURN_TYPE name(                                        \
++        uint32_t index                                                         \
++      , v8::Local<v8::Value> value                                             \
++      , _NAN_INDEX_SETTER_ARGS)
++#define NAN_INDEX_ENUMERATOR(name)                                             \
++    _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS)
++#define NAN_INDEX_DELETER(name)                                                \
++    _NAN_INDEX_DELETER_RETURN_TYPE name(                                       \
++        uint32_t index                                                         \
++      , _NAN_INDEX_DELETER_ARGS)
++#define NAN_INDEX_QUERY(name)                                                  \
++    _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS)
++
++class NanCallback {
++ public:
++  NanCallback() {
++    NanScope();
++    v8::Local<v8::Object> obj = NanNew<v8::Object>();
++    NanAssignPersistent(handle, obj);
++  }
++
++  explicit NanCallback(const v8::Handle<v8::Function> &fn) {
++    NanScope();
++    v8::Local<v8::Object> obj = NanNew<v8::Object>();
++    NanAssignPersistent(handle, obj);
++    SetFunction(fn);
++  }
++
++  ~NanCallback() {
++    if (handle.IsEmpty()) return;
++    NanDisposePersistent(handle);
++  }
++
++  NAN_INLINE void SetFunction(const v8::Handle<v8::Function> &fn) {
++    NanScope();
++    NanNew(handle)->Set(kCallbackIndex, fn);
++  }
++
++  NAN_INLINE v8::Local<v8::Function> GetFunction() const {
++    NanEscapableScope();
++    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
++        .As<v8::Function>());
++  }
++
++  NAN_INLINE bool IsEmpty() const {
++    NanScope();
++    return NanNew(handle)->Get(kCallbackIndex)->IsUndefined();
++  }
++
++  v8::Handle<v8::Value> Call(int argc, v8::Handle<v8::Value> argv[]) const {
++    NanEscapableScope();
++#if (NODE_MODULE_VERSION > 0x000B)  // 0.11.12+
++    v8::Isolate* isolate = v8::Isolate::GetCurrent();
++    v8::Local<v8::Function> callback = NanNew(handle)->
++        Get(kCallbackIndex).As<v8::Function>();
++    return NanEscapeScope(node::MakeCallback(
++        isolate
++      , isolate->GetCurrentContext()->Global()
++      , callback
++      , argc
++      , argv
++    ));
++#else
++#if NODE_VERSION_AT_LEAST(0, 8, 0)
++    v8::Local<v8::Function> callback = handle->
++        Get(kCallbackIndex).As<v8::Function>();
++    return NanEscapeScope(node::MakeCallback(
++        v8::Context::GetCurrent()->Global()
++      , callback
++      , argc
++      , argv
++    ));
++#else
++    v8::Local<v8::Function> callback = handle->
++        Get(kCallbackIndex).As<v8::Function>();
++    return NanEscapeScope(NanMakeCallback(
++        v8::Context::GetCurrent()->Global(), callback, argc, argv));
++#endif
++#endif
++  }
++
++ private:
++  v8::Persistent<v8::Object> handle;
++  static const uint32_t kCallbackIndex = 0;
++};
++
++/* abstract */ class NanAsyncWorker {
++ public:
++  explicit NanAsyncWorker(NanCallback *callback)
++      : callback(callback), errmsg_(NULL) {
++    request.data = this;
++
++    NanScope();
++    v8::Local<v8::Object> obj = NanNew<v8::Object>();
++    NanAssignPersistent(persistentHandle, obj);
++  }
++
++  virtual ~NanAsyncWorker() {
++    NanScope();
++
++    if (!persistentHandle.IsEmpty())
++      NanDisposePersistent(persistentHandle);
++    if (callback)
++      delete callback;
++    if (errmsg_)
++      delete[] errmsg_;
++  }
++
++  virtual void WorkComplete() {
++    NanScope();
++
++    if (errmsg_ == NULL)
++      HandleOKCallback();
++    else
++      HandleErrorCallback();
++    delete callback;
++    callback = NULL;
++  }
++
++  NAN_INLINE void SaveToPersistent(
++      const char *key, const v8::Local<v8::Object> &obj) {
++    v8::Local<v8::Object> handle = NanNew(persistentHandle);
++    handle->Set(NanNew<v8::String>(key), obj);
++  }
++
++  v8::Local<v8::Object> GetFromPersistent(const char *key) const {
++    NanEscapableScope();
++    v8::Local<v8::Object> handle = NanNew(persistentHandle);
++    return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
++  }
++
++  virtual void Execute() = 0;
++
++  uv_work_t request;
++
++ protected:
++  v8::Persistent<v8::Object> persistentHandle;
++  NanCallback *callback;
++
++  virtual void HandleOKCallback() {
++    NanScope();
++
++    callback->Call(0, NULL);
++  }
++
++  virtual void HandleErrorCallback() {
++    NanScope();
++
++    v8::Local<v8::Value> argv[] = {
++        v8::Exception::Error(NanNew<v8::String>(ErrorMessage()))
++    };
++    callback->Call(1, argv);
++  }
++
++  void SetErrorMessage(const char *msg) {
++    if (errmsg_) {
++      delete[] errmsg_;
++    }
++
++    size_t size = strlen(msg) + 1;
++    errmsg_ = new char[size];
++    memcpy(errmsg_, msg, size);
++  }
++
++  const char* ErrorMessage() const {
++    return errmsg_;
++  }
++
++ private:
++  char *errmsg_;
++};
++
++NAN_INLINE void NanAsyncExecute (uv_work_t* req) {
++  NanAsyncWorker *worker = static_cast<NanAsyncWorker*>(req->data);
++  worker->Execute();
++}
++
++NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) {
++  NanAsyncWorker* worker = static_cast<NanAsyncWorker*>(req->data);
++  worker->WorkComplete();
++  delete worker;
++}
++
++NAN_INLINE void NanAsyncQueueWorker (NanAsyncWorker* worker) {
++  uv_queue_work(
++      uv_default_loop()
++    , &worker->request
++    , NanAsyncExecute
++    , (uv_after_work_cb)NanAsyncExecuteComplete
++  );
++}
++
++//// Base 64 ////
++
++#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
++
++// Doesn't check for padding at the end.  Can be 1-2 bytes over.
++NAN_INLINE size_t _nan_base64_decoded_size_fast(size_t size) {
++  size_t remainder = size % 4;
++
++  size = (size / 4) * 3;
++  if (remainder) {
++    if (size == 0 && remainder == 1) {
++      // special case: 1-byte input cannot be decoded
++      size = 0;
++    } else {
++      // non-padded input, add 1 or 2 extra bytes
++      size += 1 + (remainder == 3);
++    }
++  }
++
++  return size;
++}
++
++template<typename T>
++NAN_INLINE size_t _nan_base64_decoded_size(
++    const T* src
++  , size_t size
++) {
++  if (size == 0)
++    return 0;
++
++  if (src[size - 1] == '=')
++    size--;
++  if (size > 0 && src[size - 1] == '=')
++    size--;
++
++  return _nan_base64_decoded_size_fast(size);
++}
++
++// supports regular and URL-safe base64
++static const int _nan_unbase64_table[] = {
++    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63
++  , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1
++  , -1,  0,  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, -1, -1, -1, -1, 63
++  , -1, 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, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++  , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
++};
++
++#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)]
++
++template<typename T> static size_t _nan_base64_decode(
++    char* buf
++  , size_t len
++  , const T* src
++  , const size_t srcLen
++) {
++  char* dst = buf;
++  char* dstEnd = buf + len;
++  const T* srcEnd = src + srcLen;
++
++  while (src < srcEnd && dst < dstEnd) {
++    ptrdiff_t remaining = srcEnd - src;
++    char a, b, c, d;
++
++    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
++    if (remaining == 0 || *src == '=') break;
++    a = _nan_unbase64(*src++);
++
++    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
++    if (remaining <= 1 || *src == '=') break;
++    b = _nan_unbase64(*src++);
++
++    *dst++ = (a << 2) | ((b & 0x30) >> 4);
++    if (dst == dstEnd) break;
++
++    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
++    if (remaining <= 2 || *src == '=') break;
++    c = _nan_unbase64(*src++);
++
++    *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
++    if (dst == dstEnd) break;
++
++    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
++    if (remaining <= 3 || *src == '=') break;
++    d = _nan_unbase64(*src++);
++
++    *dst++ = ((c & 0x03) << 6) | (d & 0x3F);
++  }
++
++  return dst - buf;
++}
++
++//// HEX ////
++
++template<typename T> unsigned _nan_hex2bin(T c) {
++  if (c >= '0' && c <= '9') return c - '0';
++  if (c >= 'A' && c <= 'F') return 10 + (c - 'A');
++  if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
++  return static_cast<unsigned>(-1);
++}
++
++template<typename T> static size_t _nan_hex_decode(
++    char* buf
++  , size_t len
++  , const T* src
++  , const size_t srcLen
++) {
++  size_t i;
++  for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) {
++    unsigned a = _nan_hex2bin(src[i * 2 + 0]);
++    unsigned b = _nan_hex2bin(src[i * 2 + 1]);
++    if (!~a || !~b) return i;
++    buf[i] = a * 16 + b;
++  }
++
++  return i;
++}
++
++static bool _NanGetExternalParts(
++    v8::Handle<v8::Value> val
++  , const char** data
++  , size_t* len
++) {
++  if (node::Buffer::HasInstance(val)) {
++    *data = node::Buffer::Data(val.As<v8::Object>());
++    *len = node::Buffer::Length(val.As<v8::Object>());
++    return true;
++  }
++
++  assert(val->IsString());
++  v8::Local<v8::String> str = NanNew(val.As<v8::String>());
++
++  if (str->IsExternalAscii()) {
++    const v8::String::ExternalAsciiStringResource* ext;
++    ext = str->GetExternalAsciiStringResource();
++    *data = ext->data();
++    *len = ext->length();
++    return true;
++
++  } else if (str->IsExternal()) {
++    const v8::String::ExternalStringResource* ext;
++    ext = str->GetExternalStringResource();
++    *data = reinterpret_cast<const char*>(ext->data());
++    *len = ext->length();
++    return true;
++  }
++
++  return false;
++}
++
++namespace Nan {
++  enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
++}
++
++/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString(
++    v8::Handle<v8::Value> from
++  , enum Nan::Encoding encoding
++  , size_t *datalen
++  , void *buf
++  , size_t buflen
++  , int flags
++) {
++  NanScope();
++
++  size_t sz_;
++  size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION);
++  char *data = NULL;
++  size_t len;
++  bool is_extern = _NanGetExternalParts(
++      from
++    , const_cast<const char**>(&data)
++    , &len);
++
++  if (is_extern && !term_len) {
++    NanSetPointerSafe(datalen, len);
++    return data;
++  }
++
++  v8::Local<v8::String> toStr = from->ToString();
++
++  char *to = static_cast<char *>(buf);
++
++  switch (encoding) {
++    case Nan::ASCII:
++#if NODE_MODULE_VERSION < 0x000C
++      sz_ = toStr->Length();
++      if (to == NULL) {
++        to = new char[sz_ + term_len];
++      } else {
++        assert(buflen >= sz_ + term_len && "too small buffer");
++      }
++      NanSetPointerSafe<size_t>(
++          datalen
++        , toStr->WriteAscii(to, 0, static_cast<int>(sz_ + term_len), flags));
++      return to;
++#endif
++    case Nan::BINARY:
++    case Nan::BUFFER:
++      sz_ = toStr->Length();
++      if (to == NULL) {
++        to = new char[sz_ + term_len];
++      } else {
++        assert(buflen >= sz_ + term_len && "too small buffer");
++      }
++#if NODE_MODULE_VERSION < 0x000C
++      {
++        uint16_t* twobytebuf = new uint16_t[sz_ + term_len];
++
++        size_t len = toStr->Write(twobytebuf, 0,
++          static_cast<int>(sz_ + term_len), flags);
++
++        for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) {
++          unsigned char *b = reinterpret_cast<unsigned char*>(&twobytebuf[i]);
++          to[i] = *b;
++        }
++
++        NanSetPointerSafe<size_t>(datalen, len);
++
++        delete[] twobytebuf;
++        return to;
++      }
++#else
++      NanSetPointerSafe<size_t>(
++        datalen,
++        toStr->WriteOneByte(
++            reinterpret_cast<uint8_t *>(to)
++          , 0
++          , static_cast<int>(sz_ + term_len)
++          , flags));
++      return to;
++#endif
++    case Nan::UTF8:
++      sz_ = toStr->Utf8Length();
++      if (to == NULL) {
++        to = new char[sz_ + term_len];
++      } else {
++        assert(buflen >= sz_ + term_len && "too small buffer");
++      }
++      NanSetPointerSafe<size_t>(
++          datalen
++        , toStr->WriteUtf8(to, static_cast<int>(sz_ + term_len)
++            , NULL, flags)
++          - term_len);
++      return to;
++    case Nan::BASE64:
++      {
++        v8::String::Value value(toStr);
++        sz_ = _nan_base64_decoded_size(*value, value.length());
++        if (to == NULL) {
++          to = new char[sz_ + term_len];
++        } else {
++          assert(buflen >= sz_ + term_len);
++        }
++        NanSetPointerSafe<size_t>(
++            datalen
++          , _nan_base64_decode(to, sz_, *value, value.length()));
++        if (term_len) {
++          to[sz_] = '\0';
++        }
++        return to;
++      }
++    case Nan::UCS2:
++      {
++        sz_ = toStr->Length();
++        if (to == NULL) {
++          to = new char[(sz_ + term_len) * 2];
++        } else {
++          assert(buflen >= (sz_ + term_len) * 2 && "too small buffer");
++        }
++
++        int bc = 2 * toStr->Write(
++            reinterpret_cast<uint16_t *>(to)
++          , 0
++          , static_cast<int>(sz_ + term_len)
++          , flags);
++        NanSetPointerSafe<size_t>(datalen, bc);
++        return to;
++      }
++    case Nan::HEX:
++      {
++        v8::String::Value value(toStr);
++        sz_ = value.length();
++        assert(!(sz_ & 1) && "bad hex data");
++        if (to == NULL) {
++          to = new char[sz_ / 2 + term_len];
++        } else {
++          assert(buflen >= sz_ / 2 + term_len && "too small buffer");
++        }
++        NanSetPointerSafe<size_t>(
++            datalen
++          , _nan_hex_decode(to, sz_ / 2, *value, value.length()));
++      }
++      if (term_len) {
++        to[sz_ / 2] = '\0';
++      }
++      return to;
++    default:
++      assert(0 && "unknown encoding");
++  }
++  return to;
++}
++
++NAN_DEPRECATED NAN_INLINE void* NanRawString(
++    v8::Handle<v8::Value> from
++  , enum Nan::Encoding encoding
++  , size_t *datalen
++  , void *buf
++  , size_t buflen
++  , int flags
++) {
++  return _NanRawString(from, encoding, datalen, buf, buflen, flags);
++}
++
++
++NAN_DEPRECATED NAN_INLINE char* NanCString(
++    v8::Handle<v8::Value> from
++  , size_t *datalen
++  , char *buf = NULL
++  , size_t buflen = 0
++  , int flags = v8::String::NO_OPTIONS
++) {
++    return static_cast<char *>(
++      _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags)
++    );
++}
++
++NAN_INLINE void NanSetPrototypeTemplate(
++    v8::Local<v8::FunctionTemplate> templ
++  , const char *name
++  , v8::Handle<v8::Data> value
++) {
++  NanSetTemplate(templ->PrototypeTemplate(), name, value);
++}
++
++NAN_INLINE void NanSetPrototypeTemplate(
++    v8::Local<v8::FunctionTemplate> templ
++  , v8::Handle<v8::String> name
++  , v8::Handle<v8::Data> value
++  , v8::PropertyAttribute attributes
++) {
++  NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes);
++}
++
++NAN_INLINE void NanSetInstanceTemplate(
++    v8::Local<v8::FunctionTemplate> templ
++  , const char *name
++  , v8::Handle<v8::Data> value
++) {
++  NanSetTemplate(templ->InstanceTemplate(), name, value);
++}
++
++NAN_INLINE void NanSetInstanceTemplate(
++    v8::Local<v8::FunctionTemplate> templ
++  , v8::Handle<v8::String> name
++  , v8::Handle<v8::Data> value
++  , v8::PropertyAttribute attributes
++) {
++  NanSetTemplate(templ->InstanceTemplate(), name, value, attributes);
++}
++
++#endif  // NAN_H_
diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile
new file mode 100644 (file)
index 0000000..ad4b7af
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2014 Arduino LLC
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NPM_NAME:=serialport
+PKG_NAME:=node-$(PKG_NPM_NAME)
+PKG_VERSION:=1.4.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
+PKG_MD5SUM:=1eb21082e0aa676b8350182a60230808
+
+PKG_BUILD_DEPENDS:=node
+PKG_NODE_VERSION:=0.12.7
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=Custom
+PKG_LICENSE_FILE:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node-serialport
+  DEPENDS:=+node
+  SUBMENU:=Node.js
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Node.js package to access serial ports for reading and writing
+  URL:=https://www.npmjs.org/package/serialport
+endef
+
+define Package/node-serialport/description
+ Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
+endef
+
+define Build/Prepare
+       /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
+       $(Build/Patch)
+endef
+
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
+
+define Build/Compile
+       $(MAKE_FLAGS) \
+       npm_config_arch=$(CONFIG_ARCH) \
+       npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
+       PREFIX="$(PKG_INSTALL_DIR)/usr/" \
+       $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
+endef
+
+define Package/node-serialport/install
+       mkdir -p $(1)/usr/lib/node/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
+endef
+
+$(eval $(call BuildPackage,node-serialport))
+
diff --git a/lang/node-serialport/patches/package.json.patch b/lang/node-serialport/patches/package.json.patch
new file mode 100644 (file)
index 0000000..a20c6a5
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/package.json     2014-05-02 12:02:02.940515727 +0200
++++ b/package.json     2014-05-02 12:03:08.488512762 +0200
+@@ -69,7 +71,7 @@
+     "serialportterm": "./bin/serialportTerminal.js"
+   },
+   "scripts": {
+-    "install": "node-pre-gyp install --fallback-to-build",
++    "install": "node-pre-gyp reinstall --build-from-source --target_arch=${npm_config_arch}",
+     "test": "grunt --verbose"
+   }
+ }
diff --git a/lang/node/Makefile b/lang/node/Makefile
new file mode 100644 (file)
index 0000000..74eb44e
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=node
+PKG_VERSION:=v0.12.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=node-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
+
+PKG_BUILD_DEPENDS:=python/host
+PKG_INSTALL:=1
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Node.js
+  TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
+  URL:=http://nodejs.org/
+  DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv
+endef
+
+define Package/node/description
+  Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
+  an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
+   package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
+endef
+
+CONFIGURE_ARGS= \
+       --dest-cpu=$(CONFIG_ARCH) \
+       --dest-os=linux \
+       --without-snapshot \
+       --shared-zlib \
+       --shared-openssl \
+       --prefix=/usr
+
+HOST_CONFIGURE_VARS:=
+HOST_CONFIGURE_ARGS:= \
+       --dest-os=linux \
+       --without-snapshot \
+       --prefix=$(STAGING_DIR_HOST)/
+
+HOST_CONFIGURE_CMD:=python ./configure
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+endef
+
+define Package/node/install
+       mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,node))
diff --git a/lang/node/patches/001-mips-no-fpu.patch b/lang/node/patches/001-mips-no-fpu.patch
new file mode 100644 (file)
index 0000000..5bf8142
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/deps/v8/build/toolchain.gypi
++++ b/deps/v8/build/toolchain.gypi
+@@ -50,10 +50,10 @@
+     'arm_test_noprobe%': 'off',
+     # Similar to vfp but on MIPS.
+-    'v8_can_use_fpu_instructions%': 'true',
++    'v8_can_use_fpu_instructions%': 'false',
+     # Similar to the ARM hard float ABI but on MIPS.
+-    'v8_use_mips_abi_hardfloat%': 'true',
++    'v8_use_mips_abi_hardfloat%': 'false',
+     # Default arch variant for MIPS.
+     'mips_arch_variant%': 'r2',
diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch
new file mode 100644 (file)
index 0000000..78225db
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/deps/uv/src/unix/getaddrinfo.c
++++ b/deps/uv/src/unix/getaddrinfo.c
+@@ -99,6 +99,7 @@
+   int err;
+   req = container_of(w, uv_getaddrinfo_t, work_req);
++   req->hints->ai_flags &= ~AI_V4MAPPED;
+   err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo);
+   req->retcode = uv__getaddrinfo_translate_error(err);
+ }
diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch
new file mode 100644 (file)
index 0000000..723fe9d
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/lib/module.js
++++ b/lib/module.js
+@@ -512,7 +512,8 @@
+     var homeDir = process.env.HOME;
+   }
+-  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
++  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node'),
++    path.resolve(process.execPath, '..', '..', 'lib', 'node_modules')];
+   if (homeDir) {
+     paths.unshift(path.resolve(homeDir, '.node_libraries'));
index 89ec2deb7e680971c37d671cb573ac9cd0fa5255..bbeff7b799e7c29da770dfa27e9d7be7d90a6bc6 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-parse-recdescent
-PKG_VERSION:=1.967009
+PKG_VERSION:=1.967013
 PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JT/JTBRAUN
 PKG_SOURCE:=Parse-RecDescent-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=6dab60d44451a9f57a261d1b5358753c
+PKG_MD5SUM:=98f582240556a4a92e5d57e480f9d39d
 
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
index 6c302b9ef85cdd9e339f513e14fb0d52679a5a21..cd6989a49f32d5cb3aa9ce63d9b92d55670015ab 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=php
-PKG_VERSION:=5.6.13
+PKG_VERSION:=5.6.14
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>, Michael Heimpold <mhei@heimpold.de>
@@ -18,7 +18,7 @@ PKG_LICENSE_FILES:=LICENSE
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.php.net/distributions/
-PKG_MD5SUM:=64d9a82068e3b0bbb16c261261391172
+PKG_MD5SUM:=2e1332123a7e19d15ed2af2d1d6bd6fd
 
 PKG_FIXUP:=libtool autoreconf
 PKG_BUILD_PARALLEL:=1
index 80b9768bb737e542a5980b8bce49c1606869cc1f..d8500e6382d2a63ef27b5be47b5b48ef53879b8d 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=glib2
-PKG_VERSION:=2.43.4
+PKG_VERSION:=2.44.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=glib-$(PKG_VERSION).tar.xz
 PKG_BUILD_DIR:=$(BUILD_DIR)/glib-$(PKG_VERSION)
-PKG_SOURCE_URL:=@GNOME/glib/2.43
-PKG_MD5SUM:=2f28879252c660a65aa3139ec499776b
+PKG_SOURCE_URL:=@GNOME/glib/2.44
+PKG_MD5SUM:=83efba4722a9674b97437d1d99af79db
 
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
index 8f8ce37abd26b5c710d59ca5516a0ba25f249bcd..602d3f15c51450484dc723108284088e128bc245 100644 (file)
@@ -1,6 +1,6 @@
 --- a/gtk-doc.make
 +++ b/gtk-doc.make
-@@ -267,7 +267,7 @@ uninstall-local:
+@@ -271,7 +271,7 @@ uninstall-local:
  #
  # Require gtk-doc when making dist
  #
index b88859b1f2f736556da5be29d2e95f44470ba860..3ce57fcfc534cd582a619c6d72ae536dc4e8478e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/gio/Makefile.am
 +++ b/gio/Makefile.am
-@@ -700,6 +700,7 @@ bin_PROGRAMS = gio-querymodules glib-com
+@@ -707,6 +707,7 @@ bin_PROGRAMS = gio-querymodules glib-com
  
  glib_compile_resources_LDADD = libgio-2.0.la          \
        $(top_builddir)/gobject/libgobject-2.0.la       \
index b6cd2de410d11eeb3ec94adcabfe9cfcc21d6478..8dbf7217c0c5ed333ad901b9c83b0a62a5d23e78 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnutls
-PKG_VERSION:=3.4.5
+PKG_VERSION:=3.4.6
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4
-PKG_MD5SUM:=f5dae0e0ecda28aab12386e6c0705d4c
+PKG_MD5SUM:=4f2c4b4483da65de7edfeb050911fafb
 #PKG_FIXUP:=autoreconf gettext-version
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
 PKG_LICENSE:=LGPLv2.1+
index 41d553599a63a915423280a476048e1d6e7f3a7f..8e6ef5d250324b5d42ddfcb44f2f23be00e31622 100644 (file)
@@ -42,6 +42,10 @@ CONFIGURE_ARGS += \
        --disable-examples \
        --disable-documentation
 
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+TARGET_CFLAGS += -DWORDS_BIGENDIAN
+endif
+
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
index 557b31e205f07675fb57e37a5a4dddac2dc99ab5..522eb0649ce5dd156e2137d08e9b97fb1fea0c48 100644 (file)
@@ -10,7 +10,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libdmapsharing
-PKG_VERSION:=2.9.30
+PKG_VERSION:=2.9.32
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
@@ -20,7 +20,7 @@ PKG_LICENSE_FILES:=COPYING
 
 PKG_SOURCE:=libdmapsharing-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.flyn.org/projects/libdmapsharing/
-PKG_MD5SUM:=25de55d128d432d82f2a1ec010d7069a
+PKG_MD5SUM:=b0bb27525c92233bd76e5f7b7b6cfe6d
 
 PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
diff --git a/libs/libgee/Makefile b/libs/libgee/Makefile
new file mode 100644 (file)
index 0000000..87705e3
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2009-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libgee
+PKG_VERSION:=0.18.0
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_LICENSE:=LGPL-2.1 
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://download.gnome.org/sources/libgee/0.18/
+PKG_MD5SUM:=29ea6125e653d7e60b49a9a9544abc96
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libgee
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+glib2
+  TITLE:=libgee
+  URL:=https://wiki.gnome.org/Libgee
+endef
+
+define Package/libgee/decription
+  Libgee is an utility library providing GObject-based interfaces and classes
+endef
+
+CONFIGURE_ARGS += \
+       --disable-doc
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/gee-0.8/ \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libgee/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgee))
diff --git a/libs/libgee/patches/libgee-0.18.0-no-introspection.patch b/libs/libgee/patches/libgee-0.18.0-no-introspection.patch
new file mode 100644 (file)
index 0000000..caa6e16
--- /dev/null
@@ -0,0 +1,101 @@
+diff -u --recursive libgee-0.18.0-vanilla/configure.ac libgee-0.18.0/configure.ac
+--- libgee-0.18.0-vanilla/configure.ac 2015-03-23 23:24:39.000000000 -0400
++++ libgee-0.18.0/configure.ac 2015-10-18 07:25:39.474698663 -0400
+@@ -64,10 +64,6 @@
+               enable_consistency_check=$enableval, enable_consistency_check=no)
+ AS_IF([test "x$enable_consistency_check" != xno], [VALA_ADD_VALAFLAGS(-D CONSISTENCY_CHECKS)])
+-GOBJECT_INTROSPECTION_CHECK([0.9.0])
+-
+-VALA_CHECK([0.25.1])
+-
+ AC_OUTPUT([Makefile
+            gee-0.8.pc
+            benchmark/Makefile
+diff -u --recursive libgee-0.18.0-vanilla/gee/Makefile.am libgee-0.18.0/gee/Makefile.am
+--- libgee-0.18.0-vanilla/gee/Makefile.am      2015-03-16 11:23:57.000000000 -0400
++++ libgee-0.18.0/gee/Makefile.am      2015-10-18 10:41:49.759314756 -0400
+@@ -146,29 +146,6 @@
+       gee-0.8.vapi \
+       $(NULL)
+-if HAVE_INTROSPECTION
+-girdir = @INTROSPECTION_GIRDIR@
+-
+-dist_gir_DATA = \
+-      Gee-0.8.gir \
+-      $(NULL)
+-
+-typelibdir = @INTROSPECTION_TYPELIBDIR@
+-typelib_DATA = \
+-      Gee-0.8.typelib \
+-      $(NULL)
+-
+-# Extract dlname from libfolks.la; see bug #658002.
+-# This is what g-ir-scanner does.
+-libgee_dlname = \
+-      `$(SED) -nE "s/^dlname='([A-Za-z0-9.+-]+)'/\1/p" libgee-0.8.la`
+-INTROSPECTION_COMPILER_ARGS= \
+-      -l $(libgee_dlname)
+-Gee-0.8.gir: libgee_0_8_la_vala.stamp
+-Gee-0.8.typelib: Gee-0.8.gir libgee-0.8.la
+-      @INTROSPECTION_COMPILER@ $(INTROSPECTION_COMPILER_ARGS) -o $@ $^
+-endif
+-
+ MOSTLYCLEANFILES = \
+       $(libgee_0_8_la_VALASOURCES:.vala=.c) \
+       libgee_0_8_la_vala.stamp \
+diff -u --recursive libgee-0.18.0-vanilla/gee/Makefile.in libgee-0.18.0/gee/Makefile.in
+--- libgee-0.18.0-vanilla/gee/Makefile.in      2015-03-23 23:25:03.000000000 -0400
++++ libgee-0.18.0/gee/Makefile.in      2015-10-18 11:02:34.888709559 -0400
+@@ -285,14 +285,6 @@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+-INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+-INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+-INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+-INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+-INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+-INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
+-INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+-INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
+ LCOV = @LCOV@
+ LD = @LD@
+ LDFLAGS = @LDFLAGS@
+@@ -531,25 +523,6 @@
+       gee-0.8.vapi \
+       $(NULL)
+-@HAVE_INTROSPECTION_TRUE@girdir = @INTROSPECTION_GIRDIR@
+-@HAVE_INTROSPECTION_TRUE@dist_gir_DATA = \
+-@HAVE_INTROSPECTION_TRUE@     Gee-0.8.gir \
+-@HAVE_INTROSPECTION_TRUE@     $(NULL)
+-
+-@HAVE_INTROSPECTION_TRUE@typelibdir = @INTROSPECTION_TYPELIBDIR@
+-@HAVE_INTROSPECTION_TRUE@typelib_DATA = \
+-@HAVE_INTROSPECTION_TRUE@     Gee-0.8.typelib \
+-@HAVE_INTROSPECTION_TRUE@     $(NULL)
+-
+-
+-# Extract dlname from libfolks.la; see bug #658002.
+-# This is what g-ir-scanner does.
+-@HAVE_INTROSPECTION_TRUE@libgee_dlname = \
+-@HAVE_INTROSPECTION_TRUE@     `$(SED) -nE "s/^dlname='([A-Za-z0-9.+-]+)'/\1/p" libgee-0.8.la`
+-
+-@HAVE_INTROSPECTION_TRUE@INTROSPECTION_COMPILER_ARGS = \
+-@HAVE_INTROSPECTION_TRUE@     -l $(libgee_dlname)
+-
+ MOSTLYCLEANFILES = \
+       $(libgee_0_8_la_VALASOURCES:.vala=.c) \
+       libgee_0_8_la_vala.stamp \
+@@ -1607,9 +1580,6 @@
+ $(libgee_0_8_la_VALASOURCES:.vala=.c): libgee_0_8_la_vala.stamp
+ gee-0.8.vapi gee-internals-0.8.vapi gee.h gee-internals.h: libgee_0_8_la_vala.stamp
+-@HAVE_INTROSPECTION_TRUE@Gee-0.8.gir: libgee_0_8_la_vala.stamp
+-@HAVE_INTROSPECTION_TRUE@Gee-0.8.typelib: Gee-0.8.gir libgee-0.8.la
+-@HAVE_INTROSPECTION_TRUE@     @INTROSPECTION_COMPILER@ $(INTROSPECTION_COMPILER_ARGS) -o $@ $^
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libs/libmraa/Makefile b/libs/libmraa/Makefile
new file mode 100644 (file)
index 0000000..3e3202a
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libmraa
+PKG_VERSION:=0.8.0
+
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/intel-iot-devkit/mraa.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=70600dece4138b0c0dbaff42f57828f1559cd840
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_BUILD_DEPENDS:=node python/host swig/host node/host
+CMAKE_INSTALL:=1
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=LGPL-2.1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_OPTIONS=-DBUILDARCH=$(CONFIG_ARCH) \
+       -DENABLEEXAMPLES=0 \
+       -DNODE_EXECUTABLE=$(STAGING_DIR_HOST)/bin/node \
+       -DSWIG_DIR=$(STAGING_DIR_HOST)/bin
+
+TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include/node
+
+define Package/libmraa
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+python +libstdcpp
+  TITLE:=Intel IoT lowlevel IO library
+endef
+
+define Package/libmraa/install
+       $(INSTALL_DIR) $(1)/usr/lib/{node/mraa,python2.7/site-packages} $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libmraa.so* $(1)/usr/lib/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/node_modules/mraa/* $(1)/usr/lib/node/mraa/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/* $(1)/usr/lib/python2.7/site-packages/
+#      $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mraa/examples/python/blink-io8.py $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libmraa))
diff --git a/libs/libmraa/patches/0001-base.patch b/libs/libmraa/patches/0001-base.patch
new file mode 100644 (file)
index 0000000..5094389
--- /dev/null
@@ -0,0 +1,118 @@
+From 6fecad819376442d057bdd35a0909cfac9df02f5 Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Thu, 23 Jul 2015 12:18:39 +0200
+Subject: [PATCH 1/4] base
+
+---
+ CMakeLists.txt          |   10 ++++------
+ api/mraa/types.h        |    1 +
+ include/mraa_internal.h |    7 +++++++
+ src/CMakeLists.txt      |    5 +++++
+ src/i2c/i2c.c           |    2 +-
+ src/mraa.c              |    3 +++
+ src/uart/uart.c         |    1 +
+ 7 files changed, 22 insertions(+), 7 deletions(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,12 +14,7 @@
+ set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
+ # Make a version file containing the current version from git.
+-include (GetGitRevisionDescription)
+-git_describe (VERSION "--tags")
+-if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND")
+-  message (WARNING " - Install git to compile a production libmraa!")
+-  set (VERSION "v0.8.0-dirty")
+-endif ()
++set (VERSION "v0.8.0")
+ message (INFO " - libmraa Version ${VERSION}")
+@@ -84,8 +79,10 @@
+   set (X86PLAT ON)
+ elseif (DETECTED_ARCH MATCHES "arm.*")
+   set (ARMPLAT ON)
++elseif (DETECTED_ARCH MATCHES "mips")
++  set (MIPSPLAT ON)
+ else ()
+-  message(FATAL_ERROR "Only x86 and arm platforms currently supported")
++  message(FATAL_ERROR "Only x86, arm and mips platforms currently supported")
+ endif()
+ if (BUILDSWIGPYTHON)
+--- a/api/mraa/types.h
++++ b/api/mraa/types.h
+@@ -46,6 +46,7 @@
+     MRAA_BEAGLEBONE = 6,            /**< The different BeagleBone Black Modes B/C */
+     MRAA_BANANA = 7,                /**< Allwinner A20 based Banana Pi and Banana Pro */
+     MRAA_INTEL_NUC5 = 8,            /**< The Intel 5th generations Broadwell NUCs */
++    MRAA_MTK_LINKIT = 9,            /**< Mediatek MT7688 based Linkit (Air) */
+     // USB platform extenders start at 256
+     MRAA_FTDI_FT4222 = 256,         /**< FTDI FT4222 USB to i2c bridge */
+--- a/include/mraa_internal.h
++++ b/include/mraa_internal.h
+@@ -66,6 +66,13 @@
+ mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);
+ /**
++ * runtime detect running arm platforms
++ *
++ * @return mraa_platform_t of the init'ed platform
++ */
++mraa_platform_t mraa_mips_platform();
++
++/**
+  * helper function to check if file exists
+  *
+  * @param filename to check
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -71,6 +71,11 @@
+   add_subdirectory(usb)
+ endif ()
++if (MIPSPLAT)
++  add_subdirectory(mips)
++  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMIPSPLAT=1")
++endif()
++
+ set (mraa_LIB_SRCS
+   ${mraa_LIB_PLAT_SRCS_NOAUTO}
+ # autogenerated version file
+--- a/src/i2c/i2c.c
++++ b/src/i2c/i2c.c
+@@ -31,9 +31,9 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <errno.h>
+ #include <inttypes.h>
+ #include <sys/types.h>
+-#include <sys/errno.h>
+ #include <sys/ioctl.h>
+ #include "linux/i2c-dev.h"
+--- a/src/mraa.c
++++ b/src/mraa.c
+@@ -111,6 +111,9 @@
+ #elif defined(ARMPLAT)
+     // Use runtime ARM platform detection
+     platform_type = mraa_arm_platform();
++#elif MIPSPLAT
++    // Use runtime ARM platform detection
++    platform_type = mraa_mips_platform();
+ #else
+ #error mraa_ARCH NOTHING
+ #endif
+--- a/src/uart/uart.c
++++ b/src/uart/uart.c
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ #include <sys/stat.h>
++#include <sys/time.h>
+ #include <unistd.h>
+ #include <string.h>
+ #include <termios.h>
diff --git a/libs/libmraa/patches/0002-add-mips-support.patch b/libs/libmraa/patches/0002-add-mips-support.patch
new file mode 100644 (file)
index 0000000..66219b9
--- /dev/null
@@ -0,0 +1,483 @@
+From 2c67c6f51ce5bab18c79f4304ccf42716f59f13c Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Thu, 23 Jul 2015 13:21:25 +0200
+Subject: [PATCH 2/4] add mips support
+
+Signed-off-by: John Crispin <blogic@openwrt.org>
+---
+ include/mips/mediatek.h |   39 ++++++
+ src/mips/CMakeLists.txt |    6 +
+ src/mips/mediatek.c     |  349 +++++++++++++++++++++++++++++++++++++++++++++++
+ src/mips/mips.c         |   60 ++++++++
+ 4 files changed, 454 insertions(+)
+ create mode 100644 include/mips/mediatek.h
+ create mode 100644 src/mips/CMakeLists.txt
+ create mode 100644 src/mips/mediatek.c
+ create mode 100644 src/mips/mips.c
+
+--- /dev/null
++++ b/include/mips/mediatek.h
+@@ -0,0 +1,39 @@
++/*
++ * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
++ * Author: Michael Ring <mail@michael-ring.org>
++ * Copyright (c) 2014 Intel Corporation.
++ *
++ * 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.
++ */
++
++#pragma once
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#include "mraa_internal.h"
++
++mraa_board_t *
++        mraa_mtk_linkit();
++
++#ifdef __cplusplus
++}
++#endif
+--- /dev/null
++++ b/src/mips/CMakeLists.txt
+@@ -0,0 +1,6 @@
++message (INFO " - Adding MIPS platforms")
++set (mraa_LIB_PLAT_SRCS_NOAUTO ${mraa_LIB_SRCS_NOAUTO}
++  ${PROJECT_SOURCE_DIR}/src/mips/mips.c
++  ${PROJECT_SOURCE_DIR}/src/mips/mediatek.c
++  PARENT_SCOPE
++)
+--- /dev/null
++++ b/src/mips/mediatek.c
+@@ -0,0 +1,349 @@
++/*
++ * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
++ * Author: Michael Ring <mail@michael-ring.org>
++ * Copyright (c) 2014 Intel Corporation.
++ *
++ * 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.
++ */
++
++#include <stdio.h>
++#include <stdint.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <mraa/common.h>
++
++#include "mraa_internal.h"
++
++#include "common.h"
++
++#define PLATFORM_MEDIATEK_LINKIT      1
++#define PLATFORM_MEDIATEK_LINKIT_AIR  2
++#define MMAP_PATH                     "/dev/mem"
++#define MT7628_GPIO_BASE              0x100
++#define MT7628_BLOCK_SIZE             (4 * 1024)
++#define MT7628_GPIO_CTRL              0x00
++#define MT7628_GPIO_DATA              0x20
++#define MT7628_GPIO_SET                       0x30
++#define MT7628_GPIO_CLEAR             0x40
++
++#define MAX_SIZE 64
++
++// MMAP
++static uint8_t* mmap_reg = NULL;
++static int mmap_fd = 0;
++static int mmap_size;
++static unsigned int mmap_count = 0;
++static int platform_detected = 0;
++
++mraa_result_t
++mraa_mtk_linkit_mmap_write(mraa_gpio_context dev, int value)
++{
++    volatile uint32_t* addr;
++    if (value) {
++        *(volatile uint32_t*) (mmap_reg + MT7628_GPIO_SET + (dev->pin / 32) * 4) =
++        (uint32_t)(1 << (dev->pin % 32));
++    } else {
++        *(volatile uint32_t*) (mmap_reg + MT7628_GPIO_CLEAR + (dev->pin / 32) * 4) =
++        (uint32_t)(1 << (dev->pin % 32));
++    }
++    return MRAA_SUCCESS;
++}
++
++static mraa_result_t
++mraa_mtk_linkit_mmap_unsetup()
++{
++    if (mmap_reg == NULL) {
++        syslog(LOG_ERR, "linkit mmap: null register cant unsetup");
++        return MRAA_ERROR_INVALID_RESOURCE;
++    }
++    munmap(mmap_reg, mmap_size);
++    mmap_reg = NULL;
++    if (close(mmap_fd) != 0) {
++        return MRAA_ERROR_INVALID_RESOURCE;
++    }
++    return MRAA_SUCCESS;
++}
++
++int
++mraa_mtk_linkit_mmap_read(mraa_gpio_context dev)
++{
++    uint32_t value = *(volatile uint32_t*) (mmap_reg + MT7628_GPIO_DATA + (dev->pin / 32) * 4);
++    if (value & (uint32_t)(1 << (dev->pin % 32))) {
++        return 1;
++    }
++    return 0;
++}
++
++mraa_result_t
++mraa_mtk_linkit_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
++{
++    if (dev == NULL) {
++        syslog(LOG_ERR, "linkit mmap: context not valid");
++        return MRAA_ERROR_INVALID_HANDLE;
++    }
++
++    if (en == 0) {
++        if (dev->mmap_write == NULL && dev->mmap_read == NULL) {
++            syslog(LOG_ERR, "linkit mmap: can't disable disabled mmap gpio");
++            return MRAA_ERROR_INVALID_PARAMETER;
++        }
++        dev->mmap_write = NULL;
++        dev->mmap_read = NULL;
++        mmap_count--;
++        if (mmap_count == 0) {
++            return mraa_mtk_linkit_mmap_unsetup();
++        }
++        return MRAA_SUCCESS;
++    }
++
++    if (dev->mmap_write != NULL && dev->mmap_read != NULL) {
++        syslog(LOG_ERR, "linkit mmap: can't enable enabled mmap gpio");
++        return MRAA_ERROR_INVALID_PARAMETER;
++    }
++
++    // Might need to make some elements of this thread safe.
++    // For example only allow one thread to enter the following block
++    // to prevent mmap'ing twice.
++    if (mmap_reg == NULL) {
++        if ((mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
++            syslog(LOG_ERR, "linkit map: unable to open resource0 file");
++            return MRAA_ERROR_INVALID_HANDLE;
++        }
++
++        mmap_reg = (uint8_t*) mmap(NULL, MT7628_BLOCK_SIZE, PROT_READ | PROT_WRITE,
++                                       MAP_FILE | MAP_SHARED, mmap_fd, MT7628_GPIO_BASE);
++        if (mmap_reg == MAP_FAILED) {
++            syslog(LOG_ERR, "linkit mmap: failed to mmap");
++            mmap_reg = NULL;
++            close(mmap_fd);
++            return MRAA_ERROR_NO_RESOURCES;
++        }
++    }
++    dev->mmap_write = &mraa_mtk_linkit_mmap_write;
++    dev->mmap_read = &mraa_mtk_linkit_mmap_read;
++    mmap_count++;
++
++    return MRAA_SUCCESS;
++}
++
++mraa_board_t*
++mraa_mtk_linkit()
++{
++    mraa_board_t* b = (mraa_board_t*) malloc(sizeof(mraa_board_t));
++    if (b == NULL) {
++        return NULL;
++    }
++
++    b->platform_name = "LINKIT";
++    platform_detected = PLATFORM_MEDIATEK_LINKIT;
++    b->phy_pin_count = 31;
++
++    b->aio_count = 0;
++    b->adc_raw = 0;
++    b->adc_supported = 0;
++    b->pwm_default_period = 500;
++    b->pwm_max_period = 2147483;
++    b->pwm_min_period = 1;
++
++    b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * b->phy_pin_count);
++
++    advance_func->gpio_mmap_setup = &mraa_mtk_linkit_mmap_setup;
++
++    strncpy(b->pins[0].name, "P0", MRAA_PIN_NAME_SIZE);
++    b->pins[0].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[1].name, "P1", MRAA_PIN_NAME_SIZE);
++    b->pins[1].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[2].name, "P2", MRAA_PIN_NAME_SIZE);
++    b->pins[2].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[3].name, "P3", MRAA_PIN_NAME_SIZE);
++    b->pins[3].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[4].name, "P4", MRAA_PIN_NAME_SIZE);
++    b->pins[4].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[5].name, "P5", MRAA_PIN_NAME_SIZE);
++    b->pins[5].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[6].name, "P6", MRAA_PIN_NAME_SIZE);
++    b->pins[6].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[7].name, "P7", MRAA_PIN_NAME_SIZE);
++    b->pins[7].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[8].name, "P8", MRAA_PIN_NAME_SIZE);
++    b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[8].gpio.pinmap = 21;
++    b->pins[8].uart.parent_id = 2;
++    b->pins[8].uart.mux_total = 0;
++
++    strncpy(b->pins[9].name, "P9", MRAA_PIN_NAME_SIZE);
++    b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[9].gpio.pinmap = 20;
++    b->pins[9].uart.parent_id = 2;
++    b->pins[9].uart.mux_total = 0;
++
++    strncpy(b->pins[10].name, "P10", MRAA_PIN_NAME_SIZE);
++    b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[10].gpio.pinmap = 2;
++
++    strncpy(b->pins[11].name, "P11", MRAA_PIN_NAME_SIZE);
++    b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[11].gpio.pinmap = 3;
++
++    strncpy(b->pins[12].name, "P12", MRAA_PIN_NAME_SIZE);
++    b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[12].gpio.pinmap = 0;
++
++    strncpy(b->pins[13].name, "P13", MRAA_PIN_NAME_SIZE);
++    b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[13].gpio.pinmap = 1;
++
++    strncpy(b->pins[14].name, "P14", MRAA_PIN_NAME_SIZE);
++    b->pins[14].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++
++    strncpy(b->pins[15].name, "P15", MRAA_PIN_NAME_SIZE);
++    b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[15].gpio.pinmap = 44;
++
++    strncpy(b->pins[16].name, "P16", MRAA_PIN_NAME_SIZE);
++    b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[16].gpio.pinmap = 46;
++    b->pins[16].uart.parent_id = 1;
++    b->pins[16].uart.mux_total = 0;
++
++    strncpy(b->pins[17].name, "P17", MRAA_PIN_NAME_SIZE);
++    b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[17].gpio.pinmap = 45;
++    b->pins[17].uart.parent_id = 1;
++    b->pins[17].uart.mux_total = 0;
++
++    strncpy(b->pins[18].name, "P18", MRAA_PIN_NAME_SIZE);
++    b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[18].gpio.pinmap = 13;
++    b->pins[18].uart.parent_id = 1;
++    b->pins[18].uart.mux_total = 0;
++
++    strncpy(b->pins[19].name, "P19", MRAA_PIN_NAME_SIZE);
++    b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[19].gpio.pinmap = 12;
++    b->pins[19].uart.parent_id = 0;
++    b->pins[19].uart.mux_total = 0;
++
++    strncpy(b->pins[20].name, "P20", MRAA_PIN_NAME_SIZE);
++    b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
++    b->pins[20].gpio.pinmap = 5;
++    b->pins[20].i2c.pinmap = 0;
++    b->pins[20].i2c.mux_total = 0;
++
++    strncpy(b->pins[21].name, "P21", MRAA_PIN_NAME_SIZE);
++    b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
++    b->pins[21].gpio.pinmap = 4;
++    b->pins[21].i2c.pinmap = 0;
++    b->pins[21].i2c.mux_total = 0;
++
++    strncpy(b->pins[22].name, "P22", MRAA_PIN_NAME_SIZE);
++    b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
++    b->pins[22].gpio.pinmap = 8;
++    b->pins[22].spi.pinmap = 0;
++    b->pins[22].spi.mux_total = 0;
++
++    strncpy(b->pins[23].name, "P23", MRAA_PIN_NAME_SIZE);
++    b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
++    b->pins[23].gpio.pinmap = 9;
++    b->pins[23].spi.pinmap = 0;
++    b->pins[23].spi.mux_total = 0;
++
++    strncpy(b->pins[24].name, "P24", MRAA_PIN_NAME_SIZE);
++    b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
++    b->pins[24].gpio.pinmap = 7;
++    b->pins[24].spi.pinmap = 0;
++    b->pins[24].spi.mux_total = 0;
++
++    strncpy(b->pins[25].name, "P25", MRAA_PIN_NAME_SIZE);
++    b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
++    b->pins[25].gpio.pinmap = 6;
++    b->pins[25].spi.pinmap = 0;
++    b->pins[25].spi.mux_total = 0;
++
++    strncpy(b->pins[26].name, "P26", MRAA_PIN_NAME_SIZE);
++    b->pins[26].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
++    b->pins[26].gpio.pinmap = 18;
++
++    strncpy(b->pins[27].name, "P27", MRAA_PIN_NAME_SIZE);
++    b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
++    b->pins[27].gpio.pinmap = 19;
++
++    strncpy(b->pins[28].name, "P28", MRAA_PIN_NAME_SIZE);
++    b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[28].gpio.pinmap = 16;
++
++    strncpy(b->pins[29].name, "P29", MRAA_PIN_NAME_SIZE);
++    b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[29].gpio.pinmap = 17;
++
++    strncpy(b->pins[30].name, "P30", MRAA_PIN_NAME_SIZE);
++    b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[30].gpio.pinmap = 14;
++
++    strncpy(b->pins[31].name, "P31", MRAA_PIN_NAME_SIZE);
++    b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[31].gpio.pinmap = 15;
++
++    // BUS DEFINITIONS
++    b->i2c_bus_count = 1;
++    b->def_i2c_bus = 0;
++        b->i2c_bus[0].bus_id = 0;
++    b->i2c_bus[0].sda = 20;
++    b->i2c_bus[0].scl = 21;
++
++    b->spi_bus_count = 1;
++    b->def_spi_bus = 0;
++    b->spi_bus[0].bus_id = 0;
++    b->spi_bus[0].slave_s = 0;
++    b->spi_bus[0].cs = 25;
++    b->spi_bus[0].mosi = 22;
++    b->spi_bus[0].miso = 23;
++    b->spi_bus[0].sclk = 21;
++
++    b->uart_dev_count = 3;
++    b->def_uart_dev = 0;
++    b->uart_dev[0].rx = 18;
++    b->uart_dev[0].tx = 19;
++
++    b->uart_dev[1].rx = 16;
++    b->uart_dev[1].tx = 17;
++
++    b->uart_dev[2].rx = 9;
++    b->uart_dev[2].tx = 8;
++
++    b->gpio_count = 0;
++    int i;
++    for (i = 0; i < b->phy_pin_count; i++) {
++        if (b->pins[i].capabilites.gpio) {
++            b->gpio_count++;
++        }
++    }
++
++    return b;
++}
+--- /dev/null
++++ b/src/mips/mips.c
+@@ -0,0 +1,60 @@
++/*
++ * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
++ * Author: Michael Ring <mail@michael-ring.org>
++ * Copyright (c) 2014 Intel Corporation.
++ *
++ * 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.
++ */
++
++#include <stdlib.h>
++#include <string.h>
++
++#include "mraa_internal.h"
++#include "mips/mediatek.h"
++
++mraa_platform_t
++mraa_mips_platform()
++{
++    mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
++    size_t len = 100;
++    char* line = malloc(len);
++    FILE* fh = fopen("/proc/cpuinfo", "r");
++    if (fh != NULL) {
++        while (getline(&line, &len, fh) != -1) {
++            if (strncmp(line, "machine", 7) == 0) {
++                if (strstr(line, "MediaTek LinkIt Smart7688")) {
++                    platform_type = MRAA_MTK_LINKIT;
++                }
++            }
++        }
++        fclose(fh);
++    }
++    free(line);
++
++    switch (platform_type) {
++        case MRAA_MTK_LINKIT:
++            plat = mraa_mtk_linkit();
++            break;
++        default:
++            plat = NULL;
++            syslog(LOG_ERR, "Unknown Platform, currently not supported by MRAA");
++    }
++    return platform_type;
++}
diff --git a/libs/libmraa/patches/0003-uart.patch b/libs/libmraa/patches/0003-uart.patch
new file mode 100644 (file)
index 0000000..647abc5
--- /dev/null
@@ -0,0 +1,26 @@
+From 9540f9b93704e8e80ab2048954ca88d8e6eddf86 Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Thu, 23 Jul 2015 16:43:42 +0200
+Subject: [PATCH 3/4] uart
+
+---
+ src/uart/uart.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/uart/uart.c b/src/uart/uart.c
+index 3ef55a4..5102f81 100644
+--- a/src/uart/uart.c
++++ b/src/uart/uart.c
+@@ -34,6 +34,9 @@
+ #include "uart.h"
+ #include "mraa_internal.h"
++#ifndef CMSPAR
++#define CMSPAR          010000000000
++#endif
+ // This function takes an unsigned int and converts it to a B* speed_t
+ // that can be used with linux/posix termios
+ static speed_t
+-- 
+1.7.10.4
+
diff --git a/libs/libmraa/patches/0004-fixes.patch b/libs/libmraa/patches/0004-fixes.patch
new file mode 100644 (file)
index 0000000..40e5930
--- /dev/null
@@ -0,0 +1,666 @@
+From 3c34e5f87a741ec2fc7809fc8c169a832275d32c Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Thu, 23 Jul 2015 18:19:32 +0200
+Subject: [PATCH 4/4] fixes
+
+---
+ src/mips/mediatek.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/src/mips/mediatek.c
++++ b/src/mips/mediatek.c
+@@ -37,12 +37,12 @@
+ #define PLATFORM_MEDIATEK_LINKIT      1
+ #define PLATFORM_MEDIATEK_LINKIT_AIR  2
+ #define MMAP_PATH                     "/dev/mem"
+-#define MT7628_GPIO_BASE              0x100
+-#define MT7628_BLOCK_SIZE             (4 * 1024)
+-#define MT7628_GPIO_CTRL              0x00
+-#define MT7628_GPIO_DATA              0x20
+-#define MT7628_GPIO_SET                       0x30
+-#define MT7628_GPIO_CLEAR             0x40
++#define MT7628_GPIOMODE_BASE          0x10000000
++#define MT7628_BLOCK_SIZE             0x1000
++#define MT7628_GPIO_CTRL              0x600
++#define MT7628_GPIO_DATA              0x620
++#define MT7628_GPIO_SET                       0x630
++#define MT7628_GPIO_CLEAR             0x640
+ #define MAX_SIZE 64
+@@ -50,6 +50,9 @@
+ static uint8_t* mmap_reg = NULL;
+ static int mmap_fd = 0;
+ static int mmap_size;
++static uint8_t* gpio_mmap_reg = NULL;
++static int gpio_mmap_fd = 0;
++static int gpio_mmap_size;
+ static unsigned int mmap_count = 0;
+ static int platform_detected = 0;
+@@ -129,9 +132,10 @@
+         }
+         mmap_reg = (uint8_t*) mmap(NULL, MT7628_BLOCK_SIZE, PROT_READ | PROT_WRITE,
+-                                       MAP_FILE | MAP_SHARED, mmap_fd, MT7628_GPIO_BASE);
++                                       MAP_FILE | MAP_SHARED, mmap_fd, 0x10000000);
+         if (mmap_reg == MAP_FAILED) {
+-            syslog(LOG_ERR, "linkit mmap: failed to mmap");
++            perror("foo");
++          syslog(LOG_ERR, "linkit mmap: failed to mmap");
+             mmap_reg = NULL;
+             close(mmap_fd);
+             return MRAA_ERROR_NO_RESOURCES;
+@@ -144,201 +148,442 @@
+     return MRAA_SUCCESS;
+ }
++static int mmap_gpiomode(void)
++{
++    if ((gpio_mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
++        syslog(LOG_ERR, "linkit map: unable to open resource0 file");
++        return MRAA_ERROR_INVALID_HANDLE;
++    }
++
++    gpio_mmap_reg = (uint8_t*) mmap(NULL, MT7628_BLOCK_SIZE, PROT_READ | PROT_WRITE,
++                                   MAP_FILE | MAP_SHARED, gpio_mmap_fd, MT7628_GPIOMODE_BASE);
++    if (gpio_mmap_reg == MAP_FAILED) {
++        syslog(LOG_ERR, "linkit gpio_mmap: failed to mmap");
++        gpio_mmap_reg = NULL;
++        close(gpio_mmap_fd);
++        return MRAA_ERROR_NO_RESOURCES;
++    }
++    return 0;
++}
++
++static void set_gpiomode(unsigned int mask, unsigned int shift, unsigned int val)
++{
++    unsigned int reg;
++    unsigned int offset = 0x60;
++
++    if (shift >= 32) {
++              shift -= 32;
++              offset += 4;
++    }
++
++    reg = *(volatile uint32_t*) (gpio_mmap_reg + offset);
++
++    reg &= ~(mask << shift);
++    reg |= (val << shift);
++    *(volatile uint32_t*) (gpio_mmap_reg + offset) = reg;
++}
++
++enum {
++      MUX_GPIO = 0,
++      MUX_SPI_S,
++      MUX_SPI_CS1,
++      MUX_I2S,
++      MUX_UART0,
++      MUX_I2C,
++      MUX_UART1,
++      MUX_UART2,
++      MUX_PWM0,
++      MUX_PWM1,
++      MUX_EPHY,
++      MUX_WLED,
++      __MUX_MAX,
++};
++
++static unsigned char gpio_mux_groups[64];
++static struct pinmux {
++      char *name;
++      char *func[4];
++      unsigned int shift;
++      unsigned int mask;
++} mt7688_mux[] = {
++      {
++              .name = "refclk",
++              .func = { "refclk", "gpio", NULL, NULL },
++              .shift = 18,
++              .mask = 0x1,
++      }, {
++              .name = "spi_s",
++              .func = { "spi_s", "gpio", "utif", "pwm" },
++              .shift = 2,
++              .mask = 0x3,
++      }, {
++              .name = "spi_cs1",
++              .func = { "spi_cs1", "gpio", NULL, "refclk" },
++              .shift = 4,
++              .mask = 0x3,
++      }, {
++              .name = "i2s",
++              .func = { "i2s", "gpio", "pcm", NULL },
++              .shift = 6,
++              .mask = 0x3,
++      }, {
++              .name = "uart0",
++              .func = { "uart", "gpio", NULL, NULL },
++              .shift = 8,
++              .mask = 0x3,
++      }, {
++              .name = "i2c",
++              .func = { "i2c", "gpio", NULL, NULL },
++              .shift = 20,
++              .mask = 0x3,
++      }, {
++              .name = "uart1",
++              .func = { "uart", "gpio", NULL, NULL },
++              .shift = 24,
++              .mask = 0x3,
++      }, {
++              .name = "uart2",
++              .func = { "uart", "gpio", "pwm", NULL },
++              .shift = 26,
++              .mask = 0x3,
++      }, {
++              .name = "pwm0",
++              .func = { "pwm", "gpio", NULL, NULL },
++              .shift = 28,
++              .mask = 0x3,
++      }, {
++              .name = "pwm1",
++              .func = { "pwm", "gpio", NULL, NULL },
++              .shift = 30,
++              .mask = 0x3,
++      }, {
++              .name = "ephy",
++              .func = { "ephy", "gpio", NULL, NULL },
++              .shift = 34,
++              .mask = 0x3,
++      }, {
++              .name = "wled",
++              .func = { "wled", "gpio", NULL, NULL },
++              .shift = 32,
++              .mask = 0x3,
++      },
++};
++
++mraa_result_t gpio_init_pre(int pin)
++{
++      struct pinmux *m = &mt7688_mux[gpio_mux_groups[pin]];
++
++      set_gpiomode(m->mask, m->shift, 1);
++
++      return 0;
++}
++
++static void gpiomode_set(unsigned int id, char *name)
++{
++      int i;
++
++      if (id >= __MUX_MAX)
++              return;
++
++      for (i = 0; i < 4; i++) {
++              if (!mt7688_mux[id].func[i] || strcmp(mt7688_mux[id].func[i], name))
++                      continue;
++              set_gpiomode(mt7688_mux[id].mask, mt7688_mux[id].shift, i);
++              syslog(0, "mraa: set pinmux %s -> %s\n", mt7688_mux[id].name, name);
++              return;
++      }
++}
++
++mraa_result_t i2c_init_pre(unsigned int bus)
++{
++      gpiomode_set(MUX_I2C, "i2c");
++      return 0;
++}
++
++mraa_result_t
++pwm_init_post(mraa_pwm_context pwm)
++{
++      switch(pwm->pin) {
++      case 0:
++              gpiomode_set(MUX_PWM0, "pwm");
++              break;
++      case 1:
++              gpiomode_set(MUX_PWM1, "pwm");
++              break;
++      case 2:
++      case 3:
++              gpiomode_set(MUX_UART2, "pwm");
++              break;
++      }
++      return 0;
++}
++
++mraa_result_t spi_init_pre(int bus)
++{
++      gpiomode_set(MUX_SPI_CS1, "spi_cs1");
++      return 0;
++}
++
++mraa_result_t uart_init_pre(int index)
++{
++      switch(index) {
++      case 0:
++              gpiomode_set(MUX_UART0, "uart");
++              break;
++      case 1:
++              gpiomode_set(MUX_UART1, "uart");
++              break;
++      case 2:
++              gpiomode_set(MUX_UART2, "uart");
++              break;
++      }
++      return 0;
++}
++
++mraa_result_t
++i2c_freq(mraa_i2c_context dev, mraa_i2c_mode_t mode)
++{
++    switch (mode) {
++        case MRAA_I2C_STD:
++            break;
++        default:
++            syslog(LOG_ERR, "Invalid i2c frequency");
++            break;
++    }
++    return MRAA_SUCCESS;
++}
++
++
+ mraa_board_t*
+ mraa_mtk_linkit()
+ {
++    int i;
++
++    if (mmap_gpiomode())
++          return NULL;
++
+     mraa_board_t* b = (mraa_board_t*) malloc(sizeof(mraa_board_t));
+     if (b == NULL) {
+         return NULL;
+     }
+-    b->platform_name = "LINKIT";
++    memset(b, 0, sizeof(mraa_board_t));
++
++    b->platform_name = "LinkIt Smart 7688";
+     platform_detected = PLATFORM_MEDIATEK_LINKIT;
+-    b->phy_pin_count = 31;
++    b->phy_pin_count = 64;
+     b->aio_count = 0;
+     b->adc_raw = 0;
+     b->adc_supported = 0;
+     b->pwm_default_period = 500;
+-    b->pwm_max_period = 2147483;
++    b->pwm_max_period = 1000000;
+     b->pwm_min_period = 1;
+-    b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * b->phy_pin_count);
+-
+-    advance_func->gpio_mmap_setup = &mraa_mtk_linkit_mmap_setup;
+-
+-    strncpy(b->pins[0].name, "P0", MRAA_PIN_NAME_SIZE);
+-    b->pins[0].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[1].name, "P1", MRAA_PIN_NAME_SIZE);
+-    b->pins[1].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[2].name, "P2", MRAA_PIN_NAME_SIZE);
+-    b->pins[2].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[3].name, "P3", MRAA_PIN_NAME_SIZE);
+-    b->pins[3].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[4].name, "P4", MRAA_PIN_NAME_SIZE);
+-    b->pins[4].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[5].name, "P5", MRAA_PIN_NAME_SIZE);
+-    b->pins[5].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[6].name, "P6", MRAA_PIN_NAME_SIZE);
+-    b->pins[6].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[7].name, "P7", MRAA_PIN_NAME_SIZE);
+-    b->pins[7].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
+-
+-    strncpy(b->pins[8].name, "P8", MRAA_PIN_NAME_SIZE);
+-    b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[8].gpio.pinmap = 21;
+-    b->pins[8].uart.parent_id = 2;
+-    b->pins[8].uart.mux_total = 0;
++    b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
++    if (b->adv_func == NULL) {
++        return NULL;
++    }
+-    strncpy(b->pins[9].name, "P9", MRAA_PIN_NAME_SIZE);
+-    b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[9].gpio.pinmap = 20;
+-    b->pins[9].uart.parent_id = 2;
+-    b->pins[9].uart.mux_total = 0;
++    b->adv_func->i2c_init_pre = i2c_init_pre;
++    b->adv_func->pwm_init_post = pwm_init_post;
++    b->adv_func->spi_init_pre = spi_init_pre;
++    b->adv_func->uart_init_pre = uart_init_pre;
++    b->adv_func->gpio_init_pre = gpio_init_pre;
++    b->adv_func->i2c_set_frequency_replace = &i2c_freq;
+-    strncpy(b->pins[10].name, "P10", MRAA_PIN_NAME_SIZE);
+-    b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[10].gpio.pinmap = 2;
++    b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * b->phy_pin_count);
+-    strncpy(b->pins[11].name, "P11", MRAA_PIN_NAME_SIZE);
+-    b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[11].gpio.pinmap = 3;
++    memset(b->pins, 0, sizeof(mraa_pininfo_t) * b->phy_pin_count);
++    memset(gpio_mux_groups, -1, sizeof(gpio_mux_groups));
+-    strncpy(b->pins[12].name, "P12", MRAA_PIN_NAME_SIZE);
+-    b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[12].gpio.pinmap = 0;
++    b->adv_func->gpio_mmap_setup = &mraa_mtk_linkit_mmap_setup;
+-    strncpy(b->pins[13].name, "P13", MRAA_PIN_NAME_SIZE);
+-    b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[13].gpio.pinmap = 1;
++    for (i = 0; i < b->phy_pin_count; i++) {
++        snprintf(b->pins[i].name, MRAA_PIN_NAME_SIZE, "GPIO%d", i);
++        b->pins[i].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++    }
+-    strncpy(b->pins[14].name, "P14", MRAA_PIN_NAME_SIZE);
+-    b->pins[14].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++    strncpy(b->pins[43].name, "GPIO43", MRAA_PIN_NAME_SIZE);
++    b->pins[43].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[43].gpio.pinmap = 43;
++    gpio_mux_groups[43] = MUX_EPHY;
++
++    strncpy(b->pins[20].name, "GPIO20", MRAA_PIN_NAME_SIZE);
++    b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 1 };
++    b->pins[20].gpio.pinmap = 20;
++    b->pins[20].uart.parent_id = 2;
++    b->pins[20].uart.mux_total = 0;
++    b->pins[20].pwm.parent_id = 0;
++    b->pins[20].pwm.pinmap = 2;
++    gpio_mux_groups[20] = MUX_UART2;
++
++    strncpy(b->pins[21].name, "GPIO21", MRAA_PIN_NAME_SIZE);
++    b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 1 };
++    b->pins[21].gpio.pinmap = 21;
++    b->pins[21].uart.parent_id = 2;
++    b->pins[21].uart.mux_total = 0;
++    b->pins[21].pwm.parent_id = 0;
++    b->pins[21].pwm.pinmap = 3;
++    gpio_mux_groups[21] = MUX_UART2;
++
++    strncpy(b->pins[2].name, "GPIO2", MRAA_PIN_NAME_SIZE);
++    b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[2].gpio.pinmap = 2;
++    gpio_mux_groups[2] = MUX_I2S;
++
++    strncpy(b->pins[3].name, "GPIO3", MRAA_PIN_NAME_SIZE);
++    b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[3].gpio.pinmap = 3;
++    gpio_mux_groups[3] = MUX_I2S;
++
++    strncpy(b->pins[0].name, "GPIO0", MRAA_PIN_NAME_SIZE);
++    b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[0].gpio.pinmap = 0;
++    gpio_mux_groups[0] = MUX_I2S;
++
++    strncpy(b->pins[1].name, "GPIO1", MRAA_PIN_NAME_SIZE);
++    b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[1].gpio.pinmap = 1;
++    gpio_mux_groups[1] = MUX_I2S;
++
++    strncpy(b->pins[37].name, "GPIO37", MRAA_PIN_NAME_SIZE);
++    b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[37].gpio.pinmap = 37;
++    gpio_mux_groups[37] = MUX_GPIO;
++
++    strncpy(b->pins[44].name, "GPIO44", MRAA_PIN_NAME_SIZE);
++    b->pins[44].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[44].gpio.pinmap = 44;
++    gpio_mux_groups[44] = MUX_WLED;
++
++    strncpy(b->pins[46].name, "GPIO46", MRAA_PIN_NAME_SIZE);
++    b->pins[46].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[46].gpio.pinmap = 46;
++    b->pins[46].uart.parent_id = 1;
++    b->pins[46].uart.mux_total = 0;
++    gpio_mux_groups[46] = MUX_UART1;
++
++    strncpy(b->pins[45].name, "GPIO45", MRAA_PIN_NAME_SIZE);
++    b->pins[45].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[45].gpio.pinmap = 45;
++    b->pins[45].uart.parent_id = 1;
++    b->pins[45].uart.mux_total = 0;
++    gpio_mux_groups[45] = MUX_UART1;
++
++    strncpy(b->pins[13].name, "GPIO13", MRAA_PIN_NAME_SIZE);
++    b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[13].gpio.pinmap = 13;
++    b->pins[13].uart.parent_id = 1;
++    b->pins[13].uart.mux_total = 0;
++    gpio_mux_groups[13] = MUX_UART0;
++
++    strncpy(b->pins[12].name, "GPIO12", MRAA_PIN_NAME_SIZE);
++    b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
++    b->pins[12].gpio.pinmap = 12;
++    b->pins[12].uart.parent_id = 0;
++    b->pins[12].uart.mux_total = 0;
++    gpio_mux_groups[12] = MUX_UART0;
++
++    strncpy(b->pins[5].name, "GPIO5", MRAA_PIN_NAME_SIZE);
++    b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
++    b->pins[5].gpio.pinmap = 5;
++    b->pins[5].i2c.pinmap = 0;
++    b->pins[5].i2c.mux_total = 0;
++    gpio_mux_groups[5] = MUX_I2C;
++
++    strncpy(b->pins[4].name, "GPIO4", MRAA_PIN_NAME_SIZE);
++    b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
++    b->pins[4].gpio.pinmap = 4;
++    b->pins[4].i2c.pinmap = 0;
++    b->pins[4].i2c.mux_total = 0;
++    gpio_mux_groups[4] = MUX_I2C;
++
++    strncpy(b->pins[6].name, "GPIO6", MRAA_PIN_NAME_SIZE);
++    b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
++    b->pins[6].gpio.pinmap = 6;
++    b->pins[6].spi.pinmap = 0;
++    b->pins[6].spi.mux_total = 0;
++    gpio_mux_groups[6] = MUX_SPI_CS1;
++
++    strncpy(b->pins[7].name, "GPIO7", MRAA_PIN_NAME_SIZE);
++    b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
++    b->pins[7].spi.pinmap = 0;
++    b->pins[7].spi.mux_total = 0;
++
++    strncpy(b->pins[8].name, "GPIO8", MRAA_PIN_NAME_SIZE);
++    b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
++    b->pins[8].spi.pinmap = 0;
++    b->pins[8].spi.mux_total = 0;
++
++    strncpy(b->pins[9].name, "GPIO9", MRAA_PIN_NAME_SIZE);
++    b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
++    b->pins[9].spi.pinmap = 0;
++    b->pins[9].spi.mux_total = 0;
++
++    strncpy(b->pins[18].name, "GPIO18", MRAA_PIN_NAME_SIZE);
++    b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
++    b->pins[18].gpio.pinmap = 18;
++    b->pins[18].pwm.parent_id = 0;
++    b->pins[18].pwm.pinmap = 0;
++    gpio_mux_groups[18] = MUX_PWM0;
++
++    strncpy(b->pins[19].name, "GPIO19", MRAA_PIN_NAME_SIZE);
++    b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
++    b->pins[19].gpio.pinmap = 19;
++    b->pins[19].pwm.parent_id = 0;
++    b->pins[19].pwm.pinmap = 1;
++    gpio_mux_groups[19] = MUX_PWM1;
++
++    strncpy(b->pins[16].name, "GPIO16", MRAA_PIN_NAME_SIZE);
++    b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[16].gpio.pinmap = 16;
++    gpio_mux_groups[16] = MUX_SPI_S;
++
++    strncpy(b->pins[17].name, "GPIO17", MRAA_PIN_NAME_SIZE);
++    b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[17].gpio.pinmap = 17;
++    gpio_mux_groups[17] = MUX_SPI_S;
++
++    strncpy(b->pins[14].name, "GPIO14", MRAA_PIN_NAME_SIZE);
++    b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++    b->pins[14].gpio.pinmap = 14;
++    gpio_mux_groups[14] = MUX_SPI_S;
+-    strncpy(b->pins[15].name, "P15", MRAA_PIN_NAME_SIZE);
++    strncpy(b->pins[15].name, "GPIO15", MRAA_PIN_NAME_SIZE);
+     b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[15].gpio.pinmap = 44;
+-
+-    strncpy(b->pins[16].name, "P16", MRAA_PIN_NAME_SIZE);
+-    b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[16].gpio.pinmap = 46;
+-    b->pins[16].uart.parent_id = 1;
+-    b->pins[16].uart.mux_total = 0;
+-
+-    strncpy(b->pins[17].name, "P17", MRAA_PIN_NAME_SIZE);
+-    b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[17].gpio.pinmap = 45;
+-    b->pins[17].uart.parent_id = 1;
+-    b->pins[17].uart.mux_total = 0;
+-
+-    strncpy(b->pins[18].name, "P18", MRAA_PIN_NAME_SIZE);
+-    b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[18].gpio.pinmap = 13;
+-    b->pins[18].uart.parent_id = 1;
+-    b->pins[18].uart.mux_total = 0;
+-
+-    strncpy(b->pins[19].name, "P19", MRAA_PIN_NAME_SIZE);
+-    b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
+-    b->pins[19].gpio.pinmap = 12;
+-    b->pins[19].uart.parent_id = 0;
+-    b->pins[19].uart.mux_total = 0;
+-
+-    strncpy(b->pins[20].name, "P20", MRAA_PIN_NAME_SIZE);
+-    b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
+-    b->pins[20].gpio.pinmap = 5;
+-    b->pins[20].i2c.pinmap = 0;
+-    b->pins[20].i2c.mux_total = 0;
+-
+-    strncpy(b->pins[21].name, "P21", MRAA_PIN_NAME_SIZE);
+-    b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
+-    b->pins[21].gpio.pinmap = 4;
+-    b->pins[21].i2c.pinmap = 0;
+-    b->pins[21].i2c.mux_total = 0;
+-
+-    strncpy(b->pins[22].name, "P22", MRAA_PIN_NAME_SIZE);
+-    b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
+-    b->pins[22].gpio.pinmap = 8;
+-    b->pins[22].spi.pinmap = 0;
+-    b->pins[22].spi.mux_total = 0;
+-
+-    strncpy(b->pins[23].name, "P23", MRAA_PIN_NAME_SIZE);
+-    b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
+-    b->pins[23].gpio.pinmap = 9;
+-    b->pins[23].spi.pinmap = 0;
+-    b->pins[23].spi.mux_total = 0;
+-
+-    strncpy(b->pins[24].name, "P24", MRAA_PIN_NAME_SIZE);
+-    b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
+-    b->pins[24].gpio.pinmap = 7;
+-    b->pins[24].spi.pinmap = 0;
+-    b->pins[24].spi.mux_total = 0;
+-
+-    strncpy(b->pins[25].name, "P25", MRAA_PIN_NAME_SIZE);
+-    b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
+-    b->pins[25].gpio.pinmap = 6;
+-    b->pins[25].spi.pinmap = 0;
+-    b->pins[25].spi.mux_total = 0;
+-
+-    strncpy(b->pins[26].name, "P26", MRAA_PIN_NAME_SIZE);
+-    b->pins[26].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
+-    b->pins[26].gpio.pinmap = 18;
+-
+-    strncpy(b->pins[27].name, "P27", MRAA_PIN_NAME_SIZE);
+-    b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
+-    b->pins[27].gpio.pinmap = 19;
+-
+-    strncpy(b->pins[28].name, "P28", MRAA_PIN_NAME_SIZE);
+-    b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[28].gpio.pinmap = 16;
+-
+-    strncpy(b->pins[29].name, "P29", MRAA_PIN_NAME_SIZE);
+-    b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[29].gpio.pinmap = 17;
+-
+-    strncpy(b->pins[30].name, "P30", MRAA_PIN_NAME_SIZE);
+-    b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[30].gpio.pinmap = 14;
+-
+-    strncpy(b->pins[31].name, "P31", MRAA_PIN_NAME_SIZE);
+-    b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
+-    b->pins[31].gpio.pinmap = 15;
++    b->pins[15].gpio.pinmap = 15;
++    gpio_mux_groups[15] = MUX_SPI_S;
+     // BUS DEFINITIONS
+     b->i2c_bus_count = 1;
+     b->def_i2c_bus = 0;
+-        b->i2c_bus[0].bus_id = 0;
+-    b->i2c_bus[0].sda = 20;
+-    b->i2c_bus[0].scl = 21;
++    b->i2c_bus[0].bus_id = 0;
++    b->i2c_bus[0].sda = 5;
++    b->i2c_bus[0].scl = 4;
+     b->spi_bus_count = 1;
+     b->def_spi_bus = 0;
+-    b->spi_bus[0].bus_id = 0;
+-    b->spi_bus[0].slave_s = 0;
+-    b->spi_bus[0].cs = 25;
+-    b->spi_bus[0].mosi = 22;
+-    b->spi_bus[0].miso = 23;
+-    b->spi_bus[0].sclk = 21;
++    b->spi_bus[0].bus_id = 32766;
++    b->spi_bus[0].slave_s = 1;
++    b->spi_bus[0].cs = 6;
++    b->spi_bus[0].mosi = 8;
++    b->spi_bus[0].miso = 9;
++    b->spi_bus[0].sclk = 7;
+     b->uart_dev_count = 3;
+     b->def_uart_dev = 0;
+-    b->uart_dev[0].rx = 18;
+-    b->uart_dev[0].tx = 19;
+-
+-    b->uart_dev[1].rx = 16;
+-    b->uart_dev[1].tx = 17;
+-
+-    b->uart_dev[2].rx = 9;
+-    b->uart_dev[2].tx = 8;
++    b->uart_dev[0].rx = 13;
++    b->uart_dev[0].tx = 12;
++    b->uart_dev[0].device_path = "/dev/ttyS0";
++    b->uart_dev[1].rx = 46;
++    b->uart_dev[1].tx = 45;
++    b->uart_dev[1].device_path = "/dev/ttyS1";
++    b->uart_dev[2].rx = 21;
++    b->uart_dev[2].tx = 20;
++    b->uart_dev[2].device_path = "/dev/ttyS2";
+     b->gpio_count = 0;
+-    int i;
+     for (i = 0; i < b->phy_pin_count; i++) {
+         if (b->pins[i].capabilites.gpio) {
+             b->gpio_count++;
+--- a/src/gpio/gpio.c
++++ b/src/gpio/gpio.c
+@@ -113,6 +113,8 @@
+         close(export);
+     }
++    mraa_gpio_use_mmaped(dev, 1);
++
+ init_internal_cleanup:
+     if (status != MRAA_SUCCESS) {
+         if (dev != NULL)
diff --git a/libs/libupm/Makefile b/libs/libupm/Makefile
new file mode 100644 (file)
index 0000000..93287c5
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libupm
+PKG_VERSION:=0.4.0
+
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/intel-iot-devkit/upm.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=04dc6df4297a7766d6f1a8fef9699d586e7e0d92
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+CMAKE_INSTALL:=1
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=LGPL-2.1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+UPM_MODULES:= \
+       a110x ad8232 adafruitss adc121c021 adis16448 adxl335 adxl345 am2315 apds9002 at42qt1070 biss0001 bmpx8x buzzer \
+       cjq4435 ds1307 ecs1030 enc03r flex gas gp2y0a grovecircularled grovecollision groveehr groveeldriver groveelectromagnet \
+       groveemg grovegprs grovegsr grovelinefinder grovemd grovemoisture groveo2 grovescam grove grovespeaker grovevdiv grovewater \
+       grovewfs guvas12d h3lis331dl hcsr04 hm11 hmc5883l hmtrp hp20x ht9170 htu21d hx711 i2clcd ina132 isd1820 itg3200 joystick12 \
+       l298 ldt0028 lm35 lol loudness lpd8806 lsm303 lsm9ds0 m24lr64e max31723 max31855 max44000 max5487 maxds3231m maxsonarez \
+       mg811 mhz16 mic mlx90614 mma7455 mma7660 mpl3115a2 mpr121 mpu9150 mq303a my9221 nrf24l01 nrf8001 nunchuck otp538u \
+       pn532 ppd42ns pulsensor rfr359f rgbringcoder rotaryencoder rpr220 servo si114x sm130 st7735 stepmotor sx6119 ta12200 tcs3414cs \
+       th02 tm1637 tsl2561 ttp223 ublox6 uln200xa waterlevel wheelencoder wt5001 yg1006 zfm20
+
+CMAKE_OPTIONS=-DBUILDARCH=$(CONFIG_ARCH) \
+       -DNODE_EXECUTABLE=$(STAGING_DIR_HOST)/bin/node \
+       -DSWIG_DIR=$(STAGING_DIR_HOST)/bin
+
+define Package/libupm/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libmraa +librt
+  SUBMENU:=IoT
+endef
+
+define Package/libupm
+  $(call Package/libupm/Default)
+  TITLE:=Intel IoT sensor library - Full
+endef
+
+define Package/libupm/install/Default
+       $(INSTALL_DIR) $(1)/usr/lib/{node/,python2.7/site-packages}; \
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupm-$(2).so* $(1)/usr/lib/; \
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/jsupm_$(2) $(1)/usr/lib/node/; \
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/{pyupm_$(2).py,_pyupm_$(2).so} \
+               $(1)/usr/lib/python2.7/site-packages/ ;
+endef
+
+define Package/libupm/install
+       $(foreach module, $(UPM_MODULES),       \
+               $(call Package/libupm/install/Default,$(1),$(module)))
+endef
+
+define UpmPackage
+define Package/libupm-$(1)
+  $(call Package/libupm/Default)
+  TITLE:=Intel IoT sensor library - $(1)
+endef
+
+define Package/libupm-$(1)/install
+       $(call Package/libupm/install/Default,$$(1),$(1))
+endef
+endef
+
+$(eval $(call BuildPackage,libupm))
+$(foreach package, $(UPM_MODULES),                     \
+       $(eval $(call UpmPackage,$(package)))           \
+       $(eval $(call BuildPackage,libupm-$(package)))  \
+)
diff --git a/libs/libupm/patches/001-version.patch b/libs/libupm/patches/001-version.patch
new file mode 100644 (file)
index 0000000..3d4fd6c
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,12 +26,7 @@
+ include(GNUInstallDirs)
+ # Make a version file containing the current version from git.
+-include (GetGitRevisionDescription)
+-git_describe (VERSION "--tags")
+-if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
+-  message (WARNING " - Install git to compile a production UPM!")
+-  set (VERSION "v0.4.0-dirty")
+-endif ()
++set (VERSION "v0.4.0")
+ message (INFO " - UPM Version ${VERSION}")
diff --git a/libs/libupm/patches/002-at42qt1070-id.patch b/libs/libupm/patches/002-at42qt1070-id.patch
new file mode 100644 (file)
index 0000000..85544c9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/at42qt1070/at42qt1070.cxx
++++ b/src/at42qt1070/at42qt1070.cxx
+@@ -53,7 +53,7 @@
+         return;
+     }
+-    if (readChipID() != 0x2E) {
++    if (readChipID() != 0x1b && readChipID() != 0x2E) {
+         throw std::runtime_error("Chip ID does not match the expected value (2Eh)");
+     }
diff --git a/libs/libupm/patches/003-lsm303-args.patch b/libs/libupm/patches/003-lsm303-args.patch
new file mode 100644 (file)
index 0000000..d2b2d0e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/lsm303/lsm303.h
++++ b/src/lsm303/lsm303.h
+@@ -34,7 +34,7 @@
+ /* LSM303 Address definitions */
+ #define LSM303_MAG 0x1E // assuming SA0 grounded
+-#define LSM303_ACC 0x18 // assuming SA0 grounded
++#define LSM303_ACC 0x1E // assuming SA0 grounded
+ /* LSM303 Register definitions */
+ #define CTRL_REG1_A 0x20
index d9952e6fba147c3bd50934a89887c7f1bc050e7b..9e827d7d868f5c7f1f5c2e312cb721086831be78 100644 (file)
@@ -27,7 +27,7 @@ CMAKE_INSTALL:=1
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
-CMAKE_OPTIONS += $(if $(CONFIG_PACKAGE_kmod-ipv6),,-DLWS_IPV6=)
+CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DLWS_IPV6=)
 
 CMAKE_OPTIONS += -DLWS_WITHOUT_TESTAPPS=ON
 
diff --git a/multimedia/grilo-plugins/Makefile b/multimedia/grilo-plugins/Makefile
new file mode 100644 (file)
index 0000000..59800e1
--- /dev/null
@@ -0,0 +1,92 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=grilo-plugins
+PKG_VERSION:=0.2.16
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://download.gnome.org/sources/grilo-plugins/0.2/
+PKG_MD5SUM:=62ecaad877b485a950259eef1ef38c18
+
+PKG_BUILD_DEPENDS:=glib2 grilo
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/grilo-plugins/Default
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=grilo-plugins
+  URL:=https://wiki.gnome.org/Projects/Grilo
+endef
+
+define Package/grilo-plugins
+  $(call Package/grilo-plugins/Default)
+  MENU:=1
+  DEPENDS:=+grilo $(ICONV_DEPENDS) $(INTL_DEPENDS)
+  TITLE:=Plugins for the Grilo framework
+endef
+
+define Package/grilo/decription
+  Grilo is a framework that provides access to different sources of
+  multimedia content, using a pluggable system. This package contains 
+  plugins to get information from a number of sources.
+endef
+
+CONFIGURE_ARGS += \
+        --enable-static \
+        --without-libiconv-prefix \
+        --without-libintl-prefix \
+        --without-x \
+
+define Package/grilo-plugins/install
+       $(INSTALL_DIR) $(1)/usr/lib/grilo-0.2
+endef
+
+define BuildPlugin
+  define Package/grilo-plugins-$(1)
+    $(call Package/grilo-plugins/Default)
+    DEPENDS:=grilo-plugins
+    ifneq ($(4),)
+      DEPENDS+= $(4)
+    endif
+    TITLE:=$(2) plugin
+  endef
+
+  define Package/grilo-plugins-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/grilo-0.2
+       for p in $(3); do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/grilo-0.2/libgrl$$$$$$$${p}.so $$(1)/usr/lib/grilo-0.2; \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/grilo-0.2/grl-$$$$$$$${p}.xml $$(1)/usr/lib/grilo-0.2; \
+       done
+  endef
+
+  $$(eval $$(call BuildPackage,grilo-plugins-$(1)))
+endef
+
+$(eval $(call BuildPackage,grilo-plugins))
+
+$(eval $(call BuildPlugin,dleyna,DLNA sharing,dleyna,,30))
+$(eval $(call BuildPlugin,dmap,DAAP and DPAP sharing,daap dpap,libdmapsharing,30))
+$(eval $(call BuildPlugin,gravatar,Gravatar provider,gravatar,,30))
+$(eval $(call BuildPlugin,jamendo,Jamendo sharing,jamendo,,30))
+$(eval $(call BuildPlugin,lastfm-albumart,Last.FM album art provider,lastfm-albumart,,30))
+$(eval $(call BuildPlugin,magnatune,Magnatune sharing,magnatune,,30))
+$(eval $(call BuildPlugin,metadata-store,Extra metadata store,metadata-store,,30))
+$(eval $(call BuildPlugin,opensubtitles,Openi subtitles provider,opensubtitles,,30))
+$(eval $(call BuildPlugin,raitv,Rai.tv sharing,raitv,,30))
+$(eval $(call BuildPlugin,shoutcast,SHOUTcast sharing,shoutcast,,30))
diff --git a/multimedia/grilo/Makefile b/multimedia/grilo/Makefile
new file mode 100644 (file)
index 0000000..473344a
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2009-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=grilo
+PKG_VERSION:=0.2.14
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://download.gnome.org/sources/grilo/0.2/
+PKG_MD5SUM:=7eba405ada20fefcb877d534d9d4f
+
+PKG_BUILD_DEPENDS:=glib2 libsoup libxml2
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/grilo
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=grilo
+  URL:=https://wiki.gnome.org/Projects/Grilo
+  DEPENDS:=+glib2 +libsoup +libxml2
+endef
+
+define Package/grilo/decription
+  Grilo is a framework that provides access to different sources of
+  multimedia content, using a pluggable system. 
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/grilo-0.2/ \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/grilo/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,grilo))
diff --git a/multimedia/lcdgrilo/Makefile b/multimedia/lcdgrilo/Makefile
new file mode 100644 (file)
index 0000000..53888d1
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2009-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lcdgrilo
+PKG_VERSION:=0.0.7
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.flyn.org/projects/lcdgrilo
+PKG_MD5SUM:=80a946bf144da5cc32bdf9f1aa2f91e6
+PKG_BUILD_DEPENDS:=+vala
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/lcdgrilo
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=+grilo +grilo-plugins +libgee +libgstreamer1
+  TITLE:=lcdgrilo
+  URL:=http://www.flyn.org/projects/lcdgrilo/
+endef
+
+define Package/lcdgrilo/decription
+       A simple Grilo-based audio player meant to run on a Raspberry Pi with a PiFace CAD
+endef
+
+define Package/lcdgrilo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/lcdgrilo \
+               $(1)/usr/bin/
+       $(INSTALL_BIN) ./files/lcdgrilo.init $(1)/etc/init.d/lcdgrilo
+endef
+
+$(eval $(call BuildPackage,lcdgrilo))
diff --git a/multimedia/lcdgrilo/files/lcdgrilo.init b/multimedia/lcdgrilo/files/lcdgrilo.init
new file mode 100644 (file)
index 0000000..5c4ff1b
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2012 OpenWrt.org
+
+START=60
+
+start() {
+       /usr/bin/lcdgrilo &
+       echo $! > /var/run/lcdgrilo.pid
+}
+
+stop() {
+       if [ ! -f /var/run/lcdgrilo.pid ]; then
+               return
+       fi
+       /bin/kill `cat /var/run/lcdgrilo.pid`
+}
index e1e0e200eda3a80629b881b73093c16cf993b89b..cae661aaf990602400901bc8f92615abf4dac2ae 100644 (file)
@@ -51,8 +51,11 @@ endef
 
 CAMBOZOLA:=cambozola-0.936.tar.gz
 
+# Distribution URL doesn't always have the correct version
+# Using the OpenWrt mirror provides a stable version
+#      orig-URL:=http://www.andywilcock.com/code/cambozola
 define Download/cambozola
-  URL:=http://www.andywilcock.com/code/cambozola
+  URL:=http://mirror2.openwrt.org/sources
   FILE:=$(CAMBOZOLA)
   MD5SUM:=35c45188aa9635aef2b745c35c311396
 endef
index 412b5f90bc5b5a72e94360d7a61f63f3b501909d..eeb49b183705452cbf6cfbeb6a4bbc7dc41fa156 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2011 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=motion
 PKG_VERSION=3.4.0-20141018-$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
 PKG_LICENSE:=GPLv2
diff --git a/multimedia/motion/patches/100-musl-compat.patch b/multimedia/motion/patches/100-musl-compat.patch
new file mode 100644 (file)
index 0000000..b788e26
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/motion.c
++++ b/motion.c
+@@ -2630,6 +2630,17 @@ int main (int argc, char **argv)
+     struct sigaction sigchild_action;
+     setup_signals(&sig_handler_action, &sigchild_action);
++    /*
++     * Create and a thread attribute for the threads we spawn later on.
++     * PTHREAD_CREATE_DETACHED means to create threads detached, i.e.
++     * their termination cannot be synchronized through 'pthread_join'.
++     */
++    pthread_attr_init(&thread_attr);
++    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
++
++    /* Create the TLS key for thread number. */
++    pthread_key_create(&tls_key_threadnr, NULL);
++
+     motion_startup(1, argc, argv);
+ #ifdef HAVE_FFMPEG
+@@ -2648,17 +2659,6 @@ int main (int argc, char **argv)
+     if (cnt_list[0]->conf.setup_mode)
+         MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion running in setup mode.");
+-    /*
+-     * Create and a thread attribute for the threads we spawn later on.
+-     * PTHREAD_CREATE_DETACHED means to create threads detached, i.e.
+-     * their termination cannot be synchronized through 'pthread_join'.
+-     */
+-    pthread_attr_init(&thread_attr);
+-    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+-
+-    /* Create the TLS key for thread number. */
+-    pthread_key_create(&tls_key_threadnr, NULL);
+-
+     do {
+         if (restart) {
+             /*
+--- a/motion.h
++++ b/motion.h
+@@ -84,7 +84,7 @@
+ #endif
+ /* strerror_r() XSI vs GNU */
+-#if (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
++#if (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) || (!defined(__GLIBC__))
+ #define XSI_STRERROR_R
+ #endif
index 960ef856fdc56f853f9c1b4372c6394496a0af17..fed4ab22ae159d8f6b20877a0847a514e83ca9b0 100644 (file)
@@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/aircrack-ng
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libpcap +libpthread +libopenssl +libnl +wireless-tools +ethtool
+  DEPENDS:=+libpcap +libpthread +libopenssl +libnl-core +libnl-genl +wireless-tools +ethtool
   TITLE:=WLAN tools for breaking 802.11 WEP/WPA keys
   URL:=http://www.aircrack-ng.org/
   MAINTAINER:=Rick Farina <zerochaos@gentoo.org>
index 54e7ff34fc349dbac4c8ee02d7bf4412e04ce888..2a0fd0e44191ba3b690099cebf77343e73d378c7 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bmon
 PKG_VERSION:=3.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/tgraf/bmon/releases/download/v$(PKG_VERSION)/
@@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/bmon
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+PACKAGE_libncursesw:libncursesw +!PACKAGE_libncursesw:libncurses +libnl +confuse +terminfo
+  DEPENDS:=+PACKAGE_libncursesw:libncursesw +!PACKAGE_libncursesw:libncurses +libnl-core +libnl-route +confuse +terminfo
   TITLE:=bmon is a portable bandwidth monitor
   URL:=https://github.com/tgraf/bmon/
 endef
diff --git a/net/cgi-io/Makefile b/net/cgi-io/Makefile
new file mode 100644 (file)
index 0000000..c36231a
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cgi-io
+PKG_RELEASE:=1
+
+PKG_LICENSE:=GPL-2.0+
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/cgi-io
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  DEPENDS:=+libubox +libubus
+  TITLE:=CGI utility for handling up/downloading of files
+endef
+
+define Package/cgi-io/description
+  This package contains an cgi utility that is useful for up/downloading files
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/cgi-io/install
+       $(INSTALL_DIR) $(1)/usr/libexec $(1)/www/cgi-bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi-io $(1)/usr/libexec
+       $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload 
+       $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download 
+endef
+
+$(eval $(call BuildPackage,cgi-io))
diff --git a/net/cgi-io/src/CMakeLists.txt b/net/cgi-io/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8a4ca19
--- /dev/null
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.6)
+
+PROJECT(cgi-io C)
+
+INCLUDE(CheckFunctionExists)
+
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
+
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+
+IF(APPLE)
+  INCLUDE_DIRECTORIES(/opt/local/include)
+  LINK_DIRECTORIES(/opt/local/lib)
+ENDIF()
+
+ADD_EXECUTABLE(cgi-io main.c multipart_parser.c)
+TARGET_LINK_LIBRARIES(cgi-io ubox ubus)
+
+INSTALL(TARGETS cgi-io RUNTIME DESTINATION sbin)
diff --git a/net/cgi-io/src/main.c b/net/cgi-io/src/main.c
new file mode 100644 (file)
index 0000000..985831c
--- /dev/null
@@ -0,0 +1,644 @@
+/*
+ * cgi-io - LuCI non-RPC helper
+ *
+ *   Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include <libubus.h>
+#include <libubox/blobmsg.h>
+
+#include "multipart_parser.h"
+
+
+enum part {
+       PART_UNKNOWN,
+       PART_SESSIONID,
+       PART_FILENAME,
+       PART_FILEMODE,
+       PART_FILEDATA
+};
+
+const char *parts[] = {
+       "(bug)",
+       "sessionid",
+       "filename",
+       "filemode",
+       "filedata",
+};
+
+struct state
+{
+       bool is_content_disposition;
+       enum part parttype;
+       char *sessionid;
+       char *filename;
+       bool filedata;
+       int filemode;
+       int filefd;
+       int tempfd;
+};
+
+enum {
+       SES_ACCESS,
+       __SES_MAX,
+};
+
+static const struct blobmsg_policy ses_policy[__SES_MAX] = {
+       [SES_ACCESS] = { .name = "access", .type = BLOBMSG_TYPE_BOOL },
+};
+
+
+static struct state st;
+
+static void
+session_access_cb(struct ubus_request *req, int type, struct blob_attr *msg)
+{
+       struct blob_attr *tb[__SES_MAX];
+       bool *allow = (bool *)req->priv;
+
+       if (!msg)
+               return;
+
+       blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg));
+
+       if (tb[SES_ACCESS])
+               *allow = blobmsg_get_bool(tb[SES_ACCESS]);
+}
+
+static bool
+session_access(const char *sid, const char *obj, const char *func)
+{
+       uint32_t id;
+       bool allow = false;
+       struct ubus_context *ctx;
+       static struct blob_buf req;
+
+       ctx = ubus_connect(NULL);
+
+       if (!ctx || ubus_lookup_id(ctx, "session", &id))
+               goto out;
+
+       blob_buf_init(&req, 0);
+       blobmsg_add_string(&req, "ubus_rpc_session", sid);
+       blobmsg_add_string(&req, "scope", "cgi-io");
+       blobmsg_add_string(&req, "object", obj);
+       blobmsg_add_string(&req, "function", func);
+
+       ubus_invoke(ctx, id, "access", req.head, session_access_cb, &allow, 500);
+
+out:
+       if (ctx)
+               ubus_free(ctx);
+
+       return allow;
+}
+
+static char *
+md5sum(const char *file)
+{
+       pid_t pid;
+       int fds[2];
+       static char md5[33];
+
+       if (pipe(fds))
+               return NULL;
+
+       switch ((pid = fork()))
+       {
+       case -1:
+               return NULL;
+
+       case 0:
+               uloop_done();
+
+               dup2(fds[1], 1);
+
+               close(0);
+               close(2);
+               close(fds[0]);
+               close(fds[1]);
+
+               if (execl("/bin/busybox", "/bin/busybox", "md5sum", file, NULL));
+                       return NULL;
+
+               break;
+
+       default:
+               memset(md5, 0, sizeof(md5));
+               read(fds[0], md5, 32);
+               waitpid(pid, NULL, 0);
+               close(fds[0]);
+               close(fds[1]);
+       }
+
+       return md5;
+}
+
+static char *
+datadup(const void *in, size_t len)
+{
+       char *out = malloc(len + 1);
+
+       if (!out)
+               return NULL;
+
+       memcpy(out, in, len);
+
+       *(out + len) = 0;
+
+       return out;
+}
+
+static bool
+urldecode(char *buf)
+{
+       char *c, *p;
+
+       if (!buf || !*buf)
+               return true;
+
+#define hex(x) \
+       (((x) <= '9') ? ((x) - '0') : \
+               (((x) <= 'F') ? ((x) - 'A' + 10) : \
+                       ((x) - 'a' + 10)))
+
+       for (c = p = buf; *p; c++)
+       {
+               if (*p == '%')
+               {
+                       if (!isxdigit(*(p + 1)) || !isxdigit(*(p + 2)))
+                               return false;
+
+                       *c = (char)(16 * hex(*(p + 1)) + hex(*(p + 2)));
+
+                       p += 3;
+               }
+               else if (*p == '+')
+               {
+                       *c = ' ';
+                       p++;
+               }
+               else
+               {
+                       *c = *p++;
+               }
+       }
+
+       *c = 0;
+
+       return true;
+}
+
+static bool
+postdecode(char **fields, int n_fields)
+{
+       char *p;
+       const char *var;
+       static char buf[1024];
+       int i, len, field, found = 0;
+
+       var = getenv("CONTENT_TYPE");
+
+       if (!var || strncmp(var, "application/x-www-form-urlencoded", 33))
+               return false;
+
+       memset(buf, 0, sizeof(buf));
+
+       if ((len = read(0, buf, sizeof(buf) - 1)) > 0)
+       {
+               for (p = buf, i = 0; i <= len; i++)
+               {
+                       if (buf[i] == '=')
+                       {
+                               buf[i] = 0;
+
+                               for (field = 0; field < (n_fields * 2); field += 2)
+                               {
+                                       if (!strcmp(p, fields[field]))
+                                       {
+                                               fields[field + 1] = buf + i + 1;
+                                               found++;
+                                       }
+                               }
+                       }
+                       else if (buf[i] == '&' || buf[i] == '\0')
+                       {
+                               buf[i] = 0;
+
+                               if (found >= n_fields)
+                                       break;
+
+                               p = buf + i + 1;
+                       }
+               }
+       }
+
+       for (field = 0; field < (n_fields * 2); field += 2)
+               if (!urldecode(fields[field + 1]))
+                       return false;
+
+       return (found >= n_fields);
+}
+
+static int
+response(bool success, const char *message)
+{
+       char *md5;
+       struct stat s;
+
+       printf("Status: 200 OK\r\n");
+       printf("Content-Type: text/plain\r\n\r\n{\n");
+
+       if (success)
+       {
+               if (!stat(st.filename, &s) && (md5 = md5sum(st.filename)) != NULL)
+                       printf("\t\"size\": %u,\n\t\"checksum\": \"%s\"\n",
+                                  (unsigned int)s.st_size, md5);
+       }
+       else
+       {
+               if (message)
+                       printf("\t\"message\": \"%s\",\n", message);
+
+               printf("\t\"failure\": [ %u, \"%s\" ]\n", errno, strerror(errno));
+
+               if (st.filefd > -1)
+                       unlink(st.filename);
+       }
+
+       printf("}\n");
+
+       return -1;
+}
+
+static int
+failure(int e, const char *message)
+{
+       printf("Status: 500 Internal Server failure\r\n");
+       printf("Content-Type: text/plain\r\n\r\n");
+       printf("%s", message);
+
+       if (e)
+               printf(": %s", strerror(e));
+
+       return -1;
+}
+
+static int
+filecopy(void)
+{
+       int len;
+       char buf[4096];
+
+       if (!st.filedata)
+       {
+               close(st.tempfd);
+               errno = EINVAL;
+               return response(false, "No file data received");
+       }
+
+       if (lseek(st.tempfd, 0, SEEK_SET) < 0)
+       {
+               close(st.tempfd);
+               return response(false, "Failed to rewind temp file");
+       }
+
+       st.filefd = open(st.filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
+
+       if (st.filefd < 0)
+       {
+               close(st.tempfd);
+               return response(false, "Failed to open target file");
+       }
+
+       while ((len = read(st.tempfd, buf, sizeof(buf))) > 0)
+       {
+               if (write(st.filefd, buf, len) != len)
+               {
+                       close(st.tempfd);
+                       close(st.filefd);
+                       return response(false, "I/O failure while writing target file");
+               }
+       }
+
+       close(st.tempfd);
+       close(st.filefd);
+
+       if (chmod(st.filename, st.filemode))
+               return response(false, "Failed to chmod target file");
+
+       return 0;
+}
+
+static int
+header_field(multipart_parser *p, const char *data, size_t len)
+{
+       st.is_content_disposition = !strncasecmp(data, "Content-Disposition", len);
+       return 0;
+}
+
+static int
+header_value(multipart_parser *p, const char *data, size_t len)
+{
+       int i, j;
+
+       if (!st.is_content_disposition)
+               return 0;
+
+       if (len < 10 || strncasecmp(data, "form-data", 9))
+               return 0;
+
+       for (data += 9, len -= 9; *data == ' ' || *data == ';'; data++, len--);
+
+       if (len < 8 || strncasecmp(data, "name=\"", 6))
+               return 0;
+
+       for (data += 6, len -= 6, i = 0; i <= len; i++)
+       {
+               if (*(data + i) != '"')
+                       continue;
+
+               for (j = 1; j < sizeof(parts) / sizeof(parts[0]); j++)
+                       if (!strncmp(data, parts[j], i))
+                               st.parttype = j;
+
+               break;
+       }
+
+       return 0;
+}
+
+static int
+data_begin_cb(multipart_parser *p)
+{
+       char tmpname[24] = "/tmp/luci-upload.XXXXXX";
+
+       if (st.parttype == PART_FILEDATA)
+       {
+               if (!st.sessionid)
+                       return response(false, "File data without session");
+
+               if (!st.filename)
+                       return response(false, "File data without name");
+
+               st.tempfd = mkstemp(tmpname);
+
+               if (st.tempfd < 0)
+                       return response(false, "Failed to create temporary file");
+
+               unlink(tmpname);
+       }
+
+       return 0;
+}
+
+static int
+data_cb(multipart_parser *p, const char *data, size_t len)
+{
+       switch (st.parttype)
+       {
+       case PART_SESSIONID:
+               st.sessionid = datadup(data, len);
+               break;
+
+       case PART_FILENAME:
+               st.filename = datadup(data, len);
+               break;
+
+       case PART_FILEMODE:
+               st.filemode = strtoul(data, NULL, 8);
+               break;
+
+       case PART_FILEDATA:
+               if (write(st.tempfd, data, len) != len)
+               {
+                       close(st.tempfd);
+                       return response(false, "I/O failure while writing temporary file");
+               }
+
+               if (!st.filedata)
+                       st.filedata = !!len;
+
+               break;
+
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+static int
+data_end_cb(multipart_parser *p)
+{
+       if (st.parttype == PART_SESSIONID)
+       {
+               if (!session_access(st.sessionid, "upload", "write"))
+               {
+                       errno = EPERM;
+                       return response(false, "Upload permission denied");
+               }
+       }
+       else if (st.parttype == PART_FILEDATA)
+       {
+               if (st.tempfd < 0)
+                       return response(false, "Internal program failure");
+
+#if 0
+               /* prepare directory */
+               for (ptr = st.filename; *ptr; ptr++)
+               {
+                       if (*ptr == '/')
+                       {
+                               *ptr = 0;
+
+                               if (mkdir(st.filename, 0755))
+                               {
+                                       unlink(st.tmpname);
+                                       return response(false, "Failed to create destination directory");
+                               }
+
+                               *ptr = '/';
+                       }
+               }
+#endif
+
+               if (filecopy())
+                       return -1;
+
+               return response(true, NULL);
+       }
+
+       st.parttype = PART_UNKNOWN;
+       return 0;
+}
+
+static multipart_parser *
+init_parser(void)
+{
+       char *boundary;
+       const char *var;
+
+       multipart_parser *p;
+       static multipart_parser_settings s = {
+               .on_part_data        = data_cb,
+               .on_headers_complete = data_begin_cb,
+               .on_part_data_end    = data_end_cb,
+               .on_header_field     = header_field,
+               .on_header_value     = header_value
+       };
+
+       var = getenv("CONTENT_TYPE");
+
+       if (!var || strncmp(var, "multipart/form-data;", 20))
+               return NULL;
+
+       for (var += 20; *var && *var != '='; var++);
+
+       if (*var++ != '=')
+               return NULL;
+
+       boundary = malloc(strlen(var) + 3);
+
+       if (!boundary)
+               return NULL;
+
+       strcpy(boundary, "--");
+       strcpy(boundary + 2, var);
+
+       st.tempfd = -1;
+       st.filefd = -1;
+       st.filemode = 0600;
+
+       p = multipart_parser_init(boundary, &s);
+
+       free(boundary);
+
+       return p;
+}
+
+static int
+main_upload(int argc, char *argv[])
+{
+       int rem, len;
+       char buf[4096];
+       multipart_parser *p;
+
+       p = init_parser();
+
+       if (!p)
+       {
+               errno = EINVAL;
+               return response(false, "Invalid request");
+       }
+
+       while ((len = read(0, buf, sizeof(buf))) > 0)
+       {
+               rem = multipart_parser_execute(p, buf, len);
+
+               if (rem < len)
+                       break;
+       }
+
+       multipart_parser_free(p);
+
+       /* read remaining post data */
+       while ((len = read(0, buf, sizeof(buf))) > 0);
+
+       return 0;
+}
+
+static int
+main_backup(int argc, char **argv)
+{
+       pid_t pid;
+       time_t now;
+       int len;
+       int fds[2];
+       char buf[4096];
+       char datestr[16] = { 0 };
+       char hostname[64] = { 0 };
+       char *fields[] = { "sessionid", NULL };
+
+       if (!postdecode(fields, 1) || !session_access(fields[1], "backup", "read"))
+               return failure(0, "Backup permission denied");
+
+       if (pipe(fds))
+               return failure(errno, "Failed to spawn pipe");
+
+       switch ((pid = fork()))
+       {
+       case -1:
+               return failure(errno, "Failed to fork process");
+
+       case 0:
+               dup2(fds[1], 1);
+
+               close(0);
+               close(2);
+               close(fds[0]);
+               close(fds[1]);
+
+               chdir("/");
+
+               execl("/sbin/sysupgrade", "/sbin/sysupgrade",
+                     "--create-backup", "-", NULL);
+
+               return -1;
+
+       default:
+               now = time(NULL);
+               strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", localtime(&now));
+
+               if (gethostname(hostname, sizeof(hostname) - 1))
+                       sprintf(hostname, "OpenWrt");
+
+               printf("Status: 200 OK\r\n");
+               printf("Content-Type: application/x-targz\r\n");
+               printf("Content-Disposition: attachment; "
+                      "filename=\"backup-%s-%s.tar.gz\"\r\n\r\n", hostname, datestr);
+
+               while ((len = read(fds[0], buf, sizeof(buf))) > 0)
+                       fwrite(buf, len, 1, stdout);
+
+               waitpid(pid, NULL, 0);
+
+               close(fds[0]);
+               close(fds[1]);
+
+               return 0;
+       }
+}
+
+int main(int argc, char **argv)
+{
+       if (strstr(argv[0], "cgi-upload"))
+               return main_upload(argc, argv);
+       else if (strstr(argv[0], "cgi-backup"))
+               return main_backup(argc, argv);
+
+       return -1;
+}
diff --git a/net/cgi-io/src/multipart_parser.c b/net/cgi-io/src/multipart_parser.c
new file mode 100644 (file)
index 0000000..ee82c82
--- /dev/null
@@ -0,0 +1,309 @@
+/* Based on node-formidable by Felix Geisendörfer
+ * Igor Afonov - afonov@gmail.com - 2012
+ * MIT License - http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include "multipart_parser.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+static void multipart_log(const char * format, ...)
+{
+#ifdef DEBUG_MULTIPART
+    va_list args;
+    va_start(args, format);
+
+    fprintf(stderr, "[HTTP_MULTIPART_PARSER] %s:%d: ", __FILE__, __LINE__);
+    vfprintf(stderr, format, args);
+    fprintf(stderr, "\n");
+#endif
+}
+
+#define NOTIFY_CB(FOR)                                                 \
+do {                                                                   \
+  if (p->settings->on_##FOR) {                                         \
+    if (p->settings->on_##FOR(p) != 0) {                               \
+      return i;                                                        \
+    }                                                                  \
+  }                                                                    \
+} while (0)
+
+#define EMIT_DATA_CB(FOR, ptr, len)                                    \
+do {                                                                   \
+  if (p->settings->on_##FOR) {                                         \
+    if (p->settings->on_##FOR(p, ptr, len) != 0) {                     \
+      return i;                                                        \
+    }                                                                  \
+  }                                                                    \
+} while (0)
+
+
+#define LF 10
+#define CR 13
+
+struct multipart_parser {
+  void * data;
+
+  size_t index;
+  size_t boundary_length;
+
+  unsigned char state;
+
+  const multipart_parser_settings* settings;
+
+  char* lookbehind;
+  char multipart_boundary[1];
+};
+
+enum state {
+  s_uninitialized = 1,
+  s_start,
+  s_start_boundary,
+  s_header_field_start,
+  s_header_field,
+  s_headers_almost_done,
+  s_header_value_start,
+  s_header_value,
+  s_header_value_almost_done,
+  s_part_data_start,
+  s_part_data,
+  s_part_data_almost_boundary,
+  s_part_data_boundary,
+  s_part_data_almost_end,
+  s_part_data_end,
+  s_part_data_final_hyphen,
+  s_end
+};
+
+multipart_parser* multipart_parser_init
+    (const char *boundary, const multipart_parser_settings* settings) {
+
+  multipart_parser* p = malloc(sizeof(multipart_parser) +
+                               strlen(boundary) +
+                               strlen(boundary) + 9);
+
+  strcpy(p->multipart_boundary, boundary);
+  p->boundary_length = strlen(boundary);
+
+  p->lookbehind = (p->multipart_boundary + p->boundary_length + 1);
+
+  p->index = 0;
+  p->state = s_start;
+  p->settings = settings;
+
+  return p;
+}
+
+void multipart_parser_free(multipart_parser* p) {
+  free(p);
+}
+
+void multipart_parser_set_data(multipart_parser *p, void *data) {
+    p->data = data;
+}
+
+void *multipart_parser_get_data(multipart_parser *p) {
+    return p->data;
+}
+
+size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len) {
+  size_t i = 0;
+  size_t mark = 0;
+  char c, cl;
+  int is_last = 0;
+
+  while(i < len) {
+    c = buf[i];
+    is_last = (i == (len - 1));
+    switch (p->state) {
+      case s_start:
+        multipart_log("s_start");
+        p->index = 0;
+        p->state = s_start_boundary;
+
+      /* fallthrough */
+      case s_start_boundary:
+        multipart_log("s_start_boundary");
+        if (p->index == p->boundary_length) {
+          if (c != CR) {
+            return i;
+          }
+          p->index++;
+          break;
+        } else if (p->index == (p->boundary_length + 1)) {
+          if (c != LF) {
+            return i;
+          }
+          p->index = 0;
+          NOTIFY_CB(part_data_begin);
+          p->state = s_header_field_start;
+          break;
+        }
+        if (c != p->multipart_boundary[p->index]) {
+          return i;
+        }
+        p->index++;
+        break;
+
+      case s_header_field_start:
+        multipart_log("s_header_field_start");
+        mark = i;
+        p->state = s_header_field;
+
+      /* fallthrough */
+      case s_header_field:
+        multipart_log("s_header_field");
+        if (c == CR) {
+          p->state = s_headers_almost_done;
+          break;
+        }
+
+        if (c == '-') {
+          break;
+        }
+
+        if (c == ':') {
+          EMIT_DATA_CB(header_field, buf + mark, i - mark);
+          p->state = s_header_value_start;
+          break;
+        }
+
+        cl = tolower(c);
+        if (cl < 'a' || cl > 'z') {
+          multipart_log("invalid character in header name");
+          return i;
+        }
+        if (is_last)
+            EMIT_DATA_CB(header_field, buf + mark, (i - mark) + 1);
+        break;
+
+      case s_headers_almost_done:
+        multipart_log("s_headers_almost_done");
+        if (c != LF) {
+          return i;
+        }
+
+        p->state = s_part_data_start;
+        break;
+
+      case s_header_value_start:
+        multipart_log("s_header_value_start");
+        if (c == ' ') {
+          break;
+        }
+
+        mark = i;
+        p->state = s_header_value;
+
+      /* fallthrough */
+      case s_header_value:
+        multipart_log("s_header_value");
+        if (c == CR) {
+          EMIT_DATA_CB(header_value, buf + mark, i - mark);
+          p->state = s_header_value_almost_done;
+        }
+        if (is_last)
+            EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1);
+        break;
+
+      case s_header_value_almost_done:
+        multipart_log("s_header_value_almost_done");
+        if (c != LF) {
+          return i;
+        }
+        p->state = s_header_field_start;
+        break;
+
+      case s_part_data_start:
+        multipart_log("s_part_data_start");
+        NOTIFY_CB(headers_complete);
+        mark = i;
+        p->state = s_part_data;
+
+      /* fallthrough */
+      case s_part_data:
+        multipart_log("s_part_data");
+        if (c == CR) {
+            EMIT_DATA_CB(part_data, buf + mark, i - mark);
+            mark = i;
+            p->state = s_part_data_almost_boundary;
+            p->lookbehind[0] = CR;
+            break;
+        }
+        if (is_last)
+            EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1);
+        break;
+
+      case s_part_data_almost_boundary:
+        multipart_log("s_part_data_almost_boundary");
+        if (c == LF) {
+            p->state = s_part_data_boundary;
+            p->lookbehind[1] = LF;
+            p->index = 0;
+            break;
+        }
+        EMIT_DATA_CB(part_data, p->lookbehind, 1);
+        p->state = s_part_data;
+        mark = i --;
+        break;
+
+      case s_part_data_boundary:
+        multipart_log("s_part_data_boundary");
+        if (p->multipart_boundary[p->index] != c) {
+          EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index);
+          p->state = s_part_data;
+          mark = i --;
+          break;
+        }
+        p->lookbehind[2 + p->index] = c;
+        if ((++ p->index) == p->boundary_length) {
+            NOTIFY_CB(part_data_end);
+            p->state = s_part_data_almost_end;
+        }
+        break;
+
+      case s_part_data_almost_end:
+        multipart_log("s_part_data_almost_end");
+        if (c == '-') {
+            p->state = s_part_data_final_hyphen;
+            break;
+        }
+        if (c == CR) {
+            p->state = s_part_data_end;
+            break;
+        }
+        return i;
+
+      case s_part_data_final_hyphen:
+        multipart_log("s_part_data_final_hyphen");
+        if (c == '-') {
+            NOTIFY_CB(body_end);
+            p->state = s_end;
+            break;
+        }
+        return i;
+
+      case s_part_data_end:
+        multipart_log("s_part_data_end");
+        if (c == LF) {
+            p->state = s_header_field_start;
+            NOTIFY_CB(part_data_begin);
+            break;
+        }
+        return i;
+
+      case s_end:
+        multipart_log("s_end: %02X", (int) c);
+        break;
+
+      default:
+        multipart_log("Multipart parser unrecoverable error");
+        return 0;
+    }
+    ++ i;
+  }
+
+  return len;
+}
diff --git a/net/cgi-io/src/multipart_parser.h b/net/cgi-io/src/multipart_parser.h
new file mode 100644 (file)
index 0000000..87e67f4
--- /dev/null
@@ -0,0 +1,48 @@
+/* Based on node-formidable by Felix Geisendörfer
+ * Igor Afonov - afonov@gmail.com - 2012
+ * MIT License - http://www.opensource.org/licenses/mit-license.php
+ */
+#ifndef _multipart_parser_h
+#define _multipart_parser_h
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+#include <ctype.h>
+
+typedef struct multipart_parser multipart_parser;
+typedef struct multipart_parser_settings multipart_parser_settings;
+typedef struct multipart_parser_state multipart_parser_state;
+
+typedef int (*multipart_data_cb) (multipart_parser*, const char *at, size_t length);
+typedef int (*multipart_notify_cb) (multipart_parser*);
+
+struct multipart_parser_settings {
+  multipart_data_cb on_header_field;
+  multipart_data_cb on_header_value;
+  multipart_data_cb on_part_data;
+
+  multipart_notify_cb on_part_data_begin;
+  multipart_notify_cb on_headers_complete;
+  multipart_notify_cb on_part_data_end;
+  multipart_notify_cb on_body_end;
+};
+
+multipart_parser* multipart_parser_init
+    (const char *boundary, const multipart_parser_settings* settings);
+
+void multipart_parser_free(multipart_parser* p);
+
+size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len);
+
+void multipart_parser_set_data(multipart_parser* p, void* data);
+void * multipart_parser_get_data(multipart_parser* p);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/net/chaosvpn/Makefile b/net/chaosvpn/Makefile
new file mode 100644 (file)
index 0000000..0205752
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2010-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=chaosvpn
+
+PKG_REV:=2eb24810b5aa0b2d56f21562e52927020dc3090a
+PKG_VERSION:=2014-01-24
+PKG_RELEASE=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/ryd/chaosvpn.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_LICENSE:=Apache-2.0
+PKG_MAINTAINER:Norbert Summer <git@o-g.at>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/chaosvpn
+               TITLE:=Config generator for chaos vpn
+               SECTION:=net
+               CATEGORY:=Network
+               URL:=https://wiki.hamburg.ccc.de/index.php/ChaosVPN::DebianHowto
+               SUBMENU:=VPN
+               DEPENDS:=+tinc +ip +kmod-tun +libopenssl
+endef
+
+define Package/chaosvpn/description
+               Configure tincd for the chaosvpn network
+endef
+
+define Package/chaosvpn/conffiles
+/etc/tinc/chaosvpn.conf
+endef
+
+MAKE_FLAGS += \
+               COPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)"
+
+define Package/chaosvpn/install
+               $(INSTALL_DIR) $(1)/etc/tinc/chaos/ $(1)/usr/sbin/ $(1)/etc/init.d/ $(1)/etc/hotplug.d/iface/
+               $(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn $(1)/usr/sbin/
+               $(INSTALL_BIN) ./files/chaosvpn.init $(1)/etc/init.d/chaosvpn
+               $(INSTALL_BIN) ./files/chaosvpn.hotplug $(1)/etc/hotplug.d/iface/40-chaosvpn
+               sed  -i -e 's/"\/sbin\/ip /"\/usr\/sbin\/ip /' $(PKG_BUILD_DIR)/chaosvpn.conf
+               $(INSTALL_CONF) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/chaosvpn.conf
+endef
+
+$(eval $(call BuildPackage,chaosvpn))
+
diff --git a/net/chaosvpn/files/chaosvpn.hotplug b/net/chaosvpn/files/chaosvpn.hotplug
new file mode 100755 (executable)
index 0000000..3044e53
--- /dev/null
@@ -0,0 +1,3 @@
+[ "$INTERFACE" == "wan" ] || return
+[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart
+
diff --git a/net/chaosvpn/files/chaosvpn.init b/net/chaosvpn/files/chaosvpn.init
new file mode 100755 (executable)
index 0000000..f847a9a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh /etc/rc.common
+START=99
+
+USE_PROCD=1
+
+start_service()
+{
+  #check if chaosvpn is configured
+  if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then
+    logger -t chaosvpn "please generate rsa key pair"
+    logger -t chaosvpn "tincd -n chaos --generate-keys=2048"
+    exit 1
+  fi
+
+  if [ "`grep unique_name /etc/tinc/chaosvpn.conf  | wc -l`" != "0" ]; then
+    logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'"
+    exit 1
+  fi
+
+  procd_open_instance
+  procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf
+  procd_close_instance
+}
+
+stop_service()
+{
+  #force remove tinc pid
+  if [ -f "/var/run/tinc.chaos.pid" ]; then
+    rm "/var/run/tinc.chaos.pid"
+  fi
+}
diff --git a/net/chrony/Makefile b/net/chrony/Makefile
new file mode 100644 (file)
index 0000000..5ef68cf
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=chrony
+PKG_VERSION:=2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.tuxfamily.org/chrony/
+PKG_MD5SUM:=17bc77d3d2ce942675f9600b60452717
+
+PKG_MAINTAINER:=Miroslav Lichvar <mlichvar0@gmail.com>
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DEPENDS:=+pps-tools
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/chrony
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcap
+  USERID:=chrony=323:chrony=323
+  TITLE:=A versatile NTP client and server
+  URL:=http://chrony.tuxfamily.org/
+endef
+
+define Package/chrony/description
+       An NTP client and server designed to perform well in a wide range
+       of conditions. It can synchronize the system clock with NTP servers,
+       reference clocks, and manual input using wristwatch and keyboard.
+endef
+
+define Package/chrony/conffiles
+/etc/chrony/chrony.conf
+/etc/config/chrony
+endef
+
+CONFIGURE_ARGS+= \
+       --host-machine=$(shell echo $(GNU_TARGET_NAME) | sed -e 's/-.*//') \
+       --host-release="" \
+       --host-system=Linux \
+       --sysconfdir=/etc/chrony \
+       --prefix=/usr \
+       --chronysockdir=/var/run/chrony \
+       --disable-readline \
+       --disable-rtc \
+       --disable-asyncdns \
+       --with-user=chrony
+
+CONFIGURE_VARS+=CPPFLAGS=-DNDEBUG
+
+define Package/chrony/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyd $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyc $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DIR) $(1)/etc/chrony
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/chrony.hotplug $(1)/etc/hotplug.d/iface/20-chrony
+       $(INSTALL_BIN) ./files/chronyd.init $(1)/etc/init.d/chronyd
+       $(INSTALL_CONF) ./files/chrony.config $(1)/etc/config/chrony
+       $(INSTALL_CONF) ./files/chrony.conf $(1)/etc/chrony/chrony.conf
+endef
+
+$(eval $(call BuildPackage,chrony))
diff --git a/net/chrony/files/chrony.conf b/net/chrony/files/chrony.conf
new file mode 100644 (file)
index 0000000..b207c94
--- /dev/null
@@ -0,0 +1,7 @@
+# This file is included from config file generated from /etc/config/chrony
+
+# Log clock errors above 0.5 seconds
+logchange 0.5
+
+# Don't log client accesses
+noclientlog
diff --git a/net/chrony/files/chrony.config b/net/chrony/files/chrony.config
new file mode 100644 (file)
index 0000000..56d2b88
--- /dev/null
@@ -0,0 +1,11 @@
+config pool
+       option hostname '2.openwrt.pool.ntp.org'
+       option maxpoll '12'
+       option iburst 'yes'
+
+config allow
+       option interface 'lan'
+
+config makestep
+       option threshold '1.0'
+       option limit '3'
diff --git a/net/chrony/files/chrony.hotplug b/net/chrony/files/chrony.hotplug
new file mode 100644 (file)
index 0000000..5f6a14b
--- /dev/null
@@ -0,0 +1,6 @@
+COMMAND=/usr/bin/chronyc
+
+[ -x $COMMAND ] || exit 0
+
+[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && $COMMAND online
+[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && $COMMAND offline
diff --git a/net/chrony/files/chronyd.init b/net/chrony/files/chronyd.init
new file mode 100644 (file)
index 0000000..9be3a90
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+USE_PROCD=1
+PROG=/usr/sbin/chronyd
+CONFIGFILE=/var/etc/chrony.conf
+
+handle_source() {
+       local cfg=$1 sourcetype=$2 hostname minpoll maxpoll iburst
+
+       config_get hostname "$cfg" hostname
+       [ -z "$hostname" ] && return
+       config_get minpoll "$cfg" minpoll
+       config_get maxpoll "$cfg" maxpoll
+       config_get_bool iburst "$cfg" iburst 0
+       echo $(
+               echo $sourcetype $hostname
+               [ -n "$minpoll" ] && echo minpoll $minpoll
+               [ -n "$maxpoll" ] && echo maxpoll $maxpoll
+               [ "$iburst" = "1" ] && echo iburst
+       ) >> $CONFIGFILE
+}
+
+handle_allow() {
+       local cfg=$1 iface wan_iface wan6_iface subnet subnets subnets6
+
+       network_find_wan wan_iface true
+       network_find_wan6 wan6_iface true
+       config_get iface "$cfg" interface
+
+       if [ "$wan_iface" = "$iface" ]; then
+               echo allow >> $CONFIGFILE
+       else
+               network_get_subnets subnets $iface || \
+                       network_get_subnets subnets6 $iface || continue
+               for subnet in $subnets $subnets6; do
+                       echo allow $subnet >> $CONFIGFILE
+               done
+       fi
+}
+
+handle_makestep() {
+       local cfg=$1 threshold limit
+
+       config_get threshold "$cfg" threshold
+       config_get limit "$cfg" limit
+       [ -z "$threshold" -o -z "$limit" ] && return
+       echo makestep $threshold $limit >> $CONFIGFILE
+}
+
+start_service() {
+       . /lib/functions/network.sh
+
+       procd_open_instance
+       procd_set_param command $PROG -n -f $CONFIGFILE
+       procd_set_param file $CONFIGFILE
+       procd_set_param file /etc/chrony/chrony.conf
+       procd_close_instance
+
+       echo include /etc/chrony/chrony.conf > $CONFIGFILE
+
+       config_load ntpd
+       config_foreach handle_source server server
+       config_foreach handle_source pool pool
+       config_foreach handle_source peer peer
+       config_foreach handle_allow allow
+       config_foreach handle_makestep makestep
+}
index 1ca475661b74d7e135e81de7b7598b78ae582301..d388b3f2225784ed23c8f5bb6551e33336b2bd9c 100755 (executable)
@@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
 PKG_VERSION:=2.4.3
 # Release == build
 # increase on changes of services files or tld_names.dat
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=GPL-2.0
 PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
index b3ac40564c3601ff5fbbc7b25d1efedde843f74b..4d81a246df1f55dd7c45a56a3b2440266e19ba7a 100644 (file)
@@ -91,3 +91,6 @@
 
 # domains.google.com   non free service - require HTTPS communication
 "domains.google.com"   "https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
+
+# Schokokeks Hosting, schokokeks.org
+"schokokeks.org" "http://[USERNAME]:[PASSWORD]@dyndns.schokokeks.org/nic/update?myip=[IP]"
index 1a0d832b6f9f38d9e70dc74c007093d3ed62a32b..110765407202755fb266466b979ec18a22665b1b 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ethtool
-PKG_VERSION:=4.0
+PKG_VERSION:=4.2
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
-PKG_MD5SUM:=37c77b02556255e4122c3636f75a8646
+PKG_MD5SUM:=8433e71a256678d859ecc264132063c5
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
index 27f75c6ef0bfaba3933fd961d0f7776fffa31a51..e529a889185c3c08c496dd18181df55426469ae4 100644 (file)
@@ -1,22 +1,27 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+
+USE_PROCD=1
+
 START=50
 
+NAME=radiusd
+PROG=/usr/sbin/radiusd
 DEFAULT=/etc/default/radiusd
-LOG_D=/var/log
-RUN_D=/var/run
-PID_F=$RUN_D/radiusd.pid
-RADACCT_D=/var/db/radacct
-IPADDR=$(ifconfig br-lan | sed -n 's/.*dr:\(.*\)Bc.*/\1/p')
 
-start() {
+start_service()
+{
        [ -f $DEFAULT ] && . $DEFAULT
-       mkdir -p $LOG_D
-       mkdir -p $RUN_D
-       mkdir -p $RADACCT_D
-       radiusd -i $IPADDR -p 1812,1813 $OPTIONS
-}
+       mkdir -p /var/log
+       mkdir -p /var/run
+       mkdir -p /var/db/radacct
 
-stop() {
-       [ -f $PID_F ] && kill $(cat $PID_F)
+       procd_open_instance
+       procd_set_param command $PROG
+       [ -n "$IPADDR" ] && procd_append_param command -i $IPADDR
+       [ -n "$OPTIONS" ] && procd_append_param command $OPTIONS
+       procd_set_param respawn
+       procd_close_instance
 }
index 13c2681f551665cab96c454442d1a6385861911b..2114cc9aa6192b7efc975a71954b335ac6441db4 100644 (file)
@@ -87,7 +87,7 @@ define Package/libfko/description
 endef
 
 
-ifeq ($(CONFIG_FWKNOPD_GPG),n)
+ifneq ($(CONFIG_FWKNOPD_GPG),y)
        CONFIGURE_ARGS += --without-gpgme 
 endif
 
index 4c86493de98cfdc67293ff8f6aef3ab140dbd060..97763121ac2577d355a893eaf48aeca33ca82083 100644 (file)
@@ -36,7 +36,7 @@ reload()
 gen_confs()
 {
        [ -f /tmp/access.conf.tmp ] && rm /tmp/access.conf.tmp
-       if [`uci get fwknopd.@access[0].PCAP_INTF` = ""]
+       if [ "`uci get fwknopd.@config[0].PCAP_INTF`" = ""]
        then
                . /lib/functions/network.sh
                network_get_physdev device wan
index 89ace0ba8eb525fb9659f5ac143858468ebee00f..3f646fcc5da91223ae234c306c920812bb073f94 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=git
-PKG_VERSION:=2.4.6
+PKG_VERSION:=2.6.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/scm/git/
-PKG_MD5SUM:=fb2c5214f5dc90bad0a2abdd4c425df6
+PKG_MD5SUM:=6b7d43d615fb3f0dfecf4d131e23f438
 
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
index 4742deeb7a297882a1819b038be752fe95d2ffeb..3f9ea0c66dad65a3236a6834b7ed08f19038288f 100644 (file)
@@ -33,7 +33,7 @@ define Package/lispd
   CATEGORY:=Network
   TITLE:=Locator/ID separation protocol (using TUN)
   URL:=https://github.com/LISPmob
-  DEPENDS:= +librt +libopenssl +confuse +kmod-tun +uci +kmod-ipv6
+  DEPENDS:= +librt +libopenssl +confuse +kmod-tun +uci @IPV6
   $(call Package/lispd/default)
 endef
 
index 97511b9985df32852e99bf272eb224e837e7f327..bcf56f05ef4c6c58872c9ef9fd7e6bcd86765c33 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mwan3
 PKG_VERSION:=1.6
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_MAINTAINER:=Jeroen Louwes <jeroen.louwes@gmail.com>
 PKG_LICENSE:=GPLv2
 
index f117e49e6bc24a5f4356d438808d328bcbcaba0f..12423c794f867ca60011dc4df8bbbcacb7133868 100644 (file)
@@ -1,5 +1,41 @@
 #!/bin/sh
 
+local IP IPS IPT LOG
+
+[ -n "$ACTION" ] || exit 0
+[ -n "$INTERFACE" ] || exit 0
+
+if [ $ACTION == "ifup" ]; then
+        [ -n "$DEVICE" ] || exit 0
+fi
+
+if [ -x /usr/sbin/ip ]; then
+        IP="/usr/sbin/ip -4"
+elif [ -x /usr/bin/ip ]; then
+        IP="/usr/bin/ip -4"
+else
+        exit 1
+fi
+
+if [ -x /usr/sbin/ipset ]; then
+        IPS="/usr/sbin/ipset"
+else
+        exit 1
+fi
+
+if [ -x /usr/sbin/iptables ]; then
+        IPT="/usr/sbin/iptables -t mangle -w"
+else
+        exit 1
+fi
+
+if [ -x /usr/bin/logger ]; then
+        LOG="/usr/bin/logger -t mwan3 -p"
+else
+        exit 1
+fi
+
+
 mwan3_get_iface_id()
 {
        let iface_count++
@@ -398,25 +434,6 @@ mwan3_ifupdown()
        config_foreach mwan3_set_user_rules_iptables rule
 }
 
-[ -n "$ACTION" ] || exit 0
-[ -n "$INTERFACE" ] || exit 0
-
-if [ $ACTION == "ifup" ]; then
-       [ -n "$DEVICE" ] || exit 0
-fi
-
-[ -x /usr/sbin/ip ] || exit 1
-[ -x /usr/sbin/ipset ] || exit 1
-[ -x /usr/sbin/iptables ] || exit 1
-[ -x /usr/bin/logger ] || exit 1
-
-local IP IPS IPT LOG
-
-IP="/usr/sbin/ip -4"
-IPS="/usr/sbin/ipset"
-IPT="/usr/sbin/iptables -t mangle -w"
-LOG="/usr/bin/logger -t mwan3 -p"
-
 case "$ACTION" in
        ifup|ifdown)
                mwan3_ifupdown
index b887fa5e6b446e99312c3c9c814f34c8bde00f7e..a5da22ac9ffcff4a36472b56f0cc53fd92db276e 100755 (executable)
@@ -1,9 +1,26 @@
 #!/bin/sh
-. /lib/functions.sh
 
-IP="/usr/sbin/ip -4"
-IPS="/usr/sbin/ipset"
-IPT="/usr/sbin/iptables -t mangle -w"
+if [ -x /usr/sbin/ip ]; then
+        IP="/usr/sbin/ip -4"
+elif [ -x /usr/bin/ip ]; then
+        IP="/usr/bin/ip -4"
+else
+        exit 1
+fi
+
+if [ -x /usr/sbin/ipset ]; then
+        IPS="/usr/sbin/ipset"
+else
+        exit 1
+fi
+
+if [ -x /usr/sbin/iptables ]; then
+        IPT="/usr/sbin/iptables -t mangle -w"
+else
+        exit 1
+fi
+
+. /lib/functions.sh
 
 help()
 {
index e66fe65f5513f5fce0cd68a2b15b91e9fe8fd975..8c2d26daa5cc43f73c3819b3a8b70ad014fc4d16 100644 (file)
@@ -7,9 +7,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nfs-kernel-server
-PKG_VERSION:=1.3.2
-PKG_RELEASE:=4
-PKG_MD5SUM:=1e2f3c1ed468dee02d00c534c002ea10
+PKG_VERSION:=1.3.3
+PKG_RELEASE:=1
+PKG_MD5SUM:=9b87d890669eaaec8e97a2b0a35b2665
 
 PKG_SOURCE_URL:=@SF/nfs
 PKG_SOURCE:=nfs-utils-$(PKG_VERSION).tar.bz2
index b37dbca01d54a6aca4e542623628363ac7ba025d..b48102f34f131568bfada501da6b75d46b0f8b62 100644 (file)
                        some space and build NUT without SSL support.
                default n
        
-       config NUT_DRIVER_SERIAL
-               depends on PACKAGE_nut
-               bool "Build with support for serial drivers"
-               help
-                       If you have a UPS connected via serial, select this.
-               default n
-       
        config NUT_DRIVER_USB
                depends on PACKAGE_nut
                bool "Build with support for USB drivers"
index 176ab5150826d162559a949851f29e5f3a328871..41ab4cc4448c4338c95ef82fd5012518c4f9e0f8 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nut
 PKG_VERSION:=2.7.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
@@ -28,11 +28,10 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_NUT_CLIENTS_UPSMON \
        CONFIG_NUT_CLIENTS_UPSRW \
        CONFIG_NUT_CLIENTS_UPSSCHED \
-       CONFIG_NUT_DRIVER_SERIAL \
        CONFIG_NUT_DRIVER_SNMP \
        CONFIG_NUT_DRIVER_USB \
        CONFIG_NUT_SERVER \
-       CONFIG_NUT_SSL \
+       CONFIG_NUT_SSL
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -78,7 +77,6 @@ endef
 define Package/nut/install
        $(INSTALL_DIR) $(1)/etc/nut
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_DIR) $(1)/usr/lib
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
@@ -102,7 +100,7 @@ define Package/nut/install
        $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users)
        $(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/)
        $(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/)
-       $(if $(CONFIG_NUT_CLIENTS_LOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
+       $(if $(CONFIG_NUT_CLIENTS_UPSLOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
        $(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/)
        $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/)
        $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/)
@@ -112,13 +110,62 @@ define Package/nut/install
        $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf)
 endef
 
+define Package/nut-web-cgi
+       $(call Package/nut/Default)
+       TITLE+= Web CGI interface
+       DEPENDS+=+libgd
+endef
+
+define Package/nut-web-cgi/description
+The CGI programs are clients that run through your web server.
+They allow you to see UPS status and perform certain administrative
+commands from any web browser. Javascript and cookies are not required.
+endef
+
+define Package/nut-web-cgi/conffiles
+       /etc/nut/hosts.conf
+       /etc/nut/upsset.conf
+       /etc/nut/upsstats.html
+       /etc/nut/upsstats-single.html
+endef
+
+define Package/nut-web-cgi/install
+       $(INSTALL_DIR) $(1)/etc/nut
+       $(INSTALL_DIR) $(1)/usr/share/www/cgi-bin
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/hosts.conf.sample $(1)/etc/nut/hosts.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsset.conf.sample $(1)/etc/nut/upsset.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats.html.sample $(1)/etc/nut/upsstats.html
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats-single.html.sample $(1)/etc/nut/upsstats-single.html
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/www/nut $(1)/usr/share/www/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/www/cgi-bin/nut $(1)/usr/share/www/cgi-bin/
+endef
+
+define Package/nut-avahi-service
+       $(call Package/nut/Default)
+       TITLE+= (Avahi service)
+       DEPENDS+=+avahi-daemon
+endef
+
+define Package/nut-avahi-service/description
+This package contains the service definition for announcing the
+attached UPS via mDNS/DNS-SD.
+endef
+
+define Package/nut-avahi-service/conffiles
+       /etc/avahi/services/nut.service
+endef
+
+define Package/nut-avahi-service/install
+       $(INSTALL_DIR) $(1)/etc/avahi/services
+       $(INSTALL_CONF) ./files/nut.service $(1)/etc/avahi/services/
+endef
+
 # Dealing with all of the drivers is very repetitive, but the previous
 # maintainer had a neat solution which just needed some tweaking.
 define DriverPackage
         define Package/nut-driver-$(2)
                $(call Package/nut/Default)
                TITLE:=$(2) (NUT $(1) driver)
-               $(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL)
                $(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP)
                $(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB)
         endef
@@ -270,24 +317,36 @@ $(eval $(call DriverDescription,usb,nutdrv_qx,\
        Driver for Q* protocol serial and USB based UPS equipment))
 
 CONFIGURE_ARGS += \
-       --$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \
+       --sysconfdir=/etc/nut \
+       --datadir=/usr/share/nut \
+       --with-dev \
        --$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
+       --without-avahi \
        --$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \
        --without-neon \
        --without-powerman \
        --without-ipmi \
        --without-freeipmi \
        --$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \
-       --without-avahi \
        --without-libltdl \
-       --with-user=root \
-       --with-group=root \
-       --sysconfdir=/etc/nut \
-       --with-drvpath=/lib/nut \
+       --$(if $(CONFIG_PACKAGE_nut-web-cgi),with,without)-cgi \
        --with-statepath=/var/run \
-       --datadir=/usr/share/nut
+       --with-drvpath=/lib/nut \
+       --with-cgipath=/usr/share/www/cgi-bin/nut \
+       --with-htmlpath=/usr/share/www/nut \
+       --with-user=root \
+       --with-group=root
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
+endef
 
 $(eval $(call BuildPackage,nut))
+$(eval $(call BuildPackage,nut-web-cgi))
+$(eval $(call BuildPackage,nut-avahi-service))
 $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d))))
 $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
 $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
diff --git a/net/nut/files/nut.service b/net/nut/files/nut.service
new file mode 100644 (file)
index 0000000..5ad6b31
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+
+<!--
+  This file is part of NUT - Network UPS Tools
+
+  NUT is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  NUT is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with NUT; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+  02111-1307 USA.
+-->
+
+<!-- See avahi.service(5) for more information about this configuration file -->
+
+<service-group>
+
+  <name replace-wildcards="yes">%h</name>
+
+  <service>
+    <type>_nut._tcp</type>
+    <port>3493</port>
+  </service>
+
+</service-group>
index f0a85bbc52fe507160d9dfd9fc55f9f076a1b3db..879142dcdafb0b5b1daa77124d6a9cf8e3ace383 100644 (file)
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ocserv
-PKG_VERSION:=0.10.8
+PKG_VERSION:=0.10.9
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/ocserv/
-PKG_MD5SUM:=665b854377850db535271098a37213f1
+PKG_MD5SUM:=74834c59aa96beaa222c21ee6521adb2
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=COPYING
index 86e6c52afb096f0061993779c7af8807072f57f8..1446c38989958416ae94e20648dec26aeb94f063 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openvswitch
 
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_VERSION:=2.4.0
 PKG_RELEASE=$(PKG_SOURCE_VERSION)
 PKG_LICENSE:=Apache-2.0
@@ -21,7 +21,7 @@ PKG_USE_MIPS16:=0
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=1b05a9d3298f92525d1c2d91bec11abf0766fdf1
+PKG_SOURCE_VERSION:=b979c282ef040a20d09b8d6885648b09352f05db
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 
 PKG_BUILD_PARALLEL:=1
@@ -98,7 +98,7 @@ define KernelPackage/openvswitch
   SUBMENU:=Network Support
   TITLE:=Open vSwitch Kernel Package
   KCONFIG:=CONFIG_BRIDGE
-  DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan @($(SUPPORTED_KERNELS))
+  DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan @($(SUPPORTED_KERNELS))
   FILES:= \
        $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
   AUTOLOAD:=$(call AutoLoad,21,openvswitch)
diff --git a/net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch b/net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch
deleted file mode 100644 (file)
index d6dd6a1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/tests/test-ovn.c b/tests/test-ovn.c
-index 60b87de..4ad3697 100644
---- a/tests/test-ovn.c
-+++ b/tests/test-ovn.c
-@@ -974,6 +974,9 @@ test_tree_shape_exhaustively(struct expr *expr, struct shash *symtab,
- }
- #ifndef _WIN32
-+#ifndef WAIT_ANY
-+#define WAIT_ANY   (-1)
-+#endif
- static void
- wait_pid(pid_t *pids, int *n)
- {
diff --git a/net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch b/net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch
new file mode 100644 (file)
index 0000000..61504d2
--- /dev/null
@@ -0,0 +1,34 @@
+From 554daf066bf4a8eb7bbc8edc1a877a3afc0de38d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jason=20K=C3=B6lker?= <jason@koelker.net>
+Date: Wed, 2 Sep 2015 22:40:24 +0000
+Subject: [PATCH] datapath: Add net/ip6_checksum.h to stt.c
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+`csum_ipv6_magic` is an asm inline on most platforms. However if it is
+not defined (like on ppc64le) including <net/ip6_checksum.h> will fall
+back to the c implementation by wrapping it in an
+`#ifndef _HAVE_ARCH_IPV6_CSUM`.
+
+Signed-off-by: Jason Kölker <jason@koelker.net>
+Signed-off-by: Jesse Gross <jesse@nicira.com>
+---
+ datapath/linux/compat/stt.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
+index b44f470..dd21753 100644
+--- a/datapath/linux/compat/stt.c
++++ b/datapath/linux/compat/stt.c
+@@ -30,6 +30,7 @@
+ #include <net/icmp.h>
+ #include <net/inet_ecn.h>
+ #include <net/ip.h>
++#include <net/ip6_checksum.h>
+ #include <net/net_namespace.h>
+ #include <net/netns/generic.h>
+ #include <net/sock.h>
+-- 
+2.1.4
+
diff --git a/net/openvswitch/patches/0006-force-kernel-4-1.patch b/net/openvswitch/patches/0006-force-kernel-4-1.patch
new file mode 100644 (file)
index 0000000..d87fd90
--- /dev/null
@@ -0,0 +1,17 @@
+diff --git a/acinclude.m4 b/acinclude.m4
+index 45cfaf6..42866de 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [
+     AC_MSG_RESULT([$kversion])
+     if test "$version" -ge 4; then
+-       if test "$version" = 4 && test "$patchlevel" -le 0; then
++       if test "$version" = 4 && test "$patchlevel" -le 1; then
+           : # Linux 4.x
+        else
+-          AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.0.x is not supported (please refer to the FAQ for advice)])
++          AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.1.x is not supported (please refer to the FAQ for advice)])
+        fi
+     elif test "$version" = 3; then
+        : # Linux 3.x
diff --git a/net/openvswitch/patches/0007-add-netns-compat.patch b/net/openvswitch/patches/0007-add-netns-compat.patch
new file mode 100644 (file)
index 0000000..b6592c8
--- /dev/null
@@ -0,0 +1,93 @@
+diff --git a/datapath/datapath.h b/datapath/datapath.h
+index fdf35f0..02be8be 100644
+--- a/datapath/datapath.h
++++ b/datapath/datapath.h
+@@ -86,10 +86,8 @@ struct datapath {
+       /* Stats. */
+       struct dp_stats_percpu __percpu *stats_percpu;
+-#ifdef CONFIG_NET_NS
+       /* Network namespace ref. */
+-      struct net *net;
+-#endif
++      possible_net_t net;
+       u32 user_features;
+ };
+@@ -154,12 +152,12 @@ int lockdep_ovsl_is_held(void);
+ static inline struct net *ovs_dp_get_net(const struct datapath *dp)
+ {
+-      return read_pnet(&dp->net);
++      return ovs_compat_read_pnet(&dp->net);
+ }
+ static inline void ovs_dp_set_net(struct datapath *dp, struct net *net)
+ {
+-      write_pnet(&dp->net, net);
++      ovs_compat_write_pnet(&dp->net, net);
+ }
+ struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no);
+diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h
+index b7dbfe3..7763584 100644
+--- a/datapath/linux/compat/include/net/net_namespace.h
++++ b/datapath/linux/compat/include/net/net_namespace.h
+@@ -51,4 +51,57 @@ static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_p
+ #define DEFINE_COMPAT_PNET_REG_FUNC(TYPE)
+ #endif /* 2.6.33 */
++/* In recent kernel versions (4.1) this type is defined ; for older versions we have to define it */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
++#define ovs_compat_read_pnet  read_pnet
++#define ovs_compat_write_pnet write_pnet
++
++#if defined(CONFIG_NET_NS) && defined(NETNS_REFCNT_DEBUG)
++static inline struct net *hold_net(struct net *net)
++{
++      if (net)
++              atomic_inc(&net->use_count);
++      return net;
++}
++
++static inline void release_net(struct net *net)
++{
++      if (net)
++              atomic_dec(&net->use_count);
++}
++#else
++static inline struct net *hold_net(struct net *net)
++{
++      return net;
++}
++
++static inline void release_net(struct net *net)
++{
++}
++#endif
++
++#else /* lower than 4.1 */
++typedef struct {
++#ifdef CONFIG_NET_NS
++      struct net *net;
++#endif
++} possible_net_t;
++
++static inline void ovs_compat_write_pnet(possible_net_t *pnet, struct net *net)
++{
++#ifdef CONFIG_NET_NS
++      pnet->net = net;
++#endif
++}
++
++static inline struct net *ovs_compat_read_pnet(const possible_net_t *pnet)
++{
++#ifdef CONFIG_NET_NS
++      return pnet->net;
++#else
++      return &init_net;
++#endif
++}
++#endif /* 4.1.0 */
++
+ #endif /* net/net_namespace.h wrapper */
diff --git a/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch b/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch
new file mode 100644 (file)
index 0000000..ec7d325
--- /dev/null
@@ -0,0 +1,19 @@
+diff --git a/datapath/flow.c b/datapath/flow.c
+index a7a2063..8db8041 100644
+--- a/datapath/flow.c
++++ b/datapath/flow.c
+@@ -51,6 +51,14 @@
+ #include "vlan.h"
++#ifndef GFP_THISNODE
++#ifdef CONFIG_NUMA  
++#define GFP_THISNODE    (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
++#else                             
++#define GFP_THISNODE    ((__force gfp_t)0)
++#endif 
++#endif
++
+ u64 ovs_flow_used_time(unsigned long flow_jiffies)
+ {
+       struct timespec cur_ts;
diff --git a/net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch b/net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch
new file mode 100644 (file)
index 0000000..46c3432
--- /dev/null
@@ -0,0 +1,20 @@
+diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
+index b44f470..f95416e 100644
+--- a/datapath/linux/compat/stt.c
++++ b/datapath/linux/compat/stt.c
+@@ -1326,9 +1326,14 @@ static void clean_percpu(struct work_struct *work)
+ static unsigned int nf_ip_hook(FIRST_PARAM
+                              struct sk_buff *skb,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
++                             const struct nf_hook_state *state
++#else
+                              const struct net_device *in,
+                              const struct net_device *out,
+-                             int (*okfn)(struct sk_buff *))
++                             int (*okfn)(struct sk_buff *)
++#endif
++                             )
+ {
+       struct stt_sock *stt_sock;
+       int ip_hdr_len;
diff --git a/net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch b/net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch
new file mode 100644 (file)
index 0000000..1aecdab
--- /dev/null
@@ -0,0 +1,18 @@
+diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
+index 0d60c18..db4dfb6 100644
+--- a/datapath/linux/compat/include/net/vxlan.h
++++ b/datapath/linux/compat/include/net/vxlan.h
+@@ -99,8 +99,13 @@ static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs,
+               return -ENOSYS;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
++      return vxlan_xmit_skb(rt, vs->sock->sk, skb, src, dst, tos, ttl, df,
++                            src_port, dst_port, md, xnet, vxflags);
++#else
+       return vxlan_xmit_skb(rt, skb, src, dst, tos, ttl, df,
+                             src_port, dst_port, md, xnet, vxflags);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)  */
+ }
+ #define vxlan_xmit_skb rpl_vxlan_xmit_skb
diff --git a/net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch b/net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch
new file mode 100644 (file)
index 0000000..47bbfb4
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
+index 0024eb4..ce1c3a8 100644
+--- a/datapath/vport-lisp.c
++++ b/datapath/vport-lisp.c
+@@ -455,7 +455,11 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb)
+       ovs_skb_set_inner_protocol(skb, skb->protocol);
+       df = tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
++      sent_len = udp_tunnel_xmit_skb(rt, lisp_port->lisp_rcv_socket->sk, skb, saddr, tun_key->ipv4_dst,
++#else
+       sent_len = udp_tunnel_xmit_skb(rt, skb, saddr, tun_key->ipv4_dst,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)  */
+                                      tun_key->ipv4_tos, tun_key->ipv4_ttl,
+                                      df, src_port, dst_port, false, true);
diff --git a/net/u2pnpd/Makefile b/net/u2pnpd/Makefile
new file mode 100644 (file)
index 0000000..f859d3b
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=u2pnpd
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://github.com/mhei/u2pnpd/releases/download/v$(PKG_VERSION)
+PKG_MD5SUM:=a98089923d93803fa90d03a504c98b8e
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/u2pnpd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Announce device via UPnP on the network
+  URL:=https://github.com/mhei/u2pnpd
+  DEPENDS:=+libupnp
+endef
+
+define Package/u2pnpd/description
+  This tools announces a device via UPnP on the local network, thus it is possible
+  to find it within the network neightboorhood of a well-known OS and the user
+  can easily double-click on an icon to open the web frontend of this device without
+  knowing the IP address.
+endef
+
+define Package/u2pnpd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/u2pnpd $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/u2pnpd.init $(1)/etc/init.d/u2pnpd
+
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_DATA) ./files/u2pnpd.defaults $(1)/etc/uci-defaults/u2pnpd
+
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/u2pnpd.config $(1)/etc/config/u2pnpd
+endef
+
+define Package/u2pnpd/postinst
+#!/bin/sh
+[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/u2pnpd) && rm -f /etc/uci-defaults/u2pnpd
+exit 0
+endef
+
+$(eval $(call BuildPackage,u2pnpd))
diff --git a/net/u2pnpd/files/u2pnpd.config b/net/u2pnpd/files/u2pnpd.config
new file mode 100644 (file)
index 0000000..8c0d561
--- /dev/null
@@ -0,0 +1,11 @@
+config u2pnpd
+#      option interface        br-lan
+#      option use_https        no
+#      option manufacturer     'OpenWrt'
+#      option manufacturerURL  'http://www.openwrt.org/'
+#      option modelDescription ''
+#      option modelName        'Generic'
+#      option modelNumber      ''
+#      option modelURL         ''
+#      option serialNumber     ''
+#      option uuid             ''
diff --git a/net/u2pnpd/files/u2pnpd.defaults b/net/u2pnpd/files/u2pnpd.defaults
new file mode 100644 (file)
index 0000000..322b0bc
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+uuid=$(cat /proc/sys/kernel/random/uuid)
+
+uci -q batch <<-EOF >/dev/null
+       set u2pnpd.@u2pnpd[0].uuid=$uuid
+       commit u2pnpd
+EOF
+
+exit 0
diff --git a/net/u2pnpd/files/u2pnpd.init b/net/u2pnpd/files/u2pnpd.init
new file mode 100644 (file)
index 0000000..01437fd
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=50
+STOP=20
+
+SERVICE_DAEMONIZE=1
+SERVICE_PID_FILE=/var/run/u2pnpd.pid
+SERVICE_USE_PID=1
+SERVICE_WRITE_PID=1
+
+start_instance() {
+       local section="$1"
+       local enabled
+       local interface manufacturer manufacturerURL modelDescription
+       local modelName modelNumber modelURL serialNumber friendlyName
+       local uuid httpsURL
+       local i
+
+       config_get_bool enabled "$section" 'enabled' 1
+       [ "$enabled" -gt 0 ] || return 0
+
+       for i in interface httpsURL manufacturer manufacturerURL modelDescription \
+                modelName modelNumber modelURL serialNumber friendlyName uuid; do
+               config_get "$i" "$section" "$i"
+       done
+
+       [ -n "$interface" ] && SERVICE_PID_FILE="/var/run/u2pnpd.$interface.pid"
+
+       service_start /usr/bin/u2pnpd ${httpsURL:+-s} \
+           ${interface:+--interface="$interface"} \
+           ${manufacturer:+--manufacturer="$manufacturer"} \
+           ${manufacturerURL:+--manufacturerURL="$manufacturerURL"} \
+           ${modelDescription:+--modelDescription="$modelDescription"} \
+           ${modelName:+--modelName="$modelName"} \
+           ${modelNumber:+--modelNumber="$modelNumber"} \
+           ${modelURL:+--modelURL="$modelURL"} \
+           ${serialNumber:+--serialNumber="$serialNumber"} \
+           ${friendlyName:+--friendlyName="$friendlyName"} \
+           ${uuid:+--uuid="$uuid"}
+}
+
+stop_instance() {
+       local section="$1"
+       local interface
+
+       config_get interface "$section" 'interface'
+       [ -n "$interface" ] && SERVICE_PID_FILE="/var/run/u2pnpd.$interface.pid"
+
+       service_stop /usr/bin/u2pnpd
+       rm -f "$SERVICE_PID_FILE"
+}
+
+start() {
+       config_load 'u2pnpd'
+       config_foreach start_instance 'u2pnpd'
+}
+
+stop() {
+       config_load 'u2pnpd'
+       config_foreach stop_instance 'u2pnpd'
+}
index e0cfd2c0d5d3b1b876c8ba7ae8ce53fe0c5ba637..ae94fdf21386a904be43062a37b64891fc2fa0e7 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=unbound
-PKG_VERSION:=1.5.4
+PKG_VERSION:=1.5.5
 PKG_RELEASE:=1
 
 PKG_LICENSE:=BSD-3-Clause
@@ -17,7 +17,7 @@ PKG_MAINTAINER:=Michael Hanselmann <public@hansmi.ch>
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.unbound.net/downloads
-PKG_MD5SUM:=f85854baad15adc7ce8acefe6cda4cf8
+PKG_MD5SUM:=e86cccd261c1b01fa9e34cb59b0013d3
 
 PKG_BUILD_DEPENDS:=libexpat
 PKG_BUILD_PARALLEL:=1
index f46cec615840654d02accb19e76c4859c2338fab..91dcbfb037228b41e9e0c03334fe1c1f488d6065 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=xl2tpd
-PKG_VERSION:=devel-20150812
+PKG_VERSION:=devel-20150930
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
 PKG_LICENSE:=GPL-2.0
@@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=LICENSE
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/xelerance/xl2tpd.git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=5674a5835e9b89b7438917a380f3a6d68528fa3e
+PKG_SOURCE_VERSION:=5faece38704ae32063abe1d25e199c03e6f44669
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 
 PKG_INSTALL:=1
index 3c89801a35dd5eb1c4a55291b31ce4f3c3b7f475..b1c97d705988eac0cf7ba6b975282b093578d15a 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=madplay
 PKG_VERSION:=0.15.2b
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/mad \
@@ -24,14 +24,18 @@ PKG_FIXUP:=autoreconf
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
 
-define Package/madplay
+define Package/madplay/default
   SECTION:=sound
   CATEGORY:=Sound
   DEPENDS:=+libid3tag +libmad $(INTL_DEPENDS)
-  TITLE:=MPEG audio player in fixed point
+  TITLE:=MPEG audio player in fixed point - $(1)
+  VARIANT:=$(1)
   URL:=http://sourceforge.net/projects/mad
 endef
 
+Package/madplay-alsa=$(call Package/madplay/default,alsa)
+Package/madplay=$(call Package/madplay/default,oss)
+
 define Package/madplay/description
        MAD is an MPEG audio decoder. It currently only supports the MPEG 1
        standard, but fully implements all three audio layers (Layer I, Layer II,
@@ -48,16 +52,27 @@ define Build/Configure
                --disable-experimental \
                --without-libiconv-prefix \
                --without-libintl-prefix \
-               --without-alsa \
                --without-esd \
                , \
                LIBS="-lz" \
        )
 endef
 
-define Package/madplay/install
+ifeq ($(BUILD_VARIANT),madplay-alsa)
+       CONFIGURE_ARGS += \
+               --without-oss \
+               --with-alsa
+endif
+
+ifeq ($(BUILD_VARIANT),madplay)
+       CONFIGURE_ARGS += \
+               --without-alsa
+endif
+
+define Package/madplay-$(BUILD_VARIANT)/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/madplay $(1)/usr/bin/
 endef
 
+$(eval $(call BuildPackage,madplay-alsa))
 $(eval $(call BuildPackage,madplay))
diff --git a/sound/madplay/patches/0001-switch-to-new-alsa-api.patch b/sound/madplay/patches/0001-switch-to-new-alsa-api.patch
new file mode 100644 (file)
index 0000000..60d7bd3
--- /dev/null
@@ -0,0 +1,173 @@
+Switch madplay to the new API. This is done thanks to a patch written
+by Micha Nelissen <micha@neli.hopto.org> and available at
+http://article.gmane.org/gmane.comp.audio.mad.devel/729.
+
+--- madplay-0.15.2b/audio_alsa.c       2008-10-18 15:10:16.000000000 +0200
++++ madplay-0.15.2b/audio_alsa.c.new   2008-10-18 15:03:27.000000000 +0200
+@@ -28,31 +28,30 @@
+
+ #include <errno.h>
+
+-#define ALSA_PCM_OLD_HW_PARAMS_API
+-#define ALSA_PCM_OLD_SW_PARAMS_API
+ #include <alsa/asoundlib.h>
+
+ #include <mad.h>
+
+ #include "audio.h"
+
+-char *buf     = NULL;
+-int paused    = 0;
++#define BUFFER_TIME_MAX     500000
+
+-int rate      = -1;
+-int channels  = -1;
+-int bitdepth  = -1;
+-int sample_size       = -1;
+-
+-int buffer_time               = 500000;
+-int period_time               = 100000;
+-char *defaultdev      = "plughw:0,0";
++unsigned char *buf  = NULL;
++int paused        = 0;
++
++unsigned int rate           = 0;
++unsigned int channels     = -1;
++unsigned int bitdepth     = -1;
++unsigned int sample_size    = -1;
++
++unsigned int buffer_time;
++unsigned int period_time;
++char *defaultdev          = "plughw:0,0";
+
+ snd_pcm_hw_params_t *alsa_hwparams;
+ snd_pcm_sw_params_t *alsa_swparams;
+
+-snd_pcm_sframes_t buffer_size;
+-snd_pcm_sframes_t period_size;
++snd_pcm_uframes_t buffer_size;
+
+ snd_pcm_format_t  alsa_format = -1;
+ snd_pcm_access_t  alsa_access = SND_PCM_ACCESS_MMAP_INTERLEAVED;
+@@ -66,14 +65,20 @@
+                snd_pcm_hw_params_t *params,
+                snd_pcm_access_t access)
+ {
+-      int err, dir;
+-      
++      int err;
++
+       /* choose all parameters */
+       err = snd_pcm_hw_params_any(handle,params);
+       if (err < 0) {
+               printf("Access type not available for playback: %s\n", snd_strerror(err));
+               return err;
+       }
++      /* set the access type */
++      err = snd_pcm_hw_params_set_access(handle, params, alsa_access);
++      if (err < 0) {
++              printf("Sample format not available for playback: %s\n", snd_strerror(err));
++              return err;
++      }
+       /* set the sample format */
+       err = snd_pcm_hw_params_set_format(handle, params, alsa_format);
+       if (err < 0) {
+@@ -87,29 +92,38 @@
+               return err;
+       }
+       /* set the stream rate */
+-      err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0);
++      err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
+       if (err < 0) {
+               printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
+               return err;
+       }
+-      if (err != rate) {
+-              printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
+-              return -EINVAL;
+-      }
++      err = snd_pcm_hw_params_get_buffer_time_max(params, &buffer_time, NULL);
++        if (err < 0) {
++                printf("Unable to retrieve buffer time: %s\n", snd_strerror(err));
++                return err;
++        }
++        if (buffer_time > BUFFER_TIME_MAX)
++                buffer_time = BUFFER_TIME_MAX;
+       /* set buffer time */
+-      err = snd_pcm_hw_params_set_buffer_time_near(handle, params, buffer_time, &dir);
++      err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, 0);
+       if (err < 0) {
+               printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err));
+               return err;
+       }
+-      buffer_size = snd_pcm_hw_params_get_buffer_size(params);
++        if (period_time * 4 > buffer_time)
++                period_time = buffer_time / 4;
+       /* set period time */
+-      err = snd_pcm_hw_params_set_period_time_near(handle, params, period_time, &dir);
++      err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL);
+       if (err < 0) {
+               printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err));
+               return err;
+       }
+-      period_size = snd_pcm_hw_params_get_period_size(params, &dir);
++        /* retrieve buffer size */
++      err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
++        if (err < 0) {
++                printf("Unable to retrieve buffer size: %s\n", snd_strerror(err));
++                return err;
++        }
+       /* write the parameters to device */
+       err = snd_pcm_hw_params(handle, params);
+       if (err < 0) {
+@@ -123,6 +137,7 @@
+ int set_swparams(snd_pcm_t *handle,
+                snd_pcm_sw_params_t *params)
+ {
++        unsigned int start_threshold;
+       int err;
+
+         /* get current swparams */
+@@ -136,13 +151,7 @@
+         if (err < 0) {
+                 printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err));
+                 return err;
+-                                                                                      }
+-        /* allow transfer when at least period_size samples can be processed */
+-        err = snd_pcm_sw_params_set_avail_min(handle, params, period_size);
+-        if (err < 0) {
+-                printf("Unable to set avail min for playback: %s\n", snd_strerror(err));
+-                return err;
+-                                                                                                      }
++      }
+         /* align all transfers to 1 samples */
+         err = snd_pcm_sw_params_set_xfer_align(handle, params, 1);
+         if (err < 0) {
+@@ -190,7 +199,7 @@
+       rate            = config->speed;
+
+       if ( bitdepth == 0 )
+-              config->precision = bitdepth = 32;
++              config->precision = bitdepth = 16;
+
+       switch (bitdepth)
+       {
+@@ -241,7 +250,7 @@
+               return -1;
+       }
+
+-      buf = malloc(buffer_size);
++      buf = malloc(buffer_size * sample_size);
+       if (buf == NULL) {
+               audio_error="unable to allocate output buffer table";
+               return -1;
+@@ -279,7 +288,7 @@
+ int play(struct audio_play *play)
+ {
+       int err, len;
+-      char *ptr;
++      unsigned char *ptr;
+
+       ptr = buf;
+       len = play->nsamples;
+
index 2eeff44cfc71dcf09c8a8e895a7514b1a9bcd656..60697c0ff85faffbdcc02f9b009843de3e97f106 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mpg123
 PKG_VERSION:=1.22.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.mpg123.de/download/
@@ -43,7 +43,7 @@ define Package/mpg123
   SECTION:=sound
   CATEGORY:=Sound
   TITLE:=fast console mpeg audio player
-  DEPENDS+=+libmpg123 +alsa-lib +libsdl +libpthread
+  DEPENDS+=+libmpg123 +alsa-lib
 endef
 
 define Build/Configure
@@ -51,6 +51,7 @@ define Build/Configure
                --enable-shared \
                --enable-static \
                --with-cpu=generic_nofpu \
+               --with-default-audio=alsa \
        )
 endef
 
@@ -86,7 +87,8 @@ endef
 define Package/mpg123/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) \
-               $(PKG_INSTALL_DIR)/usr/bin/mpg123 \
+               $(PKG_INSTALL_DIR)/usr/bin/mpg123{,-id3dump,-strip} \
+               $(PKG_INSTALL_DIR)/usr/bin/out123
                $(1)/usr/bin
 
        $(INSTALL_DIR) $(1)/usr/lib/mpg123
index 0c6689454292aa1ee2ac61794ba29bd45a45516e..86a5b3aa091ffa6758a1919930d9a08ff8275427 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pianod
-PKG_VERSION:=173
-PKG_RELEASE:=3
+PKG_VERSION:=174
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://deviousfish.com/Downloads/pianod/
-PKG_MD5SUM:=be0cec19ea6df1c4bc6c1cac8e253445
+PKG_MD5SUM:=cca2143e4a5301dea8c0cb9fcbd20881
 
 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
 
diff --git a/sound/pianod/patches/005-Fix_IPV6_socket_handling.patch b/sound/pianod/patches/005-Fix_IPV6_socket_handling.patch
deleted file mode 100644 (file)
index 883495a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
---- a/src/libwaitress/waitress.c
-+++ b/src/libwaitress/waitress.c
-@@ -805,34 +805,37 @@ static WaitressReturn_t WaitressConnect
-                       int pollres;
-                       /* we need shorter timeouts for connect() */
--                      fcntl (sock, F_SETFL, O_NONBLOCK);
-+                      pollres = fcntl (sock, F_SETFL, O_NONBLOCK);
-+                      assert (pollres != -1);
--                      /* increase socket receive buffer */
--                      const int sockopt = 256*1024;
--                      setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
--                                      sizeof (sockopt));
--
--                      /* non-blocking connect will return immediately */
--                      connect (sock, gacurr->ai_addr, gacurr->ai_addrlen);
--
--                      pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
--                      if (pollres == 0) {
--                              ret = WAITRESS_RET_TIMEOUT;
--                      } else if (pollres == -1) {
--                              ret = WAITRESS_RET_ERR;
--                      } else {
--                              /* check connect () return value */
--                              socklen_t pollresSize = sizeof (pollres);
--                              getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
--                                              &pollresSize);
--                              if (pollres != 0) {
--                                      ret = WAITRESS_RET_CONNECT_REFUSED;
-+                      if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) != -1) {
-+                              /* working */
-+                              waith->request.sockfd = sock;
-+                              break;
-+                      } else if (errno == EINPROGRESS) {
-+                              /* wait for connect to succeed */
-+                              pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
-+                              if (pollres == 0) {
-+                                      ret = WAITRESS_RET_TIMEOUT;
-+                              } else if (pollres == -1) {
-+                                      ret = WAITRESS_RET_ERR;
-                               } else {
--                                      /* this one is working */
--                                      waith->request.sockfd = sock;
--                                      break;
-+                                      /* check connect () return value */
-+                                      socklen_t pollresSize = sizeof (pollres);
-+                                      getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
-+                                                      &pollresSize);
-+                                      if (pollres != 0) {
-+                                              ret = WAITRESS_RET_CONNECT_REFUSED;
-+                                      } else {
-+                                              /* this one is working */
-+                                              waith->request.sockfd = sock;
-+                                              break;
-+                                      }
-                               }
-+                      } else {
-+                              ret = WAITRESS_RET_ERR;
-                       }
-+
-                       close (sock);
-               }
-       }
---- a/src/libfootball/fb_service.c
-+++ b/src/libfootball/fb_service.c
-@@ -111,6 +111,8 @@ static bool fb_setup_socket (FB_SERVICE
-               service->socket [which] = 0;
-       } else {
-         fb_perror ("socket");
-+        // Element must be zero (not -1)
-+        service->socket [which] = 0;
-       };
-       return false;
- }
index 228710b05637ced1f85eeee552aa59b085769f02..25569ccc229d13568c1ac9553168d1ec2df8b646 100644 (file)
@@ -19,7 +19,7 @@
  
 --- a/src/libwaitress/waitress.c
 +++ b/src/libwaitress/waitress.c
-@@ -918,14 +918,14 @@ static WaitressReturn_t WaitressSendRequ
+@@ -922,14 +922,14 @@ static WaitressReturn_t WaitressSendRequ
        if (WaitressProxyEnabled (waith) && !waith->url.tls) {
                snprintf (buf, WAITRESS_BUFFER_SIZE,
                        "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n"
index b2a657645b0b06a57c85d5c32eb3c39c9ac7e2ec..ad27e9b6a1ff977eb8eb46f0d0c7a51a171c1e1a 100644 (file)
        return WAITRESS_RET_OK;
  }
  
-@@ -876,6 +947,12 @@ static WaitressReturn_t WaitressConnect
+@@ -880,6 +951,12 @@ static WaitressReturn_t WaitressConnect
                        }
                }
  
                /* Ignore return code as connection will likely still succeed */
                gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS,
                                waith->url.host, strlen (waith->url.host));
-@@ -883,14 +960,15 @@ static WaitressReturn_t WaitressConnect
+@@ -887,14 +964,15 @@ static WaitressReturn_t WaitressConnect
                if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) {
                        return WAITRESS_RET_TLS_HANDSHAKE_ERR;
                }
        }
  
        return WAITRESS_RET_OK;
-@@ -1116,6 +1194,21 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1120,6 +1198,21 @@ WaitressReturn_t WaitressFetchCall (Wait
        waith->request.contentLengthKnown = false;
  
        if (waith->url.tls) {
                gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT);
                gnutls_set_default_priority (waith->request.tlsSession);
  
-@@ -1133,6 +1226,7 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1137,6 +1230,7 @@ WaitressReturn_t WaitressFetchCall (Wait
                                WaitressPollRead);
                gnutls_transport_set_push_function (waith->request.tlsSession,
                                WaitressPollWrite);
        }
  
        /* buffer is required for connect already */
-@@ -1144,15 +1238,22 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1148,15 +1242,22 @@ WaitressReturn_t WaitressFetchCall (Wait
                if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) {
                        wRet = WaitressReceiveResponse (waith);
                }
index a4a449b7cccae92579d634e9c8e41b0b5e508f77..d14f05620675824d054b767e9371572b8f83d91a 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pulseaudio
-PKG_VERSION:=6.0
-PKG_RELEASE:=2
+PKG_VERSION:=7.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://freedesktop.org/software/pulseaudio/releases/
-PKG_MD5SUM:=b691e83b7434c678dffacfa3a027750e
+PKG_MD5SUM:=09668b660ffb32f2639cfd6fdc9d3b37
 PKG_LICENSE:=LGPL-2.1+
 PKG_LICENSE_FILES:=GPL LICENSE
 
diff --git a/sound/pulseaudio/patches/002-xlocale.patch b/sound/pulseaudio/patches/002-xlocale.patch
new file mode 100644 (file)
index 0000000..ef3ee91
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/pulsecore/core-util.c b/pulsecore/core-util.c
+index ba31221..824368a 100644
+--- a/src/pulsecore/core-util.c
++++ b/src/pulsecore/core-util.c
+@@ -54,7 +54,6 @@
+ #ifdef HAVE_STRTOD_L
+ #include <locale.h>
+-#include <xlocale.h>
+ #endif
+ #ifdef HAVE_SCHED_H
index cd60f97d3aa079364ffd7bffa390f063412a49bf..1cb6f57a81de8e4cac47b861491833a9055e6e5b 100644 (file)
@@ -9,21 +9,22 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shairport-sync
-PKG_VERSION:=2.1.15
-PKG_RELEASE:=1
+PKG_VERSION:=2.4.1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=git://github.com/mikebrady/shairport-sync.git
 PKG_SOURCE_VERSION:=$(PKG_VERSION)
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, Mike Brady <mikebrady@eircom.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=COPYING LICENSES shairport.c
 
 PKG_BUILD_PARALLEL:=1
-
 PKG_FIXUP:=autoreconf
 
 include $(INCLUDE_DIR)/package.mk
@@ -32,31 +33,70 @@ CONFIGURE_ARGS+= \
        --with-alsa \
        --with-avahi \
        --with-soxr \
-       --with-ssl=openssl
+       --with-metadata
 
+ifeq ($(BUILD_VARIANT),openssl)
+  CONFIGURE_ARGS+= --with-ssl=openssl
+endif
+ifeq ($(BUILD_VARIANT),polarssl)
+  CONFIGURE_ARGS+= --with-ssl=polarssl
+endif
 
-define Package/shairport-sync
+define Package/shairport-sync/default
   SECTION:=sound
   CATEGORY:=Sound
-  TITLE:=iPhone/iTunes compatible audio player
-  DEPENDS:= +libpthread +libopenssl +libavahi-client +alsa-lib +libdaemon +libsoxr +libpopt
-  MAINTAINER:=Mike Brady <mikebrady@eircom.net>
+  TITLE:=iPhone/iTunes/AirPlay/Quicktime Player compatible Audio Player
+  DEPENDS:=@AUDIO_SUPPORT +libpthread +libavahi-client +alsa-lib +libconfig +libdaemon +libsoxr +libpopt
+  URL:=http://github.com/mikebrady/shairport-sync
+endef
+
+define Package/shairport-sync-openssl
+  $(Package/shairport-sync/default)
+  TITLE+= (openssl)
+  DEPENDS+= +PACKAGE_shairport-sync-openssl:libopenssl
+  VARIANT:=openssl
+endef
+
+define Package/shairport-sync-polarssl
+  $(Package/shairport-sync/default)
+  TITLE+= (polarssl)
+  DEPENDS+= +PACKAGE_shairport-sync-polarssl:libpolarssl
+  VARIANT:=polarssl
+  DEFAULT_VARIANT:=1
+endef
+
+define Package/shairport-sync/default/description
+  Shairport Sync plays audio from iTunes and AirPlay sources, including
+  iOS devices, Quicktime Player and third party sources such as forkedDaapd.
+  Audio played by a Shairport Sync-powered device stays synchronised with the source
+  and hence with similar devices playing the same source.
+  Thus, for example, synchronised multi-room audio is possible without difficulty.
+  (Hence the name Shairport Sync, BTW.)
+  Shairport Sync does not support AirPlay video or photo streaming.
+  Ensure Kernel Modules > Sound Support > kmod-sound-core is selected.
+  Also select kmod-usb-audio if you want to use USB-connected sound cards.
 endef
+Package/shairport-sync-openssl/description = $(Package/shairport-sync/default/description)
+Package/shairport-sync-polarssl/description = $(Package/shairport-sync/default/description)
 
-define Package/shairport-sync/description
-  Shairport Sync is server software that implements the Apple-originated RAOP protocol for
-  playback of audio from a compatible remote client such as the iPhone, iTunes, Apple TV, Quicktime Player or forked-daapd.
-  Shairport Sync implements audio synchronisation, supporting multi-room use.
-  Shairport Sync supports audio only.
+define Package/shairport-sync/default/conffiles
+/etc/shairport-sync.conf
 endef
+Package/shairport-sync-openssl/conffiles = $(Package/shairport-sync/default/conffiles)
+Package/shairport-sync-polarssl/conffiles = $(Package/shairport-sync/default/conffiles)
 
-define Package/shairport-sync/install
+define Package/shairport-sync/default/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport-sync $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/scripts/shairport-sync.conf $(1)/etc/shairport-sync.conf
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/shairport-sync.init $(1)/etc/init.d/shairport-sync
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_DATA) ./files/shairport-sync.config $(1)/etc/config/shairport-sync
 endef
+Package/shairport-sync-openssl/install = $(Package/shairport-sync/default/install)
+Package/shairport-sync-polarssl/install = $(Package/shairport-sync/default/install)
 
-$(eval $(call BuildPackage,shairport-sync))
+$(eval $(call BuildPackage,shairport-sync-openssl))
+$(eval $(call BuildPackage,shairport-sync-polarssl))
index f72c7854919b5e93c33bd1ae28738cf6ebc8e6d4..289a3785541a6bd4db7fb623d3c894b5ebd47e45 100644 (file)
@@ -1,35 +1,53 @@
-# Uncomment the stanza you want, and make sure to comment out the others, especially duplicate options.
+# Use your own config file
+config shairport-sync 'shairport_sync_file'
+       option disabled '1'
+       option respawn '1'
+       option conf_custom '1'
+       option conf_file '/etc/shairport-sync.conf'
 
-#Arguments and defaults are as follows
-config shairport-sync main
-#       option name 'Shairport Sync'           #default name, "Shairport Sync on %d"
-#       option device default                  #default soundcard, volume control by software
-                                               #(Troubleshooting hint: make sure the soundcard's volume is turned up fully -- use alsamixer or amixer)
-#       option airplaylatency 88200
-#       option ituneslatency 99400
-#       option port 5000
-#       option stuffing basic                  #options are 'basic' or 'soxr' if shairport-sync was compiled with soxr support
-#       option awaitactioncompletion false     #[don't] wait until beforeaction or afteraction completes
-#       option beforeaction <action>           #action must be a fully qualified program with no arguments. Default no action.
-#       option afteraction <action>            #action must be a fully qualified program with no arguments. Default no action.
-#       option devicetype <devicetype>
-#       option volumecontrolname <name>
-
-#Here are some sample stanzas:
-
-#For Raspberry Pi using the built-in soundcard for the headphone jack
-#       option device 'hw:0'
-#       option devicetype hardware
-#       option volumecontrolname Master
-
-#For Raspberry Pi with the "3D Sound" USB Soundcard
-#        option name 'Pi'
-#        option device 'hw:1'
-#        option devicetype hardware
-#        option volumecontrolname Speaker
-
-#For Raspberry Pi with the first generation iMic or the Topping TP30 Class T Digital Mini Amplifier
-#        option name 'Kitchen'
-#        option device 'hw:1'
-#        option devicetype hardware
-#        option volumecontrolname PCM
+# Use OpenWrt UCI config
+config shairport-sync 'shairport_sync'
+       option disabled '1'
+       option respawn '1'
+       # General
+       option name 'Shairport-Sync'
+       option password ''
+       option interpolation '' # basic/soxr
+       option output_backend '' # alsa/pipe/stdout/ao/dummy/pulse/sndio
+       option mdns_backend '' # avahi/external-avahi/dns-sd/external-dns-sd/tinysvcmdns
+       option port '' # 5000
+       option udp_port_base '' # 6001
+       option udp_port_range '' # 100
+       option statistics '' # no/yes
+       option drift '' # 88
+       option resync_threshold '' # 2205
+       option log_verbosity '' # 0/1/2/3
+       option ignore_volume_control '' # no/yes
+       # Latencies
+       option latencies_default '' # 88200
+       option latencies_itunes '' # 99400
+       option latencies_airplay '' # 88200
+       option latencies_forked_daapd '' # 99400
+       # Metadata
+       option metadata_enabled '' # no/yes
+       option metadata_cover_art '' # no/yes
+       option metadata_pipe_name '' # /tmp/shairport-sync-metadata
+       # Session Control
+       option sesctl_run_before_play_begins '' # /etc/shairport-sync-start.sh
+       option sesctl_run_after_play_ends '' # /etc/shairport-sync-stop.sh
+       option sesctl_wait_for_completion '' # no/yes
+       option sesctl_session_interruption '' # no/yes
+       option sesctl_session_timeout '' # 120
+       # ALSA
+       option alsa_output_device '' # default
+       option alsa_mixer_control_name '' # PCM
+       option alsa_mixer_device '' # default
+       option alsa_latency_offset '' # 0
+       option alsa_buffer_length '' # 6615
+       # Pipe
+       option pipe_name '' # /tmp/shairport-sync-audio
+       option pipe_latency_offset '' # 0
+       option pipe_buffer_length '' # 44100
+       # Stdout
+       option stdout_latency_offset '' # 0
+       option stdout_buffer_length '' # 44100
old mode 100755 (executable)
new mode 100644 (file)
index f49e1e3..2631401
 #!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
 
-NAME='shairport-sync'
 START=99
-
 USE_PROCD=1
 
-append_arg() {
+append_num() {
        local cfg="$1"
-       local var="$2"
-       local opt="$3"
-       local def="$4"
+       local file="$2"
+       local var="$3"
+       local opt="$4"
+       local def="$5"
        local val
 
        config_get val "$cfg" "$var"
-       [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
+       [ -n "$val" -o -n "$def" ] && echo -e "\t$opt = ${val:-$def};" >> $file
 }
-
-append_bool() {
+append_str() {
        local cfg="$1"
-       local var="$2"
-       local opt="$3"
-       local def="$4"
+       local file="$2"
+       local var="$3"
+       local opt="$4"
+       local def="$5"
        local val
 
-       config_get_bool val "$cfg" "$var" "$def"
-       [ "$val" = 1 ] && procd_append_param command "$opt"
+       config_get val "$cfg" "$var"
+       [ -n "$val" -o -n "$def" ] && echo -e "\t$opt = \"${val:-$def}\";" >> $file
 }
 
-start_shairport_service() {
+start_instance() {
        local cfg=$1
-       local stuffing
-        local device
+       local conf_custom conf_file aux
+
+       config_get_bool aux "$cfg" 'disabled' '0'
+       [ "$aux" = 1 ] && return 1
+
+       config_get_bool conf_custom "$cfg" 'conf_custom' '0'
+       config_get conf_file "$cfg" "conf_file"
+       if [ $conf_custom -ne 1 ] && [ ! -n "$conf_file" ]; then
+               mkdir -p /var/etc
+               conf_file="/var/etc/shairport-sync-${cfg}.conf"
+
+               echo -e "// Automatically generated from UCI config\n" > $conf_file
+
+               # General
+               echo -e "general =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_str "$cfg" "$conf_file" name "name"
+               append_str "$cfg" "$conf_file" password "password"
+               append_str "$cfg" "$conf_file" interpolation "interpolation"
+               append_str "$cfg" "$conf_file" output_backend "output_backend"
+               append_str "$cfg" "$conf_file" mdns_backend "mdns_backend"
+               append_num "$cfg" "$conf_file" port "port"
+               append_num "$cfg" "$conf_file" udp_port_base "udp_port_base"
+               append_num "$cfg" "$conf_file" udp_port_range "udp_port_range"
+               append_str "$cfg" "$conf_file" statistics "statistics"
+               append_num "$cfg" "$conf_file" drift "drift"
+               append_num "$cfg" "$conf_file" resync_threshold "resync_threshold"
+               append_num "$cfg" "$conf_file" log_verbosity "log_verbosity"
+               append_str "$cfg" "$conf_file" ignore_volume_control "ignore_volume_control"
+               echo -e "};\n" >> $conf_file
+
+               # Latencies
+               echo -e "latencies =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_num "$cfg" "$conf_file" latencies_default "default"
+               append_num "$cfg" "$conf_file" latencies_itunes "itunes"
+               append_num "$cfg" "$conf_file" latencies_airplay "airplay"
+               append_num "$cfg" "$conf_file" latencies_forked_daapd "forkedDaapd"
+               echo -e "};\n" >> $conf_file
+
+               # Metadata
+               echo -e "metadata =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_str "$cfg" "$conf_file" metadata_enabled "enabled"
+               append_str "$cfg" "$conf_file" metadata_cover_art "include_cover_art"
+               append_str "$cfg" "$conf_file" metadata_pipe_name "pipe_name"
+               echo -e "};\n" >> $conf_file
+
+               # Session control
+               echo -e "sessioncontrol =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_str "$cfg" "$conf_file" sesctl_run_before_play_begins "run_this_before_play_begins"
+               append_str "$cfg" "$conf_file" sesctl_run_after_play_ends "run_this_after_play_ends"
+               append_str "$cfg" "$conf_file" sesctl_wait_for_completion "wait_for_completion"
+               append_str "$cfg" "$conf_file" sesctl_session_interruption "allow_session_interruption"
+               append_num "$cfg" "$conf_file" sesctl_session_timeout "session_timeout"
+               echo -e "};\n" >> $conf_file
+
+               # Alsa audio back end
+               echo -e "alsa =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_str "$cfg" "$conf_file" alsa_output_device "output_device"
+               append_str "$cfg" "$conf_file" alsa_mixer_control_name "mixer_control_name"
+               append_str "$cfg" "$conf_file" alsa_mixer_device "mixer_device"
+               append_num "$cfg" "$conf_file" alsa_latency_offset "audio_backend_latency_offset"
+               append_num "$cfg" "$conf_file" alsa_buffer_length "audio_backend_buffer_desired_length"
+               echo -e "};\n" >> $conf_file
+
+               # Pipe audio back end
+               echo -e "pipe =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_str "$cfg" "$conf_file" pipe_name "name"
+               append_num "$cfg" "$conf_file" pipe_latency_offset "audio_backend_latency_offset"
+               append_num "$cfg" "$conf_file" pipe_buffer_length "audio_backend_buffer_desired_length"
+               echo -e "};\n" >> $conf_file
+
+               # Stdout audio back end
+               echo -e "stdout =" >> $conf_file
+               echo -e "{" >> $conf_file
+               append_num "$cfg" "$conf_file" stdout_latency_offset "audio_backend_latency_offset"
+               append_num "$cfg" "$conf_file" stdout_buffer_length "audio_backend_buffer_desired_length"
+               echo -e "};\n" >> $conf_file
+       fi
 
        procd_open_instance
 
-       procd_set_param command /usr/bin/$NAME
-
-       append_arg "$cfg" name "-a"
-       append_arg "$cfg" port "-p"
-       append_arg "$cfg" airplaylatency "-A"
-       append_arg "$cfg" ituneslatency "-i"
-
-        config_get stuffing "$cfg" stuffing ""
-
-       if [ -n "$stuffing" ] ; then
-                case "x$stuffing" in
-                        ( "xbasic" ) procd_append_param command -S basic ;;
-                        ( "xsoxr" ) procd_append_param command -S soxr ;;
-                        ( * ) logger "bad argument for -S option -- should be \"basic\" or \"soxr\"" ;;
-                esac
-        fi
-
-       append_arg "$cfg" beforeaction "-B"
-       append_arg "$cfg" afteraction "-E"
-       append_bool "$cfg" awaitactioncompletion "-w"
-
-        config_get device "$cfg" device ""
-       if [ -n "$device" ] ; then
-               procd_append_param command "--"
-               append_arg "$cfg" device "-d"
-               append_arg "$cfg" devicetype "-t"
-               append_arg "$cfg" volumecontrolname "-c"
-       fi
+       procd_set_param command /usr/bin/shairport-sync
+       procd_append_param command -c $conf_file
+
+       config_get_bool aux "$cfg" 'respawn' '0'
+       [ "$aux" = 1 ] && procd_set_param respawn
 
        procd_close_instance
 }
 
-service_triggers() { 
-        procd_add_reload_trigger $NAME
-} 
+service_triggers() {
+       procd_add_reload_trigger "shairport-sync"
+}
 
 start_service() {
-        config_load $NAME
-       # Just a single instance
-        start_shairport_service "main"
+       config_load shairport-sync
+       config_foreach start_instance shairport-sync
 }
diff --git a/utils/bandwidthd/Makefile b/utils/bandwidthd/Makefile
new file mode 100644 (file)
index 0000000..6ef14e5
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bandwidthd
+PKG_VERSION:=2.0.1
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/bandwidthd
+PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6
+
+PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bandwidthd
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Bandwidthd
+  URL:=http://bandwidthd.sourceforge.net/
+  DEPENDS:=+libgd +libpcap
+endef
+
+define Package/bandwidthd/daemon
+ This package contains bandwidthd a bandwith tracking utility.
+endef
+
+CONFIGURE_ARGS += \
+       ac_cv_file__sw_lib=no \
+       ac_cv_file__sw_include=no \
+       ac_cv_file__usr_pkg_lib=no \
+       ac_cv_file__usr_pkg_include=no \
+       ac_cv_file__usr_local_pgsql_lib=no \
+       ac_cv_file__usr_local_pgsql_include=no \
+       ac_cv_lib_pq_PQconnectdb=no \
+
+EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
+EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/bandwidthd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
+       $(INSTALL_DIR) $(1)/www
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
+endef
+
+define Package/bandwidthd/conffiles
+/etc/config/bandwidthd
+endef
+
+$(eval $(call BuildPackage,bandwidthd))
diff --git a/utils/bandwidthd/files/bandwidthd.config b/utils/bandwidthd/files/bandwidthd.config
new file mode 100644 (file)
index 0000000..4bb18cf
--- /dev/null
@@ -0,0 +1,11 @@
+config bandwidthd
+       option dev      br-lan
+       option subnets          "192.168.0.0/16 10.0.0.0/8 172.16.0.0/12"
+       option skip_intervals   0
+       option graph_cutoff     1024
+       option promiscuous      true
+       option output_cdf       false
+       option recover_cdf      false
+       option filter           ip
+       option graph            true
+       option meta_refresh     150
diff --git a/utils/bandwidthd/files/bandwidthd.init b/utils/bandwidthd/files/bandwidthd.init
new file mode 100644 (file)
index 0000000..6483daa
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=99
+
+config_cb() {
+       local cfg_type="$1"
+       local cfg_name="$2"
+
+       case "$cfg_type" in
+               bandwidthd)
+                       append cfgs "$cfg_name"
+               ;;
+       esac
+}
+
+export_bool() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get_bool _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option "
+               if [ 1 -eq "$_loctmp" ]; then
+                       conffile="${conffile}true"
+               else
+                       conffile="${conffile}false"
+               fi
+               conffile="${conffile}\n"
+       fi
+}
+
+export_number() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option ${_loctmp}\n"
+       fi
+}
+
+export_string() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option \"${_loctmp}\"\n"
+       fi
+}
+
+start() {
+       local subnet conffile
+
+       [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/
+       [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs
+       [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd
+       rm -f /tmp/bandwidthd.conf
+       touch /tmp/bandwidthd.conf
+       [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf
+       
+       
+       config_load bandwidthd
+       for cfg in $cfgs; do
+               config_get subnets $cfg subnets
+                       for subnet in $subnets; do
+                               conffile="${conffile}subnet ${subnet}\n"
+                       done
+               export_string dev $cfg
+               export_number skip_intervals $cfg
+               export_number graph_cutoff $cfg
+               export_bool promiscuous $cfg
+               export_bool output_cdf $cfg
+               export_bool recover_cdf $cfg
+               export_string filter $cfg
+               export_bool graph $cfg
+               export_number meta_refresh $cfg
+               [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf
+               unset conffile
+       done
+       cd /
+       service_start /usr/sbin/bandwidthd
+}
+
+stop() {
+       service_stop /usr/sbin/bandwidthd
+}
diff --git a/utils/bandwidthd/files/logo.gif b/utils/bandwidthd/files/logo.gif
new file mode 100644 (file)
index 0000000..7b17cc6
Binary files /dev/null and b/utils/bandwidthd/files/logo.gif differ
diff --git a/utils/bandwidthd/patches/010-dont-add-host-paths.patch b/utils/bandwidthd/patches/010-dont-add-host-paths.patch
new file mode 100644 (file)
index 0000000..59a5737
--- /dev/null
@@ -0,0 +1,36 @@
+diff --git a/configure b/configure
+index 4c2546e..e516137 100755
+--- a/configure
++++ b/configure
+@@ -2439,11 +2439,6 @@ if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
+       LDFLAGS="$LDFLAGS -L$x_libraries"
+ fi
+-# May be equired for BSD
+-LDFLAGS="$LDFLAGS -L/usr/local/lib"
+-
+-CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+-
+ #Check for Darwin sw directory
+ echo "$as_me:2448: checking for /sw/lib" >&5
+ echo $ECHO_N "checking for /sw/lib... $ECHO_C" >&6
+@@ -2505,9 +2500,6 @@ fi
+ fi
+ echo "$as_me:2506: result: $ac_cv_file__usr_pkg_lib" >&5
+ echo "${ECHO_T}$ac_cv_file__usr_pkg_lib" >&6
+-if test $ac_cv_file__usr_pkg_lib = yes; then
+-  LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
+-fi
+ echo "$as_me:2512: checking for /usr/pkg/include" >&5
+ echo $ECHO_N "checking for /usr/pkg/include... $ECHO_C" >&6
+@@ -3092,9 +3084,6 @@ fi
+ fi
+ echo "$as_me:3093: result: $ac_cv_file__usr_local_pgsql_lib" >&5
+ echo "${ECHO_T}$ac_cv_file__usr_local_pgsql_lib" >&6
+-if test $ac_cv_file__usr_local_pgsql_lib = yes; then
+-  LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib"
+-fi
+ echo "$as_me:3099: checking for /usr/local/pgsql/include" >&5
+ echo $ECHO_N "checking for /usr/local/pgsql/include... $ECHO_C" >&6
diff --git a/utils/bandwidthd/patches/100-fix_config_file_location b/utils/bandwidthd/patches/100-fix_config_file_location
new file mode 100644 (file)
index 0000000..ae44cd2
--- /dev/null
@@ -0,0 +1,31 @@
+--- bandwidthd-2.0.1/bandwidthd.c.orig 2008-05-09 10:06:37.000000000 -0500
++++ bandwidthd-2.0.1/bandwidthd.c      2008-05-09 10:32:54.000000000 -0500
+@@ -255,22 +255,22 @@
+       openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
+-      if (stat("./etc/bandwidthd.conf", &StatBuf))
++      if (stat("/etc/bandwidthd.conf", &StatBuf))
+               {
+               chdir(INSTALL_DIR);
+-              if (stat("./etc/bandwidthd.conf", &StatBuf))
++              if (stat("/etc/bandwidthd.conf", &StatBuf))
+                       {
+-                      printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
+-                      syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
++                      printf("Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
++                      syslog(LOG_ERR, "Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
+                       exit(1);
+                       }
+               }
+-      bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
++      bdconfig_in = fopen("/etc/bandwidthd.conf", "rt");
+       if (!bdconfig_in)
+               {
+               syslog(LOG_ERR, "Cannot open bandwidthd.conf");
+-              printf("Cannot open ./etc/bandwidthd.conf\n");
++              printf("Cannot open /etc/bandwidthd.conf\n");
+               exit(1);
+               }
+       bdconfig_parse();
index 03f30014846c5e92dd74b05ed9dbacf93fe1d5d4..2bfc749fcfe8c1fcbc665aae0d322bb0821622a0 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=collectd
 PKG_VERSION:=5.5.0
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://collectd.org/files/
@@ -185,6 +185,7 @@ CONFIGURE_ARGS+= \
        --disable-debug \
        --enable-daemon \
        --with-nan-emulation \
+       --with-perl-bindings= \
        --without-libgcrypt
 
 CONFIGURE_VARS+= \
@@ -314,7 +315,7 @@ $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
 #$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
-$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @BROKEN))
+$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
 $(eval $(call BuildPlugin,network,network input/output,network))
 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
diff --git a/utils/collectd/patches/300-delay-first-read-cycle.patch b/utils/collectd/patches/300-delay-first-read-cycle.patch
new file mode 100644 (file)
index 0000000..9a60cc4
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/src/daemon/plugin.c
++++ b/src/daemon/plugin.c
+@@ -1149,7 +1149,7 @@ static int plugin_insert_read (read_func
+       int status;
+       llentry_t *le;
+-      rf->rf_next_read = cdtime ();
++      rf->rf_next_read = cdtime () + (cdtime_t) 1073741824; //delay first read 1s
+       rf->rf_effective_interval = rf->rf_interval;
+       pthread_mutex_lock (&read_lock);
+
diff --git a/utils/collectd/patches/500-upstream-parallel-build-fix.patch b/utils/collectd/patches/500-upstream-parallel-build-fix.patch
new file mode 100644 (file)
index 0000000..a10fbbb
--- /dev/null
@@ -0,0 +1,17 @@
+Backport of 780e6a76021a240e95007a04b723d827120afa95
+Subject: [PATCH] build: add libavltree, libcommon & libheap dependencies
+
+Otherwise it can break on very parallel builds since collectd link time
+arrives before one or more of these were built.
+
+--- a/src/daemon/Makefile.am
++++ b/src/daemon/Makefile.am
+@@ -49,7 +49,7 @@ collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LT
+ collectd_CFLAGS = $(AM_CFLAGS)
+ collectd_LDFLAGS = -export-dynamic
+ collectd_LDADD = libavltree.la libcommon.la libheap.la -lm
+-collectd_DEPENDENCIES =
++collectd_DEPENDENCIES = libavltree.la libcommon.la libheap.la
+ # Link to these libraries..
+ if BUILD_WITH_LIBRT
index 5fa70ba3c6358cb1c28da08c143c1256b928e1a2..15e34362ef439d9d173408988c776802460d25c0 100644 (file)
@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
 
 # Make sure to also update the dbus-x package
 PKG_NAME:=dbus
-PKG_VERSION:=1.9.20
+PKG_VERSION:=1.10.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://dbus.freedesktop.org/releases/dbus/
-PKG_MD5SUM:=d5a6f0467612054d3bc7361e42ac6ee9
+PKG_MD5SUM:=5af6297348107a906c8449817a728b3b
 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
 PKG_LICENSE:=AFL-2.1
 
@@ -168,10 +168,10 @@ define Package/libdbus/install
 endef
 
 define Package/dbus/install
-       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/usr/share
        $(CP) \
-               $(PKG_INSTALL_DIR)/etc/dbus-1 \
-               $(1)/etc/
+               $(PKG_INSTALL_DIR)/usr/share/dbus-1 \
+               $(1)/usr/share/
 
        $(INSTALL_DIR) $(1)/usr/lib/dbus-1
        $(INSTALL_BIN) \
diff --git a/utils/dfu-programmer/Makefile b/utils/dfu-programmer/Makefile
new file mode 100644 (file)
index 0000000..153c69f
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dfu-programmer
+PKG_VERSION:=0.7.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/$(PKG_VERSION)/
+PKG_MD5SUM:=98641b0a7cf1cc8c8be3584d5552f6d8
+
+PKG_MAINTAINER:=Stefan Hellermann <stefan@the2masters.de>
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dfu-programmer
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=USB programmer for Atmel microcontrollers
+  URL:=http://dfu-programmer.github.io/
+  DEPENDS:=+libusb-1.0
+endef
+
+define Package/dfu-programmer/description
+  dfu-programmer is a Device Firmware Update (DFU) based USB programmer
+  for Atmel chips with a USB bootloader.
+endef
+
+define Package/dfu-programmer/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,dfu-programmer))
index 6725664b9380dc24f255836ad70b55bec74be7ad..74acd12a1c5aae92c9bafaaf2a97ed2182b3989d 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dump1090
-PKG_VERSION:=2015-09-28
-PKG_RELEASE:=2
+PKG_VERSION:=2015-10-08
+PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=git://github.com/mutability/dump1090.git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=3b4c872ea67118de1399ba9979e71b504a36aca8
+PKG_SOURCE_VERSION:=c55c71b57cf34e90d95afd52449a05a4b6dbda03
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
 
diff --git a/utils/flashrom/Config.in b/utils/flashrom/Config.in
deleted file mode 100644 (file)
index 552001a..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-menu "Flashrom configuration"
-       depends on PACKAGE_flashrom
-
-       choice
-               prompt "Default Programmer"
-               default DEFPROG_INTERNAL if FLASHROM_PCI
-               default DEFPROG_LINUX_SPI
-
-               config DEFPROG_INTERNAL
-                       depends on FRPROG_INTERNAL
-                       bool "Internal"
-
-               config DEFPROG_LINUX_SPI
-                       depends on FRPROG_LINUX_SPI
-                       bool "Linux SPI"
-
-               config DEFPROG_SERPROG
-                       depends on FRPROG_SERPROG
-                       bool "Serial"
-
-               config DEFPROG_RAYER_SPI
-                       depends on FRPROG_RAYER_SPI
-                       bool "Rayer SPI"
-
-               config DEFPROG_PONY_SPI
-                       depends on FRPROG_PONY_SPI
-                       bool "Pony SPI"
-
-               config DEFPROG_NIC3COM
-                       depends on FRPROG_NIC3COM
-                       bool "NIC3Com"
-
-               config DEFPROG_GFXNVIDIA
-                       depends on FRPROG_GFXNVIDIA
-                       bool "GFX Nvidia"
-
-               config DEFPROG_SATASII
-                       depends on FRPROG_SATASII
-                       bool "SATASII"
-
-#              config DEFPROG_ATAHPT
-#                      depends on FRPROG_ATAHPT
-#                      bool "Highpoint (HPT) ATA/RAID"
-
-               config DEFPROG_ATAVIA
-                       depends on FRPROG_ATAVIA
-                       bool "ATAVIA"
-
-               config DEFPROG_FT2232_SPI
-                       depends on FRPROG_FT2232_SPI
-                       bool "FT2232 SPI"
-
-               config DEFPROG_USBBLASTER_SPI
-                       depends on FRPROG_USBBLASTER_SPI
-                       bool "USBBlaster SPI"
-
-#              config DEFPROG_MSTARDDC_SPI
-#                      depends on FRPROG_MSTARDDC_SPI
-#                      bool "MSTAR DDC SPI"
-
-               config DEFPROG_PICKIT2_SPI
-                       depends on FRPROG_PICKIT2_SPI
-                       bool "PICkit2 SPI"
-
-               config DEFPROG_DUMMY
-                       depends on FRPROG_DUMMY
-                       bool "Dummy"
-
-               config DEFPROG_DRKAISER
-                       depends on FRPROG_DRKAISER
-                       bool "Dr. Kaiser"
-
-               config DEFPROG_NICREALTEK
-                       depends on FRPROG_NICREALTEK
-                       bool "Realtek NICs"
-
-#              config DEFPROG_NICNATSEMI
-#                      depends on FRPROG_NICNATSEMI
-#                      bool "National Semiconductor NICs"
-
-               config DEFPROG_NICINTEL
-                       depends on FRPROG_NICINTEL
-                       bool "Intel NICs"
-
-               config DEFPROG_NICINTEL_SPI
-                       depends on FRPROG_NICINTEL_SPI
-                       bool "Intel NICs SPI"
-
-               config DEFPROG_NICINTEL_EEPROM
-                       depends on FRPROG_NICINTEL_EEPROM
-                       bool "Intel NICs EEPROM"
-
-               config DEFPROG_OGP_SPI
-                       depends on FRPROG_OGP_SPI
-                       bool "OGP SPI"
-
-               config DEFPROG_BUSPIRATE_SPI
-                       depends on FRPROG_BUSPIRATE_SPI
-                       bool "SPI BUS Pirate"
-
-#              config DEFPROG_DEDIPROG
-#                      depends on FRPROG_DEDIPROG
-#                      bool "Dediprog SF100"
-
-               config DEFPROG_SATAMV
-                       depends on FRPROG_SATAMV
-                       bool "Marvell SATA"
-
-               config DEFPROG_IT8212
-                       depends on FRPROG_IT8212
-                       bool "ITE IT8212F PATA"
-       endchoice
-
-
-       menu "Misc Programmers"
-               config FRPROG_LINUX_SPI
-                       bool "Linux SPI"
-                       default y
-
-#              config FRPROG_MSTARDDC_SPI
-#                      bool "MSTAR DDC"
-#                      default n
-
-               config FRPROG_DUMMY
-                       bool "Dummy"
-                       default y
-       endmenu
-
-
-       config FLASHROM_FTDI
-               bool "FTDI Support"
-               default y
-
-       menu "FTDI Programmers"
-               depends on FLASHROM_FTDI
-
-               config FRPROG_FT2232_SPI
-                       depends on FLASHROM_FTDI
-                       bool "FT2232 SPI"
-                       default y
-
-               config FRPROG_USBBLASTER_SPI
-                       depends on FLASHROM_FTDI
-                       bool "USBBlaster SPI"
-                       default y
-       endmenu
-
-
-       config FLASHROM_PCI
-               bool "PCI Support"
-               default y if (TARGET_x86||TARGET_x86_64)
-
-       menu "PCI Programmers"
-               depends on FLASHROM_PCI
-
-               config FRPROG_INTERNAL
-                       depends on FLASHROM_PCI
-                       bool "Internal"
-                       default y
-
-               config FRPROG_RAYER_SPI
-                       depends on FLASHROM_PCI
-                       bool "Rayer SPI"
-                       default y
-
-               config FRPROG_NIC3COM
-                       depends on FLASHROM_PCI
-                       bool "NIC3Com"
-                       default y
-
-               config FRPROG_GFXNVIDIA
-                       depends on FLASHROM_PCI
-                       bool "GFX Nvidia"
-                       default y
-
-               config FRPROG_SATASII
-                       depends on FLASHROM_PCI
-                       bool "SATASII"
-                       default y
-
-#              config FRPROG_ATAHPT
-#                      depends on FLASHROM_PCI
-#                      bool "Highpoint (HPT) ATA/RAID"
-#                      default n
-
-               config FRPROG_ATAVIA
-                       depends on FLASHROM_PCI
-                       bool "ATAVIA"
-                       default y
-
-               config FRPROG_IT8212
-                       depends on FLASHROM_PCI
-                       bool "ITE IT8212F PATA"
-                       default y
-
-               config FRPROG_DRKAISER
-                       depends on FLASHROM_PCI
-                       bool "Dr. Kaiser"
-                       default y
-
-               config FRPROG_NICREALTEK
-                       depends on FLASHROM_PCI
-                       bool "Realtek NICs"
-                       default y
-
-#              config FRPROG_NICNATSEMI
-#                      depends on FLASHROM_PCI
-#                      bool "National Semiconductor NICs"
-#                      default n
-
-               config FRPROG_NICINTEL
-                       depends on FLASHROM_PCI
-                       bool "Intel NICs"
-                       default y
-
-               config FRPROG_NICINTEL_SPI
-                       depends on FLASHROM_PCI
-                       bool "Intel NICs SPI"
-                       default y
-
-               config FRPROG_NICINTEL_EEPROM
-                       depends on FLASHROM_PCI
-                       bool "Intel NICs EEPROM"
-                       default y
-
-               config FRPROG_OGP_SPI
-                       depends on FLASHROM_PCI
-                       bool "OGP SPI"
-                       default y
-
-               config FRPROG_SATAMV
-                       depends on FLASHROM_PCI
-                       bool "Marvell SATA"
-                       default y
-       endmenu
-
-
-       config FLASHROM_SERIAL
-               bool "Serial Support"
-               default y
-
-       menu "Serial Programmers"
-               depends on FLASHROM_SERIAL
-
-               config FRPROG_SERPROG
-                       depends on FLASHROM_SERIAL
-                       bool "Serial"
-                       default y
-
-               config FRPROG_PONY_SPI
-                       depends on FLASHROM_SERIAL
-                       bool "Pony SPI"
-                       default y
-
-               config FRPROG_BUSPIRATE_SPI
-                       depends on FLASHROM_SERIAL
-                       bool "SPI BUS Pirate"
-                       default y
-       endmenu
-
-
-       config FLASHROM_USB
-               bool "USB Support"
-               default y
-
-       menu "USB Programmers"
-               depends on FLASHROM_USB
-
-               config FRPROG_PICKIT2_SPI
-                       depends on FLASHROM_USB
-                       bool "PICkit2 SPI"
-                       default y
-
-#              config FRPROG_DEDIPROG
-#                      depends on FLASHROM_USB
-#                      bool "Dediprog SF100"
-#                      default n
-       endmenu
-endmenu
index 6d3c573a4fabc548a25a17c2030d4fbcc020f920..e6e38b43192e98344b53a5e704a627926f9d7579 100644 (file)
@@ -9,13 +9,16 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=flashrom
 PKG_VERSION:=0.9.8
-PKG_RELEASE:=3
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://download.flashrom.org/releases
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_MD5SUM:=ac513076b63ab7eb411a7694bb8f6fda
 PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
 
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
 
@@ -24,36 +27,83 @@ PKG_INSTALL:=1
 include $(INCLUDE_DIR)/package.mk
 include flashrom.mk
 
-define Package/flashrom
+TARGET_CFLAGS+= \
+       -std=gnu89
+
+MAKE_FLAGS+= \
+       PREFIX="/usr"
+
+define Package/flashrom/default
   SECTION:=utils
   CATEGORY:=Utilities
   TITLE:=FlashROM Utility
   URL:=http://www.flashrom.org/
-  DEPENDS:=\
-       +(TARGET_x86||TARGET_x86_64):dmidecode \
-       +FLASHROM_FTDI:libftdi \
-       +FLASHROM_PCI:pciutils \
-       +FLASHROM_USB:libusb-compat
 endef
 
-define Package/flashrom/config
-       source "$(SOURCE)/Config.in"
+define Package/flashrom
+  $(Package/flashrom/default)
+  TITLE+= (full)
+  DEPENDS+= \
+    +(PACKAGE_flashrom&&(TARGET_x86||TARGET_x86_64)):dmidecode \
+    +PACKAGE_flashrom:libftdi \
+    +PACKAGE_flashrom:libusb-compat \
+    +PACKAGE_flashrom:pciutils
+  VARIANT:=full
+  DEFAULT_VARIANT:=1
 endef
 
-define Package/flashrom/description
+define Package/flashrom-pci
+  $(Package/flashrom/default)
+  TITLE+= (pci)
+  DEPENDS+= \
+    +(PACKAGE_flashrom-pci&&(TARGET_x86||TARGET_x86_64)):dmidecode \
+    +PACKAGE_flashrom-pci:pciutils
+  VARIANT:=pci
+endef
+
+define Package/flashrom-spi
+  $(Package/flashrom/default)
+  TITLE+= (spi)
+  VARIANT:=spi
+endef
+
+define Package/flashrom-usb
+  $(Package/flashrom/default)
+  TITLE+= (usb)
+  DEPENDS+= \
+    +PACKAGE_flashrom-usb:libftdi \
+    +PACKAGE_flashrom-usb:libusb-compat
+  VARIANT:=usb
+endef
+
+define Package/flashrom/default/description
  flashrom is an utility for identifying, reading, writing, verifying
  and erasing flash chips. It's often used to flash BIOS/EFI/coreboot
  /firmware images.
 endef
-
-TARGET_CFLAGS+=-std=gnu89
-
-MAKE_FLAGS += \
-       PREFIX="/usr"
+Package/flashrom/description = $(Package/flashrom/default/description)
+Package/flashrom-pci/description = $(Package/flashrom/default/description)
+Package/flashrom-spi/description = $(Package/flashrom/default/description)
+Package/flashrom-usb/description = $(Package/flashrom/default/description)
 
 define Package/flashrom/install
        $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom
+endef
+define Package/flashrom-pci/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-pci
+endef
+define Package/flashrom-spi/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-spi
+endef
+define Package/flashrom-usb/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-usb
 endef
 
 $(eval $(call BuildPackage,flashrom))
+$(eval $(call BuildPackage,flashrom-pci))
+$(eval $(call BuildPackage,flashrom-spi))
+$(eval $(call BuildPackage,flashrom-usb))
index 14fc5d88d23a2f2487196dd4f9e15e5cc1254508..0ca82b6d05d603ef4eafdd654dc004f037763849 100644 (file)
@@ -1,54 +1,88 @@
-# Flashrom configuration
+# Flashrom variants
+
+define DefaultProgrammer
+  MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_$(1)
+endef
 define DefineConfig
-  ifeq ($(CONFIG_FLASHROM_$(1)),)
-    MAKE_FLAGS += NEED_$(1)=0
-  endif
+  MAKE_FLAGS += NEED_$(1)=$(2)
 endef
 define DefineProgrammer
-  ifeq ($(CONFIG_FRPROG_$(1)),)
-    MAKE_FLAGS += CONFIG_$(1)=0
-  endif
-  ifneq ($(CONFIG_DEFPROG_$(1)),)
-    MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=CONFIG_$(1)
+  # Selecting invalid programmers will fail
+  # Only disable unwanted programmers and keep the default ones
+  ifeq ($(2),no)
+    MAKE_FLAGS += CONFIG_$(1)=$(2)
   endif
 endef
 
+ifeq ($(BUILD_VARIANT),full)
+  $(eval $(call DefaultProgrammer,LINUX_SPI))
+  FLASHROM_BASIC := yes
+  FLASHROM_FTDI := yes
+  FLASHROM_PCI := yes
+  FLASHROM_SERIAL := yes
+  FLASHROM_USB := yes
+endif
+ifeq ($(BUILD_VARIANT),pci)
+  $(eval $(call DefaultProgrammer,INTERNAL))
+  FLASHROM_BASIC := yes
+  FLASHROM_FTDI := no
+  FLASHROM_PCI := yes
+  FLASHROM_SERIAL := no
+  FLASHROM_USB := no
+endif
+ifeq ($(BUILD_VARIANT),spi)
+  $(eval $(call DefaultProgrammer,LINUX_SPI))
+  FLASHROM_BASIC := yes
+  FLASHROM_FTDI := no
+  FLASHROM_PCI := no
+  FLASHROM_SERIAL := no
+  FLASHROM_USB := no
+endif
+ifeq ($(BUILD_VARIANT),usb)
+  $(eval $(call DefaultProgrammer,SERPROG))
+  FLASHROM_BASIC := yes
+  FLASHROM_FTDI := yes
+  FLASHROM_PCI := no
+  FLASHROM_SERIAL := yes
+  FLASHROM_USB := yes
+endif
+
 # Misc
-$(eval $(call DefineProgrammer,LINUX_SPI))
-#$(eval $(call DefineProgrammer,MSTARDDC_SPI))
-$(eval $(call DefineProgrammer,DUMMY))
+$(eval $(call DefineProgrammer,LINUX_SPI,$(FLASHROM_BASIC)))
+#$(eval $(call DefineProgrammer,MSTARDDC_SPI,$(FLASHROM_BASIC)))
+$(eval $(call DefineProgrammer,DUMMY,$(FLASHROM_BASIC)))
 
 # FTDI
-$(eval $(call DefineConfig,FTDI))
-$(eval $(call DefineProgrammer,FT2232_SPI))
-$(eval $(call DefineProgrammer,USBBLASTER_SPI))
+$(eval $(call DefineConfig,FTDI,$(FLASHROM_FTDI)))
+$(eval $(call DefineProgrammer,FT2232_SPI,$(FLASHROM_FTDI)))
+$(eval $(call DefineProgrammer,USBBLASTER_SPI,$(FLASHROM_FTDI)))
 
 # PCI
-$(eval $(call DefineConfig,PCI))
-$(eval $(call DefineProgrammer,INTERNAL))
-$(eval $(call DefineProgrammer,RAYER_SPI))
-$(eval $(call DefineProgrammer,NIC3COM))
-$(eval $(call DefineProgrammer,GFXNVIDIA))
-$(eval $(call DefineProgrammer,SATASII))
-#$(eval $(call DefineProgrammer,ATAHPT))
-$(eval $(call DefineProgrammer,ATAVIA))
-$(eval $(call DefineProgrammer,IT8212))
-$(eval $(call DefineProgrammer,DRKAISER))
-$(eval $(call DefineProgrammer,NICREALTEK))
-#$(eval $(call DefineProgrammer,NICNATSEMI))
-$(eval $(call DefineProgrammer,NICINTEL))
-$(eval $(call DefineProgrammer,NICINTEL_SPI))
-$(eval $(call DefineProgrammer,NICINTEL_EEPROM))
-$(eval $(call DefineProgrammer,OGP_SPI))
-$(eval $(call DefineProgrammer,SATAMV))
+$(eval $(call DefineConfig,PCI,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,INTERNAL,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,RAYER_SPI,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,NIC3COM,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,GFXNVIDIA,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,SATASII,$(FLASHROM_PCI)))
+#$(eval $(call DefineProgrammer,ATAHPT,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,ATAVIA,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,IT8212,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,DRKAISER,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,NICREALTEK,$(FLASHROM_PCI)))
+#$(eval $(call DefineProgrammer,NICNATSEMI,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,NICINTEL,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,NICINTEL_SPI,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,NICINTEL_EEPROM,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,OGP_SPI,$(FLASHROM_PCI)))
+$(eval $(call DefineProgrammer,SATAMV,$(FLASHROM_PCI)))
 
 # Serial
-$(eval $(call DefineConfig,SERIAL))
-$(eval $(call DefineProgrammer,SERPROG))
-$(eval $(call DefineProgrammer,PONY_SPI))
-$(eval $(call DefineProgrammer,BUSPIRATE_SPI))
+$(eval $(call DefineConfig,SERIAL,$(FLASHROM_SERIAL)))
+$(eval $(call DefineProgrammer,SERPROG,$(FLASHROM_SERIAL)))
+$(eval $(call DefineProgrammer,PONY_SPI,$(FLASHROM_SERIAL)))
+$(eval $(call DefineProgrammer,BUSPIRATE_SPI,$(FLASHROM_SERIAL)))
 
 # USB
-$(eval $(call DefineConfig,USB))
-$(eval $(call DefineProgrammer,PICKIT2_SPI))
-#$(eval $(call DefineProgrammer,DEDIPROG))
+$(eval $(call DefineConfig,USB,$(FLASHROM_USB)))
+$(eval $(call DefineProgrammer,PICKIT2_SPI,$(FLASHROM_USB)))
+#$(eval $(call DefineProgrammer,DEDIPROG,$(FLASHROM_USB)))
index 9ddcdd4d95ffe17d9aabf72053c6eb4a68a70feb..e31d39005e5ca2ca27bbe367545e1b0f27bf57f4 100644 (file)
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gammu
-PKG_VERSION:=1.36.5
+PKG_VERSION:=1.36.6
 PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://dl.cihar.com/gammu/releases/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MD5SUM:=b89d4d90137ccd6bf76a2c24fc3fc99f
+PKG_MD5SUM:=9047f0598602144a99153f5e61104529
 PKG_MAINTAINER:=Vitaly Protsko <villy@sft.ru>
 PKG_LICENCE:=GPL-2.0
 
index f3893e966007a6d8bd1647587114308dce759f8a..2e79e8ea1ec30681092af36670470d44d253439b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2010-2012 OpenWrt.org
+# Copyright (C) 2010-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=less
-PKG_VERSION:=458
+PKG_VERSION:=481
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.greenwoodsoftware.com/less
-PKG_MD5SUM:=935b38aa2e73c888c210dedf8fd94f49
+PKG_MD5SUM:=50ef46065c65257141a7340123527767
 
 PKG_LICENSE:=GPL-3.0
 PKG_LICENSE_FILES:=COPYING
index 102f4339ec58a4bdbededc051d982337017493d6..04be41405897b38a39452dacfb5beb24d7fd2fbf 100644 (file)
@@ -9,13 +9,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=LVM2
-PKG_VERSION:=2.02.130
+PKG_VERSION:=2.02.132
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-2.0 LGPL-2.1
 
 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2
-PKG_MD5SUM:=e7ae07e413120713549cc6dd2a558c75
+PKG_MD5SUM:=80af5af726949bbbb2aceb15b24b7d20
 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
 
index 09fa238f400eac07312f9f30f3551e64e2f7119d..c26232d440ab90c8dd0c12db58f837f018af6f30 100644 (file)
@@ -1,6 +1,6 @@
 --- a/lib/commands/toolcontext.c
 +++ b/lib/commands/toolcontext.c
-@@ -1728,8 +1728,10 @@ struct cmd_context *create_toolcontext(u
+@@ -1740,8 +1740,10 @@ struct cmd_context *create_toolcontext(u
                                       unsigned set_filters)
  {
        struct cmd_context *cmd;
@@ -11,7 +11,7 @@
  
  #ifdef M_MMAP_MAX
        mallopt(M_MMAP_MAX, 0);
-@@ -1765,7 +1767,7 @@ struct cmd_context *create_toolcontext(u
+@@ -1777,7 +1779,7 @@ struct cmd_context *create_toolcontext(u
        /* FIXME Make this configurable? */
        reset_lvm_errno(1);
  
@@ -20,7 +20,7 @@
        /* Set in/out stream buffering before glibc */
        if (set_buffering) {
                /* Allocate 2 buffers */
-@@ -2148,7 +2150,7 @@ void destroy_toolcontext(struct cmd_cont
+@@ -2160,7 +2162,7 @@ void destroy_toolcontext(struct cmd_cont
        if (cmd->libmem)
                dm_pool_destroy(cmd->libmem);
  
@@ -31,7 +31,7 @@
                if (is_valid_fd(STDIN_FILENO) &&
 --- a/tools/lvmcmdline.c
 +++ b/tools/lvmcmdline.c
-@@ -1735,6 +1735,7 @@ int lvm_split(char *str, int *argc, char
+@@ -1741,6 +1741,7 @@ int lvm_split(char *str, int *argc, char
  /* Make sure we have always valid filedescriptors 0,1,2 */
  static int _check_standard_fds(void)
  {
@@ -39,7 +39,7 @@
        int err = is_valid_fd(STDERR_FILENO);
  
        if (!is_valid_fd(STDIN_FILENO) &&
-@@ -1761,6 +1762,12 @@ static int _check_standard_fds(void)
+@@ -1767,6 +1768,12 @@ static int _check_standard_fds(void)
                       strerror(errno));
                return 0;
        }
diff --git a/utils/open2300/Makefile b/utils/open2300/Makefile
new file mode 100644 (file)
index 0000000..2354610
--- /dev/null
@@ -0,0 +1,67 @@
+# 
+# Copyright (C) 2010 segal.ubi.pt
+# Copyright (C) 2014 nunojpg@gmail.com
+# Copyright (C) 2015 dev@localnet.hu
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=open2300
+PKG_VERSION:=1.12
+PKG_RELEASE:=5
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_URL:=http://www.lavrsen.dk/svn/open2300/trunk
+PKG_SOURCE_VERSION:=r12
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_CHECK_FORMAT_SECURITY:=0
+
+PKG_MAINTAINER:=Gabor SZOLLOSI <dev@localnet.hu>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/open2300
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=WS23XX weather station utilities
+  URL:=http://www.lavrsen.dk/foswiki/bin/view/Open2300
+endef
+
+define Package/open2300/description
+  This is an utility suite used to communicate with and collect data from a WS23XX wheather station.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -DVERSION=\"$(PKG_VERSION)\""
+
+define Package/open2300/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin2300         $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cw2300          $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dump2300        $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fetch2300       $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/histlog2300     $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/history2300     $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/interval2300    $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/light2300       $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2300         $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/minmax2300      $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/open2300        $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wu2300          $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/xml2300         $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/open2300.conf $(1)/etc/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib2300.so.1.11 $(1)/usr/lib/
+       ln -sf /usr/lib/lib2300.so.1.11 $(1)/usr/lib/lib2300.so
+endef
+
+$(eval $(call BuildPackage,open2300))
diff --git a/utils/open2300/files/open2300.conf b/utils/open2300/files/open2300.conf
new file mode 100644 (file)
index 0000000..6414b49
--- /dev/null
@@ -0,0 +1,65 @@
+# open2300.conf
+#
+# Configuration files for open2300 weather station tools
+#
+# Default locations in which the programs will search for this file: 
+# Programs search in this sequence:
+#  1. Path to config file including filename given as parameter (not supported by all tools)
+#  2. ./open2300.conf (current working directory)
+#  3. /jffs/etc/open2300.conf (typical DD-WRT location)
+#  4. /etc/open2300.conf (typical Linux location)
+#
+# All names are case sensitive!!!
+
+
+# Set to your serial port and time zone
+# For Windows use COM1, COM2, COM2 etc
+# For Linux use /dev/ttyS0, /dev/ttyS1 etc
+
+SERIAL_DEVICE                 /dev/tts/1  # /dev/ttyS0, /dev/ttyS1, COM1, COM2 etc
+TIMEZONE                      1           # Hours Relative to UTC. East is positive, west is negative
+
+
+# Units of measure (set them to your preference)
+# The units of measure are ignored by wu2300 and cw2300 because both requires specific units
+
+WIND_SPEED                    m/s         # select MPH (miles/hour), m/s, or km/h
+TEMPERATURE                   C           # Select C or F
+RAIN                          mm          # Select mm or IN
+PRESSURE                      hPa         # Select hPa, mb or INHG
+
+#### Citizens Weather variables (used only by cw2300)
+# Format for latitude is
+# [2 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][N for north or S for south]
+# Format for longitude is
+# [3 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][E for east or W for west]
+# Use leading zeros to get the format ####.##N (lat) and #####.##E (long)
+
+CITIZEN_WEATHER_ID            CW0000      # CW0000 should be replaced by HAM call or actual CW number
+CITIZEN_WEATHER_LATITUDE      5540.12N    # DDMM.mmN or S - example 55 deg, 40.23 minutes north
+CITIZEN_WEATHER_LONGITUDE     01224.60E   # DDDMM.mmE or W - example 12 deg, 24.60 minutes east
+
+APRS_SERVER   rotate.aprs.net   14580     # These are the APRS servers and ports for
+APRS_SERVER   first.aprs.net    14580     # Citizens Weather reporting.
+APRS_SERVER   second.aprs.net   14580     # They they are tried in the entered order
+APRS_SERVER   third.aprs.net    14580     # you may enter up to 5 alternate servers
+
+
+#### WEATHER UNDERGROUND variables (used only by wu2300)
+
+WEATHER_UNDERGROUND_ID        WUID        # ID received from Weather Underground
+WEATHER_UNDERGROUND_PASSWORD  WUPASSWORD  # Password for Weather Underground
+
+
+### MYSQL Settings (only used by mysql2300)
+
+#MYSQL_HOST              localhost         # Localhost or IP address/host name
+#MYSQL_USERNAME          open2300          # Name of the MySQL user that has access to the database
+#MYSQL_PASSWORD          mysql2300         # Password for the MySQL user
+#MYSQL_DATABASE          open2300          # Named of your database
+#MYSQL_PORT              0                 # TCP/IP Port number. Zero means default
+
+#PGSQL_CONNECT         hostaddr='127.0.0.1'dbname='open2300'user='postgres'password='sql' # Connection string
+#PGSQL_TABLE           weather           # Table name
+#PGSQL_STATION         open2300          # Unique station id
diff --git a/utils/open2300/patches/001-crosscompile.patch b/utils/open2300/patches/001-crosscompile.patch
new file mode 100644 (file)
index 0000000..0953047
--- /dev/null
@@ -0,0 +1,139 @@
+--- a/Makefile
++++ b/Makefile
+@@ -15,87 +15,82 @@
+ prefix = /usr/local
+ exec_prefix = ${prefix}
+ bindir = ${exec_prefix}/bin
++libdir = ${prefix}/lib
+ #########################################
+ CC  = gcc
+-OBJ = open2300.o rw2300.o linux2300.o win2300.o
+-LOGOBJ = log2300.o rw2300.o linux2300.o win2300.o
+-FETCHOBJ = fetch2300.o rw2300.o linux2300.o win2300.o
+-WUOBJ = wu2300.o rw2300.o linux2300.o win2300.o
+-CWOBJ = cw2300.o rw2300.o linux2300.o win2300.o
+-DUMPOBJ = dump2300.o rw2300.o linux2300.o win2300.o
+-HISTOBJ = history2300.o rw2300.o linux2300.o win2300.o
+-HISTLOGOBJ = histlog2300.o rw2300.o linux2300.o win2300.o
+-DUMPBINOBJ = bin2300.o rw2300.o linux2300.o win2300.o
+-XMLOBJ = xml2300.o rw2300.o linux2300.o win2300.o
+-PGSQLOBJ = pgsql2300.o rw2300.o linux2300.o win2300.o
+-LIGHTOBJ = light2300.o rw2300.o linux2300.o win2300.o
+-INTERVALOBJ = interval2300.o rw2300.o linux2300.o win2300.o
+-MINMAXOBJ = minmax2300.o rw2300.o linux2300.o win2300.o
+-MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
++LIB = lib2300
++LIB_C = rw2300.c linux2300.c
++LIBOBJ = rw2300.o linux2300.o
+ VERSION = 1.11
+ CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
+-CC_LDFLAGS = -lm
+-CC_WINFLAG = 
+-# For Windows - comment the two line above and un-comment the two lines below.
+-#CC_LDFLAGS = -lm -lwsock32
+-#CC_WINFLAG = -mwindows
++CC_LDFLAGS = -L. -lm -l2300
++LFLAGS = -shared -Wl,-soname
+ INSTALL = install
++MAKE_EXEC = $(CC) $(CFLAGS) $@.c -o $@ $(CC_LDFLAGS)
+ ####### Build rules
+-all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300
++all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 #mysql2300 mysqlhistlog2300
+-open2300 : $(OBJ)
+-      $(CC) $(CFLAGS) -o $@ $(OBJ) $(CC_LDFLAGS)
+-      
+-dump2300 : $(DUMPOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(DUMPOBJ) $(CC_LDFLAGS)
++lib2300 :
++      $(CC) -c -fPIC $(CFLAGS) $(LIB_C)
++      $(CC) $(LFLAGS),$@.so -o $@.so.$(VERSION) $(LIBOBJ)
++      ln -sf $@.so.$(VERSION) $@.so
++
++open2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-log2300 : $(LOGOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(LOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++dump2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-fetch2300 : $(FETCHOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(FETCHOBJ) $(CC_LDFLAGS)
++log2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-wu2300 : $(WUOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(WUOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++fetch2300 : $(LIB)
++      $(MAKE_EXEC)
++
++srv2300 : $(LIB)
++      $(MAKE_EXEC)
++
++wu2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-cw2300 : $(CWOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(CWOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++cw2300 : $(LIB)
++      $(MAKE_EXEC)
+-history2300 : $(HISTOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(HISTOBJ) $(CC_LDFLAGS)
++history2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-histlog2300 : $(HISTLOGOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(HISTLOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++histlog2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-bin2300 : $(DUMPBINOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(DUMPBINOBJ) $(CC_LDFLAGS)
++bin2300 : $(LIB)
++      $(MAKE_EXEC)
+-xml2300 : $(XMLOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++xml2300 : $(LIB)
++      $(MAKE_EXEC)
+-mysql2300:
+-      $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++mysql2300: $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
+-pgsql2300: $(PGSQLOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
++pgsql2300: $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/pgsql -L/usr/lib/pgsql $(CC_LDFLAGS) -lpq
+-light2300: $(LIGHTOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(LIGHTOBJ) $(CC_LDFLAGS)
++light2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-interval2300: $(INTERVALOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(INTERVALOBJ) $(CC_LDFLAGS)
++interval2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-minmax2300: $(MINMAXOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++minmax2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-mysqlhistlog2300 :
+-      $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++mysqlhistlog2300 : $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
+ install:
diff --git a/utils/sane-backends/Makefile b/utils/sane-backends/Makefile
new file mode 100644 (file)
index 0000000..7c79db0
--- /dev/null
@@ -0,0 +1,356 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=sane-backends
+PKG_VERSION:=1.0.25
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fossies.org/linux/misc \
+    https://alioth.debian.org/frs/download.php/file/4146/
+PKG_MD5SUM:=f9ed5405b3c12f07c6ca51ee60225fe7
+PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
+PKG_LICENSE:=GPL-2.0 GPL-2.0+
+PKG_LICENSE_FILES:=COPYING LICENSE
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+SANE_BACKENDS:=
+
+define Package/sane-backends/Default
+  TITLE:=Scanner Access Now Easy
+  URL:=http://www.sane-project.org/
+endef
+
+define Package/sane-backends/Default/description
+ SANE (Scanner Access Now Easy) is a universal scanner interface.
+endef
+
+define Package/sane-backends
+$(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (drivers)
+endef
+
+define Package/sane-backends/description
+$(call Package/sane-backends/Default/description)
+.
+This
+endef
+
+define Package/sane-backends/config
+    menu "Select SANE backends"
+      depends on PACKAGE_sane-backends
+
+
+    config PACKAGE_sane-backends-all
+      depends on PACKAGE_sane-backends
+      prompt "Include all SANE backends (sane-backends-all)"
+
+    comment "Modules"
+
+$(foreach backend,$(SANE_BACKENDS), \
+    $(eval \
+      $(call Package/Default)
+      $(call Package/sane-$(backend))
+    )\
+    config PACKAGE_sane-$(backend)
+      prompt "$(TITLE)"
+     $(foreach config_dep,\
+       $(filter @%,
+         $(foreach v, $(DEPENDS), $(if $(findstring :,$v),,$v))
+       ),\
+      depends on $(strip $(subst @,,$(config_dep)))
+     )
+)
+  endmenu
+
+endef
+
+# returns conditional dependency on sane backend
+# 1: backend name
+#
+# If there is no config deps on $(1), returns +sane-$(1).
+# Otherwise, +(CONFIG1&&CONFIG2&&..):sane-$(1)
+define SaneBackendDependency
+    $(eval \
+        $(call Package/Default)
+        $(call Package/sane-$(1))
+        FILTER_CONFIG:=$$(strip \
+            $$(foreach config_dep, \
+                $$(filter @%, \
+                    $$(foreach v, \
+                        $$(DEPENDS), \
+                        $$(if $$(findstring :,$$v),,$$v) \
+                    ) \
+                ), \
+                $$(subst @,,$$(config_dep)) \
+            ) \
+        )
+        ifneq (,$$(FILTER_CONFIG))
+           FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))):
+        endif
+    ) \
+    +$(FILTER_CONFIG)sane-$(1)
+endef
+
+define Package/sane-backends-all
+$(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (all backends)
+  DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(strip $(call SaneBackendDependency,$(backend))))
+  HIDDEN:=1
+endef
+
+define Package/sane-backends/description
+$(call Package/sane-backends/Default/description)
+.
+Metapackage for selecting all SANE Backends
+endef
+
+define Package/sane-daemon
+$(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libsane
+  TITLE+= (network daemon)
+endef
+
+define Package/sane-daemon/description
+$(call Package/sane-backends/Default/description)
+This package contains the SANE daemon.
+endef
+
+define Package/libsane
+  $(call Package/sane-backends/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libusb-compat
+  TITLE+= (libraries)
+endef
+
+define Package/libsane/description
+$(call Package/sane-backends/Default/description)
+This package contains the SANE shared libraries.
+endef
+
+define Package/sane-frontends
+  $(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libsane +libjpeg +libpng
+  TITLE+= (frontends)
+endef
+
+define Package/sane-frontends/description
+$(call Package/sane-backends/Default/description)
+This package contains the SANE frontends.
+endef
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link $(STAGING_DIR)/usr/lib \
+       -Wl,-rpath-link $(PKG_BUILD_DIR)/backend/.libs
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --enable-static \
+       --disable-translations \
+       --disable-latex \
+       --without-gphoto2 \
+       --without-snmp
+
+CONFIGURE_VARS+= \
+    ac_cv_func_mmap_fixed_mapped="yes" \
+
+define Build/Configure
+       mkdir -p $(PKG_BUILD_DIR)/backend/.libs
+       $(Build/Configure/Default)
+endef
+
+define Package/libsane/install
+       $(INSTALL_DIR) $(1)/usr/lib/sane/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-dll.so.* $(1)/usr/lib/sane/
+       $(INSTALL_DIR) $(1)/etc/sane.d/dll.d
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/dll.conf $(1)/etc/sane.d/
+endef
+
+define Package/libsane/conffiles
+/etc/sane.d/dll.conf
+endef
+
+define Package/sane-daemon/install
+       $(INSTALL_DIR) $(1)/etc/sane.d
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/xinetd.d
+       $(CP) ./files/xinet.d_sane-port $(1)/etc/xinetd.d/sane-port
+endef
+
+define Package/sane-daemon/conffiles
+/etc/sane.d/saned.conf
+endef
+
+define Package/sane-frontends/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+define Package/sane-backends-all/install
+       /bin/true
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/
+endef
+
+# 1: short name
+# 2: description
+# 3: dependencies on other packages
+define SaneBackend
+  SANE_BACKENDS+= $(1)
+
+  define Package/sane-$(1)
+    $(call Package/sane-backends/Default)
+    TITLE:=SANE backend (sane-$(1)) for $(2)
+    DEPENDS+= +libsane $(3)
+    HIDDEN:=1
+  endef
+
+  define Package/sane-$(1)/description
+   $(call Package/sane-backends/Default/description)
+.
+This package contains the SANE backend for $(2).
+  endef
+
+  define Package/sane-$(1)/install
+       if [ -f "$(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf" ]; then \
+         $(INSTALL_DIR) $$(1)/etc/sane.d ; \
+         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf $$(1)/etc/sane.d/; \
+       fi
+       $(INSTALL_DIR) $$(1)/usr/lib/sane
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-$(1).so.* $$(1)/usr/lib/sane/
+       if [ -d "$(PKG_INSTALL_DIR)/usr/share/sane/$(1)" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
+               $(CP) -a $(PKG_INSTALL_DIR)/usr/share/sane/$(1) $$(1)/usr/share/sane/ ; \
+       fi
+  endef
+
+  define Package/sane-$(1)/conffiles
+       /etc/sane.d/$(1).conf
+  endef
+
+  $$(eval $$(call BuildPackage,sane-$(1)))
+endef
+
+$(eval $(call BuildPackage,libsane))
+$(eval $(call BuildPackage,sane-daemon))
+$(eval $(call SaneBackend,abaton,Abaton flatbed scanners))
+$(eval $(call SaneBackend,agfafocus,AGFA Focus flatbed scanners))
+$(eval $(call SaneBackend,apple,Apple flatbed scanners))
+$(eval $(call SaneBackend,artec,Artec flatbed scanners))
+$(eval $(call SaneBackend,artec_eplus48u,Artec E+ 48U and re-badged models))
+$(eval $(call SaneBackend,as6e,Artec AS6E parallel port interface scanner))
+$(eval $(call SaneBackend,avision,Avision and Avision OEM scanners and possibly more flatbed and film scanners))
+$(eval $(call SaneBackend,bh,Bell+Howell Copiscan II series document scanners))
+$(eval $(call SaneBackend,canon,Canon SCSI scanners))
+$(eval $(call SaneBackend,canon630u,the Canon 630u USB flatbed scanner))
+$(eval $(call SaneBackend,canon_dr,Canon DR-series scanners))
+# Depends on libieee1284
+#$(eval $(call SaneBackend,canon_pp,Canon CanoScan Parallel Port flatbed scanners,+libieee1284))
+$(eval $(call SaneBackend,cardscan,Corex CardScan usb scanners))
+$(eval $(call SaneBackend,coolscan,Nikon film-scanners))
+$(eval $(call SaneBackend,coolscan2,Nikon Coolscan film scanners))
+$(eval $(call SaneBackend,coolscan3,Nikon Coolscan film scanners))
+$(eval $(call SaneBackend,dc210,Kodak DC210 Digital Camera,+libjpeg))
+$(eval $(call SaneBackend,dc240,Kodak DC240 Digital Camera,+libjpeg))
+$(eval $(call SaneBackend,dc25,Kodak DC20/DC25 Digital Cameras))
+$(eval $(call SaneBackend,dell1600n_net,Dell 1600n,+libtiff))
+$(eval $(call SaneBackend,dmc,Polaroid Digital Microscope Camera))
+$(eval $(call SaneBackend,epjitsu,Epson-based Fujitsu USB scanners))
+$(eval $(call SaneBackend,epson,EPSON scanners))
+$(eval $(call SaneBackend,epsonds,EPSON scanners,+libjpeg)) ####
+$(eval $(call SaneBackend,epson2,EPSON scanners))
+$(eval $(call SaneBackend,fujitsu,Fujitsu flatbed and ADF scanners))
+$(eval $(call SaneBackend,genesys,GL646 GL841 GL843 GL847 and GL124 based USB flatbed scanners))
+#$(eval $(call SaneBackend,gphoto2,digital cameras supported by gphoto2,+libjpeg))
+$(eval $(call SaneBackend,gt68xx,GT-68XX based USB flatbed scanners))
+$(eval $(call SaneBackend,hp,HP ScanJet scanners))
+$(eval $(call SaneBackend,hp3500,Hewlett-Packard ScanJet 3500 series scanners))
+$(eval $(call SaneBackend,hp3900,RTS8822 chipset based scanners,+libtiff))
+$(eval $(call SaneBackend,hp4200,Hewlett-Packard 4200 scanners))
+$(eval $(call SaneBackend,hp5400,Hewlett-Packard 54XX scanners))
+$(eval $(call SaneBackend,hp5590,Hewlett-Packard 4500C/4570C/5500C/5550C/5590/7650 Workgroup/Document scanners))
+$(eval $(call SaneBackend,hpljm1005,Hewlett-Packard LaserJet M1005 MFP Scanner))
+# Depends on libieee1284
+#$(eval $(call SaneBackend,hpsj5s,HP ScanJet 5S sheet-fed scanner,+libieee1284))
+$(eval $(call SaneBackend,hs2p,Ricoh SCSI flatbed/ADF scanners))
+$(eval $(call SaneBackend,ibm,IBM and Ricoh SCSI flatbed scanners))
+$(eval $(call SaneBackend,kodak,big Kodak flatbed and ADF scanners))
+$(eval $(call SaneBackend,kodakaio,Kodak aio printer / scanners))
+$(eval $(call SaneBackend,kvs20xx,Panasonic KV-S20xxC USB/SCSI ADF scanners))
+$(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners))
+$(eval $(call SaneBackend,kvs1025,Panasonic KV-S102xC USB ADF scanners))
+$(eval $(call SaneBackend,leo,LEO Technologies scanners))
+$(eval $(call SaneBackend,lexmark,Lexmark X1100/X1200 Series scanners))
+$(eval $(call SaneBackend,ma1509,Mustek BearPaw 1200F USB scanner))
+$(eval $(call SaneBackend,magicolor,KONICA MINOLTA magicolor scanners))
+$(eval $(call SaneBackend,matsushita,Panasonic KV-SS high speed scanners))
+$(eval $(call SaneBackend,microtek,Microtek scanners))
+$(eval $(call SaneBackend,microtek2,Microtek scanners with SCSI-2 command set))
+$(eval $(call SaneBackend,mustek,Mustek SCSI flatbed scanners and some other devices))
+# Depends on libieee1284
+#$(eval $(call SaneBackend,mustek_pp,Mustek parallel port flatbed scanners,+libieee1284))
+$(eval $(call SaneBackend,mustek_usb,Mustek USB flatbed scanners))
+$(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners))
+$(eval $(call SaneBackend,nec,NEC scanners))
+$(eval $(call SaneBackend,net,network backend))
+$(eval $(call SaneBackend,niash,scanners based on the NIASH chipset))
+$(eval $(call SaneBackend,p5,the Primax PagePartner))
+$(eval $(call SaneBackend,pie,PIE Devcom and AdLib SCSI flatbed scanners))
+$(eval $(call SaneBackend,pieusb,PIE Devcom and AdLib SCSI flatbed scanners)) #####
+$(eval $(call SaneBackend,pixma,Canon Multi-Function Printers and CanoScan Scanners))
+$(eval $(call SaneBackend,plustek,LM983[1/2/3] based USB flatbed scanners))
+$(eval $(call SaneBackend,plustek_pp,Plustek parallel port flatbed scanners))
+$(eval $(call SaneBackend,qcam,Connectix QuickCam cameras,@(TARGET_x86||TARGET_x86_64)))
+$(eval $(call SaneBackend,ricoh,Ricoh flatbed scanners))
+$(eval $(call SaneBackend,rts8891,rts8891 based scanners))
+$(eval $(call SaneBackend,s9036,Siemens 9036 flatbed scanners))
+$(eval $(call SaneBackend,sceptre,SCEPTRE scanners))
+$(eval $(call SaneBackend,sharp,SHARP scanners))
+$(eval $(call SaneBackend,sm3600,Microtek scanners with M011 USB chip))
+$(eval $(call SaneBackend,sm3840,Microtek scanners with SCAN08 USB chip))
+$(eval $(call SaneBackend,snapscan,AGFA SnapScan flatbed scanners))
+$(eval $(call SaneBackend,sp15c,Fujitsu ScanPartner 15C flatbed scanner))
+$(eval $(call SaneBackend,st400,Siemens ST/Highscan flatbed scanners))
+$(eval $(call SaneBackend,stv680,STV680 cameras))
+$(eval $(call SaneBackend,tamarack,Tamarack flatbed scanners))
+$(eval $(call SaneBackend,teco1,TECO / RELISYS scanners))
+$(eval $(call SaneBackend,teco2,TECO / RELISYS scanners))
+$(eval $(call SaneBackend,teco3,TECO / RELISYS scanners))
+$(eval $(call SaneBackend,test,testing frontends))
+$(eval $(call SaneBackend,u12,Plustek USB flatbed scanners based on older parport designs))
+$(eval $(call SaneBackend,umax,UMAX scanners))
+$(eval $(call SaneBackend,umax1220u,the UMAX Astra 1220U and similar scanners))
+$(eval $(call SaneBackend,umax_pp,Umax Astra parallel port flatbed scanners))
+$(eval $(call SaneBackend,v4l,Video for Linux API,+libv4l +libjpeg))
+$(eval $(call SaneBackend,xerox_mfp,Xerox Phaser 3200MFP device))
+$(eval $(call BuildPackage,sane-backends))
+$(eval $(call BuildPackage,sane-backends-all))
+$(eval $(call BuildPackage,sane-frontends))
diff --git a/utils/sane-backends/files/xinet.d_sane-port b/utils/sane-backends/files/xinet.d_sane-port
new file mode 100644 (file)
index 0000000..9119973
--- /dev/null
@@ -0,0 +1,14 @@
+# default: off
+# description: The saned provides scanner service via the network.  \
+#      Applications like kooka, xsane or xscanimage can use the remote \
+#      scanner. 
+service sane-port
+{
+       socket_type = stream
+       port        = 6566
+       wait        = no
+       user        = root
+       group       = root
+       server      = /usr/sbin/saned
+       disable     = yes
+}
diff --git a/utils/sane-backends/patches/002-remove-uneeded.patch b/utils/sane-backends/patches/002-remove-uneeded.patch
new file mode 100644 (file)
index 0000000..8348058
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -400,7 +400,7 @@ target_alias = @target_alias@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = include lib sanei backend frontend tools doc po testsuite
++SUBDIRS = include lib sanei backend frontend
+ DIST_SUBDIRS = include lib sanei backend frontend tools doc po japi testsuite
+ dist_doc_DATA = AUTHORS ChangeLog COPYING LICENSE NEWS PROBLEMS PROJECTS \
+  README README.aix README.beos README.darwin README.djpeg README.freebsd \
diff --git a/utils/sane-backends/patches/020-fix_pieusb.patch b/utils/sane-backends/patches/020-fix_pieusb.patch
new file mode 100644 (file)
index 0000000..ae97040
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/backend/pieusb_buffer.c
++++ b/backend/pieusb_buffer.c
+@@ -104,11 +104,13 @@
+ /* When creating the release backend, make complains about unresolved external
+  * le16toh, although it finds the include <endian.h> */
++#ifndef le16toh
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+  #define le16toh(x) (x)
+ #else
+  #define le16toh(x) __bswap_16 (x)
+ #endif
++#endif
+ static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment);
diff --git a/utils/sane-backends/patches/030-musl.patch b/utils/sane-backends/patches/030-musl.patch
new file mode 100644 (file)
index 0000000..b8dd50e
--- /dev/null
@@ -0,0 +1,61 @@
+--- a/include/sane/sanei_udp.h
++++ b/include/sane/sanei_udp.h
+@@ -27,6 +27,7 @@
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #endif
++#include <sys/types.h>
+ extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp);
+ extern SANE_Status sanei_udp_open_broadcast(int *fdp);
+--- a/backend/kvs20xx_cmd.h
++++ b/backend/kvs20xx_cmd.h
+@@ -9,6 +9,8 @@
+    Panasonic KV-S20xx USB-SCSI scanners.
+ */
++#include <sys/types.h>
++
+ #define COMMAND_BLOCK 1
+ #define DATA_BLOCK    2
+ #define RESPONSE_BLOCK        3
+--- a/backend/kvs40xx.h
++++ b/backend/kvs40xx.h
+@@ -10,6 +10,7 @@
+ #include "../include/sane/config.h"
+ #include <semaphore.h>
++#include <sys/types.h>
+ #undef  BACKEND_NAME
+ #define BACKEND_NAME kvs40xx
+--- a/backend/hp5400.c
++++ b/backend/hp5400.c
+@@ -67,6 +67,7 @@
+ #include <stdlib.h>           /* malloc, free */
+ #include <string.h>           /* memcpy */
+ #include <stdio.h>
++#include <sys/types.h>
+ #define HP5400_CONFIG_FILE "hp5400.conf"
+--- a/backend/hp5590.c
++++ b/backend/hp5590.c
+@@ -48,6 +48,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <sys/types.h>
+ #include "../include/sane/sane.h"
+ #define BACKEND_NAME hp5590
+--- a/backend/epsonds-io.c
++++ b/backend/epsonds-io.c
+@@ -16,6 +16,7 @@
+ #include "sane/config.h"
+ #include <ctype.h>
+ #include <unistd.h>     /* sleep */
++#include <sys/types.h>
+ #include "epsonds.h"
+ #include "epsonds-io.h"
diff --git a/utils/sane-backends/patches/031-fix_uclibc.patch b/utils/sane-backends/patches/031-fix_uclibc.patch
new file mode 100644 (file)
index 0000000..b7495a5
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/configure.in
++++ b/configure.in
+@@ -279,6 +279,9 @@ dnl ************************************
+ dnl Checks for library functions
+ dnl ***********************************************************************
++dnl Check mkostemp (missing in uclibc)
++AC_CHECK_FUNC(mkostemp)
++
+ dnl Define SOCKET_LIB, NSL_LIB, BIND_LIB, and RESOLV_LIB  when required 
+ dnl for functions we use.
+ AC_CHECK_FUNC(gethostbyaddr,, [AC_CHECK_LIB(bind, gethostbyaddr, BIND_LIB="-lbind")])
+--- a/include/sane/config.h.in
++++ b/include/sane/config.h.in
+@@ -207,6 +207,9 @@
+ /* Define to 1 if you have the `mkdir' function. */
+ #undef HAVE_MKDIR
++/* Define to 1 if you have a working `mkostemp' function. */
++#undef HAVE_MKOSTEMP
++
+ /* Define to 1 if you have a working `mmap' system call. */
+ #undef HAVE_MMAP
+--- a/backend/pieusb_buffer.c
++++ b/backend/pieusb_buffer.c
+@@ -112,6 +112,11 @@
+ #endif
+ #endif
++#ifndef HAVE_MKOSTEMP
++/* uclibc might not implement mkostemp GNU extension */
++#define mkostemp(template, flags) mkstemp(template)
++#endif
++
+ static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment);
+ /* READER */
diff --git a/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch b/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch
new file mode 100644 (file)
index 0000000..bb01dd9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/backend/Makefile.am
++++ b/backend/Makefile.am
+@@ -1142,7 +1142,7 @@ EXTRA_DIST += dll.aliases
+ nodist_libsane_la_SOURCES =  dll-s.c
+ libsane_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll
+ libsane_la_LDFLAGS = $(DIST_LIBS_LDFLAGS)
+-libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo  ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
++libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo  ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
+ # WARNING: Automake is getting this wrong so have to do it ourselves.
+ libsane_la_DEPENDENCIES = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo  ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo @SANEI_SANEI_JPEG_LO@
index 0c7dd2cf555c95b001b5caded76000061023811f..d2499a756370cf061a0cc5aef59f68d7dfefb409 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=smstools3
 PKG_VERSION:=3.1.15
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_MAINTAINER:=Gérald Kerma <dreagle@doukki.net>
 PKG_LICENSE:=GPL-2.0
@@ -50,11 +50,11 @@ TARGET_LDFLAGS += -liconv
 BINDIR=/usr/local/bin
 
 define Build/Compile
-       $(MAKE) -C "$(PKG_BUILD_DIR)"/src \
+       $(MAKE) -C "$(PKG_BUILD_DIR)/src" \
                CC="$(TARGET_CC)" \
-               USER_CFLAGS='$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS) \
+               CFLAGS='$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS) \
                -I"$(STAGING_DIR)/usr/lib/libiconv-full/include"' \
-               USER_LDFLAGS='$(TARGET_LFLAGS) $(EXTRA_LDFLAGS) -L"$(STAGING_DIR)/usr/lib/libiconv-full/lib"' \
+               LFLAGS='$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS) -L"$(STAGING_DIR)/usr/lib/libiconv-full/lib"' \
                all
 endef
 
diff --git a/utils/spi-tools/Makefile b/utils/spi-tools/Makefile
new file mode 100644 (file)
index 0000000..ca4da88
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2014-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=spi-tools
+PKG_VERSION:=1
+
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/cpb-/spi-tools.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=cc6a41fdcec60610703ba6db488c621c64952898
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/spi-tools
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Command line SPI tools
+endef
+
+EXTRA_CFLAGS+=-DVERSION=\"$(PKG_SOURCE_VERSION)\"
+
+define Build/Compile
+       cd $(PKG_BUILD_DIR) ; \
+        $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -Wall -Werror -o spi-config src/spi-config.c ; \
+        $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -Wall -Werror -o spi-pipe src/spi-pipe.c
+endef
+
+define Package/spi-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/spi-config $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/spi-pipe $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,spi-tools))
diff --git a/utils/swig/Makefile b/utils/swig/Makefile
new file mode 100644 (file)
index 0000000..7b9c4f0
--- /dev/null
@@ -0,0 +1,39 @@
+# 
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=swig
+PKG_VERSION:=3.0.7
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=7fff46c84b8c630ede5b0f0827e3d90a
+PKG_INSTALL:=1
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=GPL-3.0
+PKG_LICENSE_FILE:=LICENSE
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/swig
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=swig binding generator
+  BUILDONLY:=1
+endef
+
+HOST_CONFIGURE_ARGS+= \
+       --without-pcre
+
+define Package/swig/description
+  tool that generates bindings for various languages
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,swig))
index 1925319e5d3f2fc10af1a33042fabec24dc9781e..45cbc8eb06a0acffca857f9d33ac1264575df8a6 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=unrar
-PKG_VERSION:=5.3.4
+PKG_VERSION:=5.3.5
 PKG_RELEASE:=1
 
 PKG_SOURCE:=unrarsrc-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.rarlab.com/rar
-PKG_MD5SUM:=60afbc74a97eff512a6c42425ec43bbf
+PKG_MD5SUM:=687fc04817d138b988739b0e3c8f83db
 PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
 
 PKG_LICENSE:=UnRAR
diff --git a/utils/yunbridge/Makefile b/utils/yunbridge/Makefile
new file mode 100644 (file)
index 0000000..ae49232
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=yunbridge
+PKG_VERSION:=160
+
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/arduino/YunBridge.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=f2042052115e71ad2c91f77e78d21db8275fcdd6
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/yunbridge
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Arduino YUN bridge library
+  URL:=http://arduino.cc/
+  DEPENDS:=+python
+endef
+
+define Package/yunbridge/description
+  Arduino YUN bridge library
+endef
+
+define Build/Compile
+       true
+endef
+
+define Package/yunbridge/install
+       mkdir -p $(1)/usr/lib/python2.7/bridge
+       $(CP) $(PKG_BUILD_DIR)/bridge/*.py $(1)/usr/lib/python2.7/bridge/
+       $(CP) ./files/* $(1)
+endef
+
+$(eval $(call BuildPackage,yunbridge))
diff --git a/utils/yunbridge/files/etc/config/yunbridge b/utils/yunbridge/files/etc/config/yunbridge
new file mode 100644 (file)
index 0000000..fe8dd28
--- /dev/null
@@ -0,0 +1,6 @@
+config bridge config
+       option socket_timeout 5
+       option secure_rest_api false
+
+       # remove this line to activae the yunbridge
+       option disabled 1
diff --git a/utils/yunbridge/files/etc/init.d/yunbridge b/utils/yunbridge/files/etc/init.d/yunbridge
new file mode 100755 (executable)
index 0000000..4b48220
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2013 OpenWrt.org
+
+# start after and stop before networking
+START=20
+STOP=89
+
+USE_PROCD=1
+
+service_triggers()
+{
+       procd_add_reload_trigger "yunbridge"
+}
+
+start_service()
+{
+       [ "$(uci -q get yunbridge.config.disabled)" = "1" ] && return 0
+       procd_open_instance
+       procd_set_param command "/sbin/yunbridge"
+       procd_set_param respawn
+       procd_close_instance
+}
diff --git a/utils/yunbridge/files/sbin/yunbridge b/utils/yunbridge/files/sbin/yunbridge
new file mode 100755 (executable)
index 0000000..c8e4812
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+stty -F /dev/ttyS0 2500000 clocal cread cs8 -cstopb -parenb
+exec < /dev/ttyS0
+exec > /dev/ttyS0
+exec 2> /dev/ttyS0
+askfirst bin/ash --login
diff --git a/utils/yunbridge/files/usr/bin/pretty-wifi-info.lua b/utils/yunbridge/files/usr/bin/pretty-wifi-info.lua
new file mode 100755 (executable)
index 0000000..d91817a
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/lua
+
+local function get_basic_net_info(network, iface, accumulator)
+  local net = network:get_network(iface)
+  local device = net and net:get_interface()
+
+  if device then
+    accumulator["uptime"] = net:uptime()
+    accumulator["iface"] = device:name()
+    accumulator["mac"] = device:mac()
+    accumulator["rx_bytes"] = device:rx_bytes()
+    accumulator["tx_bytes"] = device:tx_bytes()
+    accumulator["ipaddrs"] = {}
+
+    for _, ipaddr in ipairs(device:ipaddrs()) do
+      accumulator.ipaddrs[#accumulator.ipaddrs + 1] = {
+        addr = ipaddr:host():string(),
+        netmask = ipaddr:mask():string()
+      }
+    end
+  end
+end
+
+local function get_wifi_info(network, iface, accumulator)
+  local net = network:get_wifinet(iface)
+
+  if net then
+    local dev = net:get_device()
+    if dev then
+      accumulator["mode"] = net:active_mode()
+      accumulator["ssid"] = net:active_ssid()
+      accumulator["encryption"] = net:active_encryption()
+      accumulator["quality"] = net:signal_percent()
+    end
+  end
+end
+
+local function collect_wifi_info()
+  local network = require"luci.model.network".init()
+  local accumulator = {}
+  get_basic_net_info(network, "lan", accumulator)
+  get_wifi_info(network, "wlan0", accumulator)
+  return accumulator
+end
+
+local info = collect_wifi_info()
+
+print("Current WiFi configuration")
+if info.ssid then
+  print("SSID: " .. info.ssid)
+end
+if info.mode then
+  print("Mode: " .. info.mode)
+end
+if info.quality then
+  print("Signal: " .. info.quality .. "%")
+end
+if info.encryption then
+  print("Encryption method: " .. info.encryption)
+end
+if info.iface then
+  print("Interface name: " .. info.iface)
+end
+if info.uptime then
+  print("Active for: " .. math.floor(info.uptime / 60) .. " minutes")
+end
+if #info.ipaddrs > 0 then
+  print("IP address: " .. info.ipaddrs[1].addr .. "/" .. info.ipaddrs[1].netmask)
+end
+if info.mac then
+  print("MAC address: " .. info.mac)
+end
+if info.rx_bytes and info.tx_bytes then
+  print("RX/TX: " .. math.floor(info.rx_bytes / 1024) .. "/" .. math.floor(info.tx_bytes / 1024) .. " KBs")
+end
diff --git a/utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua b/utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua
new file mode 100644 (file)
index 0000000..8d3b7eb
--- /dev/null
@@ -0,0 +1,414 @@
+--[[
+This file is part of YunWebUI.
+
+YunWebUI is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+As a special exception, you may use this file as part of a free software
+library without restriction.  Specifically, if other files instantiate
+templates or use macros or inline functions from this file, or you compile
+this file and link it with other files to produce an executable, this
+file does not by itself cause the resulting executable to be covered by
+the GNU General Public License.  This exception does not however
+invalidate any other reasons why the executable file might be covered by
+the GNU General Public License.
+
+Copyright 2013 Arduino LLC (http://www.arduino.cc/)
+]]
+
+module("luci.controller.arduino.index", package.seeall)
+
+local function not_nil_or_empty(value)
+  return value and value ~= ""
+end
+
+local function get_first(cursor, config, type, option)
+  return cursor:get_first(config, type, option)
+end
+
+local function set_first(cursor, config, type, option, value)
+  cursor:foreach(config, type, function(s)
+    if s[".type"] == type then
+      cursor:set(config, s[".name"], option, value)
+    end
+  end)
+end
+
+
+local function to_key_value(s)
+  local parts = luci.util.split(s, ":")
+  parts[1] = luci.util.trim(parts[1])
+  parts[2] = luci.util.trim(parts[2])
+  return parts[1], parts[2]
+end
+
+function http_error(code, text)
+  luci.http.prepare_content("text/plain")
+  luci.http.status(code)
+  if text then
+    luci.http.write(text)
+  end
+end
+
+function index()
+  function luci.dispatcher.authenticator.arduinoauth(validator, accs, default)
+    require("luci.controller.arduino.index")
+
+    local user = luci.http.formvalue("username")
+    local pass = luci.http.formvalue("password")
+    local basic_auth = luci.http.getenv("HTTP_AUTHORIZATION")
+
+    if user and validator(user, pass) then
+      return user
+    end
+
+    if basic_auth and basic_auth ~= "" then
+      local decoded_basic_auth = nixio.bin.b64decode(string.sub(basic_auth, 7))
+      user = string.sub(decoded_basic_auth, 0, string.find(decoded_basic_auth, ":") - 1)
+      pass = string.sub(decoded_basic_auth, string.find(decoded_basic_auth, ":") + 1)
+    end
+
+    if user then
+      if #pass ~= 64 and validator(user, pass) then
+        return user
+      elseif #pass == 64 then
+        local uci = luci.model.uci.cursor()
+        uci:load("yunbridge")
+        local stored_encrypted_pass = uci:get_first("yunbridge", "bridge", "password")
+        if pass == stored_encrypted_pass then
+          return user
+        end
+      end
+    end
+
+    luci.http.header("WWW-Authenticate", "Basic realm=\"yunbridge\"")
+    luci.http.status(401)
+
+    return false
+  end
+
+  local function make_entry(path, target, title, order)
+    local page = entry(path, target, title, order)
+    page.leaf = true
+    return page
+  end
+
+  -- web panel
+  local webpanel = entry({ "webpanel" }, alias("webpanel", "go_to_homepage"), _("%s Web Panel") % luci.sys.hostname(), 10)
+  webpanel.sysauth = "root"
+  webpanel.sysauth_authenticator = "arduinoauth"
+
+  make_entry({ "webpanel", "go_to_homepage" }, call("go_to_homepage"), nil)
+
+  --api security level
+  local uci = luci.model.uci.cursor()
+  uci:load("yunbridge")
+  local secure_rest_api = uci:get_first("yunbridge", "bridge", "secure_rest_api")
+  local rest_api_sysauth = false
+  if secure_rest_api == "true" then
+    rest_api_sysauth = webpanel.sysauth
+  end
+
+  --storage api
+  local data_api = node("data")
+  data_api.sysauth = rest_api_sysauth
+  data_api.sysauth_authenticator = webpanel.sysauth_authenticator
+  make_entry({ "data", "get" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth
+  make_entry({ "data", "put" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth
+  make_entry({ "data", "delete" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth
+  local mailbox_api = node("mailbox")
+  mailbox_api.sysauth = rest_api_sysauth
+  mailbox_api.sysauth_authenticator = webpanel.sysauth_authenticator
+  make_entry({ "mailbox" }, call("build_bridge_mailbox_request"), nil).sysauth = rest_api_sysauth
+
+  --plain socket endpoint
+  local plain_socket_endpoint = make_entry({ "arduino" }, call("board_plain_socket"), nil)
+  plain_socket_endpoint.sysauth = rest_api_sysauth
+  plain_socket_endpoint.sysauth_authenticator = webpanel.sysauth_authenticator
+end
+
+function go_to_homepage()
+  luci.http.redirect("/index.html")
+end
+
+local function build_bridge_request(command, params)
+
+  local bridge_request = {
+    command = command
+  }
+
+  if command == "raw" then
+    params = table.concat(params, "/")
+    if not_nil_or_empty(params) then
+      bridge_request["data"] = params
+    end
+    return bridge_request
+  end
+
+  if command == "get" then
+    if not_nil_or_empty(params[1]) then
+      bridge_request["key"] = params[1]
+    end
+    return bridge_request
+  end
+
+  if command == "put" and not_nil_or_empty(params[1]) and params[2] then
+    bridge_request["key"] = params[1]
+    bridge_request["value"] = params[2]
+    return bridge_request
+  end
+
+  if command == "delete" and not_nil_or_empty(params[1]) then
+    bridge_request["key"] = params[1]
+    return bridge_request
+  end
+
+  return nil
+end
+
+local function extract_jsonp_param(query_string)
+  if not not_nil_or_empty(query_string) then
+    return nil
+  end
+
+  local qs_parts = string.split(query_string, "&")
+  for idx, value in ipairs(qs_parts) do
+    if string.find(value, "jsonp") == 1 or string.find(value, "callback") == 1 then
+      return string.sub(value, string.find(value, "=") + 1)
+    end
+  end
+end
+
+local function parts_after(url_part)
+  local url = luci.http.getenv("PATH_INFO")
+  local url_after_part = string.find(url, "/", string.find(url, url_part) + 1)
+  if not url_after_part then
+    return {}
+  end
+  return luci.util.split(string.sub(url, url_after_part + 1), "/")
+end
+
+function storage_send_request()
+  local method = luci.http.getenv("REQUEST_METHOD")
+  local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING"))
+  local parts = parts_after("data")
+  local command = parts[1]
+  if not command or command == "" then
+    luci.http.status(404)
+    return
+  end
+  local params = {}
+  for idx, param in ipairs(parts) do
+    if idx > 1 and not_nil_or_empty(param) then
+      table.insert(params, param)
+    end
+  end
+
+  -- TODO check method?
+  local bridge_request = build_bridge_request(command, params)
+  if not bridge_request then
+    luci.http.status(403)
+    return
+  end
+
+  local uci = luci.model.uci.cursor()
+  uci:load("yunbridge")
+  local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5)
+
+  local sock, code, msg = nixio.connect("127.0.0.1", 5700)
+  if not sock then
+    code = code or ""
+    msg = msg or ""
+    http_error(500, "nil socket, " .. code .. " " .. msg)
+    return
+  end
+
+  sock:setopt("socket", "sndtimeo", socket_timeout)
+  sock:setopt("socket", "rcvtimeo", socket_timeout)
+  sock:setopt("tcp", "nodelay", 1)
+
+  local json = require("luci.json")
+
+  sock:write(json.encode(bridge_request))
+  sock:writeall("\n")
+
+  local response_text = {}
+  while true do
+    local bytes = sock:recv(4096)
+    if bytes and #bytes > 0 then
+      table.insert(response_text, bytes)
+    end
+
+    local json_response = json.decode(table.concat(response_text))
+    if json_response then
+      sock:close()
+      luci.http.status(200)
+      if jsonp_callback then
+        luci.http.prepare_content("application/javascript")
+        luci.http.write(jsonp_callback)
+        luci.http.write("(")
+        luci.http.write_json(json_response)
+        luci.http.write(");")
+      else
+        luci.http.prepare_content("application/json")
+        luci.http.write(json.encode(json_response))
+      end
+      return
+    end
+
+    if not bytes or #response_text == 0 then
+      sock:close()
+      http_error(500, "Empty response")
+      return
+    end
+  end
+
+  sock:close()
+end
+
+function board_plain_socket()
+  local function send_response(response_text, jsonp_callback)
+    if not response_text then
+      luci.http.status(500)
+      return
+    end
+
+    local rows = luci.util.split(response_text, "\r\n")
+    if #rows == 1 or string.find(rows[1], "Status") ~= 1 then
+      luci.http.prepare_content("text/plain")
+      luci.http.status(200)
+      luci.http.write(response_text)
+      return
+    end
+
+    local body_start_at_idx = -1
+    local content_type = "text/plain"
+    for idx, row in ipairs(rows) do
+      if row == "" then
+        body_start_at_idx = idx
+        break
+      end
+
+      local key, value = to_key_value(row)
+      if string.lower(key) == "status" then
+        luci.http.status(tonumber(value))
+      elseif string.lower(key) == "content-type" then
+        content_type = value
+      else
+        luci.http.header(key, value)
+      end
+    end
+
+    local response_body = table.concat(rows, "\r\n", body_start_at_idx + 1)
+    if content_type == "application/json" and jsonp_callback then
+      local json = require("luci.json")
+      luci.http.prepare_content("application/javascript")
+      luci.http.write(jsonp_callback)
+      luci.http.write("(")
+      luci.http.write_json(json.decode(response_body))
+      luci.http.write(");")
+    else
+      luci.http.prepare_content(content_type)
+      luci.http.write(response_body)
+    end
+  end
+
+  local method = luci.http.getenv("REQUEST_METHOD")
+  local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING"))
+  local parts = parts_after("arduino")
+  local params = {}
+  for idx, param in ipairs(parts) do
+    if not_nil_or_empty(param) then
+      table.insert(params, param)
+    end
+  end
+
+  if #params == 0 then
+    luci.http.status(404)
+    return
+  end
+
+  params = table.concat(params, "/")
+
+  local uci = luci.model.uci.cursor()
+  uci:load("yunbridge")
+  local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5)
+
+  local sock, code, msg = nixio.connect("127.0.0.1", 5555)
+  if not sock then
+    code = code or ""
+    msg = msg or ""
+    http_error(500, "Could not connect to YunServer " .. code .. " " .. msg)
+    return
+  end
+
+  sock:setopt("socket", "sndtimeo", socket_timeout)
+  sock:setopt("socket", "rcvtimeo", socket_timeout)
+  sock:setopt("tcp", "nodelay", 1)
+
+  sock:write(params)
+  sock:writeall("\r\n")
+
+  local response_text = sock:readall()
+  sock:close()
+
+  send_response(response_text, jsonp_callback)
+end
+
+function build_bridge_mailbox_request()
+  local method = luci.http.getenv("REQUEST_METHOD")
+  local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING"))
+  local parts = parts_after("mailbox")
+  local params = {}
+  for idx, param in ipairs(parts) do
+    if not_nil_or_empty(param) then
+      table.insert(params, param)
+    end
+  end
+
+  if #params == 0 then
+    luci.http.status(400)
+    return
+  end
+
+  local bridge_request = build_bridge_request("raw", params)
+  if not bridge_request then
+    luci.http.status(403)
+    return
+  end
+
+  local uci = luci.model.uci.cursor()
+  uci:load("yunbridge")
+  local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5)
+
+  local sock, code, msg = nixio.connect("127.0.0.1", 5700)
+  if not sock then
+    code = code or ""
+    msg = msg or ""
+    http_error(500, "nil socket, " .. code .. " " .. msg)
+    return
+  end
+
+  sock:setopt("socket", "sndtimeo", socket_timeout)
+  sock:setopt("socket", "rcvtimeo", socket_timeout)
+  sock:setopt("tcp", "nodelay", 1)
+
+  local json = require("luci.json")
+
+  sock:write(json.encode(bridge_request))
+  sock:writeall("\n")
+  sock:close()
+
+  luci.http.status(200)
+end
diff --git a/utils/yunbridge/files/usr/lib/lua/luci/sha256.lua b/utils/yunbridge/files/usr/lib/lua/luci/sha256.lua
new file mode 100644 (file)
index 0000000..b5e2dea
--- /dev/null
@@ -0,0 +1,199 @@
+--
+--  Code merged by gravityscore at http://pastebin.com/gsFrNjbt
+--
+--  Adaptation of the Secure Hashing Algorithm (SHA-244/256)
+--  Found Here: http://lua-users.org/wiki/SecureHashAlgorithm
+--  
+--  Using an adapted version of the bit library
+--  Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua
+--  
+
+module("luci.sha256", package.seeall)
+
+local MOD = 2 ^ 32
+local MODM = MOD - 1
+
+local function memoize(f)
+  local mt = {}
+  local t = setmetatable({}, mt)
+  function mt:__index(k)
+    local v = f(k)
+    t[k] = v
+    return v
+  end
+
+  return t
+end
+
+local function make_bitop_uncached(t, m)
+  local function bitop(a, b)
+    local res, p = 0, 1
+    while a ~= 0 and b ~= 0 do
+      local am, bm = a % m, b % m
+      res = res + t[am][bm] * p
+      a = (a - am) / m
+      b = (b - bm) / m
+      p = p * m
+    end
+    res = res + (a + b) * p
+    return res
+  end
+
+  return bitop
+end
+
+local function make_bitop(t)
+  local op1 = make_bitop_uncached(t, 2 ^ 1)
+  local op2 = memoize(function(a) return memoize(function(b) return op1(a, b) end) end)
+  return make_bitop_uncached(op2, 2 ^ (t.n or 1))
+end
+
+local bxor1 = make_bitop({ [0] = { [0] = 0, [1] = 1 }, [1] = { [0] = 1, [1] = 0 }, n = 4 })
+
+local function bxor(a, b, c, ...)
+  local z = nil
+  if b then
+    a = a % MOD
+    b = b % MOD
+    z = bxor1(a, b)
+    if c then z = bxor(z, c, ...) end
+    return z
+  elseif a then return a % MOD
+  else return 0
+  end
+end
+
+local function band(a, b, c, ...)
+  local z
+  if b then
+    a = a % MOD
+    b = b % MOD
+    z = ((a + b) - bxor1(a, b)) / 2
+    if c then z = bit32_band(z, c, ...) end
+    return z
+  elseif a then return a % MOD
+  else return MODM
+  end
+end
+
+local function bnot(x) return (-1 - x) % MOD end
+
+local function rshift1(a, disp)
+  if disp < 0 then return lshift(a, -disp) end
+  return math.floor(a % 2 ^ 32 / 2 ^ disp)
+end
+
+local function rshift(x, disp)
+  if disp > 31 or disp < -31 then return 0 end
+  return rshift1(x % MOD, disp)
+end
+
+local function lshift(a, disp)
+  if disp < 0 then return rshift(a, -disp) end
+  return (a * 2 ^ disp) % 2 ^ 32
+end
+
+local function rrotate(x, disp)
+  x = x % MOD
+  disp = disp % 32
+  local low = band(x, 2 ^ disp - 1)
+  return rshift(x, disp) + lshift(low, 32 - disp)
+end
+
+local k = {
+  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+  0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+  0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+  0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+  0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+  0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+  0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+  0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+  0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+  0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+  0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+  0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+}
+
+local function str2hexa(s)
+  return (string.gsub(s, ".", function(c) return string.format("%02x", string.byte(c)) end))
+end
+
+local function num2s(l, n)
+  local s = ""
+  for i = 1, n do
+    local rem = l % 256
+    s = string.char(rem) .. s
+    l = (l - rem) / 256
+  end
+  return s
+end
+
+local function s232num(s, i)
+  local n = 0
+  for i = i, i + 3 do n = n * 256 + string.byte(s, i) end
+  return n
+end
+
+local function preproc(msg, len)
+  local extra = 64 - ((len + 9) % 64)
+  len = num2s(8 * len, 8)
+  msg = msg .. "\128" .. string.rep("\0", extra) .. len
+  assert(#msg % 64 == 0)
+  return msg
+end
+
+local function initH256(H)
+  H[1] = 0x6a09e667
+  H[2] = 0xbb67ae85
+  H[3] = 0x3c6ef372
+  H[4] = 0xa54ff53a
+  H[5] = 0x510e527f
+  H[6] = 0x9b05688c
+  H[7] = 0x1f83d9ab
+  H[8] = 0x5be0cd19
+  return H
+end
+
+local function digestblock(msg, i, H)
+  local w = {}
+  for j = 1, 16 do w[j] = s232num(msg, i + (j - 1) * 4) end
+  for j = 17, 64 do
+    local v = w[j - 15]
+    local s0 = bxor(rrotate(v, 7), rrotate(v, 18), rshift(v, 3))
+    v = w[j - 2]
+    w[j] = w[j - 16] + s0 + w[j - 7] + bxor(rrotate(v, 17), rrotate(v, 19), rshift(v, 10))
+  end
+
+  local a, b, c, d, e, f, g, h = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8]
+  for i = 1, 64 do
+    local s0 = bxor(rrotate(a, 2), rrotate(a, 13), rrotate(a, 22))
+    local maj = bxor(band(a, b), band(a, c), band(b, c))
+    local t2 = s0 + maj
+    local s1 = bxor(rrotate(e, 6), rrotate(e, 11), rrotate(e, 25))
+    local ch = bxor(band(e, f), band(bnot(e), g))
+    local t1 = h + s1 + ch + k[i] + w[i]
+    h, g, f, e, d, c, b, a = g, f, e, d + t1, c, b, a, t1 + t2
+  end
+
+  H[1] = band(H[1] + a)
+  H[2] = band(H[2] + b)
+  H[3] = band(H[3] + c)
+  H[4] = band(H[4] + d)
+  H[5] = band(H[5] + e)
+  H[6] = band(H[6] + f)
+  H[7] = band(H[7] + g)
+  H[8] = band(H[8] + h)
+end
+
+function sha256(msg)
+  msg = preproc(msg, #msg)
+  local H = initH256({})
+  for i = 1, #msg, 64 do digestblock(msg, i, H) end
+  return str2hexa(num2s(H[1], 4) .. num2s(H[2], 4) .. num2s(H[3], 4) .. num2s(H[4], 4) ..
+          num2s(H[5], 4) .. num2s(H[6], 4) .. num2s(H[7], 4) .. num2s(H[8], 4))
+end
\ No newline at end of file
diff --git a/utils/yunbridge/patches/000-scripts.patch b/utils/yunbridge/patches/000-scripts.patch
new file mode 100644 (file)
index 0000000..46f21bd
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/bridge/packet.py
++++ b/bridge/packet.py
+@@ -93,12 +93,12 @@
+     
+   def run(self, data):
+     if data[0] != 'X':
+-      call(['/usr/bin/blink-start', '100'])
++      #call(['/usr/bin/blink-start', '100'])
+       return chr(1)
+     if data[1:4] != '100':
+-      call(['/usr/bin/blink-start', '100'])
++      #call(['/usr/bin/blink-start', '100'])
+       return chr(2)
+-    call(['/usr/bin/blink-stop'])
++    #call(['/usr/bin/blink-stop'])
+     return chr(0) + '160' # send the actual bridge version
+     
+ class PacketReader:
index cbbe32a09faf091b3701d7d61c9643cc7ff1a272..09b4f581c6eb3c45bf2a1d81a3dcf8fdc8e263de 100644 (file)
@@ -9,8 +9,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zoneinfo
-PKG_VERSION:=2015f
-PKG_VERSION_CODE:=2015f
+PKG_VERSION:=2015g
+PKG_VERSION_CODE:=2015g
 PKG_RELEASE:=1
 
 #As i couldn't find real license used "Public Domain"
@@ -20,14 +20,14 @@ PKG_LICENSE:=Public Domain
 PKG_SOURCE:=tzdata$(PKG_VERSION).tar.gz
 PKG_SOURCE_CODE:=tzcode$(PKG_VERSION_CODE).tar.gz
 PKG_SOURCE_URL:=http://www.iana.org/time-zones/repository/releases
-PKG_MD5SUM:=e3b82732d20e973e48af1c6f13df9a1d
+PKG_MD5SUM:=8d46e8b225b9a04c75f5c39636435ad6
 
 include $(INCLUDE_DIR)/package.mk
 
 define Download/tzcode
    FILE=$(PKG_SOURCE_CODE)
    URL=$(PKG_SOURCE_URL)
-   MD5SUM:=19578d432ba8b92f73406a17a9bc268d
+   MD5SUM:=a2c47d908a6426f530efb1393cf1cd06
 endef
 
 $(eval $(call Download,tzcode))
index 2e62f08a6f40802021c00f8942706af6c4b10a8d..19a909c885a7ba819b5b9031fe7eee831895d3d6 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zsh
-PKG_VERSION:=5.0.6
+PKG_VERSION:=5.1.1
 PKG_RELEASE:=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@SF/zsh
-PKG_MD5SUM:=7150a6abc2aa1a79d81ed9a282594225
-PKG_MAINTAINER:=Vadim A. Misbakh-Soloviov <mva@mva.name>
+PKG_MD5SUM:=0e8ea3313300277a04cee80836507bae
+PKG_MAINTAINER:=Vadim A. Misbakh-Soloviov <openwrt-zsh@mva.name>
 PKG_LICENSE:=ZSH
 
 PKG_INSTALL:=1