package/nodejs: Update to allow selecting node.js version
authorMartin Bark <martin@barkynet.com>
Sat, 27 Jun 2015 02:01:34 +0000 (03:01 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 28 Jun 2015 13:14:24 +0000 (15:14 +0200)
[Thomas: fix minor Config.in formatting issues pointed by Yann.]

Signed-off-by: Martin Bark <martin@barkynet.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/nodejs/0.10.39/0001-remove-python-bz2-dependency.patch [new file with mode: 0644]
package/nodejs/0.10.39/0002-gyp-force-link-command-to-use-CXX.patch [new file with mode: 0644]
package/nodejs/0.10.39/0003-use-python-variable.patch [new file with mode: 0644]
package/nodejs/0.10.39/0004-fix-build-error-without-OpenSSL-support.patch [new file with mode: 0644]
package/nodejs/0001-remove-python-bz2-dependency.patch [deleted file]
package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch [deleted file]
package/nodejs/0003-use-python-variable.patch [deleted file]
package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch [deleted file]
package/nodejs/Config.in
package/nodejs/nodejs.mk

diff --git a/package/nodejs/0.10.39/0001-remove-python-bz2-dependency.patch b/package/nodejs/0.10.39/0001-remove-python-bz2-dependency.patch
new file mode 100644 (file)
index 0000000..75fe437
--- /dev/null
@@ -0,0 +1,27 @@
+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.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Index: b/deps/v8/tools/js2c.py
+===================================================================
+--- a/deps/v8/tools/js2c.py
++++ b/deps/v8/tools/js2c.py
+@@ -33,7 +33,6 @@
+ import os, re, sys, string
+ import jsmin
+-import bz2
+ def ToCAsciiArray(lines):
+@@ -344,6 +343,7 @@
+   else:
+     raw_sources_declaration = RAW_SOURCES_COMPRESSION_DECLARATION
+     if env['COMPRESSION'] == 'bz2':
++      import bz2
+       all_sources = bz2.compress("".join(all_sources))
+     total_length = len(all_sources)
+     sources_data = ToCArray(all_sources)
diff --git a/package/nodejs/0.10.39/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.10.39/0002-gyp-force-link-command-to-use-CXX.patch
new file mode 100644 (file)
index 0000000..a2f02ab
--- /dev/null
@@ -0,0 +1,26 @@
+From 00d809e9305241f8636a2d75e22c493293e6971a Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Sun, 20 Apr 2014 15:03:01 +0200
+Subject: [PATCH] gyp: force link command to use CXX
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.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 0de510e..54e4c96 100644
+--- a/tools/gyp/pylib/gyp/generator/make.py
++++ b/tools/gyp/pylib/gyp/generator/make.py
+@@ -134,7 +134,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
+-- 
+1.9.2
+
diff --git a/package/nodejs/0.10.39/0003-use-python-variable.patch b/package/nodejs/0.10.39/0003-use-python-variable.patch
new file mode 100644 (file)
index 0000000..f231f4c
--- /dev/null
@@ -0,0 +1,43 @@
+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.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/deps/v8/tools/gyp/v8.gyp
+===================================================================
+--- a/deps/v8/tools/gyp/v8.gyp
++++ b/deps/v8/tools/gyp/v8.gyp
+@@ -792,7 +792,7 @@
+                 '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
+               ],
+               'action': [
+-                'python',
++                '<(python)',
+                 '../../tools/js2c.py',
+                 '<@(_outputs)',
+                 'CORE',
+@@ -810,7 +810,7 @@
+                 '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
+               ],
+               'action': [
+-                'python',
++                '<(python)',
+                 '../../tools/js2c.py',
+                 '<@(_outputs)',
+                 'EXPERIMENTAL',
+@@ -840,7 +840,7 @@
+                   '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
+                 ],
+                 'action': [
+-                  'python',
++                  '<(python)',
+                   '../../tools/gen-postmortem-metadata.py',
+                   '<@(_outputs)',
+                   '<@(heapobject_files)'
diff --git a/package/nodejs/0.10.39/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0.10.39/0004-fix-build-error-without-OpenSSL-support.patch
new file mode 100644 (file)
index 0000000..9d41516
--- /dev/null
@@ -0,0 +1,54 @@
+From d9acdddb42aef48a9504368019beb1ad91c9a0c4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <jkrause@posteo.de>
+Date: Mon, 17 Nov 2014 12:34:05 +0100
+Subject: [PATCH 1/1] src/node.cc: fix build error without OpenSSL support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Jörg Krause <jkrause@posteo.de>
+---
+ src/node.cc | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/node.cc b/src/node.cc
+index 18c743f..cb77f08 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -82,7 +82,6 @@ typedef int mode_t;
+ #include "node_script.h"
+ #include "v8_typed_array.h"
+-#include "node_crypto.h"
+ #include "util.h"
+ using namespace v8;
+@@ -2544,8 +2543,10 @@ static void PrintHelp() {
+          "  --trace-deprecation  show stack traces on deprecations\n"
+          "  --v8-options         print v8 command line options\n"
+          "  --max-stack-size=val set max v8 stack size (bytes)\n"
++#if HAVE_OPENSSL
+          "  --enable-ssl2        enable ssl2\n"
+          "  --enable-ssl3        enable ssl3\n"
++#endif
+          "\n"
+          "Environment variables:\n"
+ #ifdef _WIN32
+@@ -2579,12 +2580,14 @@ static void ParseArgs(int argc, char **argv) {
+       p = 1 + strchr(arg, '=');
+       max_stack_size = atoi(p);
+       argv[i] = const_cast<char*>("");
++#if HAVE_OPENSSL
+     } else if (strcmp(arg, "--enable-ssl2") == 0) {
+       SSL2_ENABLE = true;
+       argv[i] = const_cast<char*>("");
+     } else if (strcmp(arg, "--enable-ssl3") == 0) {
+       SSL3_ENABLE = true;
+       argv[i] = const_cast<char*>("");
++#endif
+     } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
+       PrintHelp();
+       exit(0);
+-- 
+2.1.3
+
diff --git a/package/nodejs/0001-remove-python-bz2-dependency.patch b/package/nodejs/0001-remove-python-bz2-dependency.patch
deleted file mode 100644 (file)
index 75fe437..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-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.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Index: b/deps/v8/tools/js2c.py
-===================================================================
---- a/deps/v8/tools/js2c.py
-+++ b/deps/v8/tools/js2c.py
-@@ -33,7 +33,6 @@
- import os, re, sys, string
- import jsmin
--import bz2
- def ToCAsciiArray(lines):
-@@ -344,6 +343,7 @@
-   else:
-     raw_sources_declaration = RAW_SOURCES_COMPRESSION_DECLARATION
-     if env['COMPRESSION'] == 'bz2':
-+      import bz2
-       all_sources = bz2.compress("".join(all_sources))
-     total_length = len(all_sources)
-     sources_data = ToCArray(all_sources)
diff --git a/package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0002-gyp-force-link-command-to-use-CXX.patch
deleted file mode 100644 (file)
index a2f02ab..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-From 00d809e9305241f8636a2d75e22c493293e6971a Mon Sep 17 00:00:00 2001
-From: Samuel Martin <s.martin49@gmail.com>
-Date: Sun, 20 Apr 2014 15:03:01 +0200
-Subject: [PATCH] gyp: force link command to use CXX
-
-Signed-off-by: Samuel Martin <s.martin49@gmail.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 0de510e..54e4c96 100644
---- a/tools/gyp/pylib/gyp/generator/make.py
-+++ b/tools/gyp/pylib/gyp/generator/make.py
-@@ -134,7 +134,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
--- 
-1.9.2
-
diff --git a/package/nodejs/0003-use-python-variable.patch b/package/nodejs/0003-use-python-variable.patch
deleted file mode 100644 (file)
index f231f4c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-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.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/deps/v8/tools/gyp/v8.gyp
-===================================================================
---- a/deps/v8/tools/gyp/v8.gyp
-+++ b/deps/v8/tools/gyp/v8.gyp
-@@ -792,7 +792,7 @@
-                 '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
-               ],
-               'action': [
--                'python',
-+                '<(python)',
-                 '../../tools/js2c.py',
-                 '<@(_outputs)',
-                 'CORE',
-@@ -810,7 +810,7 @@
-                 '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
-               ],
-               'action': [
--                'python',
-+                '<(python)',
-                 '../../tools/js2c.py',
-                 '<@(_outputs)',
-                 'EXPERIMENTAL',
-@@ -840,7 +840,7 @@
-                   '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
-                 ],
-                 'action': [
--                  'python',
-+                  '<(python)',
-                   '../../tools/gen-postmortem-metadata.py',
-                   '<@(_outputs)',
-                   '<@(heapobject_files)'
diff --git a/package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch b/package/nodejs/0004-fix-build-error-without-OpenSSL-support.patch
deleted file mode 100644 (file)
index 9d41516..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-From d9acdddb42aef48a9504368019beb1ad91c9a0c4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?J=C3=B6rg=20Krause?= <jkrause@posteo.de>
-Date: Mon, 17 Nov 2014 12:34:05 +0100
-Subject: [PATCH 1/1] src/node.cc: fix build error without OpenSSL support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Jörg Krause <jkrause@posteo.de>
----
- src/node.cc | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/src/node.cc b/src/node.cc
-index 18c743f..cb77f08 100644
---- a/src/node.cc
-+++ b/src/node.cc
-@@ -82,7 +82,6 @@ typedef int mode_t;
- #include "node_script.h"
- #include "v8_typed_array.h"
--#include "node_crypto.h"
- #include "util.h"
- using namespace v8;
-@@ -2544,8 +2543,10 @@ static void PrintHelp() {
-          "  --trace-deprecation  show stack traces on deprecations\n"
-          "  --v8-options         print v8 command line options\n"
-          "  --max-stack-size=val set max v8 stack size (bytes)\n"
-+#if HAVE_OPENSSL
-          "  --enable-ssl2        enable ssl2\n"
-          "  --enable-ssl3        enable ssl3\n"
-+#endif
-          "\n"
-          "Environment variables:\n"
- #ifdef _WIN32
-@@ -2579,12 +2580,14 @@ static void ParseArgs(int argc, char **argv) {
-       p = 1 + strchr(arg, '=');
-       max_stack_size = atoi(p);
-       argv[i] = const_cast<char*>("");
-+#if HAVE_OPENSSL
-     } else if (strcmp(arg, "--enable-ssl2") == 0) {
-       SSL2_ENABLE = true;
-       argv[i] = const_cast<char*>("");
-     } else if (strcmp(arg, "--enable-ssl3") == 0) {
-       SSL3_ENABLE = true;
-       argv[i] = const_cast<char*>("");
-+#endif
-     } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
-       PrintHelp();
-       exit(0);
--- 
-2.1.3
-
index 31406831c0a9926441578251f24e9a29781a74ec..9a393854c220139f157fa3cc9d3c0f5df5c15544 100644 (file)
@@ -22,6 +22,21 @@ 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
index 4293c70f863ccb8ebe7c16f427e315be8f4425b9..59e03b0095f6352b9a388041fc5f00858b6580fa 100644 (file)
@@ -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 \