|
commit 4daac6e35e1ea8e886a823785e7b06e80c933ac2
|
|
Author: Tom Hughes <tom@compton.nu>
|
|
Date: Mon Jan 18 17:06:18 2016 +0000
|
|
|
|
Use custom addon.gypi by default instead of downloading node source
|
|
|
|
diff --git a/lib/configure.js b/lib/configure.js
|
|
index 4e06529..046c12f 100644
|
|
--- a/lib/configure.js
|
|
+++ b/lib/configure.js
|
|
@@ -59,24 +59,26 @@ function configure (gyp, argv, callback) {
|
|
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
|
|
- return callback(new Error('Invalid version number: ' + release.version))
|
|
- }
|
|
+ if (!release.semver) {
|
|
+ // could not parse the version string with semver
|
|
+ return callback(new Error('Invalid version number: ' + release.version))
|
|
+ }
|
|
|
|
- // ensure that the target node version's dev files are installed
|
|
- gyp.opts.ensure = true
|
|
- gyp.commands.install([ release.version ], function (err, version) {
|
|
- if (err) return callback(err)
|
|
- log.verbose('get node dir', 'target node version installed:', release.versionDir)
|
|
- nodeDir = path.resolve(gyp.devDir, release.versionDir)
|
|
+ // ensure that the target node version's dev files are installed
|
|
+ gyp.opts.ensure = true
|
|
+ gyp.commands.install([ release.version ], function (err, version) {
|
|
+ if (err) return callback(err)
|
|
+ log.verbose('get node dir', 'target node version installed:', release.versionDir)
|
|
+ nodeDir = path.resolve(gyp.devDir, release.versionDir)
|
|
+ createBuildDir()
|
|
+ })
|
|
+ } 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/share/node'
|
|
createBuildDir()
|
|
- })
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -248,7 +250,8 @@ function configure (gyp, argv, callback) {
|
|
|
|
// this logic ported from the old `gyp_addon` python file
|
|
var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
|
|
- var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi')
|
|
+ var addon_gypi_file = gyp.opts.target || gyp.opts.nodeDir ? 'addon.gypi' : 'addon-rpm.gypi'
|
|
+ var addon_gypi = path.resolve(__dirname, '..', addon_gypi_file)
|
|
var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi')
|
|
fs.stat(common_gypi, function (err, stat) {
|
|
if (err)
|