diff options
author | isaacs <i@izs.me> | 2012-05-20 23:41:26 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-05-20 23:41:26 +0400 |
commit | e0eeb13a85d075738797640059aca81af220c24b (patch) | |
tree | d407744b552ba00afe290f7ccdc97841b4635ac7 | |
parent | 2fa94efc1d0ed8a086f77f28f6b8d37c2f323635 (diff) |
Upgrade node-gyp
-rw-r--r-- | node_modules/node-gyp/README.md | 4 | ||||
-rw-r--r-- | node_modules/node-gyp/lib/build.js | 21 | ||||
-rw-r--r-- | node_modules/node-gyp/lib/configure.js | 87 | ||||
-rw-r--r-- | node_modules/node-gyp/lib/node-gyp.js | 4 | ||||
-rw-r--r-- | node_modules/node-gyp/node_modules/ansi/package.json | 7 | ||||
-rw-r--r-- | node_modules/node-gyp/node_modules/glob/package.json | 7 | ||||
-rw-r--r-- | node_modules/node-gyp/package.json | 12 |
7 files changed, 92 insertions, 50 deletions
diff --git a/node_modules/node-gyp/README.md b/node_modules/node-gyp/README.md index e796e6982..5f27088bd 100644 --- a/node_modules/node-gyp/README.md +++ b/node_modules/node-gyp/README.md @@ -38,6 +38,7 @@ You will also need to install: * On Windows: * [Python][windows-python] ([`v2.7.2`][windows-python-v2.7.2] recommended, `v3.x.x` not yet supported) * Microsoft Visual C++ ([Express][msvc] version works well) + * For 64-bit builds of node and native modules you will _also_ need the [Windows 7 64-bit SDK][win7sdk] How to Use ---------- @@ -66,7 +67,7 @@ $ node-gyp build ``` Now you have your compiled `.node` bindings file! The compiled bindings end up -in `build/Debug/` or `buld/Release/`, depending on the build mode. At this point +in `build/Debug/` or `build/Release/`, depending on the build mode. At this point you can require the `.node` file with Node and run your tests! __Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or @@ -143,3 +144,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [windows-python]: http://www.python.org/getit/windows [windows-python-v2.7.2]: http://www.python.org/download/releases/2.7.2#download [msvc]: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express +[win7sdk]: http://www.microsoft.com/download/en/details.aspx?displayLang=en&id=8279 diff --git a/node_modules/node-gyp/lib/build.js b/node_modules/node-gyp/lib/build.js index 92f21336c..eb5e73049 100644 --- a/node_modules/node-gyp/lib/build.js +++ b/node_modules/node-gyp/lib/build.js @@ -11,19 +11,22 @@ var fs = require('graceful-fs') , which = require('which') , mkdirp = require('./util/mkdirp') , win = process.platform == 'win32' + , openbsd = process.platform == 'openbsd' exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module' function build (gyp, argv, callback) { gyp.verbose('build args', argv) - var command = win ? 'msbuild' : 'make' + var makeCommand = openbsd ? 'gmake' : 'make' + var command = win ? 'msbuild' : makeCommand , buildDir = path.resolve('build') , configPath = path.resolve(buildDir, 'config.gypi') , buildType , config , arch - , version + , nodeDir + , copyDevLib loadConfigGypi() @@ -43,10 +46,11 @@ function build (gyp, argv, callback) { } config = JSON.parse(data.replace(/\#.+\n/, '')) - // get the 'arch', 'buildType', and 'version' vars from the config + // get the 'arch', 'buildType', and 'nodeDir' vars from the config buildType = config.target_defaults.default_configuration arch = config.variables.target_arch - version = config.variables.target_version + nodeDir = config.variables.nodedir + copyDevLib = config.variables.copy_dev_lib == 'true' if ('debug' in gyp.opts) { buildType = gyp.opts.debug ? 'Debug' : 'Release' @@ -57,7 +61,7 @@ function build (gyp, argv, callback) { gyp.verbose('build type:', buildType) gyp.verbose('architecture:', arch) - gyp.verbose('node version:', version) + gyp.verbose('node dev dir:', nodeDir) if (win) { findSolutionFile() @@ -137,11 +141,10 @@ function build (gyp, argv, callback) { */ function copyNodeLib () { - if (!win) return doBuild() + if (!win || !copyDevLib) return doBuild() - var devDir = path.resolve(gyp.devDir, version) - , buildDir = path.resolve(devDir, buildType) - , archNodeLibPath = path.resolve(devDir, arch, 'node.lib') + var buildDir = path.resolve(nodeDir, buildType) + , archNodeLibPath = path.resolve(nodeDir, arch, 'node.lib') , buildNodeLibPath = path.resolve(buildDir, 'node.lib') mkdirp(buildDir, function (err, isNew) { diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js index c25ad8ff3..ca0da39e9 100644 --- a/node_modules/node-gyp/lib/configure.js +++ b/node_modules/node-gyp/lib/configure.js @@ -20,13 +20,13 @@ function configure (gyp, argv, callback) { var python = process.env.PYTHON || gyp.opts.python || 'python' , buildDir = path.resolve('build') , configPath - , versionStr - , version + , nodeDir checkPython() // Make sure that Python is in the $PATH function checkPython () { + gyp.verbose('checking for Python executable "' + python + '" in the PATH') which(python, function (err, execPath) { if (err) { if (win) { @@ -37,7 +37,8 @@ function configure (gyp, argv, callback) { return } gyp.verbose('`which` succeeded for `' + python + '`', execPath) - getTargetVersion() + // TODO: ensure compatible Python version + getNodeDir() }) } @@ -61,39 +62,64 @@ function configure (gyp, argv, callback) { return } python = pythonPath - getTargetVersion() + getNodeDir() }) } function failNoPython () { - callback(new Error('Can\'t find Python, you can set the PYTHON env variable.')) + callback(new Error('Can\'t find Python executable "' + python + + '", you can set the PYTHON env variable.')) } - function getTargetVersion () { + function getNodeDir () { // 'python' should be set by now process.env.PYTHON = python - if (gyp.opts.target) { - // if --target was given, then ensure that version is installed - versionStr = gyp.opts.target - gyp.verbose('compiling against --target node version', versionStr) + if (gyp.opts.nodedir) { + // --nodedir was specified. use that for the dev files + nodeDir = gyp.opts.nodedir + + // simple ~ homedir expansion based on https://github.com/joyent/node/issues/2857 + if (win) { + nodeDir = nodeDir.replace(/^~/, process.env.USERPROFILE) + } else { + nodeDir = nodeDir.replace(/^~/, process.env.HOME) + } + + gyp.verbose('compiling against specified --nodedir dev files', nodeDir) + createBuildDir() + } else { - // if no --target was specified then use the current host node version - versionStr = process.version - gyp.verbose('no --target version specified, falling back to host node version', versionStr) - } - version = semver.parse(versionStr) - if (!version) { - return callback(new Error('Invalid version number: ' + versionStr)) + // if no --nodedir specified, ensure node dependencies are installed + var version + var versionStr + + if (gyp.opts.target) { + // if --target was given, then determine a target version to compile for + versionStr = gyp.opts.target + gyp.verbose('compiling against --target node version', versionStr) + } else { + // if no --target was specified then use the current host node version + versionStr = process.version + gyp.verbose('no --target version specified, falling back to host node version', versionStr) + } + + // make sure we have a valid version + version = semver.parse(versionStr) + if (!version) { + return callback(new Error('Invalid version number: ' + versionStr)) + } + + // ensure that the target node version's dev files are installed + gyp.opts.ensure = true + gyp.commands.install([ versionStr ], function (err, version) { + if (err) return callback(err) + gyp.verbose('target node version installed:', version) + nodeDir = path.resolve(gyp.devDir, version) + createBuildDir() + }) } - gyp.opts.ensure = true - gyp.commands.install([ versionStr ], function (err, _version) { - if (err) return callback(err) - version = _version - gyp.verbose('setting target version to:', version) - createBuildDir() - }) } function createBuildDir () { @@ -145,8 +171,11 @@ function configure (gyp, argv, callback) { // set the target_arch variable variables.target_arch = gyp.opts.arch || process.arch || 'ia32' - // also set the target_version variable - variables.target_version = version + // set the node development directory + variables.nodedir = nodeDir + + // don't copy dev libraries with nodedir option + variables.copy_dev_lib = !gyp.opts.nodedir // loop through the rest of the opts and add the unknown ones as variables. // this allows for module-specific configure flags like: @@ -175,8 +204,8 @@ function configure (gyp, argv, callback) { function runGypAddon (err) { if (err) return callback(err) - // location of the `gyp_addon` python script for the target node version - var gyp_addon = path.resolve(gyp.devDir, version, 'tools', 'gyp_addon') + // location of the `gyp_addon` python script for the target nodedir + var gyp_addon = path.resolve(nodeDir, 'tools', 'gyp_addon') if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) { if (win) { @@ -210,7 +239,7 @@ function configure (gyp, argv, callback) { // enforce use of the "binding.gyp" file argv.unshift('binding.gyp') - // execute `gyp_addon` from the current target node version + // execute `gyp_addon` from the current target nodedir argv.unshift(gyp_addon) var cp = gyp.spawn(python, argv) diff --git a/node_modules/node-gyp/lib/node-gyp.js b/node_modules/node-gyp/lib/node-gyp.js index 1b014e6cd..33c5445a6 100644 --- a/node_modules/node-gyp/lib/node-gyp.js +++ b/node_modules/node-gyp/lib/node-gyp.js @@ -74,13 +74,14 @@ proto.package = require('../package') proto.configDefs = { help: Boolean // everywhere , arch: String // 'configure' + , debug: Boolean // 'build' , directory: String // bin , msvs_version: String // 'configure' - , debug: Boolean // 'build' , ensure: Boolean // 'install' , verbose: Boolean // everywhere , solution: String // 'build' (windows only) , proxy: String // 'install' + , nodedir: String // 'configure' } /** @@ -90,6 +91,7 @@ proto.configDefs = { proto.shorthands = { release: '--no-debug' , C: '--directory' + , d: '--debug' } /** diff --git a/node_modules/node-gyp/node_modules/ansi/package.json b/node_modules/node-gyp/node_modules/ansi/package.json index 9352a0ba2..afefb7545 100644 --- a/node_modules/node-gyp/node_modules/ansi/package.json +++ b/node_modules/node-gyp/node_modules/ansi/package.json @@ -41,8 +41,11 @@ "dependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.16", - "_nodeVersion": "v0.7.8-pre", + "_npmVersion": "1.1.21", + "_nodeVersion": "v0.7.9-pre", "_defaultsLoaded": true, + "dist": { + "shasum": "1bbdab47714665c8484fb62da53f4553c6baec73" + }, "_from": "ansi@0.0.x" } diff --git a/node_modules/node-gyp/node_modules/glob/package.json b/node_modules/node-gyp/node_modules/glob/package.json index 83e88f623..eb89f6c3e 100644 --- a/node_modules/node-gyp/node_modules/glob/package.json +++ b/node_modules/node-gyp/node_modules/glob/package.json @@ -36,8 +36,11 @@ "_id": "glob@3.1.9", "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.16", - "_nodeVersion": "v0.7.8-pre", + "_npmVersion": "1.1.21", + "_nodeVersion": "v0.7.9-pre", "_defaultsLoaded": true, + "dist": { + "shasum": "a81b5dd6244b74b277cc1e825f25ebc511854525" + }, "_from": "glob@3" } diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json index 19628593a..6319fafe7 100644 --- a/node_modules/node-gyp/package.json +++ b/node_modules/node-gyp/package.json @@ -10,7 +10,7 @@ "bindings", "gyp" ], - "version": "0.4.1", + "version": "0.4.3", "installVersion": 7, "author": { "name": "Nathan Rajlich", @@ -47,15 +47,15 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "node-gyp@0.4.1", + "_id": "node-gyp@0.4.3", "devDependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.16", - "_nodeVersion": "v0.7.8-pre", + "_npmVersion": "1.1.21", + "_nodeVersion": "v0.7.9-pre", "_defaultsLoaded": true, "dist": { - "shasum": "05a017b115527b63fdec1321d0b5888bc5d7b04f" + "shasum": "8d45b9b77800f40f27a6445d01d99161942d9b36" }, - "_from": "node-gyp@latest" + "_from": "node-gyp@~0.4.1" } |