All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39
@ 2015-06-27  2:01 Martin Bark
  2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changed v1 -> v2
  - No changes, added in v2

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 package/nodejs/nodejs.hash | 4 ++--
 package/nodejs/nodejs.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
index 792ebc1..bc1f15f 100644
--- a/package/nodejs/nodejs.hash
+++ b/package/nodejs/nodejs.hash
@@ -1,2 +1,2 @@
-# 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.10.39/SHASUMS256.txt
+sha256	68f8d8f9515c4e77e2a06034b742e19e9848c1fee5bcadedc1d68f3e4302df37  node-v0.10.39.tar.gz
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 5ee7714..4293c70 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-NODEJS_VERSION = 0.10.38
+NODEJS_VERSION = 0.10.39
 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
 NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
 NODEJS_DEPENDENCIES = host-python host-nodejs zlib \
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
@ 2015-06-27  2:01 ` Martin Bark
  2015-06-27 22:11   ` Yann E. MORIN
  2015-06-28 13:14   ` Thomas Petazzoni
  2015-06-27  2:01 ` [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version Martin Bark
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changes v1 -> v2
 - Updated to node.js v0.10.39

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 .../{ => 0.10.39}/0001-remove-python-bz2-dependency.patch  |  0
 .../0002-gyp-force-link-command-to-use-CXX.patch           |  0
 .../nodejs/{ => 0.10.39}/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.39}/0001-remove-python-bz2-dependency.patch (100%)
 rename package/nodejs/{ => 0.10.39}/0002-gyp-force-link-command-to-use-CXX.patch (100%)
 rename package/nodejs/{ => 0.10.39}/0003-use-python-variable.patch (100%)
 rename package/nodejs/{ => 0.10.39}/0004-fix-build-error-without-OpenSSL-support.patch (100%)

diff --git a/package/nodejs/0001-remove-python-bz2-dependency.patch b/package/nodejs/0.10.39/0001-remove-python-bz2-dependency.patch
similarity index 100%
rename from package/nodejs/0001-remove-python-bz2-dependency.patch
rename to package/nodejs/0.10.39/0001-remove-python-bz2-dependency.patch
diff --git a/package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.10.39/0002-gyp-force-link-command-to-use-CXX.patch
similarity index 100%
rename from package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch
rename to package/nodejs/0.10.39/0002-gyp-force-link-command-to-use-CXX.patch
diff --git a/package/nodejs/0003-use-python-variable.patch b/package/nodejs/0.10.39/0003-use-python-variable.patch
similarity index 100%
rename from package/nodejs/0003-use-python-variable.patch
rename to package/nodejs/0.10.39/0003-use-python-variable.patch
diff --git a/package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0.10.39/0004-fix-build-error-without-OpenSSL-support.patch
similarity index 100%
rename from package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch
rename to package/nodejs/0.10.39/0004-fix-build-error-without-OpenSSL-support.patch
diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
index 3140683..61419fd 100644
--- a/package/nodejs/Config.in
+++ b/package/nodejs/Config.in
@@ -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_39
+	help
+	  Select the version of Node.js you wish to use.
+
+	config BR2_BR2_PACKAGE_NODEJS_0_10_39
+		bool "v0.10.39"
+
+endchoice
+
+config BR2_PACKAGE_NODEJS_VERSION_STRING
+	string
+	default "0.10.39"	if BR2_BR2_PACKAGE_NODEJS_0_10_39
 menu "Module Selection"
 
 config BR2_PACKAGE_NODEJS_NPM
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 4293c70..59e03b0 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-NODEJS_VERSION = 0.10.39
+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 \
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
  2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
@ 2015-06-27  2:01 ` Martin Bark
  2015-06-27 22:34   ` Yann E. MORIN
  2015-06-27  2:01 ` [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH Martin Bark
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changed v1 -> v2
 - Added depends on !BR2_ARM_CPU_ARMV5
 - Updated from node.js v0.12.4 to v0.12.5

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 ...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                           |  8 ++-
 package/nodejs/nodejs.hash                         |  3 ++
 6 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
 create mode 100644 package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
 create mode 100644 package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
 create mode 100644 package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch

diff --git a/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
new file mode 100644
index 0000000..d2cb0b7
--- /dev/null
+++ b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
@@ -0,0 +1,38 @@
+From 2f57d17b8b1a8cb78bd9cff874a006adba3afd4a Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+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 <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ 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
+
diff --git a/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
new file mode 100644
index 0000000..ef86e5f
--- /dev/null
+++ b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
@@ -0,0 +1,27 @@
+From 04bda7143f7ea6c6e6b659b73547b463f7e28c65 Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Thu, 11 Jun 2015 19:27:46 +0100
+Subject: [PATCH 2/4] gyp: force link command to use CXX
+
+Cc: Samuel Martin <s.martin49@gmail.com>
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ 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
+
diff --git a/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
new file mode 100644
index 0000000..0a21a61
--- /dev/null
+++ b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
@@ -0,0 +1,62 @@
+From d6cc10f0765c97c402b1c1be0968f9d9eb112da9 Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Thu, 11 Jun 2015 19:25:09 +0100
+Subject: [PATCH 3/4] Use a python variable instead of hardcoding Python
+
+The nodejs build system uses python in a number of locations. However,
+there are some locations where it hardcodes 'python' as the Python
+interpreter. However, this causes problems when we need to use python2
+instead of just python.
+
+This patch fixes that by using the python variable already in place in
+the nodejs build system.
+
+Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ deps/v8/tools/gyp/v8.gyp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp
+index c703155..06c0b2b 100644
+--- a/deps/v8/tools/gyp/v8.gyp
++++ b/deps/v8/tools/gyp/v8.gyp
+@@ -1353,7 +1353,7 @@
+             'outputs': [
+               '<(PRODUCT_DIR)/natives_blob.bin',
+             ],
+-            'action': ['python', '<@(_inputs)', '<@(_outputs)'],
++            'action': ['<(python)', '<@(_inputs)', '<@(_outputs)'],
+           }],
+         }],
+         ['want_separate_host_toolset==1', {
+@@ -1435,7 +1435,7 @@
+             '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
+           ],
+           'action': [
+-            'python',
++            '<(python)',
+             '../../tools/js2c.py',
+             '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
+             'CORE',
+@@ -1462,7 +1462,7 @@
+             '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
+           ],
+           'action': [
+-            'python',
++            '<(python)',
+             '../../tools/js2c.py',
+             '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
+             'EXPERIMENTAL',
+@@ -1500,7 +1500,7 @@
+               '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
+             ],
+             'action': [
+-              'python',
++              '<(python)',
+               '../../tools/gen-postmortem-metadata.py',
+               '<@(_outputs)',
+               '<@(heapobject_files)'
+-- 
+2.1.4
+
diff --git a/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
new file mode 100644
index 0000000..aab6a31
--- /dev/null
+++ b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
@@ -0,0 +1,45 @@
+From ce288a677d89c72c2f4cd832dc4afb2e21ae060e Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Thu, 11 Jun 2015 19:57:40 +0100
+Subject: [PATCH 4/4] fix build error without OpenSSL support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Cc: J?rg Krause <jkrause@posteo.de>
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ src/node.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/node.cc b/src/node.cc
+index e669706..d43b791 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -2934,8 +2934,10 @@ static void PrintHelp() {
+          "                       present.\n"
+ #endif
+ #endif
++#if HAVE_OPENSSL
+          "  --enable-ssl2        enable ssl2\n"
+          "  --enable-ssl3        enable ssl3\n"
++#endif
+          "\n"
+          "Environment variables:\n"
+ #ifdef _WIN32
+@@ -3003,10 +3005,12 @@ static void ParseArgs(int* argc,
+     } else if (strcmp(arg, "--version") == 0 || strcmp(arg, "-v") == 0) {
+       printf("%s\n", NODE_VERSION);
+       exit(0);
++#if HAVE_OPENSSL
+     } else if (strcmp(arg, "--enable-ssl2") == 0) {
+       SSL2_ENABLE = true;
+     } else if (strcmp(arg, "--enable-ssl3") == 0) {
+       SSL3_ENABLE = true;
++#endif
+     } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
+       PrintHelp();
+       exit(0);
+-- 
+2.1.4
+
diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
index 61419fd..8a8de94 100644
--- a/package/nodejs/Config.in
+++ b/package/nodejs/Config.in
@@ -24,18 +24,24 @@ if BR2_PACKAGE_NODEJS
 
 choice
 	prompt "Node.js Version"
-	default BR2_BR2_PACKAGE_NODEJS_0_10_39
+	default BR2_BR2_PACKAGE_NODEJS_0_12_5
 	help
 	  Select the version of Node.js you wish to use.
 
 	config BR2_BR2_PACKAGE_NODEJS_0_10_39
 		bool "v0.10.39"
 
+	config BR2_BR2_PACKAGE_NODEJS_0_12_5
+		# Needs minimum of ARMv6 with VFPv2
+		depends on !BR2_ARM_CPU_ARMV5
+		bool "v0.12.5"
 endchoice
 
 config BR2_PACKAGE_NODEJS_VERSION_STRING
 	string
 	default "0.10.39"	if BR2_BR2_PACKAGE_NODEJS_0_10_39
+	default "0.12.5"	if BR2_BR2_PACKAGE_NODEJS_0_12_5
+
 menu "Module Selection"
 
 config BR2_PACKAGE_NODEJS_NPM
diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
index bc1f15f..816d602 100644
--- a/package/nodejs/nodejs.hash
+++ b/package/nodejs/nodejs.hash
@@ -1,2 +1,5 @@
 # From upstream URL: http://nodejs.org/dist/v0.10.39/SHASUMS256.txt
 sha256	68f8d8f9515c4e77e2a06034b742e19e9848c1fee5bcadedc1d68f3e4302df37  node-v0.10.39.tar.gz
+
+# From upstream URL: http://nodejs.org/dist/v0.12.5/SHASUMS256.txt
+sha256	4bc1e25f4c62ac65324d3cf4aa9de2d801cd708757c3567b6ad2ced7df30cdd2  node-v0.12.5.tar.gz
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
  2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
  2015-06-27  2:01 ` [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version Martin Bark
@ 2015-06-27  2:01 ` Martin Bark
  2015-06-27 22:44   ` Yann E. MORIN
  2015-06-27  2:01 ` [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use Martin Bark
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changes v1 -> v2
 - Improved commit message

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 package/nodejs/nodejs.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 59e03b0..5d95f77 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -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
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
                   ` (2 preceding siblings ...)
  2015-06-27  2:01 ` [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH Martin Bark
@ 2015-06-27  2:01 ` Martin Bark
  2015-06-27 22:53   ` Yann E. MORIN
  2015-06-27  2:01 ` [Buildroot] [v2 6/6] package/nodejs: Add npm_config_target_arch to npm command Martin Bark
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changes v1 -> v2
 - No changes

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 package/nodejs/nodejs.mk | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 5d95f77..8cd4fd3 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 6/6] package/nodejs: Add npm_config_target_arch to npm command
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
                   ` (3 preceding siblings ...)
  2015-06-27  2:01 ` [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use Martin Bark
@ 2015-06-27  2:01 ` Martin Bark
  2015-06-27 22:07 ` [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Yann E. MORIN
  2015-06-28 12:07 ` Thomas Petazzoni
  6 siblings, 0 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-27  2:01 UTC (permalink / raw)
  To: buildroot

Many packages use node-pre-gpy as a way of deploying pre compiled binary
dependencies with fall back to compilation for other targets.  node-gyp
uses the option --arch to determine its target architecture (which is
already set correctly), however, node-pre-gyp uses --target-arch.  Without
this set node.js packages that uses node-pre-gyp will pick the wrong target
architecture.

This patch sets npm_config_target_arch to solve this issue.  I have tested
this using the node.js package serialport.

Signed-off-by: Martin Bark <martin@barkynet.com>

---
Changes v1 -> v2
 - No changes, new in v2

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 package/nodejs/nodejs.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 8cd4fd3..50215be 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -99,6 +99,7 @@ NODEJS_MODULES_LIST= $(call qstrip,\
 NPM = $(TARGET_CONFIGURE_OPTS) \
 	LD="$(TARGET_CXX)" \
 	npm_config_arch=$(NODEJS_CPU) \
+	npm_config_target_arch=$(NODEJS_CPU) \
 	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
 	$(HOST_DIR)/usr/bin/npm
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
                   ` (4 preceding siblings ...)
  2015-06-27  2:01 ` [Buildroot] [v2 6/6] package/nodejs: Add npm_config_target_arch to npm command Martin Bark
@ 2015-06-27 22:07 ` Yann E. MORIN
  2015-06-28 12:07 ` Thomas Petazzoni
  6 siblings, 0 replies; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-27 22:07 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> Signed-off-by: Martin Bark <martin@barkynet.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Hash checked by Buildroot.

Regards,
Yann E. MORIN.

> ---
> Changed v1 -> v2
>   - No changes, added in v2
> 
> Signed-off-by: Martin Bark <martin@barkynet.com>
> ---
>  package/nodejs/nodejs.hash | 4 ++--
>  package/nodejs/nodejs.mk   | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
> index 792ebc1..bc1f15f 100644
> --- a/package/nodejs/nodejs.hash
> +++ b/package/nodejs/nodejs.hash
> @@ -1,2 +1,2 @@
> -# 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.10.39/SHASUMS256.txt
> +sha256	68f8d8f9515c4e77e2a06034b742e19e9848c1fee5bcadedc1d68f3e4302df37  node-v0.10.39.tar.gz
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 5ee7714..4293c70 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -NODEJS_VERSION = 0.10.38
> +NODEJS_VERSION = 0.10.39
>  NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
>  NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
>  NODEJS_DEPENDENCIES = host-python host-nodejs zlib \
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150628/b62e8c01/attachment.asc>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version
  2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
@ 2015-06-27 22:11   ` Yann E. MORIN
  2015-06-28 13:14   ` Thomas Petazzoni
  1 sibling, 0 replies; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-27 22:11 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> Signed-off-by: Martin Bark <martin@barkynet.com>
[--SNIP--]
> diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
> index 3140683..61419fd 100644
> --- a/package/nodejs/Config.in
> +++ b/package/nodejs/Config.in
> @@ -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_39
> +	help
> +	  Select the version of Node.js you wish to use.
> +
> +	config BR2_BR2_PACKAGE_NODEJS_0_10_39
> +		bool "v0.10.39"

We normally do not indent the config options in a choice block.

> +endchoice
> +
> +config BR2_PACKAGE_NODEJS_VERSION_STRING
> +	string
> +	default "0.10.39"	if BR2_BR2_PACKAGE_NODEJS_0_10_39
>  menu "Module Selection"

Missinge empty line before the menu definition.

Otherwise, looks good; when you fix the above, you can add my:

    Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

>  config BR2_PACKAGE_NODEJS_NPM
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 4293c70..59e03b0 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -NODEJS_VERSION = 0.10.39
> +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 \
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version
  2015-06-27  2:01 ` [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version Martin Bark
@ 2015-06-27 22:34   ` Yann E. MORIN
  2015-06-29  8:44     ` Martin Bark
  0 siblings, 1 reply; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-27 22:34 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> Signed-off-by: Martin Bark <martin@barkynet.com>
[--SNIP--]
> diff --git a/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
> new file mode 100644
> index 0000000..d2cb0b7
> --- /dev/null
> +++ b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
> @@ -0,0 +1,38 @@
> +From 2f57d17b8b1a8cb78bd9cff874a006adba3afd4a Mon Sep 17 00:00:00 2001
> +From: Martin Bark <martin@barkynet.com>
> +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 <thomas.petazzoni@free-electrons.com>
> +Signed-off-by: Martin Bark <martin@barkynet.com>

Since you're taking the original patch from 0.10 by Thomas, and adapt
it to 0.12, you should have kept the attribution and add yourself to the
list, like so:

    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    [Martin: adapt to 0.12.5]
    Signed-off-by: Martin Bark <martin@barkynet.com>

[--SNIP--]
> diff --git a/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
> new file mode 100644
> index 0000000..ef86e5f
> --- /dev/null
> +++ b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
> @@ -0,0 +1,27 @@
> +From 04bda7143f7ea6c6e6b659b73547b463f7e28c65 Mon Sep 17 00:00:00 2001
> +From: Martin Bark <martin@barkynet.com>
> +Date: Thu, 11 Jun 2015 19:27:46 +0100
> +Subject: [PATCH 2/4] gyp: force link command to use CXX
> +
> +Cc: Samuel Martin <s.martin49@gmail.com>
> +Signed-off-by: Martin Bark <martin@barkynet.com>

Ditto, but this time the patch is (AFAICS) exactly the same as the patch
for 0.10, so you should have kept attribution and add yourself to the
list, too:

    Signed-off-by: Samuel Martin <s.martin49@gmail.com>
    Signed-off-by: Martin Bark <martin@barkynet.com>

[--SNIP--]
> diff --git a/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
> new file mode 100644
> index 0000000..0a21a61
> --- /dev/null
> +++ b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
> @@ -0,0 +1,62 @@
> +From d6cc10f0765c97c402b1c1be0968f9d9eb112da9 Mon Sep 17 00:00:00 2001
> +From: Martin Bark <martin@barkynet.com>
> +Date: Thu, 11 Jun 2015 19:25:09 +0100
> +Subject: [PATCH 3/4] Use a python variable instead of hardcoding Python
> +
> +The nodejs build system uses python in a number of locations. However,
> +there are some locations where it hardcodes 'python' as the Python
> +interpreter. However, this causes problems when we need to use python2
> +instead of just python.
> +
> +This patch fixes that by using the python variable already in place in
> +the nodejs build system.
> +
> +Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +Signed-off-by: Martin Bark <martin@barkynet.com>

Ditto:

    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    [Martin: adapt to 0.12.5]
    Signed-off-by: Martin Bark <martin@barkynet.com>

[--SNIP--]
> diff --git a/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
> new file mode 100644
> index 0000000..aab6a31
> --- /dev/null
> +++ b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
> @@ -0,0 +1,45 @@
> +From ce288a677d89c72c2f4cd832dc4afb2e21ae060e Mon Sep 17 00:00:00 2001
> +From: Martin Bark <martin@barkynet.com>
> +Date: Thu, 11 Jun 2015 19:57:40 +0100
> +Subject: [PATCH 4/4] fix build error without OpenSSL support
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Cc: J?rg Krause <jkrause@posteo.de>
> +Signed-off-by: Martin Bark <martin@barkynet.com>

Ditto:

    Signed-off-by: J?rg Krause <jkrause@posteo.de>
    [Martin: adapt to 0.12.5]
    Signed-off-by: Martin Bark <martin@barkynet.com>

[--SNIP--]
> diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
> index 61419fd..8a8de94 100644
> --- a/package/nodejs/Config.in
> +++ b/package/nodejs/Config.in
> @@ -24,18 +24,24 @@ if BR2_PACKAGE_NODEJS
>  
>  choice
>  	prompt "Node.js Version"
> -	default BR2_BR2_PACKAGE_NODEJS_0_10_39
> +	default BR2_BR2_PACKAGE_NODEJS_0_12_5

Actually, that's semantically incorrect, even though it's technically
working. OK, I'll explain! ;-) :

You should keep both defaults

    default BR2_BR2_PACKAGE_NODEJS_0_10_39 if BR2_ARM_CPU_ARMV5
    default BR2_BR2_PACKAGE_NODEJS_0_12_5

Kconfig will stop at the first default that matches its conditions, so
in case you have an armv5, 0.10.39 will be the default; otherwise the
default will be 0.12.5.

(note that we don't care about armv4 because nodejs as a whole depends
on !armv4.

So, even though 0.12.5 is hidden for armv5, and thus can't be sledted,
it feels wrong to have as an unconditional default (what does it mean to
default to something that is not available?).

>  	help
>  	  Select the version of Node.js you wish to use.
>  
>  	config BR2_BR2_PACKAGE_NODEJS_0_10_39
>  		bool "v0.10.39"
>  
> +	config BR2_BR2_PACKAGE_NODEJS_0_12_5
> +		# Needs minimum of ARMv6 with VFPv2
> +		depends on !BR2_ARM_CPU_ARMV5
> +		bool "v0.12.5"
>  endchoice
>  
>  config BR2_PACKAGE_NODEJS_VERSION_STRING
>  	string
>  	default "0.10.39"	if BR2_BR2_PACKAGE_NODEJS_0_10_39
> +	default "0.12.5"	if BR2_BR2_PACKAGE_NODEJS_0_12_5
> +

Oh, look! An empty line! Hehe! ;-)

>  menu "Module Selection"
>  
>  config BR2_PACKAGE_NODEJS_NPM
> diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
> index bc1f15f..816d602 100644
> --- a/package/nodejs/nodejs.hash
> +++ b/package/nodejs/nodejs.hash
> @@ -1,2 +1,5 @@
>  # From upstream URL: http://nodejs.org/dist/v0.10.39/SHASUMS256.txt
>  sha256	68f8d8f9515c4e77e2a06034b742e19e9848c1fee5bcadedc1d68f3e4302df37  node-v0.10.39.tar.gz
> +
> +# From upstream URL: http://nodejs.org/dist/v0.12.5/SHASUMS256.txt
> +sha256	4bc1e25f4c62ac65324d3cf4aa9de2d801cd708757c3567b6ad2ced7df30cdd2  node-v0.12.5.tar.gz

Hash correct.

Regards,
Yann E. MORIN.

> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150628/f4bf6d90/attachment.asc>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH
  2015-06-27  2:01 ` [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH Martin Bark
@ 2015-06-27 22:44   ` Yann E. MORIN
  2015-06-29  9:13     ` Martin Bark
  0 siblings, 1 reply; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-27 22:44 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> This patch adds /usr/lib/node_modules/.bin to PATH so that global
> node_modules are accessible from the command line
> 
> Signed-off-by: Martin Bark <martin@barkynet.com>
> 
> ---
> Changes v1 -> v2
>  - Improved commit message
> 
> Signed-off-by: Martin Bark <martin@barkynet.com>
> ---
>  package/nodejs/nodejs.mk | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 59e03b0..5d95f77 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -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" \

Nice trick, but what about the slightly-more readable;

    printf 'PATH="$${PATH}:/usr/lib/node_modules/.bin"\n' \
        >$(TARGET_DIR)/etc/profile.d/node_modules.sh

  - because this is in a Makefile, so we need to $-escape the $.

  - because we do not want that $ to be interpreted by the shell (at build
    time!), we single-quote it.

  - because whoever knows what PATH is made of would be a fool (and
    because the world is cruel), we double-quote it (at runtime!)

Otherwise, what is the reason to have nodejs modules available as
commands from a login (!) shell? (Note: nodejs-noob speaking!)

Regards,
Yann E. MORIN.

> +		>$(TARGET_DIR)/etc/profile.d/node_modules.sh
>  endef
>  endif
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use
  2015-06-27  2:01 ` [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use Martin Bark
@ 2015-06-27 22:53   ` Yann E. MORIN
  2015-06-29 10:51     ` Martin Bark
  0 siblings, 1 reply; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-27 22:53 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> Signed-off-by: Martin Bark <martin@barkynet.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

But see below...

> ---
> Changes v1 -> v2
>  - No changes
> 
> Signed-off-by: Martin Bark <martin@barkynet.com>
> ---
>  package/nodejs/nodejs.mk | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 5d95f77..8cd4fd3 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -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) \

Although the change looks trivially OK, I wonder why you introduce
$(NPM) for this single user (there is no other user of $(NPM) added
in your series).

Do you intend to send more patches that make use of $(NPM) ?

Regards,
Yann E. MORIN.

>  	)
>  
>  	# Add global node_modules to PATH
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39
  2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
                   ` (5 preceding siblings ...)
  2015-06-27 22:07 ` [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Yann E. MORIN
@ 2015-06-28 12:07 ` Thomas Petazzoni
  6 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2015-06-28 12:07 UTC (permalink / raw)
  To: buildroot

Dear Martin Bark,

On Sat, 27 Jun 2015 03:01:33 +0100, Martin Bark wrote:
> Signed-off-by: Martin Bark <martin@barkynet.com>
> 
> ---
> Changed v1 -> v2
>   - No changes, added in v2

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version
  2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
  2015-06-27 22:11   ` Yann E. MORIN
@ 2015-06-28 13:14   ` Thomas Petazzoni
  1 sibling, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2015-06-28 13:14 UTC (permalink / raw)
  To: buildroot

Dear Martin Bark,

On Sat, 27 Jun 2015 03:01:34 +0100, Martin Bark wrote:
> Signed-off-by: Martin Bark <martin@barkynet.com>
> 
> ---
> Changes v1 -> v2
>  - Updated to node.js v0.10.39

Thanks, applied after fixing the minor Config.in formatting issues
pointed by Yann.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version
  2015-06-27 22:34   ` Yann E. MORIN
@ 2015-06-29  8:44     ` Martin Bark
  0 siblings, 0 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-29  8:44 UTC (permalink / raw)
  To: buildroot

Yann,

Thanks for the feedback and explanation, I'll get an updated patch set
send out soon.

Thanks,
Martin

On 27 June 2015 at 23:34, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Martin, All,
>
> On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
>> Signed-off-by: Martin Bark <martin@barkynet.com>
> [--SNIP--]
>> diff --git a/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
>> new file mode 100644
>> index 0000000..d2cb0b7
>> --- /dev/null
>> +++ b/package/nodejs/0.12.5/0001-Remove-dependency-on-Python-bz2-module.patch
>> @@ -0,0 +1,38 @@
>> +From 2f57d17b8b1a8cb78bd9cff874a006adba3afd4a Mon Sep 17 00:00:00 2001
>> +From: Martin Bark <martin@barkynet.com>
>> +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 <thomas.petazzoni@free-electrons.com>
>> +Signed-off-by: Martin Bark <martin@barkynet.com>
>
> Since you're taking the original patch from 0.10 by Thomas, and adapt
> it to 0.12, you should have kept the attribution and add yourself to the
> list, like so:
>
>     Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>     [Martin: adapt to 0.12.5]
>     Signed-off-by: Martin Bark <martin@barkynet.com>
>
> [--SNIP--]
>> diff --git a/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
>> new file mode 100644
>> index 0000000..ef86e5f
>> --- /dev/null
>> +++ b/package/nodejs/0.12.5/0002-gyp-force-link-command-to-use-CXX.patch
>> @@ -0,0 +1,27 @@
>> +From 04bda7143f7ea6c6e6b659b73547b463f7e28c65 Mon Sep 17 00:00:00 2001
>> +From: Martin Bark <martin@barkynet.com>
>> +Date: Thu, 11 Jun 2015 19:27:46 +0100
>> +Subject: [PATCH 2/4] gyp: force link command to use CXX
>> +
>> +Cc: Samuel Martin <s.martin49@gmail.com>
>> +Signed-off-by: Martin Bark <martin@barkynet.com>
>
> Ditto, but this time the patch is (AFAICS) exactly the same as the patch
> for 0.10, so you should have kept attribution and add yourself to the
> list, too:
>
>     Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>     Signed-off-by: Martin Bark <martin@barkynet.com>
>
> [--SNIP--]
>> diff --git a/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
>> new file mode 100644
>> index 0000000..0a21a61
>> --- /dev/null
>> +++ b/package/nodejs/0.12.5/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch
>> @@ -0,0 +1,62 @@
>> +From d6cc10f0765c97c402b1c1be0968f9d9eb112da9 Mon Sep 17 00:00:00 2001
>> +From: Martin Bark <martin@barkynet.com>
>> +Date: Thu, 11 Jun 2015 19:25:09 +0100
>> +Subject: [PATCH 3/4] Use a python variable instead of hardcoding Python
>> +
>> +The nodejs build system uses python in a number of locations. However,
>> +there are some locations where it hardcodes 'python' as the Python
>> +interpreter. However, this causes problems when we need to use python2
>> +instead of just python.
>> +
>> +This patch fixes that by using the python variable already in place in
>> +the nodejs build system.
>> +
>> +Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> +Signed-off-by: Martin Bark <martin@barkynet.com>
>
> Ditto:
>
>     Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>     [Martin: adapt to 0.12.5]
>     Signed-off-by: Martin Bark <martin@barkynet.com>
>
> [--SNIP--]
>> diff --git a/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
>> new file mode 100644
>> index 0000000..aab6a31
>> --- /dev/null
>> +++ b/package/nodejs/0.12.5/0004-fix-build-error-without-OpenSSL-support.patch
>> @@ -0,0 +1,45 @@
>> +From ce288a677d89c72c2f4cd832dc4afb2e21ae060e Mon Sep 17 00:00:00 2001
>> +From: Martin Bark <martin@barkynet.com>
>> +Date: Thu, 11 Jun 2015 19:57:40 +0100
>> +Subject: [PATCH 4/4] fix build error without OpenSSL support
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Cc: J?rg Krause <jkrause@posteo.de>
>> +Signed-off-by: Martin Bark <martin@barkynet.com>
>
> Ditto:
>
>     Signed-off-by: J?rg Krause <jkrause@posteo.de>
>     [Martin: adapt to 0.12.5]
>     Signed-off-by: Martin Bark <martin@barkynet.com>
>
> [--SNIP--]
>> diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
>> index 61419fd..8a8de94 100644
>> --- a/package/nodejs/Config.in
>> +++ b/package/nodejs/Config.in
>> @@ -24,18 +24,24 @@ if BR2_PACKAGE_NODEJS
>>
>>  choice
>>       prompt "Node.js Version"
>> -     default BR2_BR2_PACKAGE_NODEJS_0_10_39
>> +     default BR2_BR2_PACKAGE_NODEJS_0_12_5
>
> Actually, that's semantically incorrect, even though it's technically
> working. OK, I'll explain! ;-) :
>
> You should keep both defaults
>
>     default BR2_BR2_PACKAGE_NODEJS_0_10_39 if BR2_ARM_CPU_ARMV5
>     default BR2_BR2_PACKAGE_NODEJS_0_12_5
>
> Kconfig will stop at the first default that matches its conditions, so
> in case you have an armv5, 0.10.39 will be the default; otherwise the
> default will be 0.12.5.
>
> (note that we don't care about armv4 because nodejs as a whole depends
> on !armv4.
>
> So, even though 0.12.5 is hidden for armv5, and thus can't be sledted,
> it feels wrong to have as an unconditional default (what does it mean to
> default to something that is not available?).
>
>>       help
>>         Select the version of Node.js you wish to use.
>>
>>       config BR2_BR2_PACKAGE_NODEJS_0_10_39
>>               bool "v0.10.39"
>>
>> +     config BR2_BR2_PACKAGE_NODEJS_0_12_5
>> +             # Needs minimum of ARMv6 with VFPv2
>> +             depends on !BR2_ARM_CPU_ARMV5
>> +             bool "v0.12.5"
>>  endchoice
>>
>>  config BR2_PACKAGE_NODEJS_VERSION_STRING
>>       string
>>       default "0.10.39"       if BR2_BR2_PACKAGE_NODEJS_0_10_39
>> +     default "0.12.5"        if BR2_BR2_PACKAGE_NODEJS_0_12_5
>> +
>
> Oh, look! An empty line! Hehe! ;-)
>
>>  menu "Module Selection"
>>
>>  config BR2_PACKAGE_NODEJS_NPM
>> diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
>> index bc1f15f..816d602 100644
>> --- a/package/nodejs/nodejs.hash
>> +++ b/package/nodejs/nodejs.hash
>> @@ -1,2 +1,5 @@
>>  # From upstream URL: http://nodejs.org/dist/v0.10.39/SHASUMS256.txt
>>  sha256       68f8d8f9515c4e77e2a06034b742e19e9848c1fee5bcadedc1d68f3e4302df37  node-v0.10.39.tar.gz
>> +
>> +# From upstream URL: http://nodejs.org/dist/v0.12.5/SHASUMS256.txt
>> +sha256       4bc1e25f4c62ac65324d3cf4aa9de2d801cd708757c3567b6ad2ced7df30cdd2  node-v0.12.5.tar.gz
>
> Hash correct.
>
> Regards,
> Yann E. MORIN.
>
>> --
>> 2.1.4
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH
  2015-06-27 22:44   ` Yann E. MORIN
@ 2015-06-29  9:13     ` Martin Bark
  2015-06-29 17:20       ` Yann E. MORIN
  0 siblings, 1 reply; 20+ messages in thread
From: Martin Bark @ 2015-06-29  9:13 UTC (permalink / raw)
  To: buildroot

Yann,

Yes I agree your way is easier to read, I'll update my patch and resubmit it.

The reason this is useful is because there lots of node.js packages
that are normal command line apps designed to be installed globally.
For example, if you install http-server
(https://github.com/indexzero/http-server) then you simple need to cd
into any directory, type ./http-server and it will server that
directory up for you.  Another example might be vtop
(https://github.com/MrRio/vtop), a graphical version of top.

If you install these apps globally then all the executables will be in
the /usr/lib/node_modules/.bin directory.  So this patch simply saves
you typing the full path, the same as for your desktop.

You can test this out by setting BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL
to one of these packages.  For reference these is a nice list of some
useful apps here
https://github.com/sindresorhus/awesome-nodejs#command-line-apps.

Thanks

Martin

On 27 June 2015 at 23:44, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Martin, All,
>
> On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
>> This patch adds /usr/lib/node_modules/.bin to PATH so that global
>> node_modules are accessible from the command line
>>
>> Signed-off-by: Martin Bark <martin@barkynet.com>
>>
>> ---
>> Changes v1 -> v2
>>  - Improved commit message
>>
>> Signed-off-by: Martin Bark <martin@barkynet.com>
>> ---
>>  package/nodejs/nodejs.mk | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
>> index 59e03b0..5d95f77 100644
>> --- a/package/nodejs/nodejs.mk
>> +++ b/package/nodejs/nodejs.mk
>> @@ -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" \
>
> Nice trick, but what about the slightly-more readable;
>
>     printf 'PATH="$${PATH}:/usr/lib/node_modules/.bin"\n' \
>         >$(TARGET_DIR)/etc/profile.d/node_modules.sh
>
>   - because this is in a Makefile, so we need to $-escape the $.
>
>   - because we do not want that $ to be interpreted by the shell (at build
>     time!), we single-quote it.
>
>   - because whoever knows what PATH is made of would be a fool (and
>     because the world is cruel), we double-quote it (at runtime!)
>
> Otherwise, what is the reason to have nodejs modules available as
> commands from a login (!) shell? (Note: nodejs-noob speaking!)
>
> Regards,
> Yann E. MORIN.
>
>> +             >$(TARGET_DIR)/etc/profile.d/node_modules.sh
>>  endef
>>  endif
>>
>> --
>> 2.1.4
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use
  2015-06-27 22:53   ` Yann E. MORIN
@ 2015-06-29 10:51     ` Martin Bark
  2015-06-29 17:09       ` Yann E. MORIN
  0 siblings, 1 reply; 20+ messages in thread
From: Martin Bark @ 2015-06-29 10:51 UTC (permalink / raw)
  To: buildroot

Yann,

Yes I was thinking of submitting some patches to add other node.js
based packages but really I just submitted this patch because I though
$(NPM) would be useful for other people too.   I was thinking of
submitting pm2 (https://www.npmjs.com/package/pm2) as a package to
buildroot.  pm2 is a popular process manager and I've used it to solve
the issue of starting/stopping other node.js apps.  Having $(NPM)
defined makes writing node.js based packages for buildroot easier.

Thanks

Martin

On 27 June 2015 at 23:53, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Martin, All,
>
> On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
>> Signed-off-by: Martin Bark <martin@barkynet.com>
>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
> But see below...
>
>> ---
>> Changes v1 -> v2
>>  - No changes
>>
>> Signed-off-by: Martin Bark <martin@barkynet.com>
>> ---
>>  package/nodejs/nodejs.mk | 14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
>> index 5d95f77..8cd4fd3 100644
>> --- a/package/nodejs/nodejs.mk
>> +++ b/package/nodejs/nodejs.mk
>> @@ -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) \
>
> Although the change looks trivially OK, I wonder why you introduce
> $(NPM) for this single user (there is no other user of $(NPM) added
> in your series).
>
> Do you intend to send more patches that make use of $(NPM) ?
>
> Regards,
> Yann E. MORIN.
>
>>       )
>>
>>       # Add global node_modules to PATH
>> --
>> 2.1.4
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use
  2015-06-29 10:51     ` Martin Bark
@ 2015-06-29 17:09       ` Yann E. MORIN
  2015-06-29 19:34         ` Martin Bark
  0 siblings, 1 reply; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-29 17:09 UTC (permalink / raw)
  To: buildroot

Martin, All,

[Please, do not top-post; please interleave your answers with the part
you are replying to, it makes it easier to follow...]

On 2015-06-29 11:51 +0100, Martin Bark spake thusly:
> Yes I was thinking of submitting some patches to add other node.js
> based packages but really I just submitted this patch because I though
> $(NPM) would be useful for other people too.

OK, that's good. :-) You could have said it more explicitly in the
commit log, after a three-dash line:

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

    Other nodejs-related packages will need to call npm with the same
    set of arguments as is currently used by the nodejs package itself.

    To avoid duplicating this code, set the NPM variable so those
    packages can re-use it.

    Signed-off-by: you

    ---
    Note: currently, this is only used in the nodejs package itself, but I
    plan on swnding new nodejs-related packages that will use this, like
    nodejs' serialport or pm2 packages which I have tested successfully
    using this $(NPM).

(Or something similar, choose your own words if mines are way off! ;-) )

To be noted: whatever gets added after a three-dahs line is omitted by
git when the patch is applied by the maintainer, so you can basically
write whatever you see fit in there.

Thanks for the explanations!

Regards,
Yann E. MORIN.

> I was thinking of
> submitting pm2 (https://www.npmjs.com/package/pm2) as a package to
> buildroot.  pm2 is a popular process manager and I've used it to solve
> the issue of starting/stopping other node.js apps.  Having $(NPM)
> defined makes writing node.js based packages for buildroot easier.
> 
> Thanks
> 
> Martin
> 
> On 27 June 2015 at 23:53, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > Martin, All,
> >
> > On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
> >> Signed-off-by: Martin Bark <martin@barkynet.com>
> >
> > Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >
> > But see below...
> >
> >> ---
> >> Changes v1 -> v2
> >>  - No changes
> >>
> >> Signed-off-by: Martin Bark <martin@barkynet.com>
> >> ---
> >>  package/nodejs/nodejs.mk | 14 ++++++++------
> >>  1 file changed, 8 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> >> index 5d95f77..8cd4fd3 100644
> >> --- a/package/nodejs/nodejs.mk
> >> +++ b/package/nodejs/nodejs.mk
> >> @@ -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) \
> >
> > Although the change looks trivially OK, I wonder why you introduce
> > $(NPM) for this single user (there is no other user of $(NPM) added
> > in your series).
> >
> > Do you intend to send more patches that make use of $(NPM) ?
> >
> > Regards,
> > Yann E. MORIN.
> >
> >>       )
> >>
> >>       # Add global node_modules to PATH
> >> --
> >> 2.1.4
> >>
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot at busybox.net
> >> http://lists.busybox.net/mailman/listinfo/buildroot
> >
> > --
> > .-----------------.--------------------.------------------.--------------------.
> > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> > | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> > '------------------------------^-------^------------------^--------------------'

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH
  2015-06-29  9:13     ` Martin Bark
@ 2015-06-29 17:20       ` Yann E. MORIN
  2015-06-29 19:31         ` Martin Bark
  0 siblings, 1 reply; 20+ messages in thread
From: Yann E. MORIN @ 2015-06-29 17:20 UTC (permalink / raw)
  To: buildroot

Martin, All,

On 2015-06-29 10:13 +0100, Martin Bark spake thusly:
> Yes I agree your way is easier to read, I'll update my patch and resubmit it.

Great, thanls! :-)

> The reason this is useful is because there lots of node.js packages
> that are normal command line apps designed to be installed globally.
> For example, if you install http-server
> (https://github.com/indexzero/http-server) then you simple need to cd
> into any directory, type ./http-server and it will server that

You mean, http-server must be in the directory you want to serve? Or did
you mean that you just run /path/to/http-server and it will serve the
current directory?  (I guess the latter.)

> directory up for you.  Another example might be vtop
> (https://github.com/MrRio/vtop), a graphical version of top.
> 
> If you install these apps globally then all the executables will be in
> the /usr/lib/node_modules/.bin directory.  So this patch simply saves
> you typing the full path, the same as for your desktop.

OK, so why not make symlinks (or hadlinks) for each of them in /usr/bin
instead? Something like (untested):

    cd $(TARGET_DIR)/usr/bin; \
    for f in ../../usr/lib/node_modules/.bin/*; do \
        [ -f "$${f}" -a -x "$${f}" ] || continue; \
        ln -sf "$${f}" "$${f##*/}" || exit 1; \
    done

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH
  2015-06-29 17:20       ` Yann E. MORIN
@ 2015-06-29 19:31         ` Martin Bark
  0 siblings, 0 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-29 19:31 UTC (permalink / raw)
  To: buildroot

Yann,

On 29 June 2015 at 18:20, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Martin, All,
>
> On 2015-06-29 10:13 +0100, Martin Bark spake thusly:
>> Yes I agree your way is easier to read, I'll update my patch and resubmit it.
>
> Great, thanls! :-)
>
>> The reason this is useful is because there lots of node.js packages
>> that are normal command line apps designed to be installed globally.
>> For example, if you install http-server
>> (https://github.com/indexzero/http-server) then you simple need to cd
>> into any directory, type ./http-server and it will server that
>
> You mean, http-server must be in the directory you want to serve? Or did
> you mean that you just run /path/to/http-server and it will serve the
> current directory?  (I guess the latter.)

Yes i meant the latter

>
>> directory up for you.  Another example might be vtop
>> (https://github.com/MrRio/vtop), a graphical version of top.
>>
>> If you install these apps globally then all the executables will be in
>> the /usr/lib/node_modules/.bin directory.  So this patch simply saves
>> you typing the full path, the same as for your desktop.
>
> OK, so why not make symlinks (or hadlinks) for each of them in /usr/bin
> instead? Something like (untested):
>
>     cd $(TARGET_DIR)/usr/bin; \
>     for f in ../../usr/lib/node_modules/.bin/*; do \
>         [ -f "$${f}" -a -x "$${f}" ] || continue; \
>         ln -sf "$${f}" "$${f##*/}" || exit 1; \
>     done
>

OK i can see that working too and it saves adjusting PATH.  I'll send
an updated patch using your method.

Thanks

Martin

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use
  2015-06-29 17:09       ` Yann E. MORIN
@ 2015-06-29 19:34         ` Martin Bark
  0 siblings, 0 replies; 20+ messages in thread
From: Martin Bark @ 2015-06-29 19:34 UTC (permalink / raw)
  To: buildroot

Yann,

On 29 June 2015 at 18:09, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Martin, All,
>
> [Please, do not top-post; please interleave your answers with the part
> you are replying to, it makes it easier to follow...]

oops, I meant to do that.

>
> On 2015-06-29 11:51 +0100, Martin Bark spake thusly:
>> Yes I was thinking of submitting some patches to add other node.js
>> based packages but really I just submitted this patch because I though
>> $(NPM) would be useful for other people too.
>
> OK, that's good. :-) You could have said it more explicitly in the
> commit log, after a three-dash line:
>
>     package/nodejs: Define NPM command for other packages to use
>
>     Other nodejs-related packages will need to call npm with the same
>     set of arguments as is currently used by the nodejs package itself.
>
>     To avoid duplicating this code, set the NPM variable so those
>     packages can re-use it.
>
>     Signed-off-by: you
>
>     ---
>     Note: currently, this is only used in the nodejs package itself, but I
>     plan on swnding new nodejs-related packages that will use this, like
>     nodejs' serialport or pm2 packages which I have tested successfully
>     using this $(NPM).
>
> (Or something similar, choose your own words if mines are way off! ;-) )
>
> To be noted: whatever gets added after a three-dahs line is omitted by
> git when the patch is applied by the maintainer, so you can basically
> write whatever you see fit in there.
>
> Thanks for the explanations!
>
> Regards,
> Yann E. MORIN.

Good point, I should have been more explicit with the commit message.
I'll fix this.

Thanks

Martin


>
>> I was thinking of
>> submitting pm2 (https://www.npmjs.com/package/pm2) as a package to
>> buildroot.  pm2 is a popular process manager and I've used it to solve
>> the issue of starting/stopping other node.js apps.  Having $(NPM)
>> defined makes writing node.js based packages for buildroot easier.
>>
>> Thanks
>>
>> Martin
>>
>> On 27 June 2015 at 23:53, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> > Martin, All,
>> >
>> > On 2015-06-27 03:01 +0100, Martin Bark spake thusly:
>> >> Signed-off-by: Martin Bark <martin@barkynet.com>
>> >
>> > Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>> >
>> > But see below...
>> >
>> >> ---
>> >> Changes v1 -> v2
>> >>  - No changes
>> >>
>> >> Signed-off-by: Martin Bark <martin@barkynet.com>
>> >> ---
>> >>  package/nodejs/nodejs.mk | 14 ++++++++------
>> >>  1 file changed, 8 insertions(+), 6 deletions(-)
>> >>
>> >> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
>> >> index 5d95f77..8cd4fd3 100644
>> >> --- a/package/nodejs/nodejs.mk
>> >> +++ b/package/nodejs/nodejs.mk
>> >> @@ -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) \
>> >
>> > Although the change looks trivially OK, I wonder why you introduce
>> > $(NPM) for this single user (there is no other user of $(NPM) added
>> > in your series).
>> >
>> > Do you intend to send more patches that make use of $(NPM) ?
>> >
>> > Regards,
>> > Yann E. MORIN.
>> >
>> >>       )
>> >>
>> >>       # Add global node_modules to PATH
>> >> --
>> >> 2.1.4
>> >>
>> >> _______________________________________________
>> >> buildroot mailing list
>> >> buildroot at busybox.net
>> >> http://lists.busybox.net/mailman/listinfo/buildroot
>> >
>> > --
>> > .-----------------.--------------------.------------------.--------------------.
>> > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
>> > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
>> > | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
>> > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
>> > '------------------------------^-------^------------------^--------------------'
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-06-29 19:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-27  2:01 [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Martin Bark
2015-06-27  2:01 ` [Buildroot] [v2 2/6] package/nodejs: Update to allow selecting node.js version Martin Bark
2015-06-27 22:11   ` Yann E. MORIN
2015-06-28 13:14   ` Thomas Petazzoni
2015-06-27  2:01 ` [Buildroot] [v2 3/6] package/nodejs: Add node.js v0.12.5 and set as the default version Martin Bark
2015-06-27 22:34   ` Yann E. MORIN
2015-06-29  8:44     ` Martin Bark
2015-06-27  2:01 ` [Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH Martin Bark
2015-06-27 22:44   ` Yann E. MORIN
2015-06-29  9:13     ` Martin Bark
2015-06-29 17:20       ` Yann E. MORIN
2015-06-29 19:31         ` Martin Bark
2015-06-27  2:01 ` [Buildroot] [v2 5/6] package/nodejs: Define NPM command for other packages to use Martin Bark
2015-06-27 22:53   ` Yann E. MORIN
2015-06-29 10:51     ` Martin Bark
2015-06-29 17:09       ` Yann E. MORIN
2015-06-29 19:34         ` Martin Bark
2015-06-27  2:01 ` [Buildroot] [v2 6/6] package/nodejs: Add npm_config_target_arch to npm command Martin Bark
2015-06-27 22:07 ` [Buildroot] [v2 1/6] package/nodejs: Bump version to 0.10.39 Yann E. MORIN
2015-06-28 12:07 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.