nodejs22/node-gyp-addon-gypi.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

113 lines
4.3 KiB
Diff

Index: node-v21.7.1/addon-rpm.gypi
===================================================================
--- /dev/null
+++ node-v21.7.1/addon-rpm.gypi
@@ -0,0 +1,35 @@
+{
+ 'target_defaults': {
+ 'type': 'loadable_module',
+ 'product_prefix': '',
+ 'include_dirs': [
+ '/usr/include/node22/',
+ '/usr/include/'
+ ],
+
+ 'target_conditions': [
+ ['_type=="loadable_module"', {
+ 'product_extension': 'node',
+ 'defines': [ 'BUILDING_NODE_EXTENSION' ],
+ }]
+ ],
+
+ 'conditions': [
+ [ 'OS=="mac"', {
+ 'libraries': [ '-undefined dynamic_lookup' ],
+ 'xcode_settings': {
+ 'DYLIB_INSTALL_NAME_BASE': '@rpath'
+ },
+ }],
+ [ 'OS=="win"', {
+ 'libraries': [ '-l<(node_root_dir)/$(Configuration)/node.lib' ],
+ # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
+ # needs to have dll-interface to be used by clients of class 'node::ObjectWrap'
+ 'msvs_disabled_warnings': [ 4251 ],
+ }],
+ [ 'OS=="freebsd" or OS=="openbsd" or OS=="solaris" or (OS=="linux" and target_arch!="ia32")', {
+ 'cflags': [ '-fPIC' ],
+ }]
+ ]
+ }
+}
Index: node-v21.7.1/deps/npm/node_modules/node-gyp/lib/configure.js
===================================================================
--- node-v21.7.1.orig/deps/npm/node_modules/node-gyp/lib/configure.js
+++ node-v21.7.1/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -36,10 +36,6 @@ async function configure (gyp, argv) {
if ('v' + release.version !== process.version) {
// if --target was given, then determine a target version to compile for
log.verbose('get node dir', 'compiling against --target node version: %s', release.version)
- } else {
- // if no --target was specified then use the current host node version
- log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)
- }
if (!release.semver) {
// could not parse the version string with semver
@@ -54,6 +50,12 @@ async function configure (gyp, argv) {
log.verbose('get node dir', 'target node version installed:', release.versionDir)
nodeDir = path.resolve(gyp.devDir, release.versionDir)
+ } else {
+ // if no --target was specified then use RPM-installed headers
+ log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers')
+ nodeDir = '/usr/include/node22'
+ createBuildDir()
+ }
}
return createBuildDir()
@@ -201,8 +203,16 @@ async function configure (gyp, argv) {
// this logic ported from the old `gyp_addon` python file
const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
- const addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
- let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+ let addon_gypi_file = gyp.opts.target || gyp.opts.nodedir ? 'addon.gypi' : 'addon-rpm.gypi'
+ let addonGypi = path.resolve(__dirname, '..', addon_gypi_file)
+ let commonGypi = path.resolve(nodeDir, 'include/node22/common.gypi')
+
+ try {
+ await fs.stat(commonGypi)
+ } catch (err) {
+ commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+ }
+
try {
await fs.stat(commonGypi)
} catch (err) {
Index: node-v21.7.1/deps/npm/node_modules/node-gyp/addon.gypi
===================================================================
--- node-v21.7.1.orig/deps/npm/node_modules/node-gyp/addon.gypi
+++ node-v21.7.1/deps/npm/node_modules/node-gyp/addon.gypi
@@ -18,6 +18,7 @@
],
'include_dirs': [
+ '<(node_root_dir)/include/node22',
'<(node_root_dir)/include/node',
'<(node_root_dir)/src',
'<(node_root_dir)/deps/openssl/config',
Index: node-v21.7.1/tools/build_addons.py
===================================================================
--- node-v21.7.1.orig/tools/build_addons.py
+++ node-v21.7.1/tools/build_addons.py
@@ -27,7 +27,7 @@ def generate_headers(headers_dir, instal
def rebuild_addons(args):
headers_dir = os.path.abspath(args.headers_dir)
out_dir = os.path.abspath(args.out_dir)
- node_bin = os.path.join(out_dir, 'node')
+ node_bin = os.path.join(out_dir, 'node22')
if args.is_win:
node_bin += '.exe'