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

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