File versioned.patch of Package nodejs8

Author: Adam Majer <amajer@suse.de>
Date: Tue Jul  4 15:54:34 CEST 2017
Summary: Generate versioned binaries

Generate versioned binaries and install paths
so we can allow concurrent installations and
management via update_alternatives.

This is also important for generation of binary
modules for multiple versions of NodeJS
Index: node-v8.2.1/Makefile
===================================================================
--- node-v8.2.1.orig/Makefile
+++ node-v8.2.1/Makefile
@@ -40,10 +40,10 @@ BUILDTYPE_LOWER := $(shell echo $(BUILDT
 EXEEXT := $(shell $(PYTHON) -c \
 		"import sys; print('.exe' if sys.platform == 'win32' else '')")
 
-NODE_EXE = node$(EXEEXT)
+NODE_EXE = node8$(EXEEXT)
 NODE ?= ./$(NODE_EXE)
 NODE_G_EXE = node_g$(EXEEXT)
-NPM ?= ./deps/npm/bin/npm-cli.js
+NPM ?= ./deps/npm8/bin/npm-cli.js
 
 # Flags for packaging.
 BUILD_DOWNLOAD_FLAGS ?= --download=all
Index: node-v8.2.1/tools/install.py
===================================================================
--- node-v8.2.1.orig/tools/install.py
+++ node-v8.2.1/tools/install.py
@@ -77,7 +77,7 @@ def install(paths, dst): map(lambda path
 def uninstall(paths, dst): map(lambda path: try_remove(path, dst), paths)
 
 def npm_files(action):
-  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm/'
+  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm8/'
 
   # don't install npm if the target path is a symlink, it probably means
   # that a dev version of npm is installed there
@@ -91,20 +91,20 @@ def npm_files(action):
     action(paths, target_path + dirname[9:] + '/')
 
   # create/remove symlink
-  link_path = abspath(install_path, 'bin/npm')
+  link_path = abspath(install_path, 'bin/npm8')
   if action == uninstall:
-    action([link_path], 'bin/npm')
+    action([link_path], 'bin/npm8')
   elif action == install:
-    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm/bin/npm-cli.js',link_path)
+    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm8/bin/npm-cli.js',link_path)
   else:
     assert(0) # unhandled action type
 
   # create/remove symlink
-  link_path = abspath(install_path, 'bin/npx')
+  link_path = abspath(install_path, 'bin/npx8')
   if action == uninstall:
-    action([link_path], 'bin/npx')
+    action([link_path], 'bin/npx8')
   elif action == install:
-    try_symlink('../lib/node_modules/npm/bin/npx-cli.js', link_path)
+    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm8/bin/npx-cli.js', link_path)
   else:
     assert(0) # unhandled action type
 
@@ -118,7 +118,7 @@ def subdir_files(path, dest, action):
 
 def files(action):
   is_windows = sys.platform == 'win32'
-  output_file = 'node'
+  output_file = 'node8'
   output_prefix = 'out/Release/'
 
   if 'false' == variables.get('node_shared'):
@@ -140,7 +140,7 @@ def files(action):
     action(['out/Release/node.d'], sysconfig.get_config_var("LIB") + '/dtrace/node.d')
 
   # behave similarly for systemtap
-  action(['src/node.stp'], 'share/systemtap/tapset/')
+  action(['src/node.stp'], 'share/systemtap/tapset/node8.stp')
 
   action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
   action(['deps/v8/tools/lldbinit'], 'share/doc/node/')
@@ -149,7 +149,7 @@ def files(action):
   if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
     action(['doc/node.1'], 'man/man1/')
   else:
-    action(['doc/node.1'], 'share/man/man1/')
+    action(['doc/node.1'], 'share/man/man1/node8.1')
 
   if 'true' == variables.get('node_install_npm'): npm_files(action)
 
@@ -165,28 +165,28 @@ def headers(action):
     'src/node_buffer.h',
     'src/node_object_wrap.h',
     'src/node_version.h',
-  ], 'include/node/')
+  ], 'include/node8/')
 
   # Add the expfile that is created on AIX
   if sys.platform.startswith('aix'):
-    action(['out/Release/node.exp'], 'include/node/')
+    action(['out/Release/node.exp'], 'include/node8/')
 
-  subdir_files('deps/v8/include', 'include/node/', action)
+  subdir_files('deps/v8/include', 'include/node8/', action)
 
   if 'false' == variables.get('node_shared_libuv'):
-    subdir_files('deps/uv/include', 'include/node/', action)
+    subdir_files('deps/uv/include', 'include/node8/', action)
 
   if 'true' == variables.get('node_use_openssl') and \
      'false' == variables.get('node_shared_openssl'):
-    subdir_files('deps/openssl/openssl/include/openssl', 'include/node/openssl/', action)
-    subdir_files('deps/openssl/config/archs', 'include/node/openssl/archs', action)
-    action(['deps/openssl/config/opensslconf.h'], 'include/node/openssl/')
+    subdir_files('deps/openssl/openssl/include/openssl', 'include/node8/openssl/', action)
+    subdir_files('deps/openssl/config/archs', 'include/node8/openssl/archs', action)
+    action(['deps/openssl/config/opensslconf.h'], 'include/node8/openssl/')
 
   if 'false' == variables.get('node_shared_zlib'):
     action([
       'deps/zlib/zconf.h',
       'deps/zlib/zlib.h',
-    ], 'include/node/')
+    ], 'include/node8/')
 
 def run(args):
   global node_prefix, install_path, target_defaults, variables
Index: node-v8.2.1/doc/node.1
===================================================================
--- node-v8.2.1.orig/doc/node.1
+++ node-v8.2.1/doc/node.1
@@ -26,12 +26,12 @@
 
 .SH NAME
 
-node \- Server-side JavaScript runtime
+node8 \- Server-side JavaScript runtime
 
 
 .SH SYNOPSIS
 
-.B node
+.B node8
 .RI [ options ]
 .RI [ v8\ options ]
 .RI [ script.js \ |
@@ -43,14 +43,14 @@ node \- Server-side JavaScript runtime
 .B [--]
 .RI [ arguments ]
 .br
-.B node debug
+.B node8 debug
 .RI [ script.js " | "
 .B \-e
 .RI \&" script \&"\ |
 .IR <host>:<port> ]
 .I ...
 .br
-.B node
+.B node8
 .RB [ \-\-v8-options ]
 
 Execute without arguments to start the REPL.
Index: node-v8.2.1/src/node.stp
===================================================================
--- node-v8.2.1.orig/src/node.stp
+++ node-v8.2.1/src/node.stp
@@ -19,7 +19,7 @@
 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 // USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-probe node_net_server_connection = process("node").mark("net__server__connection")
+probe node_net_server_connection = process("node8").mark("net__server__connection")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -32,7 +32,7 @@ probe node_net_server_connection = proce
     fd);
 }
 
-probe node_net_stream_end = process("node").mark("net__stream__end")
+probe node_net_stream_end = process("node8").mark("net__stream__end")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -45,7 +45,7 @@ probe node_net_stream_end = process("nod
     fd);
 }
 
-probe node_http_server_request = process("node").mark("http__server__request")
+probe node_http_server_request = process("node8").mark("http__server__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -62,7 +62,7 @@ probe node_http_server_request = process
     fd);
 }
 
-probe node_http_server_response = process("node").mark("http__server__response")
+probe node_http_server_response = process("node8").mark("http__server__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -75,7 +75,7 @@ probe node_http_server_response = proces
     fd);
 }
 
-probe node_http_client_request = process("node").mark("http__client__request")
+probe node_http_client_request = process("node8").mark("http__client__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -92,7 +92,7 @@ probe node_http_client_request = process
     fd);
 }
 
-probe node_http_client_response = process("node").mark("http__client__response")
+probe node_http_client_response = process("node8").mark("http__client__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -105,7 +105,7 @@ probe node_http_client_response = proces
     fd);
 }
 
-probe node_gc_start = process("node").mark("gc__start")
+probe node_gc_start = process("node8").mark("gc__start")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
@@ -125,7 +125,7 @@ probe node_gc_start = process("node").ma
     flags);
 }
 
-probe node_gc_stop = process("node").mark("gc__stop")
+probe node_gc_stop = process("node8").mark("gc__stop")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
Index: node-v8.2.1/deps/npm/man/man1/npm.1
===================================================================
--- node-v8.2.1.orig/deps/npm/man/man1/npm.1
+++ node-v8.2.1/deps/npm/man/man1/npm.1
@@ -1,11 +1,11 @@
 .TH "NPM" "1" "July 2017" "" ""
 .SH "NAME"
-\fBnpm\fR \- javascript package manager
+\fBnpm8\fR \- javascript package manager
 .SH SYNOPSIS
 .P
 .RS 2
 .nf
-npm <command> [args]
+npm8 <command> [args]
 .fi
 .RE
 .SH VERSION
@@ -21,16 +21,16 @@ It is extremely configurable to support
 Most commonly, it is used to publish, discover, install, and develop node
 programs\.
 .P
-Run \fBnpm help\fP to get a list of available commands\.
+Run \fBnpm8 help\fP to get a list of available commands\.
 .SH INTRODUCTION
 .P
 You probably got npm because you want to install stuff\.
 .P
-Use \fBnpm install blerg\fP to install the latest version of "blerg"\.  Check out
+Use \fBnpm8 install blerg\fP to install the latest version of "blerg"\.  Check out
 npm help \fBnpm\-install\fP for more info\.  It can do a lot of stuff\.
 .P
-Use the \fBnpm search\fP command to show everything that's available\.
-Use \fBnpm ls\fP to show everything you've installed\.
+Use the \fBnpm8 search\fP command to show everything that's available\.
+Use \fBnpm8 ls\fP to show everything you've installed\.
 .SH DEPENDENCIES
 .P
 If a package references to another package with a git URL, npm depends
@@ -48,7 +48,7 @@ the node\-gyp repository \fIhttps://gith
 the node\-gyp Wiki \fIhttps://github\.com/TooTallNate/node\-gyp/wiki\fR\|\.
 .SH DIRECTORIES
 .P
-See npm help 5 \fBnpm\-folders\fP to learn about where npm puts stuff\.
+See npm8 help 5 \fBnpm\-folders\fP to learn about where npm puts stuff\.
 .P
 In particular, npm has two modes of operation:
 .RS 0
@@ -80,19 +80,19 @@ Make a package\.json file\.  See npm hel
 link:
 For linking your current working code into Node's path, so that you
 don't have to reinstall every time you make a change\.  Use
-\fBnpm link\fP to do this\.
+\fBnpm8 link\fP to do this\.
 .IP \(bu 2
 install:
 It's a good idea to install things if you don't need the symbolic link\.
 Especially, installing other peoples code from the registry is done via
-\fBnpm install\fP
+\fBnpm8 install\fP
 .IP \(bu 2
 adduser:
 Create an account or log in\.  Credentials are stored in the
 user config file\.
 .IP \(bu 2
 publish:
-Use the \fBnpm publish\fP command to upload your code to the registry\.
+Use the \fBnpm8 publish\fP command to upload your code to the registry\.
 
 .RE
 .SH CONFIGURATION
@@ -150,7 +150,7 @@ file in the "doc" folder\.  (Don't worry
 .RE
 .P
 Contributors are listed in npm's \fBpackage\.json\fP file\.  You can view them
-easily by doing \fBnpm view npm contributors\fP\|\.
+easily by doing \fBnpm8 view npm contributors\fP\|\.
 .P
 If you would like to contribute, but don't know what to work on, read
 the contributing guidelines and check the issues list\.
Index: node-v8.2.1/node.gyp
===================================================================
--- node-v8.2.1.orig/node.gyp
+++ node-v8.2.1/node.gyp
@@ -20,7 +20,7 @@
     'node_shared_openssl%': 'false',
     'node_v8_options%': '',
     'node_enable_v8_vtunejit%': 'false',
-    'node_core_target_name%': 'node',
+    'node_core_target_name%': 'node8',
     'library_files': [
       'lib/internal/bootstrap_node.js',
       'lib/async_hooks.js',
@@ -459,10 +459,10 @@
             {
               'action_name': 'node_dtrace_provider_o',
               'inputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace.o',
+                '<(OBJ_DIR)/node8/src/node_dtrace.o',
               ],
               'outputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
+                '<(OBJ_DIR)/node8/src/node_dtrace_provider.o'
               ],
               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
                 '<@(_inputs)', '-o', '<@(_outputs)' ]
@@ -512,7 +512,7 @@
                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
               ],
               'outputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
+                '<(OBJ_DIR)/node8/src/node_dtrace_ustack.o'
               ],
               'conditions': [
                 [ 'target_arch=="ia32" or target_arch=="arm"', {
@@ -573,9 +573,9 @@
       ],
 
       'variables': {
-        'OBJ_PATH': '<(OBJ_DIR)/node/src',
-        'OBJ_GEN_PATH': '<(OBJ_DIR)/node/gen',
-        'OBJ_TRACING_PATH': '<(OBJ_DIR)/node/src/tracing',
+        'OBJ_PATH': '<(OBJ_DIR)/node8/src',
+        'OBJ_GEN_PATH': '<(OBJ_DIR)/node8/gen',
+        'OBJ_TRACING_PATH': '<(OBJ_DIR)/node8/src/tracing',
         'OBJ_SUFFIX': 'o',
         'OBJ_SEPARATOR': '/',
         'conditions': [
@@ -715,7 +715,7 @@
     ['OS=="aix"', {
       'targets': [
         {
-          'target_name': 'node',
+          'target_name': 'node8',
           'conditions': [
             ['node_shared=="true"', {
               'type': 'shared_library',
Index: node-v8.2.1/deps/npm/bin/npm-cli.js
===================================================================
--- node-v8.2.1.orig/deps/npm/bin/npm-cli.js
+++ node-v8.2.1/deps/npm/bin/npm-cli.js
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/env node8
 ;(function () { // wrapper in case we're in module_context mode
   // windows: running "npm blah" in this folder will invoke WSH, not node.
   /*global WScript*/
Index: node-v8.2.1/src/node_main.cc
===================================================================
--- node-v8.2.1.orig/src/node_main.cc
+++ node-v8.2.1/src/node_main.cc
@@ -99,6 +99,7 @@ int main(int argc, char *argv[]) {
 #endif
   // Disable stdio buffering, it interacts poorly with printf()
   // calls elsewhere in the program (e.g., any logging from V8.)
+  setenv("NODE_VERSION", "8", 0);
   setvbuf(stdout, nullptr, _IONBF, 0);
   setvbuf(stderr, nullptr, _IONBF, 0);
   return node::Start(argc, argv);
openSUSE Build Service is sponsored by