File nodejs-libpath.patch of Package nodejs6
Index: node-v6.12.0/lib/module.js
===================================================================
--- node-v6.12.0.orig/lib/module.js
+++ node-v6.12.0/lib/module.js
@@ -616,16 +616,7 @@ Module._initPaths = function() {
homeDir = process.env.HOME;
}
- // $PREFIX/lib/node, where $PREFIX is the root of the Node.js installation.
- var prefixDir;
- // process.execPath is $PREFIX/bin/node except on Windows where it is
- // $PREFIX\node.exe.
- if (isWindows) {
- prefixDir = path.resolve(process.execPath, '..');
- } else {
- prefixDir = path.resolve(process.execPath, '..', '..');
- }
- var paths = [path.resolve(prefixDir, 'lib', 'node')];
+ var paths = ['/usr/lib/node_modules', '/usr/lib/node'];
if (homeDir) {
paths.unshift(path.resolve(homeDir, '.node_libraries'));
Index: node-v6.12.0/tools/install.py
===================================================================
--- node-v6.12.0.orig/tools/install.py
+++ node-v6.12.0/tools/install.py
@@ -6,6 +6,7 @@ import os
import re
import shutil
import sys
+from distutils import sysconfig
from getmoduleversion import get_version
# set at init time
@@ -76,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 = 'lib/node_modules/npm/'
+ target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm/'
# don't install npm if the target path is a symlink, it probably means
# that a dev version of npm is installed there
@@ -94,7 +95,7 @@ def npm_files(action):
if action == uninstall:
action([link_path], 'bin/npm')
elif action == install:
- try_symlink('../lib/node_modules/npm/bin/npm-cli.js', link_path)
+ try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm/bin/npm-cli.js',link_path)
else:
assert(0) # unhandled action type
@@ -130,7 +131,7 @@ def files(action):
action([output_prefix + output_file], 'lib/' + output_file)
if 'true' == variables.get('node_use_dtrace'):
- action(['out/Release/node.d'], 'lib/dtrace/node.d')
+ action(['out/Release/node.d'], sysconfig.get_config_var("LIB") + '/dtrace/node.d')
# behave similarly for systemtap
action(['src/node.stp'], 'share/systemtap/tapset/')