diff --git a/debian/patches/2001_FHS_and_rename_to_nodejs.patch b/debian/patches/2001_FHS_and_rename_to_nodejs.patch index 05747742..d190ebea 100644 --- a/debian/patches/2001_FHS_and_rename_to_nodejs.patch +++ b/debian/patches/2001_FHS_and_rename_to_nodejs.patch @@ -19,14 +19,3 @@ Last-Update: 2013-03-16 fs.mkdirSync(prefixLibNodePath); const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`); fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`); ---- a/lib/internal/modules/cjs/loader.js -+++ b/lib/internal/modules/cjs/loader.js -@@ -768,7 +768,7 @@ - } else { - prefixDir = path.resolve(process.execPath, '..', '..'); - } -- var paths = [path.resolve(prefixDir, 'lib', 'node')]; -+ var paths = [path.resolve(prefixDir, 'lib', 'nodejs')]; - - if (homeDir) { - paths.unshift(path.resolve(homeDir, '.node_libraries')); diff --git a/debian/patches/build-doc-using-js-yaml.patch b/debian/patches/build-doc-using-js-yaml.patch index 2095325d..9204588b 100644 --- a/debian/patches/build-doc-using-js-yaml.patch +++ b/debian/patches/build-doc-using-js-yaml.patch @@ -2,9 +2,11 @@ Description: build doc using js-yaml debian package Forwarded: not-needed Last-Update: 2018-03-15 Author: Jérémy Lal ---- a/Makefile -+++ b/Makefile -@@ -618,7 +618,10 @@ +Index: nodejs/Makefile +=================================================================== +--- nodejs.orig/Makefile ++++ nodejs/Makefile +@@ -618,7 +618,10 @@ out/doc: # Just copy everything under doc/api over. out/doc/api: doc/api mkdir -p $@ diff --git a/debian/patches/global_path.diff b/debian/patches/global_path.diff new file mode 100644 index 00000000..78ebd1e3 --- /dev/null +++ b/debian/patches/global_path.diff @@ -0,0 +1,77 @@ +Index: nodejs/configure +=================================================================== +--- nodejs.orig/configure ++++ nodejs/configure +@@ -92,6 +92,11 @@ parser.add_option('--prefix', + default='/usr/local', + help='select the install prefix [default: %default]') + ++parser.add_option('--arch-triplet', ++ action='store', ++ dest='arch_triplet', ++ help='arch tiplet used by distro') ++ + parser.add_option('--coverage', + action='store_true', + dest='coverage', +@@ -130,6 +135,12 @@ parser.add_option('--gdb', + dest='gdb', + help='add gdb support') + ++ ++parser.add_option('--global-node-path', ++ action='store', ++ dest='global_node_path', ++ help='Global node path used by require') ++ + parser.add_option('--no-ifaddrs', + action='store_true', + dest='no_ifaddrs', +@@ -1002,6 +1013,16 @@ def configure_node(o): + else: + o['variables']['node_target_type'] = 'executable' + ++ if options.arch_triplet: ++ o['variables']['arch_triplet'] = options.arch_triplet ++ else: ++ o['variables']['arch_triplet'] = 'unknown-unknown-unknown' ++ ++ if options.global_node_path: ++ o['variables']['global_node_path'] = options.global_node_path ++ else: ++ o['variables']['global_node_path']= '' ++ + def configure_library(lib, output): + shared_lib = 'shared_' + lib + output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) +Index: nodejs/lib/internal/modules/cjs/loader.js +=================================================================== +--- nodejs.orig/lib/internal/modules/cjs/loader.js ++++ nodejs/lib/internal/modules/cjs/loader.js +@@ -43,6 +43,8 @@ const preserveSymlinks = !!process.bindi + const preserveSymlinksMain = !!process.binding('config').preserveSymlinksMain; + const experimentalModules = !!process.binding('config').experimentalModules; + ++const GLOBAL_NODE_PATH = require("process").config.variables.global_node_path; ++ + const { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, +@@ -768,7 +770,16 @@ Module._initPaths = function() { + } else { + prefixDir = path.resolve(process.execPath, '..', '..'); + } +- var paths = [path.resolve(prefixDir, 'lib', 'node')]; ++ var paths = []; ++ ++ if (GLOBAL_NODE_PATH) { ++ paths = GLOBAL_NODE_PATH.split(path.delimiter).filter(function pathsFilterCB(path) { ++ return !!path; ++ }).concat(paths); ++ } ++ else { ++ paths.push(path.resolve('/usr','lib','nodejs')); ++ } + + if (homeDir) { + paths.unshift(path.resolve(homeDir, '.node_libraries')); diff --git a/debian/patches/series b/debian/patches/series index cd794b90..99948b2a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,8 +1,8 @@ +global_path.diff s_client_tls12.patch use_system_node_gyp.patch privacy_breach.patch build-doc-using-js-yaml.patch -2001_FHS_and_rename_to_nodejs.patch 1005_restore_sh_javascript_nonminified.patch 2017_mips_configure_fpu.patch test_ci_buildd.patch diff --git a/debian/rules b/debian/rules index a9014f81..1e7eaa7d 100755 --- a/debian/rules +++ b/debian/rules @@ -77,6 +77,8 @@ DEB_CONFIGURE_EXTRA_FLAGS = \ --with-intl=system-icu \ --prefix=/usr \ --openssl-use-def-ca-store \ +--arch-triplet=$(DEB_HOST_MULTIARCH) \ +--global-node-path="/usr/local/lib/$(DEB_HOST_MULTIARCH)/nodejs:/usr/local/share/nodejs:/usr/local/lib/nodejs:/usr/lib/$(DEB_HOST_MULTIARCH)/nodejs:/usr/share/nodejs:/usr/lib/nodejs" #--shared-libuv \ # map HOST ARCH AND OS, and if unknown let upstream guess