Skip to contentSkip to conversation

package/nodejs: Update to allow selecting node.js version

PATCH New Martin Bark 3 participants 7 messages Jun 14, 2015 – Jun 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 package/nodejs: Update to allow selecting node.js version

---
 .../{ => 0.10.38}/0001-remove-python-bz2-dependency.patch  |  0
 .../0002-gyp-force-link-command-to-use-CXX.patch           |  0
 .../nodejs/{ => 0.10.38}/0003-use-python-variable.patch    |  0
 .../0004-fix-build-error-without-OpenSSL-support.patch     |  0
 package/nodejs/Config.in                                   | 14 ++++++++++++++
 package/nodejs/nodejs.mk                                   |  2 +-
 6 files changed, 15 insertions(+), 1 deletion(-)
 rename package/nodejs/{ => 0.10.38}/0001-remove-python-bz2-dependency.patch (100%)
 rename package/nodejs/{ => 0.10.38}/0002-gyp-force-link-command-to-use-CXX.patch (100%)
 rename package/nodejs/{ => 0.10.38}/0003-use-python-variable.patch (100%)
 rename package/nodejs/{ => 0.10.38}/0004-fix-build-error-without-OpenSSL-support.patch (100%)
package/nodejs/0.10.38/0001-remove-python-bz2-dependency.patch renamed from package/nodejs/0001-remove-python-bz2-dependency.patch +0 -0
similarity index 100%
rename from package/nodejs/0001-remove-python-bz2-dependency.patch
rename to package/nodejs/0.10.38/0001-remove-python-bz2-dependency.patch
package/nodejs/0.10.38/0002-gyp-force-link-command-to-use-CXX.patch renamed from package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch +0 -0
similarity index 100%
rename from package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch
rename to package/nodejs/0.10.38/0002-gyp-force-link-command-to-use-CXX.patch
package/nodejs/0.10.38/0003-use-python-variable.patch renamed from package/nodejs/0003-use-python-variable.patch +0 -0
similarity index 100%
rename from package/nodejs/0003-use-python-variable.patch
rename to package/nodejs/0.10.38/0003-use-python-variable.patch
package/nodejs/0.10.38/0004-fix-build-error-without-OpenSSL-support.patch renamed from package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch +0 -0
similarity index 100%
rename from package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch
rename to package/nodejs/0.10.38/0004-fix-build-error-without-OpenSSL-support.patch
package/nodejs/Config.in +14 -0
index 3140683..8b0573a 100644
@@ -22,6 +22,20 @@ comment "nodejs needs a toolchain w/ C++, threads"
 
 if BR2_PACKAGE_NODEJS
 
+choice
+	prompt "Node.js Version"
+	default BR2_BR2_PACKAGE_NODEJS_0_10_38
+	help
+	  Select the version of Node.js you wish to use.
+
+	config BR2_BR2_PACKAGE_NODEJS_0_10_38
+		bool "v0.10.38"
+
+endchoice
+
+config BR2_PACKAGE_NODEJS_VERSION_STRING
+	string
+	default "0.10.38"	if BR2_BR2_PACKAGE_NODEJS_0_10_38
 menu "Module Selection"
 
 config BR2_PACKAGE_NODEJS_NPM
package/nodejs/nodejs.mk +1 -1
index 5ee7714..59e03b0 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-NODEJS_VERSION = 0.10.38
+NODEJS_VERSION = $(call qstrip,$(BR2_PACKAGE_NODEJS_VERSION_STRING))
 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
 NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
 NODEJS_DEPENDENCIES = host-python host-nodejs zlib \
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/4 package/nodejs: Add node.js v0.12.4 and set as the default version

---
 ...01-Remove-dependency-on-Python-bz2-module.patch | 38 +++++++++++++
 .../0002-gyp-force-link-command-to-use-CXX.patch   | 27 ++++++++++
 ...hon-variable-instead-of-hardcoding-Python.patch | 62 ++++++++++++++++++++++
 ...4-fix-build-error-without-OpenSSL-support.patch | 45 ++++++++++++++++
 package/nodejs/Config.in                           |  6 ++-
 package/nodejs/nodejs.hash                         |  3 ++
 6 files changed, 180 insertions(+), 1 deletion(-)
 create mode 100644 package/nodejs/0.12.4/0001-Remove-dependency-on-Python-bz2-module.patch
 create mode 100644 package/nodejs/0.12.4/0002-gyp-force-link-command-to-use-CXX.patch
 create mode 100644 package/nodejs/0.12.4/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
 create mode 100644 package/nodejs/0.12.4/0004-fix-build-error-without-OpenSSL-support.patch
package/nodejs/0.12.4/0001-Remove-dependency-on-Python-bz2-module.patch new file +38 -0
new file mode 100644
index 0000000..d2cb0b7
@@ -0,0 +1,38 @@
+From 2f57d17b8b1a8cb78bd9cff874a006adba3afd4a Mon Sep 17 00:00:00 2001
+From: Martin Bark <[email protected]>
+Date: Thu, 11 Jun 2015 20:05:11 +0100
+Subject: [PATCH 1/4] Remove dependency on Python bz2 module
+
+The Python bz2 module is only needed in certain cases, so only import
+it when needed. In the normal nodejs build, this allows to remove the
+dependency on this module.
+
+Cc: Thomas Petazzoni <[email protected]>
+Signed-off-by: Martin Bark <[email protected]>
+---
+ deps/v8/tools/js2c.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/deps/v8/tools/js2c.py b/deps/v8/tools/js2c.py
+index 77485f6..371caf5 100755
+--- a/deps/v8/tools/js2c.py
++++ b/deps/v8/tools/js2c.py
+@@ -34,7 +34,6 @@
+ import os, re, sys, string
+ import optparse
+ import jsmin
+-import bz2
+ import textwrap
+ 
+ 
+@@ -492,6 +491,7 @@ def CompressMaybe(sources, compression_type):
+   if compression_type == "off":
+     return sources_bytes
+   elif compression_type == "bz2":
++    import bz2
+     return bz2.compress(sources_bytes)
+   else:
+     raise Error("Unknown compression type %s." % compression_type)
+-- 
+2.1.4
+
package/nodejs/0.12.4/0002-gyp-force-link-command-to-use-CXX.patch new file +27 -0
new file mode 100644
index 0000000..ef86e5f
@@ -0,0 +1,27 @@
+From 04bda7143f7ea6c6e6b659b73547b463f7e28c65 Mon Sep 17 00:00:00 2001
+From: Martin Bark <[email protected]>
+Date: Thu, 11 Jun 2015 19:27:46 +0100
+Subject: [PATCH 2/4] gyp: force link command to use CXX
+
+Cc: Samuel Martin <[email protected]>
+Signed-off-by: Martin Bark <[email protected]>
+---
+ tools/gyp/pylib/gyp/generator/make.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py
+index b88a433..0a1f2e0 100644
+--- a/tools/gyp/pylib/gyp/generator/make.py
++++ b/tools/gyp/pylib/gyp/generator/make.py
+@@ -141,7 +141,7 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
+ # special "figure out circular dependencies" flags around the entire
+ # input list during linking.
+ quiet_cmd_link = LINK($(TOOLSET)) $@
+-cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
++cmd_link = $(CXX.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
+ 
+ # We support two kinds of shared objects (.so):
+ # 1) shared_library, which is just bundling together many dependent libraries
+-- 
+2.1.4
+
package/nodejs/0.12.4/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch new file +62 -0

62 lines not on this page · raw message

package/nodejs/0.12.4/0004-fix-build-error-without-OpenSSL-support.patch new file +45 -0

45 lines not on this page · raw message

package/nodejs/Config.in +5 -1
index 8b0573a..75d8e4b 100644
@@ -24,18 +24,22 @@ if BR2_PACKAGE_NODEJS
 
 choice
 	prompt "Node.js Version"
-	default BR2_BR2_PACKAGE_NODEJS_0_10_38
+	default BR2_BR2_PACKAGE_NODEJS_0_12_4
 	help
 	  Select the version of Node.js you wish to use.
 
 	config BR2_BR2_PACKAGE_NODEJS_0_10_38
 		bool "v0.10.38"
 
+	config BR2_BR2_PACKAGE_NODEJS_0_12_4
+		bool "v0.12.4"
 endchoice
 
 config BR2_PACKAGE_NODEJS_VERSION_STRING
 	string
 	default "0.10.38"	if BR2_BR2_PACKAGE_NODEJS_0_10_38
+	default "0.12.4"	if BR2_BR2_PACKAGE_NODEJS_0_12_4
+
 menu "Module Selection"
 
 config BR2_PACKAGE_NODEJS_NPM
package/nodejs/nodejs.hash +3 -0
index 792ebc1..8b5551b 100644
@@ -1,2 +1,5 @@
 # From upstream URL: http://nodejs.org/dist/v0.10.38/SHASUMS256.txt
 sha256	513da8ed5e48abefdfab664f1cabc160238d314a0481148804aff8fc6552b78b  node-v0.10.38.tar.gz
+
+# From upstream URL: http://nodejs.org/dist/v0.12.4/SHASUMS256.txt
+sha256	3298d0997613a04ac64343e8316da134d04588132554ae402eb344e3369ec912  node-v0.12.4.tar.gz
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/4 package/nodejs: Add global node_module to the PATH

In reply to Martin Bark

This patch adds /usr/lib/node_modules/.bin to PATH so that global node_modules are accessible from the command line

---
 package/nodejs/nodejs.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/nodejs/nodejs.mk +5 -0
index 59e03b0..5d95f77 100644
@@ -111,6 +111,11 @@ define NODEJS_INSTALL_MODULES
 		$(HOST_DIR)/usr/bin/npm install \
 		$(NODEJS_MODULES_LIST) \
 	)
+
+	# Add global node_modules to PATH
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/profile.d
+	printf "export PATH=\x24PATH:/usr/lib/node_modules/.bin\n" \
+		>$(TARGET_DIR)/etc/profile.d/node_modules.sh
 endef
 endif
 
Signature · 1 line
2.1.4
#3 lore raw

PATCH 4/4 package/nodejs: Define NPM command for other packages to use

In reply to Martin Bark
---
 package/nodejs/nodejs.mk | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
package/nodejs/nodejs.mk +8 -6
index 5d95f77..8cd4fd3 100644
@@ -95,6 +95,13 @@ NODEJS_MODULES_LIST= $(call qstrip,\
 	$(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
 	$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
 
+# Define NPM for other packages to use
+NPM = $(TARGET_CONFIGURE_OPTS) \
+	LD="$(TARGET_CXX)" \
+	npm_config_arch=$(NODEJS_CPU) \
+	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
+	$(HOST_DIR)/usr/bin/npm
+
 #
 # We can only call NPM if there's something to install.
 #
@@ -104,12 +111,7 @@ define NODEJS_INSTALL_MODULES
 	# npm install call below and setting npm_config_rollback=false can both
 	# help in diagnosing the problem.
 	(cd $(TARGET_DIR)/usr/lib && mkdir -p node_modules && \
-		$(TARGET_CONFIGURE_OPTS) \
-		LD="$(TARGET_CXX)" \
-		npm_config_arch=$(NODEJS_CPU) \
-		npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
-		$(HOST_DIR)/usr/bin/npm install \
-		$(NODEJS_MODULES_LIST) \
+		$(NPM) install $(NODEJS_MODULES_LIST) \
 	)
 
 	# Add global node_modules to PATH
Signature · 1 line
2.1.4
#4 lore raw

PATCH 1/4 package/nodejs: Update to allow selecting node.js version

In reply to Martin Bark

Dear Martin Bark,

Quoted 1 line · Martin Bark

What is the motivation for supporting more than one version of NodeJS at a time?

We generally try to avoid supporting multiple versions of a given component, unless there are some really good reasons to do so (like python2 vs. python3, or qt4 vs. qt5).

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 1/4 package/nodejs: Update to allow selecting node.js version

Dear Thomas,

Quoted 7 lines · Thomas Petazzoni

Dear Martin Bark,

Quoted 1 line · Martin Bark

What is the motivation for supporting more than one version of NodeJS at a time?

Nodejs 0.10 and 0.12 use different versions of the V8 engine. The V8 version used in 0.12 unfortunatly dropped support for the ARMv5 architecture.

Quoted 3 lines

We generally try to avoid supporting multiple versions of a given component, unless there are some really good reasons to do so (like python2 vs. python3, or qt4 vs. qt5).

Nodejs 0.10 is still maintaned and new versions will follow. I would suggest to support both version until maintenance is dropped.

Best regards
J?rg Krause

#6 lore raw

PATCH 1/4 package/nodejs: Update to allow selecting node.js version

Dear Thomas & J?rg,

Quoted 11 lines · J?rg Krause

Dear Thomas,

Quoted 4 lines · Thomas Petazzoni

Dear Martin Bark,

What is the motivation for supporting more than one version of NodeJS at a time?

Nodejs 0.10 and 0.12 use different versions of the V8 engine. The V8 version used in 0.12 unfortunatly dropped support for the ARMv5 architecture.

Yes and now i think about it i probably should have added something like

depends on !BR2_ARM_CPU_ARMV5

for node.js v0.12.4. V8 after version 3.18 increased the minimum to ARMv6 with VFPv2. See
https://groups.google.com/forum/#!topic/v8-users/aSOFbaAQvMk. To confirm I just ran a test and the qemu_arm_versatile_defconfig will build node.js v0.12.4 but it fails to run. qemu_arm_vexpress_defconfig will build and run node v0.12.4.

Quoted 8 lines
Quoted 4 lines

We generally try to avoid supporting multiple versions of a given component, unless there are some really good reasons to do so (like python2 vs. python3, or qt4 vs. qt5).

Nodejs 0.10 is still maintaned and new versions will follow. I would suggest to support both version until maintenance is dropped.

That was my thought too. There are some details on the upcoming 0.10.39 release here https://github.com/joyent/node/milestones/0.10.39

Thanks

Martin