From 2483673439bd4ac390b15538b38ff4940051176b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Sat, 20 Apr 2019 06:33:15 +0200 Subject: [PATCH] openwrt: update nodejs to LEDE v17.01.6 to fix compile issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates: * node * node-arduino-firmata * node-cylon * node-hid * node-serialport to their version used in LEDE v17.01.6. This fixes compile errors appearing on Debian Sid. A list of the patches picked from upstream (x'd ones excluded): $ git log --oneline 8ca186cd59..HEAD lang/node lang/node-arduino-firmata/ lang/node-cylon/ lang/node-hid/ lang/node-serialport/ x 4a984a8d6 treewide: replace $(STAGING_DIR)/host and $(HOST_BUILD_PREFIX) with $(STAGING_DIR_HOSTPKG) x 844638d51 Merge pull request #3056 from plntyk/fix_node 0da71b8f8 node: use default host install prefix def97187d Treewide fix of typo: PKG_LICENSE_FILE --> PKG_LICENSE_FILES bc86e32d4 node: fix soft/hard float compile on arm/mips 865f44ef7 node,node-*: node update to v4.4.5 and Enhance CPU-arch variant. a3148b64e node-hid: fix git submodule issue aa9202fac node-hid: fix compile error c9115cdf5 node-*: node update to v4.4.4 x bbce5fce7 node: fix undefined behaviour leading to broken code with GCC 6 9125c3615 node: update to v4.4.4 5a118cda9 node update v0.12.13 x fb744a658 Merge pull request #2486 from yousong/cp-fix bca789b6b node-* : specify npm_config_cache directory ac000220c node-* : specify npm_config_cache directory 47f466e88 node-* : specify npm_config_cache directory 10c6b4110 node-* : specify npm_config_cache directory a82363f0a node-serialport: add node host dependency 0498c8ae2 node-hid: add node host dependency a64623683 node-cylon: add node host dependency 2b8a17de0 node-arduino-firmata: add node host dependency 92b0575e2 Drop the redundant -r option to $(CP) x 9f8e5aca3 treewide: use $(STAGING_DIR)/host instead of $(STAGING_DIR_HOST), sync with changes in trunk e5ca27a97 node: fix build on x86 & x86.64 targets x 659719005 node: add python/host to HOST_BUILD_DEPENDS as well Signed-off-by: Linus Lüssing --- ...r-leading-to-broken-code-with-GCC-6.patch} | 0 .../0005-node-update-to-v0.12.14.patch | 49 - ...se-shared-instead-of-static-library.patch} | 0 ...node-fix-build-on-x86-x86.64-targets.patch | 47 + ...08-Drop-the-redundant-r-option-to-CP.patch | 56 + ...ino-firmata-add-node-host-dependency.patch | 19 + ...-node-cylon-add-node-host-dependency.patch | 19 + ...11-node-hid-add-node-host-dependency.patch | 19 + ...-serialport-add-node-host-dependency.patch | 19 + ...e-specify-npm_config_cache-directory.patch | 16 + ...e-specify-npm_config_cache-directory.patch | 16 + ...e-specify-npm_config_cache-directory.patch | 16 + ...e-specify-npm_config_cache-directory.patch | 16 + .../openwrt/0017-node-update-v0.12.13.patch | 113 + .../openwrt/0018-node-update-to-v4.4.4.patch | 110 + .../0019-node-node-update-to-v4.4.4.patch | 2622 +++++++++++++++++ .../0020-node-hid-fix-compile-error.patch | 27 + ...021-node-hid-fix-git-submodule-issue.patch | 25 + ...-v4.4.5-and-Enhance-CPU-arch-variant.patch | 202 ++ ...-soft-hard-float-compile-on-arm-mips.patch | 31 + ...o-PKG_LICENSE_FILE-PKG_LICENSE_FILES.patch | 97 + 21 files changed, 3470 insertions(+), 49 deletions(-) rename patches/packages/openwrt/{0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch => 0005-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch} (100%) delete mode 100644 patches/packages/openwrt/0005-node-update-to-v0.12.14.patch rename patches/packages/openwrt/{0007-libuecc-use-shared-instead-of-static-library.patch => 0006-libuecc-use-shared-instead-of-static-library.patch} (100%) create mode 100644 patches/packages/openwrt/0007-node-fix-build-on-x86-x86.64-targets.patch create mode 100644 patches/packages/openwrt/0008-Drop-the-redundant-r-option-to-CP.patch create mode 100644 patches/packages/openwrt/0009-node-arduino-firmata-add-node-host-dependency.patch create mode 100644 patches/packages/openwrt/0010-node-cylon-add-node-host-dependency.patch create mode 100644 patches/packages/openwrt/0011-node-hid-add-node-host-dependency.patch create mode 100644 patches/packages/openwrt/0012-node-serialport-add-node-host-dependency.patch create mode 100644 patches/packages/openwrt/0013-node-specify-npm_config_cache-directory.patch create mode 100644 patches/packages/openwrt/0014-node-specify-npm_config_cache-directory.patch create mode 100644 patches/packages/openwrt/0015-node-specify-npm_config_cache-directory.patch create mode 100644 patches/packages/openwrt/0016-node-specify-npm_config_cache-directory.patch create mode 100644 patches/packages/openwrt/0017-node-update-v0.12.13.patch create mode 100644 patches/packages/openwrt/0018-node-update-to-v4.4.4.patch create mode 100644 patches/packages/openwrt/0019-node-node-update-to-v4.4.4.patch create mode 100644 patches/packages/openwrt/0020-node-hid-fix-compile-error.patch create mode 100644 patches/packages/openwrt/0021-node-hid-fix-git-submodule-issue.patch create mode 100644 patches/packages/openwrt/0022-node-node-node-update-to-v4.4.5-and-Enhance-CPU-arch-variant.patch create mode 100644 patches/packages/openwrt/0023-node-fix-soft-hard-float-compile-on-arm-mips.patch create mode 100644 patches/packages/openwrt/0024-Treewide-fix-of-typo-PKG_LICENSE_FILE-PKG_LICENSE_FILES.patch diff --git a/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch b/patches/packages/openwrt/0005-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch similarity index 100% rename from patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch rename to patches/packages/openwrt/0005-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch diff --git a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch deleted file mode 100644 index dd52f71a..00000000 --- a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: Matthias Schiffer -Date: Mon, 9 May 2016 15:57:18 +0200 -Subject: node: update to v0.12.14 - -While we're at it, also enable parallel builds. - -Signed-off-by: Matthias Schiffer - -diff --git a/lang/node/Makefile b/lang/node/Makefile -index 243c8a5b69ae6bd12b84493de3b26992167f2c17..ed35e1729bb01bcbb89e43f975940e675d774cde 100644 ---- a/lang/node/Makefile -+++ b/lang/node/Makefile -@@ -8,17 +8,21 @@ - include $(TOPDIR)/rules.mk - - PKG_NAME:=node --PKG_VERSION:=v0.12.7 -+PKG_VERSION:=v0.12.14 - PKG_RELEASE:=1 - --PKG_SOURCE:=node-$(PKG_VERSION).tar.gz -+PKG_SOURCE:=node-$(PKG_VERSION).tar.xz - PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} -+PKG_MD5SUM:=27f1a2cf00af32cbfe9401ca4b1a805f - - HOST_BUILD_DEPENDS:=python/host - PKG_BUILD_DEPENDS:=python/host - PKG_INSTALL:=1 - PKG_USE_MIPS16:=0 - -+HOST_BUILD_PARALLEL:=1 -+PKG_BUILD_PARALLEL:=1 -+ - PKG_MAINTAINER:=John Crispin - PKG_LICENSE:= - -@@ -56,6 +60,12 @@ HOST_CONFIGURE_ARGS:= \ - - HOST_CONFIGURE_CMD:=python ./configure - -+HOST_MAKE_FLAGS += CXXFLAGS='-std=c++11' -+ -+define Host/Install -+ $(MAKE) -C $(HOST_BUILD_DIR) $(HOST_MAKE_FLAGS) install -+endef -+ - define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ diff --git a/patches/packages/openwrt/0007-libuecc-use-shared-instead-of-static-library.patch b/patches/packages/openwrt/0006-libuecc-use-shared-instead-of-static-library.patch similarity index 100% rename from patches/packages/openwrt/0007-libuecc-use-shared-instead-of-static-library.patch rename to patches/packages/openwrt/0006-libuecc-use-shared-instead-of-static-library.patch diff --git a/patches/packages/openwrt/0007-node-fix-build-on-x86-x86.64-targets.patch b/patches/packages/openwrt/0007-node-fix-build-on-x86-x86.64-targets.patch new file mode 100644 index 00000000..19992148 --- /dev/null +++ b/patches/packages/openwrt/0007-node-fix-build-on-x86-x86.64-targets.patch @@ -0,0 +1,47 @@ +From: Alexandru Ardelean +Date: Sat, 19 Dec 2015 15:16:02 +0200 +Subject: node: fix build on x86 & x86.64 targets + +For x86 and x86_64, nodejs has some special CPU +code that needs to be selected by specifying +the correct CPU name (correct for nodejs). + +On OpenWRT x86 is i386 ; node wants ia32 for this. +And x86_64 is x64 on nodejs. + +So, we just need to do the proper substitutions. + +Note: the ARCH env-var is obtained from CONFIG_ARCH, after +some subtitutions are applied. +So, it shouldn't affect other target archs. + +Signed-off-by: Alexandru Ardelean + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 243c8a5b69ae6bd12b84493de3b26992167f2c17..14741049972a8bd8a15bcf879d3c1294dd754603 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk + + PKG_NAME:=node + PKG_VERSION:=v0.12.7 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE:=node-$(PKG_VERSION).tar.gz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} +@@ -40,8 +40,13 @@ define Package/node/description + package ecosystem, npm, is the largest ecosystem of open source libraries in the world. + endef + ++CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) ++ ++MAKE_VARS += \ ++ DESTCPU=$(CPU) ++ + CONFIGURE_ARGS= \ +- --dest-cpu=$(CONFIG_ARCH) \ ++ --dest-cpu=$(CPU) \ + --dest-os=linux \ + --without-snapshot \ + --shared-zlib \ diff --git a/patches/packages/openwrt/0008-Drop-the-redundant-r-option-to-CP.patch b/patches/packages/openwrt/0008-Drop-the-redundant-r-option-to-CP.patch new file mode 100644 index 00000000..07044721 --- /dev/null +++ b/patches/packages/openwrt/0008-Drop-the-redundant-r-option-to-CP.patch @@ -0,0 +1,56 @@ +From: Yousong Zhou +Date: Sat, 12 Mar 2016 01:10:04 +0800 +Subject: Drop the redundant -r option to $(CP) + +$(CP) was defined as `cp -fpR' since the very begining of OpenWrt build +system (2006-06-22). The -R option should be enough and base packages +use only $(CP) for the same purposes just fine and BSD manual of cp also +discourages the use of `-r' option. So let's just tidy up the usage now. + +[linus.luessing@c0d3.blue: backport, node* only] +Signed-off-by: Yousong Zhou + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index aced0701287475e245a185f969b71232cf3ee6e0..73e8da126c5fc068f5af332cfde683449d16c849 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -60,7 +60,7 @@ 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)/ ++ $(CP) ./files/* $(1)/ + endef + + $(eval $(call BuildPackage,node-arduino-firmata)) +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index 753ae2319b103e392297c8cf63c915cc2fcd3453..c2e3b7265d11316dabd22dbf0f6ea8ee83fdeb5a 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -73,22 +73,22 @@ 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/ ++ $(CP) $(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/ ++ $(CP) $(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/ ++ $(CP) $(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/ ++ $(CP) $(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)) diff --git a/patches/packages/openwrt/0009-node-arduino-firmata-add-node-host-dependency.patch b/patches/packages/openwrt/0009-node-arduino-firmata-add-node-host-dependency.patch new file mode 100644 index 00000000..e81aaa64 --- /dev/null +++ b/patches/packages/openwrt/0009-node-arduino-firmata-add-node-host-dependency.patch @@ -0,0 +1,19 @@ +From: Stijn Tintel +Date: Thu, 17 Mar 2016 10:34:56 +0100 +Subject: node-arduino-firmata: add node host dependency + +Signed-off-by: Stijn Tintel + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 73e8da126c5fc068f5af332cfde683449d16c849..96d120f5698a783e54384b05c32d11ed9b1bd319 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -18,7 +18,7 @@ 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_BUILD_DEPENDS:=node/host + PKG_NODE_VERSION:=0.12.7 + + PKG_MAINTAINER:=John Crispin diff --git a/patches/packages/openwrt/0010-node-cylon-add-node-host-dependency.patch b/patches/packages/openwrt/0010-node-cylon-add-node-host-dependency.patch new file mode 100644 index 00000000..35ef6ff5 --- /dev/null +++ b/patches/packages/openwrt/0010-node-cylon-add-node-host-dependency.patch @@ -0,0 +1,19 @@ +From: Stijn Tintel +Date: Thu, 17 Mar 2016 10:35:53 +0100 +Subject: node-cylon: add node host dependency + +Signed-off-by: Stijn Tintel + +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index c2e3b7265d11316dabd22dbf0f6ea8ee83fdeb5a..d2ed0a0a25c65e8b13536dc1c44b498743766ef7 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -18,7 +18,7 @@ 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_BUILD_DEPENDS:=node/host + PKG_NODE_VERSION:=0.12.7 + + PKG_MAINTAINER:=John Crispin diff --git a/patches/packages/openwrt/0011-node-hid-add-node-host-dependency.patch b/patches/packages/openwrt/0011-node-hid-add-node-host-dependency.patch new file mode 100644 index 00000000..518c89b3 --- /dev/null +++ b/patches/packages/openwrt/0011-node-hid-add-node-host-dependency.patch @@ -0,0 +1,19 @@ +From: Stijn Tintel +Date: Thu, 17 Mar 2016 10:36:47 +0100 +Subject: node-hid: add node host dependency + +Signed-off-by: Stijn Tintel + +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index 911e2a4cc695004d4ee4ee3d3078fc7d1876bee2..fbb7ed00eebef2fcf2b63175acc53b0b77a71e5c 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -18,7 +18,7 @@ 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_BUILD_DEPENDS:=node/host + PKG_NODE_VERSION:=0.12.7 + + PKG_MAINTAINER:=John Crispin diff --git a/patches/packages/openwrt/0012-node-serialport-add-node-host-dependency.patch b/patches/packages/openwrt/0012-node-serialport-add-node-host-dependency.patch new file mode 100644 index 00000000..7475cd6b --- /dev/null +++ b/patches/packages/openwrt/0012-node-serialport-add-node-host-dependency.patch @@ -0,0 +1,19 @@ +From: Stijn Tintel +Date: Thu, 17 Mar 2016 10:37:10 +0100 +Subject: node-serialport: add node host dependency + +Signed-off-by: Stijn Tintel + +diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile +index ad4b7aff604543fdfd5a443064552c5fa8fbc472..1f75a36850125a42d88915d83a053d8b35d49577 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -16,7 +16,7 @@ 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_BUILD_DEPENDS:=node/host + PKG_NODE_VERSION:=0.12.7 + + PKG_MAINTAINER:=John Crispin diff --git a/patches/packages/openwrt/0013-node-specify-npm_config_cache-directory.patch b/patches/packages/openwrt/0013-node-specify-npm_config_cache-directory.patch new file mode 100644 index 00000000..f6c02403 --- /dev/null +++ b/patches/packages/openwrt/0013-node-specify-npm_config_cache-directory.patch @@ -0,0 +1,16 @@ +From: Hirokazu MORIKAWA +Date: Fri, 1 Apr 2016 13:46:31 +0900 +Subject: node-* : specify npm_config_cache directory + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 96d120f5698a783e54384b05c32d11ed9b1bd319..89e9637be980fff6c216ba62d1bd617d63e2e130 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -52,6 +52,7 @@ define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ ++ npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) + endef diff --git a/patches/packages/openwrt/0014-node-specify-npm_config_cache-directory.patch b/patches/packages/openwrt/0014-node-specify-npm_config_cache-directory.patch new file mode 100644 index 00000000..cf233913 --- /dev/null +++ b/patches/packages/openwrt/0014-node-specify-npm_config_cache-directory.patch @@ -0,0 +1,16 @@ +From: Hirokazu MORIKAWA +Date: Fri, 1 Apr 2016 13:47:59 +0900 +Subject: node-* : specify npm_config_cache directory + +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index d2ed0a0a25c65e8b13536dc1c44b498743766ef7..e64a4d5b5c4dcc825574838ed21eadf7a7f9e3f3 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -67,6 +67,7 @@ define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ ++ npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) + endef diff --git a/patches/packages/openwrt/0015-node-specify-npm_config_cache-directory.patch b/patches/packages/openwrt/0015-node-specify-npm_config_cache-directory.patch new file mode 100644 index 00000000..316ba644 --- /dev/null +++ b/patches/packages/openwrt/0015-node-specify-npm_config_cache-directory.patch @@ -0,0 +1,16 @@ +From: Hirokazu MORIKAWA +Date: Fri, 1 Apr 2016 13:48:46 +0900 +Subject: node-* : specify npm_config_cache directory + +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index fbb7ed00eebef2fcf2b63175acc53b0b77a71e5c..471d31e873d86031ccbc451c896d50077995f8f2 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -49,6 +49,7 @@ define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ ++ npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) + endef diff --git a/patches/packages/openwrt/0016-node-specify-npm_config_cache-directory.patch b/patches/packages/openwrt/0016-node-specify-npm_config_cache-directory.patch new file mode 100644 index 00000000..3dd4d53c --- /dev/null +++ b/patches/packages/openwrt/0016-node-specify-npm_config_cache-directory.patch @@ -0,0 +1,16 @@ +From: Hirokazu MORIKAWA +Date: Fri, 1 Apr 2016 13:49:16 +0900 +Subject: node-* : specify npm_config_cache directory + +diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile +index 1f75a36850125a42d88915d83a053d8b35d49577..c39735f32fbc51d09155f074a264a2319c895b2b 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -49,6 +49,7 @@ define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ ++ npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) + endef diff --git a/patches/packages/openwrt/0017-node-update-v0.12.13.patch b/patches/packages/openwrt/0017-node-update-v0.12.13.patch new file mode 100644 index 00000000..b3e17e92 --- /dev/null +++ b/patches/packages/openwrt/0017-node-update-v0.12.13.patch @@ -0,0 +1,113 @@ +From: Hirokazu MORIKAWA +Date: Thu, 21 Apr 2016 16:43:14 +0900 +Subject: node update v0.12.13 + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 89e9637be980fff6c216ba62d1bd617d63e2e130..9fca861f6a0b6f649bbad932da57735fe509dbfe 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=arduino-firmata + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.3.3 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.7 ++PKG_NODE_VERSION:=0.12.13 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=MIT +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index e64a4d5b5c4dcc825574838ed21eadf7a7f9e3f3..63b8220e50065fcd3d7c225881475dee13d69432 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=cylon + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.22.0 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.7 ++PKG_NODE_VERSION:=0.12.13 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Apache-2.0 +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index 471d31e873d86031ccbc451c896d50077995f8f2..777d5eafd60bdc86a7ba464aac70b1b664503893 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.4.0 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +@@ -19,7 +19,7 @@ PKG_SOURCE_VERSION:=c56c8aa5d113c6f2574d1f7e64d41745702965bb + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.7 ++PKG_NODE_VERSION:=0.12.13 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile +index c39735f32fbc51d09155f074a264a2319c895b2b..a732174731ceebdb889acd7df9a79914cf2b9220 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -10,14 +10,14 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=serialport + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=1.4.6 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + 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/host +-PKG_NODE_VERSION:=0.12.7 ++PKG_NODE_VERSION:=0.12.13 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 14741049972a8bd8a15bcf879d3c1294dd754603..37da18ce83285882208fc303a9c29bd64f279042 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -1,5 +1,5 @@ + # +-# Copyright (C) 2006-2011 OpenWrt.org ++# Copyright (C) 2006-2016 OpenWrt.org + # + # This is free software, licensed under the GNU General Public License v2. + # See /LICENSE for more information. +@@ -8,8 +8,8 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v0.12.7 +-PKG_RELEASE:=2 ++PKG_VERSION:=v0.12.13 ++PKG_RELEASE:=1 + + PKG_SOURCE:=node-$(PKG_VERSION).tar.gz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} diff --git a/patches/packages/openwrt/0018-node-update-to-v4.4.4.patch b/patches/packages/openwrt/0018-node-update-to-v4.4.4.patch new file mode 100644 index 00000000..88d13cbc --- /dev/null +++ b/patches/packages/openwrt/0018-node-update-to-v4.4.4.patch @@ -0,0 +1,110 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 15:57:18 +0200 +Subject: node: update to v4.4.4 + +While we're at it, also enable parallel builds. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 37da18ce83285882208fc303a9c29bd64f279042..a95aecb3aca1e52e29e4f151ffd28ef361bf1336 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -8,17 +8,21 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v0.12.13 ++PKG_VERSION:=v4.4.4 + PKG_RELEASE:=1 + +-PKG_SOURCE:=node-$(PKG_VERSION).tar.gz ++PKG_SOURCE:=node-$(PKG_VERSION).tar.xz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} ++PKG_MD5SUM:=1ad7915688df85f62a57f43860dc54c6 + + HOST_BUILD_DEPENDS:=python/host + PKG_BUILD_DEPENDS:=python/host + PKG_INSTALL:=1 + PKG_USE_MIPS16:=0 + ++HOST_BUILD_PARALLEL:=1 ++PKG_BUILD_PARALLEL:=1 ++ + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:= + +@@ -31,7 +35,7 @@ define Package/node + 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 ++ DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv +zlib + endef + + define Package/node/description +diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch +new file mode 100644 +index 0000000000000000000000000000000000000000..1bb24930f39e5972df72e49371994bc2debe78f6 +--- /dev/null ++++ b/lang/node/patches/001-hardfloat.patch +@@ -0,0 +1,12 @@ ++diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc ++index 4f58720..1f3071e 100644 ++--- a/deps/v8/src/base/cpu.cc +++++ b/deps/v8/src/base/cpu.cc ++@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) { ++ ".set push\n\t" ++ ".set noreorder\n\t" ++ ".set oddspreg\n\t" +++ ".set hardfloat\n\t" ++ "lui $t0, 0x3FF0\n\t" ++ "ldc1 $f0, %0\n\t" ++ "mtc1 $t0, $f1\n\t" +diff --git a/lang/node/patches/001-mips-no-fpu.patch b/lang/node/patches/001-mips-no-fpu.patch +deleted file mode 100644 +index 5bf8142ccaea10523419412940e52e036a2f8735..0000000000000000000000000000000000000000 +--- a/lang/node/patches/001-mips-no-fpu.patch ++++ /dev/null +@@ -1,15 +0,0 @@ +---- 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 +index 78225db55b9c96ac60a1d55478aecbfdec80abc9..0aa02dac231eee5ed15aff9710aa0d40990b3a60 100644 +--- a/lang/node/patches/002-addr_info.patch ++++ b/lang/node/patches/002-addr_info.patch +@@ -1,6 +1,6 @@ + --- a/deps/uv/src/unix/getaddrinfo.c + +++ b/deps/uv/src/unix/getaddrinfo.c +-@@ -99,6 +99,7 @@ ++@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); +diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch +index 723fe9da7dbcbcd0e1e8c7278100f68440462e57..01a71c6a31a76987a2eae706912f58b6d08344d8 100644 +--- a/lang/node/patches/003-path.patch ++++ b/lang/node/patches/003-path.patch +@@ -1,7 +1,7 @@ + --- a/lib/module.js + +++ b/lib/module.js +-@@ -512,7 +512,8 @@ +- var homeDir = process.env.HOME; ++@@ -453,7 +453,8 @@ Module._initPaths = function() { ++ homeDir = process.env.HOME; + } + + - var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')]; diff --git a/patches/packages/openwrt/0019-node-node-update-to-v4.4.4.patch b/patches/packages/openwrt/0019-node-node-update-to-v4.4.4.patch new file mode 100644 index 00000000..57dca86e --- /dev/null +++ b/patches/packages/openwrt/0019-node-node-update-to-v4.4.4.patch @@ -0,0 +1,2622 @@ +From: Hirokazu MORIKAWA +Date: Wed, 11 May 2016 17:10:49 +0900 +Subject: node-*: node update to v4.4.4 + +[linus.luessing@c0d3.blue: backport] + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 9fca861f6a0b6f649bbad932da57735fe509dbfe..5dc300e0e271ca0161547012b4de2a5954835965 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=arduino-firmata + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.3.3 +-PKG_RELEASE:=2 ++PKG_RELEASE:=3 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.13 ++PKG_NODE_VERSION:=4.4.4 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=MIT +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index 63b8220e50065fcd3d7c225881475dee13d69432..8c73e8e7d29b4e95b9c549cc8603f690bfcd3edb 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=cylon + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.22.0 +-PKG_RELEASE:=2 ++PKG_RELEASE:=3 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.13 ++PKG_NODE_VERSION:=4.4.4 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Apache-2.0 +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index 777d5eafd60bdc86a7ba464aac70b1b664503893..5a243a255a9a19071b62c540a6fafd10cf0628f9 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -9,17 +9,17 @@ include $(TOPDIR)/rules.mk + + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) +-PKG_VERSION:=0.4.0 +-PKG_RELEASE:=2 ++PKG_VERSION:=0.5.1 ++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_VERSION:=35d830b7810c87d32484d0a346621568c4849441 + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.13 ++PKG_NODE_VERSION:=4.4.4 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +@@ -41,6 +41,8 @@ define Package/node-hid/description + Node.js package to access HID devices + endef + ++CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) ++ + EXTRA_LDFLAGS+="-lhidapi-libusb" + EXTRA_CFLAGS+="-I$(STAGING_DIR)/usr/include/hidapi/" + +@@ -51,12 +53,12 @@ define Build/Compile + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ +- $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) ++ $(STAGING_DIR_HOST)/bin/npm install --build-from-source --target_arch=$(CPU) -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/ ++ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ + endef + + $(eval $(call BuildPackage,node-hid)) +diff --git a/lang/node-hid/patches/000-compile.patch b/lang/node-hid/patches/000-compile.patch +deleted file mode 100644 +index d44e9b30f4fafe11c239766b625c63f4b5c907c5..0000000000000000000000000000000000000000 +--- a/lang/node-hid/patches/000-compile.patch ++++ /dev/null +@@ -1,2457 +0,0 @@ +---- 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 @@ +- }, +- 'targets': [ +- { +-- 'target_name': 'hidapi', +-- 'type': 'static_library', +-- 'conditions': [ +-- [ 'OS=="mac"', { +-- 'sources': [ 'hidapi/mac/hid.c' ], +-- 'include_dirs+': [ +-- '/usr/include/libusb-1.0/' +-- ] +-- }], +-- [ 'OS=="linux"', { +-- 'conditions': [ +-- [ 'driver=="libusb"', { +-- 'sources': [ 'hidapi/libusb/hid.c' ], +-- 'include_dirs+': [ +-- '/usr/include/libusb-1.0/' +-- ] +-- }], +-- [ 'driver=="hidraw"', { +-- 'sources': [ 'hidapi/linux/hid.c' ] +-- }] +-- ] +-- }], +-- [ 'OS=="win"', { +-- 'sources': [ 'hidapi/windows/hid.c' ], +-- 'msvs_settings': { +-- 'VCLinkerTool': { +-- 'AdditionalDependencies': [ +-- 'setupapi.lib', +-- ] +-- } +-- } +-- }] +-- ], +-- 'direct_dependent_settings': { +-- 'include_dirs': [ +-- 'hidapi/hidapi', +-- " +-+ * - Benjamin Byholm +-+ * - Trevor Norris +-+ * - Nathan Rajlich +-+ * - Brett Lawson +-+ * - Ben Noordhuis +-+ * +-+ * MIT +no-false-attribs 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 +-+#include +-+#include +-+#include +-+#include +-+#include +-+#include +-+#include +-+ +-+#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 NAN_INLINE bool NanSetPointerSafe( +-+ T *var +-+ , T val +-+) { +-+ if (var) { +-+ *var = val; +-+ return true; +-+ } else { +-+ return false; +-+ } +-+} +-+ +-+template NAN_INLINE T NanGetPointerSafe( +-+ T *var +-+ , T fallback = reinterpret_cast(0) +-+) { +-+ if (var) { +-+ return *var; +-+ } else { +-+ return fallback; +-+ } +-+} +-+ +-+NAN_INLINE bool NanBooleanOptionValue( +-+ v8::Local optionsObj +-+ , v8::Handle 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 optionsObj +-+ , v8::Handle opt +-+) { +-+ return NanBooleanOptionValue(optionsObj, opt, false); +-+} +-+ +-+NAN_INLINE uint32_t NanUInt32OptionValue( +-+ v8::Local optionsObj +-+ , v8::Handle 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& +-+# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args +-+# define _NAN_METHOD_RETURN_TYPE void +-+ +-+# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +-+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +-+# define _NAN_GETTER_RETURN_TYPE void +-+ +-+# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +-+# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args +-+# define _NAN_SETTER_RETURN_TYPE void +-+ +-+# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ +-+ const v8::PropertyCallbackInfo& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# 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& +-+# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args +-+# define _NAN_INDEX_QUERY_RETURN_TYPE void +-+ +-+ typedef v8::FunctionCallback NanFunctionCallback; +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew() { +-+ return T::New(v8::Isolate::GetCurrent()); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(P arg1) { +-+ return T::New(v8::Isolate::GetCurrent(), arg1); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle receiver +-+ , int argc +-+ , v8::Handle argv[] = 0) { +-+ return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ NanFunctionCallback callback +-+ , v8::Handle data = v8::Handle() +-+ , v8::Handle signature = v8::Handle()) { +-+ return T::New(v8::Isolate::GetCurrent(), callback, data, signature); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(v8::Handle arg1) { +-+ return v8::Local::New(v8::Isolate::GetCurrent(), arg1); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(const v8::Persistent &arg1) { +-+ return v8::Local::New(v8::Isolate::GetCurrent(), arg1); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(P arg1, int arg2) { +-+ return T::New(v8::Isolate::GetCurrent(), arg1, arg2); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew() { +-+ return v8::Array::New(v8::Isolate::GetCurrent()); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int length) { +-+ return v8::Array::New(v8::Isolate::GetCurrent(), length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(double time) { +-+ return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int time) { +-+ return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); +-+ } +-+ +-+ typedef v8::UnboundScript NanUnboundScript; +-+ typedef v8::Script NanBoundScript; +-+ +-+ template +-+ NAN_INLINE v8::Local 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 NanNew( +-+ v8::Local s +-+ ) { +-+ v8::ScriptCompiler::Source source(s); +-+ return v8::ScriptCompiler::CompileUnbound( +-+ v8::Isolate::GetCurrent(), &source); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(bool value) { +-+ return v8::BooleanObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local +-+ NanNew >( +-+ v8::Local value) { +-+ return v8::StringObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local +-+ NanNew >( +-+ v8::Handle value) { +-+ return v8::StringObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(double val) { +-+ return v8::NumberObject::New( +-+ v8::Isolate::GetCurrent(), val).As(); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Local pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Local pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int32_t val) { +-+ return v8::Uint32::NewFromUnsigned( +-+ v8::Isolate::GetCurrent(), val)->ToUint32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint32_t val) { +-+ return v8::Uint32::NewFromUnsigned( +-+ v8::Isolate::GetCurrent(), val)->ToUint32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int32_t val) { +-+ return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint32_t val) { +-+ return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ char *arg +-+ , int length) { +-+ return v8::String::NewFromUtf8( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const char *arg +-+ , int length) { +-+ return v8::String::NewFromUtf8( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(char *arg) { +-+ return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const char *arg) { +-+ return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ uint8_t *arg +-+ , int length) { +-+ return v8::String::NewFromOneByte( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t *arg +-+ , int length) { +-+ return v8::String::NewFromOneByte( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint8_t *arg) { +-+ return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t *arg) { +-+ return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ uint16_t *arg +-+ , int length) { +-+ return v8::String::NewFromTwoByte( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint16_t *arg +-+ , int length) { +-+ return v8::String::NewFromTwoByte( +-+ v8::Isolate::GetCurrent() +-+ , arg +-+ , v8::String::kNormalString +-+ , length); +-+ } +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ uint16_t *arg) { +-+ return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint16_t *arg) { +-+ return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ std::string arg) { +-+ return NanNew(arg.c_str(), arg.size()); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew() { +-+ return v8::String::Empty(v8::Isolate::GetCurrent()); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t* arg +-+ , int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ const uint16_t* arg +-+ , int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ const std::string& arg) { +-+ return NanNew(arg.c_str(), arg.size()); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(double val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(int val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(unsigned int val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(bool val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ v8::String::ExternalStringResource *resource) { +-+ return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource); +-+ } +-+ +-+ NAN_INLINE v8::Local 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 +-+ NAN_INLINE v8::Local _NanEscapeScopeHelper(v8::Handle val) { +-+ return NanNew(val); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local _NanEscapeScopeHelper(v8::Local 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 NanUndefined() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNull() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); +-+ } +-+ +-+ NAN_INLINE v8::Local NanTrue() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); +-+ } +-+ +-+ NAN_INLINE v8::Local NanFalse() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); +-+ } +-+ +-+ NAN_INLINE int NanAdjustExternalMemory(int bc) { +-+ return static_cast( +-+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); +-+ } +-+ +-+ NAN_INLINE void NanSetTemplate( +-+ v8::Handle templ +-+ , const char *name +-+ , v8::Handle value) { +-+ templ->Set(v8::Isolate::GetCurrent(), name, value); +-+ } +-+ +-+ NAN_INLINE void NanSetTemplate( +-+ v8::Handle templ +-+ , v8::Handle name +-+ , v8::Handle value +-+ , v8::PropertyAttribute attributes) { +-+ templ->Set(name, value, attributes); +-+ } +-+ +-+ NAN_INLINE v8::Local NanGetCurrentContext() { +-+ return v8::Isolate::GetCurrent()->GetCurrentContext(); +-+ } +-+ +-+ NAN_INLINE void* NanGetInternalFieldPointer( +-+ v8::Handle object +-+ , int index) { +-+ return object->GetAlignedPointerFromInternalField(index); +-+ } +-+ +-+ NAN_INLINE void NanSetInternalFieldPointer( +-+ v8::Handle 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 NanSymbol( +-+ const char* data, int length = -1) { +-+ return NanNew(data, length); +-+ } +-+ +-+ template +-+ NAN_INLINE void NanAssignPersistent( +-+ v8::Persistent& handle +-+ , v8::Handle obj) { +-+ handle.Reset(v8::Isolate::GetCurrent(), obj); +-+ } +-+ +-+ template +-+ NAN_INLINE void NanAssignPersistent( +-+ v8::Persistent& handle +-+ , const v8::Persistent& obj) { +-+ handle.Reset(v8::Isolate::GetCurrent(), obj); +-+ } +-+ +-+ template +-+ class _NanWeakCallbackData; +-+ +-+ template +-+ struct _NanWeakCallbackInfo { +-+ typedef void (*Callback)(const _NanWeakCallbackData& data); +-+ NAN_INLINE _NanWeakCallbackInfo(v8::Handle 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 persistent; +-+ }; +-+ +-+ template +-+ class _NanWeakCallbackData { +-+ public: +-+ NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) +-+ : info_(info) { } +-+ +-+ NAN_INLINE v8::Local 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* GetCallbackInfo() const { +-+ return info_; +-+ } +-+ +-+ NAN_DEPRECATED NAN_INLINE void Dispose() const { +-+ } +-+ +-+ private: +-+ _NanWeakCallbackInfo* info_; +-+ }; +-+ +-+ template +-+ static void _NanWeakCallbackDispatcher( +-+ const v8::WeakCallbackData > &data) { +-+ _NanWeakCallbackInfo *info = data.GetParameter(); +-+ _NanWeakCallbackData wcbd(info); +-+ info->callback(wcbd); +-+ if (wcbd.IsNearDeath()) { +-+ delete wcbd.GetCallbackInfo(); +-+ } +-+ } +-+ +-+ template +-+ NAN_INLINE void _NanWeakCallbackData::Revive() const { +-+ info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); +-+ } +-+ +-+template +-+NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( +-+ v8::Handle handle +-+ , P* parameter +-+ , typename _NanWeakCallbackInfo::Callback callback) { +-+ _NanWeakCallbackInfo *cbinfo = +-+ new _NanWeakCallbackInfo(handle, parameter, callback); +-+ cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); +-+ return cbinfo; +-+} +-+ +-+# define NAN_WEAK_CALLBACK(name) \ +-+ template \ +-+ static void name(const _NanWeakCallbackData &data) +-+ +-+# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) +-+ +-+# define _NAN_THROW_ERROR(fun, errmsg) \ +-+ do { \ +-+ NanScope(); \ +-+ v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ +-+ } while (0); +-+ +-+ NAN_INLINE v8::Local 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 error) { +-+ NanScope(); +-+ v8::Isolate::GetCurrent()->ThrowException(error); +-+ } +-+ +-+ NAN_INLINE v8::Local NanError( +-+ const char *msg +-+ , const int errorNumber +-+ ) { +-+ v8::Local err = v8::Exception::Error(NanNew(msg)); +-+ v8::Local obj = err.As(); +-+ obj->Set(NanNew("code"), NanNew(errorNumber)); +-+ return err; +-+ } +-+ +-+ NAN_INLINE void NanThrowError( +-+ const char *msg +-+ , const int errorNumber +-+ ) { +-+ NanThrowError(NanError(msg, errorNumber)); +-+ } +-+ +-+ NAN_INLINE v8::Local 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 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 NAN_INLINE void NanDisposePersistent( +-+ v8::Persistent &handle +-+ ) { +-+ handle.Reset(); +-+ } +-+ +-+ NAN_INLINE v8::Local 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 NanNewBufferHandle ( +-+ const char *data +-+ , uint32_t size +-+ ) { +-+ return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { +-+ return node::Buffer::New(v8::Isolate::GetCurrent(), size); +-+ } +-+ +-+ NAN_INLINE v8::Local NanBufferUse( +-+ char* data +-+ , uint32_t size +-+ ) { +-+ return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); +-+ } +-+ +-+ NAN_INLINE bool NanHasInstance( +-+ v8::Persistent& function_template +-+ , v8::Handle value +-+ ) { +-+ return NanNew(function_template)->HasInstance(value); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNewContextHandle( +-+ v8::ExtensionConfiguration* extensions = NULL +-+ , v8::Handle tmpl = v8::Handle() +-+ , v8::Handle obj = v8::Handle() +-+ ) { +-+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); +-+ return v8::Local::New( +-+ isolate +-+ , v8::Context::New(isolate, extensions, tmpl, obj) +-+ ); +-+ } +-+ +-+ NAN_INLINE v8::Local NanCompileScript( +-+ v8::Local s +-+ , const v8::ScriptOrigin& origin +-+ ) { +-+ v8::ScriptCompiler::Source source(s, origin); +-+ return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); +-+ } +-+ +-+ NAN_INLINE v8::Local NanCompileScript( +-+ v8::Local s +-+ ) { +-+ v8::ScriptCompiler::Source source(s); +-+ return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); +-+ } +-+ +-+ NAN_INLINE v8::Local NanRunScript( +-+ v8::Handle script +-+ ) { +-+ return script->BindToCurrentContext()->Run(); +-+ } +-+ +-+ NAN_INLINE v8::Local NanRunScript( +-+ v8::Handle script +-+ ) { +-+ return script->Run(); +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , v8::Handle func +-+ , int argc +-+ , v8::Handle* argv) { +-+ return NanNew(node::MakeCallback( +-+ v8::Isolate::GetCurrent(), target, func, argc, argv)); +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , v8::Handle symbol +-+ , int argc +-+ , v8::Handle* argv) { +-+ return NanNew(node::MakeCallback( +-+ v8::Isolate::GetCurrent(), target, symbol, argc, argv)); +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , const char* method +-+ , int argc +-+ , v8::Handle* argv) { +-+ return NanNew(node::MakeCallback( +-+ v8::Isolate::GetCurrent(), target, method, argc, argv)); +-+ } +-+ +-+ template +-+ NAN_INLINE void NanSetIsolateData( +-+ v8::Isolate *isolate +-+ , T *data +-+ ) { +-+ isolate->SetData(0, data); +-+ } +-+ +-+ template +-+ NAN_INLINE T *NanGetIsolateData( +-+ v8::Isolate *isolate +-+ ) { +-+ return static_cast(isolate->GetData(0)); +-+ } +-+ +-+ class NanAsciiString { +-+ public: +-+ NAN_INLINE explicit NanAsciiString(v8::Handle from) { +-+ v8::Local toStr = from->ToString(); +-+ int buf_size = toStr->Length() + 1; +-+ buf = new char[buf_size]; +-+ size = toStr->WriteOneByte( +-+ reinterpret_cast(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 from) { +-+ v8::Local 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 from) { +-+ v8::Local 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 +-+ +-+# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & +-+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +-+# define _NAN_GETTER_RETURN_TYPE v8::Handle +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+# 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 +-+ +-+ typedef v8::InvocationCallback NanFunctionCallback; +-+ +-+ NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( +-+ const char* data, int length = -1) { +-+ return v8::String::NewSymbol(data, length); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew() { +-+ return v8::Local::New(T::New()); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(v8::Handle arg) { +-+ return v8::Local::New(arg); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle receiver +-+ , int argc +-+ , v8::Handle argv[] = 0) { +-+ return v8::Signature::New(receiver, argc, argv); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ NanFunctionCallback callback +-+ , v8::Handle data = v8::Handle() +-+ , v8::Handle signature = v8::Handle()) { +-+ return T::New(callback, data, signature); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(const v8::Persistent &arg) { +-+ return v8::Local::New(arg); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(P arg) { +-+ return v8::Local::New(T::New(arg)); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew(P arg, int length) { +-+ return v8::Local::New(T::New(arg, length)); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Local pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Handle pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Local pattern, v8::RegExp::Flags flags) { +-+ return v8::RegExp::New(pattern, flags); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew() { +-+ return v8::Array::New(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int length) { +-+ return v8::Array::New(length); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(double time) { +-+ return v8::Date::New(time).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int time) { +-+ return v8::Date::New(time).As(); +-+ } +-+ +-+ typedef v8::Script NanUnboundScript; +-+ typedef v8::Script NanBoundScript; +-+ +-+ template +-+ NAN_INLINE v8::Local NanNew( +-+ P s +-+ , const v8::ScriptOrigin& origin +-+ ) { +-+ return v8::Script::New(s, const_cast(&origin)); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ v8::Local s +-+ ) { +-+ return v8::Script::New(s); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(bool value) { +-+ return v8::BooleanObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local +-+ NanNew >( +-+ v8::Local value) { +-+ return v8::StringObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local +-+ NanNew >( +-+ v8::Handle value) { +-+ return v8::StringObject::New(value).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(double val) { +-+ return v8::NumberObject::New(val).As(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int32_t val) { +-+ return v8::Uint32::NewFromUnsigned(val)->ToUint32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint32_t val) { +-+ return v8::Uint32::NewFromUnsigned(val)->ToUint32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(int32_t val) { +-+ return v8::Int32::New(val)->ToInt32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint32_t val) { +-+ return v8::Int32::New(val)->ToInt32(); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ uint8_t *arg +-+ , int length) { +-+ int len = length; +-+ if (len < 0) { +-+ size_t temp = strlen(reinterpret_cast(arg)); +-+ assert(temp <= INT_MAX && "too long string"); +-+ len = static_cast(temp); +-+ } +-+ uint16_t *warg = new uint16_t[len]; +-+ for (int i = 0; i < len; i++) { +-+ warg[i] = arg[i]; +-+ } +-+ v8::Local retval = v8::String::New(warg, len); +-+ delete[] warg; +-+ return retval; +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t *arg +-+ , int length) { +-+ int len = length; +-+ if (len < 0) { +-+ size_t temp = strlen(reinterpret_cast(arg)); +-+ assert(temp <= INT_MAX && "too long string"); +-+ len = static_cast(temp); +-+ } +-+ uint16_t *warg = new uint16_t[len]; +-+ for (int i = 0; i < len; i++) { +-+ warg[i] = arg[i]; +-+ } +-+ v8::Local retval = v8::String::New(warg, len); +-+ delete[] warg; +-+ return retval; +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew(uint8_t *arg) { +-+ size_t temp = strlen(reinterpret_cast(arg)); +-+ assert(temp <= INT_MAX && "too long string"); +-+ int length = static_cast(temp); +-+ uint16_t *warg = new uint16_t[length]; +-+ for (int i = 0; i < length; i++) { +-+ warg[i] = arg[i]; +-+ } +-+ +-+ v8::Local retval = v8::String::New(warg, length); +-+ delete[] warg; +-+ return retval; +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t *arg) { +-+ size_t temp = strlen(reinterpret_cast(arg)); +-+ assert(temp <= INT_MAX && "too long string"); +-+ int length = static_cast(temp); +-+ uint16_t *warg = new uint16_t[length]; +-+ for (int i = 0; i < length; i++) { +-+ warg[i] = arg[i]; +-+ } +-+ v8::Local retval = v8::String::New(warg, length); +-+ delete[] warg; +-+ return retval; +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew( +-+ std::string arg) { +-+ return NanNew(arg.c_str(), arg.size()); +-+ } +-+ +-+ template<> +-+ NAN_INLINE v8::Local NanNew() { +-+ return v8::String::Empty(); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ const uint8_t* arg +-+ , int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ const uint16_t* arg +-+ , int length = -1) { +-+ return NanNew(arg, length); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ std::string& arg) { +-+ return NanNew(arg.c_str(), arg.size()); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(double val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(int val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(unsigned int val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew(bool val) { +-+ return NanNew(val); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNew( +-+ v8::String::ExternalStringResource *resource) { +-+ return v8::String::NewExternal(resource); +-+ } +-+ +-+ NAN_INLINE v8::Local 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::New(obj->handle_) +-+ +-+ NAN_INLINE v8::Local NanUndefined() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::Undefined())); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNull() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::Null())); +-+ } +-+ +-+ NAN_INLINE v8::Local NanTrue() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::True())); +-+ } +-+ +-+ NAN_INLINE v8::Local NanFalse() { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(v8::False())); +-+ } +-+ +-+ NAN_INLINE int NanAdjustExternalMemory(int bc) { +-+ return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); +-+ } +-+ +-+ NAN_INLINE void NanSetTemplate( +-+ v8::Handle templ +-+ , const char *name +-+ , v8::Handle value) { +-+ templ->Set(name, value); +-+ } +-+ +-+ NAN_INLINE void NanSetTemplate( +-+ v8::Handle templ +-+ , v8::Handle name +-+ , v8::Handle value +-+ , v8::PropertyAttribute attributes) { +-+ templ->Set(name, value, attributes); +-+ } +-+ +-+ NAN_INLINE v8::Local NanGetCurrentContext() { +-+ return v8::Context::GetCurrent(); +-+ } +-+ +-+ NAN_INLINE void* NanGetInternalFieldPointer( +-+ v8::Handle object +-+ , int index) { +-+ return object->GetPointerFromInternalField(index); +-+ } +-+ +-+ NAN_INLINE void NanSetInternalFieldPointer( +-+ v8::Handle 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 +-+ NAN_INLINE void NanAssignPersistent( +-+ v8::Persistent& handle +-+ , v8::Handle obj) { +-+ handle.Dispose(); +-+ handle = v8::Persistent::New(obj); +-+ } +-+ +-+ template +-+ class _NanWeakCallbackData; +-+ +-+ template +-+ struct _NanWeakCallbackInfo { +-+ typedef void (*Callback)(const _NanWeakCallbackData &data); +-+ NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) +-+ : parameter(param) +-+ , callback(cb) +-+ , persistent(v8::Persistent::New(handle)) { } +-+ +-+ NAN_INLINE ~_NanWeakCallbackInfo() { +-+ persistent.Dispose(); +-+ persistent.Clear(); +-+ } +-+ +-+ P* const parameter; +-+ Callback const callback; +-+ v8::Persistent persistent; +-+ }; +-+ +-+ template +-+ class _NanWeakCallbackData { +-+ public: +-+ NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) +-+ : info_(info) { } +-+ +-+ NAN_INLINE v8::Local 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* GetCallbackInfo() const { +-+ return info_; +-+ } +-+ +-+ NAN_DEPRECATED NAN_INLINE void Dispose() const { +-+ } +-+ +-+ private: +-+ _NanWeakCallbackInfo* info_; +-+ }; +-+ +-+ template +-+ static void _NanWeakPersistentDispatcher( +-+ v8::Persistent object, void *data) { +-+ _NanWeakCallbackInfo* info = +-+ static_cast<_NanWeakCallbackInfo*>(data); +-+ _NanWeakCallbackData wcbd(info); +-+ info->callback(wcbd); +-+ if (wcbd.IsNearDeath()) { +-+ delete wcbd.GetCallbackInfo(); +-+ } +-+ } +-+ +-+ template +-+ NAN_INLINE void _NanWeakCallbackData::Revive() const { +-+ info_->persistent.MakeWeak( +-+ info_ +-+ , &_NanWeakPersistentDispatcher); +-+ } +-+ +-+ template +-+ NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( +-+ v8::Handle handle +-+ , P* parameter +-+ , typename _NanWeakCallbackInfo::Callback callback) { +-+ _NanWeakCallbackInfo *cbinfo = +-+ new _NanWeakCallbackInfo(handle, parameter, callback); +-+ cbinfo->persistent.MakeWeak( +-+ cbinfo +-+ , &_NanWeakPersistentDispatcher); +-+ return cbinfo; +-+ } +-+ +-+# define NAN_WEAK_CALLBACK(name) \ +-+ template \ +-+ static void name(const _NanWeakCallbackData &data) +-+ +-+# define _NAN_ERROR(fun, errmsg) \ +-+ fun(v8::String::New(errmsg)) +-+ +-+# define _NAN_THROW_ERROR(fun, errmsg) \ +-+ do { \ +-+ NanScope(); \ +-+ return v8::Local::New( \ +-+ v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ +-+ } while (0); +-+ +-+ NAN_INLINE v8::Local NanError(const char* errmsg) { +-+ return _NAN_ERROR(v8::Exception::Error, errmsg); +-+ } +-+ +-+ NAN_INLINE v8::Local NanThrowError(const char* errmsg) { +-+ _NAN_THROW_ERROR(v8::Exception::Error, errmsg); +-+ } +-+ +-+ NAN_INLINE v8::Local NanThrowError( +-+ v8::Handle error +-+ ) { +-+ NanScope(); +-+ return v8::Local::New(v8::ThrowException(error)); +-+ } +-+ +-+ NAN_INLINE v8::Local NanError( +-+ const char *msg +-+ , const int errorNumber +-+ ) { +-+ v8::Local err = v8::Exception::Error(v8::String::New(msg)); +-+ v8::Local obj = err.As(); +-+ obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); +-+ return err; +-+ } +-+ +-+ NAN_INLINE v8::Local NanThrowError( +-+ const char *msg +-+ , const int errorNumber +-+ ) { +-+ return NanThrowError(NanError(msg, errorNumber)); +-+ } +-+ +-+ NAN_INLINE v8::Local NanTypeError(const char* errmsg) { +-+ return _NAN_ERROR(v8::Exception::TypeError, errmsg); +-+ } +-+ +-+ NAN_INLINE v8::Local NanThrowTypeError( +-+ const char* errmsg +-+ ) { +-+ _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); +-+ } +-+ +-+ NAN_INLINE v8::Local NanRangeError( +-+ const char* errmsg +-+ ) { +-+ return _NAN_ERROR(v8::Exception::RangeError, errmsg); +-+ } +-+ +-+ NAN_INLINE v8::Local NanThrowRangeError( +-+ const char* errmsg +-+ ) { +-+ _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); +-+ } +-+ +-+ template +-+ NAN_INLINE void NanDisposePersistent( +-+ v8::Persistent &handle) { // NOLINT(runtime/references) +-+ handle.Dispose(); +-+ handle.Clear(); +-+ } +-+ +-+ NAN_INLINE v8::Local 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 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(data), size)->handle_); +-+#endif +-+ } +-+ +-+ NAN_INLINE v8::Local 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 NanBufferUse( +-+ char* data +-+ , uint32_t size +-+ ) { +-+ return NanNew( +-+ node::Buffer::New(data, size, FreeData, NULL)->handle_); +-+ } +-+ +-+ NAN_INLINE bool NanHasInstance( +-+ v8::Persistent& function_template +-+ , v8::Handle value +-+ ) { +-+ return function_template->HasInstance(value); +-+ } +-+ +-+ NAN_INLINE v8::Local NanNewContextHandle( +-+ v8::ExtensionConfiguration* extensions = NULL +-+ , v8::Handle tmpl = v8::Handle() +-+ , v8::Handle obj = v8::Handle() +-+ ) { +-+ v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); +-+ v8::Local lctx = NanNew(ctx); +-+ ctx.Dispose(); +-+ return lctx; +-+ } +-+ +-+ NAN_INLINE v8::Local NanCompileScript( +-+ v8::Local s +-+ , const v8::ScriptOrigin& origin +-+ ) { +-+ return v8::Script::Compile(s, const_cast(&origin)); +-+ } +-+ +-+ NAN_INLINE v8::Local NanCompileScript( +-+ v8::Local s +-+ ) { +-+ return v8::Script::Compile(s); +-+ } +-+ +-+ NAN_INLINE v8::Local NanRunScript(v8::Handle script) { +-+ return script->Run(); +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , v8::Handle func +-+ , int argc +-+ , v8::Handle* argv) { +-+# if NODE_VERSION_AT_LEAST(0, 8, 0) +-+ return NanNew(node::MakeCallback(target, func, argc, argv)); +-+# else +-+ v8::TryCatch try_catch; +-+ v8::Local result = NanNew(func->Call(target, argc, argv)); +-+ if (try_catch.HasCaught()) { +-+ node::FatalException(try_catch); +-+ } +-+ return result; +-+# endif +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , v8::Handle symbol +-+ , int argc +-+ , v8::Handle* argv) { +-+# if NODE_VERSION_AT_LEAST(0, 8, 0) +-+ return NanNew(node::MakeCallback(target, symbol, argc, argv)); +-+# else +-+ v8::Local callback = target->Get(symbol).As(); +-+ return NanMakeCallback(target, callback, argc, argv); +-+# endif +-+ } +-+ +-+ NAN_INLINE v8::Local NanMakeCallback( +-+ v8::Handle target +-+ , const char* method +-+ , int argc +-+ , v8::Handle* 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 +-+ NAN_INLINE void NanSetIsolateData( +-+ v8::Isolate *isolate +-+ , T *data +-+ ) { +-+ isolate->SetData(data); +-+ } +-+ +-+ template +-+ NAN_INLINE T *NanGetIsolateData( +-+ v8::Isolate *isolate +-+ ) { +-+ return static_cast(isolate->GetData()); +-+ } +-+ +-+ class NanAsciiString { +-+ public: +-+ NAN_INLINE explicit NanAsciiString(v8::Handle from) { +-+ v8::Local 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 from) { +-+ v8::Local 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 from) { +-+ v8::Local 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 property \ +-+ , _NAN_GETTER_ARGS) +-+#define NAN_SETTER(name) \ +-+ _NAN_SETTER_RETURN_TYPE name( \ +-+ v8::Local property \ +-+ , v8::Local value \ +-+ , _NAN_SETTER_ARGS) +-+#define NAN_PROPERTY_GETTER(name) \ +-+ _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ +-+ v8::Local property \ +-+ , _NAN_PROPERTY_GETTER_ARGS) +-+#define NAN_PROPERTY_SETTER(name) \ +-+ _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ +-+ v8::Local property \ +-+ , v8::Local 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 property \ +-+ , _NAN_PROPERTY_DELETER_ARGS) +-+#define NAN_PROPERTY_QUERY(name) \ +-+ _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ +-+ v8::Local 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 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 obj = NanNew(); +-+ NanAssignPersistent(handle, obj); +-+ } +-+ +-+ explicit NanCallback(const v8::Handle &fn) { +-+ NanScope(); +-+ v8::Local obj = NanNew(); +-+ NanAssignPersistent(handle, obj); +-+ SetFunction(fn); +-+ } +-+ +-+ ~NanCallback() { +-+ if (handle.IsEmpty()) return; +-+ NanDisposePersistent(handle); +-+ } +-+ +-+ NAN_INLINE void SetFunction(const v8::Handle &fn) { +-+ NanScope(); +-+ NanNew(handle)->Set(kCallbackIndex, fn); +-+ } +-+ +-+ NAN_INLINE v8::Local GetFunction() const { +-+ NanEscapableScope(); +-+ return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) +-+ .As()); +-+ } +-+ +-+ NAN_INLINE bool IsEmpty() const { +-+ NanScope(); +-+ return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); +-+ } +-+ +-+ v8::Handle Call(int argc, v8::Handle argv[]) const { +-+ NanEscapableScope(); +-+#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ +-+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); +-+ v8::Local callback = NanNew(handle)-> +-+ Get(kCallbackIndex).As(); +-+ return NanEscapeScope(node::MakeCallback( +-+ isolate +-+ , isolate->GetCurrentContext()->Global() +-+ , callback +-+ , argc +-+ , argv +-+ )); +-+#else +-+#if NODE_VERSION_AT_LEAST(0, 8, 0) +-+ v8::Local callback = handle-> +-+ Get(kCallbackIndex).As(); +-+ return NanEscapeScope(node::MakeCallback( +-+ v8::Context::GetCurrent()->Global() +-+ , callback +-+ , argc +-+ , argv +-+ )); +-+#else +-+ v8::Local callback = handle-> +-+ Get(kCallbackIndex).As(); +-+ return NanEscapeScope(NanMakeCallback( +-+ v8::Context::GetCurrent()->Global(), callback, argc, argv)); +-+#endif +-+#endif +-+ } +-+ +-+ private: +-+ v8::Persistent 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 obj = NanNew(); +-+ 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 &obj) { +-+ v8::Local handle = NanNew(persistentHandle); +-+ handle->Set(NanNew(key), obj); +-+ } +-+ +-+ v8::Local GetFromPersistent(const char *key) const { +-+ NanEscapableScope(); +-+ v8::Local handle = NanNew(persistentHandle); +-+ return NanEscapeScope(handle->Get(NanNew(key)).As()); +-+ } +-+ +-+ virtual void Execute() = 0; +-+ +-+ uv_work_t request; +-+ +-+ protected: +-+ v8::Persistent persistentHandle; +-+ NanCallback *callback; +-+ +-+ virtual void HandleOKCallback() { +-+ NanScope(); +-+ +-+ callback->Call(0, NULL); +-+ } +-+ +-+ virtual void HandleErrorCallback() { +-+ NanScope(); +-+ +-+ v8::Local argv[] = { +-+ v8::Exception::Error(NanNew(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(req->data); +-+ worker->Execute(); +-+} +-+ +-+NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { +-+ NanAsyncWorker* worker = static_cast(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 +-+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 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 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(-1); +-+} +-+ +-+template 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 val +-+ , const char** data +-+ , size_t* len +-+) { +-+ if (node::Buffer::HasInstance(val)) { +-+ *data = node::Buffer::Data(val.As()); +-+ *len = node::Buffer::Length(val.As()); +-+ return true; +-+ } +-+ +-+ assert(val->IsString()); +-+ v8::Local str = NanNew(val.As()); +-+ +-+ 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(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 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(&data) +-+ , &len); +-+ +-+ if (is_extern && !term_len) { +-+ NanSetPointerSafe(datalen, len); +-+ return data; +-+ } +-+ +-+ v8::Local toStr = from->ToString(); +-+ +-+ char *to = static_cast(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( +-+ datalen +-+ , toStr->WriteAscii(to, 0, static_cast(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(sz_ + term_len), flags); +-+ +-+ for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) { +-+ unsigned char *b = reinterpret_cast(&twobytebuf[i]); +-+ to[i] = *b; +-+ } +-+ +-+ NanSetPointerSafe(datalen, len); +-+ +-+ delete[] twobytebuf; +-+ return to; +-+ } +-+#else +-+ NanSetPointerSafe( +-+ datalen, +-+ toStr->WriteOneByte( +-+ reinterpret_cast(to) +-+ , 0 +-+ , static_cast(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( +-+ datalen +-+ , toStr->WriteUtf8(to, static_cast(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( +-+ 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(to) +-+ , 0 +-+ , static_cast(sz_ + term_len) +-+ , flags); +-+ NanSetPointerSafe(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( +-+ 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 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 from +-+ , size_t *datalen +-+ , char *buf = NULL +-+ , size_t buflen = 0 +-+ , int flags = v8::String::NO_OPTIONS +-+) { +-+ return static_cast( +-+ _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) +-+ ); +-+} +-+ +-+NAN_INLINE void NanSetPrototypeTemplate( +-+ v8::Local templ +-+ , const char *name +-+ , v8::Handle value +-+) { +-+ NanSetTemplate(templ->PrototypeTemplate(), name, value); +-+} +-+ +-+NAN_INLINE void NanSetPrototypeTemplate( +-+ v8::Local templ +-+ , v8::Handle name +-+ , v8::Handle value +-+ , v8::PropertyAttribute attributes +-+) { +-+ NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); +-+} +-+ +-+NAN_INLINE void NanSetInstanceTemplate( +-+ v8::Local templ +-+ , const char *name +-+ , v8::Handle value +-+) { +-+ NanSetTemplate(templ->InstanceTemplate(), name, value); +-+} +-+ +-+NAN_INLINE void NanSetInstanceTemplate( +-+ v8::Local templ +-+ , v8::Handle name +-+ , v8::Handle 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 +index a732174731ceebdb889acd7df9a79914cf2b9220..fd292d706ef1d92a4c825849b755dbfb85b4bdd6 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk + + PKG_NPM_NAME:=serialport + PKG_NAME:=node-$(PKG_NPM_NAME) +-PKG_VERSION:=1.4.6 +-PKG_RELEASE:=2 ++PKG_VERSION:=3.0.0 ++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_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=0.12.13 ++PKG_NODE_VERSION:=4.4.4 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +@@ -43,6 +43,8 @@ define Build/Prepare + $(Build/Patch) + endef + ++CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) ++ + EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + + define Build/Compile +@@ -51,7 +53,7 @@ define Build/Compile + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ +- $(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR) ++ $(STAGING_DIR_HOST)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) + endef + + define Package/node-serialport/install +diff --git a/lang/node-serialport/patches/package.json.patch b/lang/node-serialport/patches/package.json.patch +deleted file mode 100644 +index a20c6a5a22bcd6faff045ef63bc40b1f7660795e..0000000000000000000000000000000000000000 +--- a/lang/node-serialport/patches/package.json.patch ++++ /dev/null +@@ -1,11 +0,0 @@ +---- 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/patches/packages/openwrt/0020-node-hid-fix-compile-error.patch b/patches/packages/openwrt/0020-node-hid-fix-compile-error.patch new file mode 100644 index 00000000..7af037b0 --- /dev/null +++ b/patches/packages/openwrt/0020-node-hid-fix-compile-error.patch @@ -0,0 +1,27 @@ +From: Hirokazu MORIKAWA +Date: Wed, 18 May 2016 14:54:38 +0900 +Subject: node-hid: fix compile error + +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index 5a243a255a9a19071b62c540a6fafd10cf0628f9..f9ad54e7ac1b46e6536753823ae7fbbcfac23b30 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.5.1 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +@@ -43,8 +43,7 @@ endef + + CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + +-EXTRA_LDFLAGS+="-lhidapi-libusb" +-EXTRA_CFLAGS+="-I$(STAGING_DIR)/usr/include/hidapi/" ++EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0 + + define Build/Compile + $(MAKE_VARS) \ diff --git a/patches/packages/openwrt/0021-node-hid-fix-git-submodule-issue.patch b/patches/packages/openwrt/0021-node-hid-fix-git-submodule-issue.patch new file mode 100644 index 00000000..f73fc982 --- /dev/null +++ b/patches/packages/openwrt/0021-node-hid-fix-git-submodule-issue.patch @@ -0,0 +1,25 @@ +From: Hirokazu MORIKAWA +Date: Mon, 23 May 2016 14:49:29 +0900 +Subject: node-hid: fix git submodule issue + +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index f9ad54e7ac1b46e6536753823ae7fbbcfac23b30..e28298b8421794f5862ed026faf0d5023713c7b3 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.5.1 +-PKG_RELEASE:=2 ++PKG_RELEASE:=3 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +@@ -46,6 +46,7 @@ CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0 + + define Build/Compile ++ git init $(PKG_BUILD_DIR) + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ diff --git a/patches/packages/openwrt/0022-node-node-node-update-to-v4.4.5-and-Enhance-CPU-arch-variant.patch b/patches/packages/openwrt/0022-node-node-node-update-to-v4.4.5-and-Enhance-CPU-arch-variant.patch new file mode 100644 index 00000000..5f33aaef --- /dev/null +++ b/patches/packages/openwrt/0022-node-node-node-update-to-v4.4.5-and-Enhance-CPU-arch-variant.patch @@ -0,0 +1,202 @@ +From: Hirokazu MORIKAWA +Date: Fri, 27 May 2016 16:22:39 +0900 +Subject: node,node-*: node update to v4.4.5 and Enhance CPU-arch variant. + +[linus.luessing@c0d3.blue: backport] +Conflicts: + lang/node/patches/004-gcc6-undefined-behaviour.patch + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 5dc300e0e271ca0161547012b4de2a5954835965..3273f9760c929eeda47f93229a7aae3b19a5f874 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=arduino-firmata + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.3.3 +-PKG_RELEASE:=3 ++PKG_RELEASE:=4 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=4.4.4 ++PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=MIT +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index 8c73e8e7d29b4e95b9c549cc8603f690bfcd3edb..dca44522e4c19fd180e5b5682592567f08a1e4f1 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=cylon + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.22.0 +-PKG_RELEASE:=3 ++PKG_RELEASE:=4 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +@@ -19,7 +19,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=4.4.4 ++PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Apache-2.0 +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index e28298b8421794f5862ed026faf0d5023713c7b3..7431cd5f22880bfea4ca8e10cf4d314f93ac050d 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.5.1 +-PKG_RELEASE:=3 ++PKG_RELEASE:=4 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +@@ -19,7 +19,7 @@ PKG_SOURCE_VERSION:=35d830b7810c87d32484d0a346621568c4849441 + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=4.4.4 ++PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile +index fd292d706ef1d92a4c825849b755dbfb85b4bdd6..c45149166b1e43e98be7f2cbb7159017874540d6 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -10,14 +10,14 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=serialport + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=3.0.0 +-PKG_RELEASE:=1 ++PKG_RELEASE:=2 + + PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz + PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ + PKG_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d + + PKG_BUILD_DEPENDS:=node/host +-PKG_NODE_VERSION:=4.4.4 ++PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +diff --git a/lang/node/Makefile b/lang/node/Makefile +index a95aecb3aca1e52e29e4f151ffd28ef361bf1336..5cf7a6ec143e0abd19106ba260f6eb16f85b36bf 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -8,12 +8,12 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v4.4.4 ++PKG_VERSION:=v4.4.5 + PKG_RELEASE:=1 + + PKG_SOURCE:=node-$(PKG_VERSION).tar.xz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} +-PKG_MD5SUM:=1ad7915688df85f62a57f43860dc54c6 ++PKG_MD5SUM:=376140907bbe362f36065a30af04f020 + + HOST_BUILD_DEPENDS:=python/host + PKG_BUILD_DEPENDS:=python/host +@@ -35,7 +35,7 @@ define Package/node + 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 +zlib ++ DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +zlib + endef + + define Package/node/description +@@ -44,7 +44,7 @@ define Package/node/description + package ecosystem, npm, is the largest ecosystem of open source libraries in the world. + endef + +-CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) ++CPU:=$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))) + + MAKE_VARS += \ + DESTCPU=$(CPU) +diff --git a/lang/node/patches/004-gcc6-undefined-behaviour.patch b/lang/node/patches/004-gcc6-undefined-behaviour.patch +deleted file mode 100644 +index dbbbcf0c54bb62f643521411668772531d42b89a..0000000000000000000000000000000000000000 +--- a/lang/node/patches/004-gcc6-undefined-behaviour.patch ++++ /dev/null +@@ -1,64 +0,0 @@ +-diff --git a/deps/v8/src/heap/incremental-marking.cc b/deps/v8/src/heap/incremental-marking.cc +-index c922e83..2ead8be 100644 +---- a/deps/v8/src/heap/incremental-marking.cc +-+++ b/deps/v8/src/heap/incremental-marking.cc +-@@ -379,7 +379,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() { +- DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); +- +- LargePage* lop = heap_->lo_space()->first_page(); +-- while (lop->is_valid()) { +-+ while (LargePage::IsValid(lop)) { +- SetOldSpacePageFlags(lop, false, false); +- lop = lop->next_page(); +- } +-@@ -414,7 +414,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() { +- ActivateIncrementalWriteBarrier(heap_->new_space()); +- +- LargePage* lop = heap_->lo_space()->first_page(); +-- while (lop->is_valid()) { +-+ while (LargePage::IsValid(lop)) { +- SetOldSpacePageFlags(lop, true, is_compacting_); +- lop = lop->next_page(); +- } +-diff --git a/deps/v8/src/heap/spaces-inl.h b/deps/v8/src/heap/spaces-inl.h +-index 56c2bad..1a45096 100644 +---- a/deps/v8/src/heap/spaces-inl.h +-+++ b/deps/v8/src/heap/spaces-inl.h +-@@ -148,7 +148,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, +- +- bool PagedSpace::Contains(Address addr) { +- Page* p = Page::FromAddress(addr); +-- if (!p->is_valid()) return false; +-+ if (!Page::IsValid(p)) return false; +- return p->owner() == this; +- } +- +-diff --git a/deps/v8/src/heap/spaces.cc b/deps/v8/src/heap/spaces.cc +-index e197f5a..2fe10eb 100644 +---- a/deps/v8/src/heap/spaces.cc +-+++ b/deps/v8/src/heap/spaces.cc +-@@ -2918,7 +2918,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) { +- if (e != NULL) { +- DCHECK(e->value != NULL); +- LargePage* page = reinterpret_cast(e->value); +-- DCHECK(page->is_valid()); +-+ DCHECK(LargePage::IsValid(page)); +- if (page->Contains(a)) { +- return page; +- } +-diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h +-index 312d75f..1054672 100644 +---- a/deps/v8/src/heap/spaces.h +-+++ b/deps/v8/src/heap/spaces.h +-@@ -283,9 +283,9 @@ class MemoryChunk { +- // Only works for addresses in pointer spaces, not data or code spaces. +- static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); +- +-- Address address() { return reinterpret_cast
(this); } +-+ static bool IsValid(MemoryChunk* chunk) { return chunk != nullptr; } +- +-- bool is_valid() { return address() != NULL; } +-+ Address address() { return reinterpret_cast
(this); } +- +- MemoryChunk* next_chunk() const { +- return reinterpret_cast(base::Acquire_Load(&next_chunk_)); diff --git a/patches/packages/openwrt/0023-node-fix-soft-hard-float-compile-on-arm-mips.patch b/patches/packages/openwrt/0023-node-fix-soft-hard-float-compile-on-arm-mips.patch new file mode 100644 index 00000000..60dafb7a --- /dev/null +++ b/patches/packages/openwrt/0023-node-fix-soft-hard-float-compile-on-arm-mips.patch @@ -0,0 +1,31 @@ +From: Dirk Neukirchen +Date: Tue, 2 Aug 2016 15:16:33 +0200 +Subject: node: fix soft/hard float compile on arm/mips + +reported by brcm2708/2709 user on IRC + +Signed-off-by: Dirk Neukirchen + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 5cf7a6ec143e0abd19106ba260f6eb16f85b36bf..e1ed0f76f953cf0e505ed4c97839a3009c8d6757 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -57,7 +57,18 @@ CONFIGURE_ARGS= \ + --shared-openssl \ + --prefix=/usr + ++ifneq ($(findstring arm,$(ARCH)),) ++CONFIGURE_ARGS+= \ ++ $(if $(CONFIG_SOFT_FLOAT),--with-arm-float-abi=soft,--with-arm-float-abi=hard) ++endif ++ ++ifneq ($(findstring mips,$(ARCH)),) ++CONFIGURE_ARGS+= \ ++ $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft,--with-mips-float-abi=hard) ++endif ++ + HOST_CONFIGURE_VARS:= ++ + HOST_CONFIGURE_ARGS:= \ + --dest-os=linux \ + --without-snapshot \ diff --git a/patches/packages/openwrt/0024-Treewide-fix-of-typo-PKG_LICENSE_FILE-PKG_LICENSE_FILES.patch b/patches/packages/openwrt/0024-Treewide-fix-of-typo-PKG_LICENSE_FILE-PKG_LICENSE_FILES.patch new file mode 100644 index 00000000..1b0f4fe4 --- /dev/null +++ b/patches/packages/openwrt/0024-Treewide-fix-of-typo-PKG_LICENSE_FILE-PKG_LICENSE_FILES.patch @@ -0,0 +1,97 @@ +From: Michael Heimpold +Date: Sat, 3 Sep 2016 00:00:54 +0200 +Subject: Treewide fix of typo: PKG_LICENSE_FILE --> PKG_LICENSE_FILES + +Without the trailing _S_ the variable is not considered at all. + +[linus.luessing@c0d3.blue: backport, node* only] +Signed-off-by: Michael Heimpold + +diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile +index 3273f9760c929eeda47f93229a7aae3b19a5f874..1a46974d44ec87d1b09d9d39396e0705426f59cb 100644 +--- a/lang/node-arduino-firmata/Makefile ++++ b/lang/node-arduino-firmata/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=arduino-firmata + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.3.3 +-PKG_RELEASE:=4 ++PKG_RELEASE:=5 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +@@ -23,7 +23,7 @@ PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=MIT +-PKG_LICENSE_FILE:=LICENSE.txt ++PKG_LICENSE_FILES:=LICENSE.txt + + include $(INCLUDE_DIR)/package.mk + +diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile +index dca44522e4c19fd180e5b5682592567f08a1e4f1..5c673b5785432ef65835d4972ef4eb88ac745b75 100644 +--- a/lang/node-cylon/Makefile ++++ b/lang/node-cylon/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=cylon + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.22.0 +-PKG_RELEASE:=4 ++PKG_RELEASE:=5 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +@@ -23,7 +23,7 @@ PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Apache-2.0 +-PKG_LICENSE_FILE:=LICENSE ++PKG_LICENSE_FILES:=LICENSE + + include $(INCLUDE_DIR)/package.mk + +diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile +index 7431cd5f22880bfea4ca8e10cf4d314f93ac050d..c553b9752a71e23290393940c27bf1443c6736f1 100644 +--- a/lang/node-hid/Makefile ++++ b/lang/node-hid/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=hid + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=0.5.1 +-PKG_RELEASE:=4 ++PKG_RELEASE:=5 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +@@ -23,7 +23,7 @@ PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +-PKG_LICENSE_FILE:= ++PKG_LICENSE_FILES:= + + include $(INCLUDE_DIR)/package.mk + +diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile +index c45149166b1e43e98be7f2cbb7159017874540d6..8fc676cd384a6d3e5348517a6839e91754d1d6b7 100644 +--- a/lang/node-serialport/Makefile ++++ b/lang/node-serialport/Makefile +@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk + PKG_NPM_NAME:=serialport + PKG_NAME:=node-$(PKG_NPM_NAME) + PKG_VERSION:=3.0.0 +-PKG_RELEASE:=2 ++PKG_RELEASE:=3 + + PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz + PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +@@ -21,7 +21,7 @@ PKG_NODE_VERSION:=4.4.5 + + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:=Custom +-PKG_LICENSE_FILE:=LICENSE ++PKG_LICENSE_FILES:=LICENSE + + include $(INCLUDE_DIR)/package.mk +