nodejs22/nodejs-libpath.patch
Adam Majer f60c62a795 - New nodejs major version 22.1.0
For overview of changes and details since 21.x and earlier see
  https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V22.md#22.1.0
- Imported patches from 21.x:
  * cares_public_headers.patch
  * fix_ci_tests.patch
  * flaky_test_rerun.patch
  * gcc13.patch
  * legacy_python.patch
  * linker_lto_jobs.patch
  * manual_configure.patch
  * node-gyp-addon-gypi.patch
  * node-gyp-config.patch
  * nodejs-libpath.patch
  * npm_search_paths.patch
  * openssl_binary_detection.patch
  * qemu_timeouts_arches.patch
  * skip_no_console.patch
  * sle12_python3_compat.patch
  * test-skip-y2038-on-32bit-time_t.patch
  * versioned.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs22?expand=0&rev=1
2024-05-15 15:22:04 +00:00

55 lines
2.1 KiB
Diff

Index: node-v20.12.0/tools/install.py
===================================================================
--- node-v20.12.0.orig/tools/install.py
+++ node-v20.12.0/tools/install.py
@@ -6,6 +6,7 @@ import errno
import os
import shutil
import sys
+from distutils import sysconfig
import re
def abspath(*args):
@@ -66,6 +67,10 @@ def try_copy(options, path, dest):
try_unlink(target_path) # prevent ETXTBSY errors
return shutil.copy2(source_path, target_path)
+def libdir(options):
+ libdir_fq = sysconfig.get_config_var("LIBDIR")
+ return re.sub("^" + re.escape(options.prefix + "/"), "", libdir_fq)
+
def try_remove(options, path, dest):
source_path, target_path = mkpaths(options, path, dest)
if not options.silent:
@@ -82,7 +87,7 @@ def uninstall(options, paths, dest):
try_remove(options, path, dest)
def package_files(options, action, name, bins):
- target_path = os.path.join('lib/node_modules', name)
+ target_path = os.path.join(libdir(options), 'node_modules', name)
# don't install npm if the target path is a symlink, it probably means
# that a dev version of npm is installed there
@@ -103,7 +108,7 @@ def package_files(options, action, name,
if action == uninstall:
action(options, [link_path], os.path.join('bin', bin_name))
elif action == install:
- try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
+ try_symlink(options, os.path.join('..', libdir(options), 'node_modules', name, bin_target), link_path)
else:
assert 0 # unhandled action type
Index: node-v20.12.0/lib/internal/modules/cjs/loader.js
===================================================================
--- node-v20.12.0.orig/lib/internal/modules/cjs/loader.js
+++ node-v20.12.0/lib/internal/modules/cjs/loader.js
@@ -1529,7 +1529,7 @@ Module._initPaths = function() {
path.resolve(process.execPath, '..') :
path.resolve(process.execPath, '..', '..');
- const paths = [path.resolve(prefixDir, 'lib', 'node')];
+ const paths = ['/usr/lib/node'];
if (homeDir) {
ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));