nodejs21/node-gyp-addon-gypi.patch

89 lines
3.6 KiB
Diff
Raw Normal View History

Index: node-v21.2.0/addon-rpm.gypi
===================================================================
--- /dev/null
+++ node-v21.2.0/addon-rpm.gypi
@@ -0,0 +1,35 @@
+{
+ 'target_defaults': {
+ 'type': 'loadable_module',
+ 'product_prefix': '',
+ 'include_dirs': [
+ '/usr/include/node21/',
+ '/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.2.0/deps/npm/node_modules/node-gyp/lib/configure.js
===================================================================
--- node-v21.2.0.orig/deps/npm/node_modules/node-gyp/lib/configure.js
+++ node-v21.2.0/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -32,28 +32,11 @@ async function configure (gyp, argv) {
nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())
log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir)
} else {
- // if no --nodedir specified, ensure node dependencies are installed
- 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
- throw new Error('Invalid version number: ' + release.version)
- }
-
- // If the tarball option is set, always remove and reinstall the headers
- // into devdir. Otherwise only install if they're not already there.
- gyp.opts.ensure = !gyp.opts.tarball
-
- await gyp.commands.install([release.version])
-
- log.verbose('get node dir', 'target node version installed:', release.versionDir)
- nodeDir = path.resolve(gyp.devDir, release.versionDir)
+ // 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/node21'
+ createBuildDir()
+
}
return createBuildDir()
@@ -201,7 +184,8 @@ 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')
+ const 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/node/common.gypi')
try {
await fs.stat(commonGypi)