Blame SOURCES/node-gyp-system-stuff.patch

56123a
--- /opt/rh/rh-nodejs4/root/usr/lib/node_modules/node-gyp/lib/configure.js	2015-11-24 09:06:13.000000000 -0500
56123a
+++ ./lib/configure.js	2016-06-08 11:35:25.821562943 -0400
56123a
@@ -59,24 +59,26 @@
56123a
       if ('v' + release.version !== process.version) {
56123a
         // if --target was given, then determine a target version to compile for
56123a
         log.verbose('get node dir', 'compiling against --target node version: %s', release.version)
56123a
-      } else {
56123a
-        // if no --target was specified then use the current host node version
56123a
-        log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)
56123a
-      }
56123a
 
56123a
-      if (!release.semver) {
56123a
-        // could not parse the version string with semver
56123a
-        return callback(new Error('Invalid version number: ' + release.version))
56123a
-      }
56123a
+        if (!release.semver) {
56123a
+          // could not parse the version string with semver
56123a
+          return callback(new Error('Invalid version number: ' + release.version))
56123a
+        }
56123a
 
56123a
-      // ensure that the target node version's dev files are installed
56123a
-      gyp.opts.ensure = true
56123a
-      gyp.commands.install([ release.version ], function (err, version) {
56123a
-        if (err) return callback(err)
56123a
-        log.verbose('get node dir', 'target node version installed:', release.versionDir)
56123a
-        nodeDir = path.resolve(gyp.devDir, release.versionDir)
56123a
+        // ensure that the target node version's dev files are installed
56123a
+        gyp.opts.ensure = true
56123a
+        gyp.commands.install([ release.version ], function (err, version) {
56123a
+          if (err) return callback(err)
56123a
+          log.verbose('get node dir', 'target node version installed:', release.versionDir)
56123a
+          nodeDir = path.resolve(gyp.devDir, release.versionDir)
56123a
+          createBuildDir()
56123a
+        })
56123a
+      } else {
56123a
+        // if no --target was specified then use RPM installed headers
56123a
+        log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers')
56123a
+        nodeDir = '/opt/rh/rh-nodejs4/root/usr/share/node'
56123a
         createBuildDir()
56123a
-      })
56123a
+      }
56123a
     }
56123a
   }
56123a
 
56123a
@@ -247,9 +249,10 @@
56123a
     }
56123a
 
56123a
     // this logic ported from the old `gyp_addon` python file
56123a
-    var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
56123a
-    var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi')
56123a
-    var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi')
56123a
+    var gyp_script = '/opt/rh/rh-nodejs4/root/usr/bin/gyp'
56123a
+    var addon_gypi_file = gyp.opts.target || gyp.opts.nodeDir ? 'addon.gypi' : 'addon-rpm.gypi'
56123a
+    var addon_gypi = path.resolve(__dirname, '..', addon_gypi_file)
56123a
+    var common_gypi = path.resolve(nodeDir, '/opt/rh/rh-nodejs4/root/usr/include/node/common.gypi')
56123a
     fs.stat(common_gypi, function (err, stat) {
56123a
       if (err)
56123a
         common_gypi = path.resolve(nodeDir, 'common.gypi')
56123a
@@ -273,7 +276,7 @@
56123a
       argv.push('-Dnode_lib_file=' + release.name + '.lib')
56123a
       argv.push('-Dmodule_root_dir=' + process.cwd())
56123a
       argv.push('--depth=.')
56123a
-      argv.push('--no-parallel')
56123a
+      //argv.push('--no-parallel')
56123a
 
56123a
       // tell gyp to write the Makefile/Solution files into output_dir
56123a
       argv.push('--generator-output', output_dir)