Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-04-12 02:08:11 +0400
committerisaacs <i@izs.me>2012-04-12 02:08:11 +0400
commit4bea5b0feb77730e5668c82d8041e26c9efcb0a3 (patch)
tree30ff9d83beee79d4a1680636f5c2c322cb1e5f60
parentb3867e8a3ac53fcff2486155664ce30b3e99c8f9 (diff)
Upgrade node-gyp
-rw-r--r--node_modules/node-gyp/LICENSE24
-rwxr-xr-xnode_modules/node-gyp/bin/node-gyp.js102
-rw-r--r--node_modules/node-gyp/legacy/common.gypi1
-rw-r--r--node_modules/node-gyp/lib/build.js102
-rw-r--r--node_modules/node-gyp/lib/clean.js27
-rw-r--r--node_modules/node-gyp/lib/configure.js119
-rw-r--r--node_modules/node-gyp/lib/install.js104
-rw-r--r--node_modules/node-gyp/lib/list.js9
-rw-r--r--node_modules/node-gyp/lib/node-gyp.js48
-rw-r--r--node_modules/node-gyp/lib/remove.js7
-rw-r--r--node_modules/node-gyp/lib/util/asyncEmit.js61
-rw-r--r--node_modules/node-gyp/lib/util/hook.js48
-rw-r--r--node_modules/node-gyp/node_modules/ansi/package.json4
-rw-r--r--node_modules/node-gyp/node_modules/glob/package.json4
-rw-r--r--node_modules/node-gyp/package.json14
-rw-r--r--package.json3
16 files changed, 358 insertions, 319 deletions
diff --git a/node_modules/node-gyp/LICENSE b/node_modules/node-gyp/LICENSE
new file mode 100644
index 000000000..2ea4dc5ef
--- /dev/null
+++ b/node_modules/node-gyp/LICENSE
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/node-gyp/bin/node-gyp.js b/node_modules/node-gyp/bin/node-gyp.js
index 328e1a94e..a7347cca5 100755
--- a/node_modules/node-gyp/bin/node-gyp.js
+++ b/node_modules/node-gyp/bin/node-gyp.js
@@ -16,12 +16,17 @@ var gyp = require('../')
, cursor = ansi(process.stderr)
/**
- * Process and execute the selected command.
+ * Process and execute the selected commands.
*/
var prog = gyp()
prog.parseArgv(process.argv)
+if (prog.todo.length === 0) {
+ return prog.usageAndExit()
+}
+
+
/**
* Set up logging handlers.
*/
@@ -36,6 +41,18 @@ prog.on('info', function () {
cursor.write('\n')
})
+prog.on('warn', function () {
+ cursor.fg.yellow().bg.red().write('warn')
+ .fg.reset().bg.reset().write(' ')
+ .fg.grey().write(arguments[0])
+ .write(' ')
+ .reset()
+ for (var i=1, l=arguments.length; i<l; i++) {
+ cursor.write(arguments[i] + ' ')
+ }
+ cursor.write('\n')
+})
+
if (prog.opts.verbose) {
prog.on('verbose', function () {
cursor.fg.cyan().write('verb ')
@@ -54,48 +71,63 @@ prog.on('spawn', function (command, args, proc) {
.reset().write(inspect(args) + '\n')
})
+prog.info('it worked if it ends with', 'ok')
+
/**
- * Process and execute the selected command.
+ * Change dir if -C/--directory was passed.
*/
-if (!prog.command) {
- return prog.usageAndExit()
-}
-
-prog.info('it worked if it ends with', 'ok')
-
-if (typeof prog.commands[prog.command] != 'function') {
- cursor.fg.red().write('ERR! ')
- .fg.reset().write('Unknown command "' + prog.command + '"\n')
- cursor.fg.red().write('ERR! ')
- .fg.reset().write('not ok\n')
- process.exit(1)
+var dir = prog.opts.directory
+if (dir) {
+ var fs = require('fs')
+ try {
+ var stat = fs.statSync(dir)
+ if (stat.isDirectory()) {
+ prog.info('chdir:', dir)
+ process.chdir(dir)
+ } else {
+ prog.warn(dir + ' is not a directory')
+ }
+ } catch (e) {
+ prog.warn('directory:', e.message)
+ }
}
+// start running the given commands!
var completed = false
-prog.commands[prog.command](prog.argv, function (err) {
- completed = true
- if (err) {
- cursor.fg.red().write('ERR! ')
- .fg.reset().write(err.stack + '\n')
- cursor.fg.red().write('ERR! ')
- .fg.reset().write('not ok\n')
- return process.exit(1)
+run()
+
+function run () {
+ if (prog.todo.length === 0) {
+ // done!
+ completed = true
+ prog.info('done', 'ok')
+ return
}
- if (prog.command == 'list') {
- var versions = arguments[1]
- if (versions.length > 0) {
- versions.forEach(function (version) {
- console.log(version)
- })
- } else {
- prog.info('No node development files installed. Use `node-gyp install` to install a version.')
+ var command = prog.todo.shift()
+ prog.commands[command](prog.argv.slice(), function (err) {
+ if (err) {
+ cursor.fg.red().write('ERR! ')
+ .fg.reset().write(err.stack + '\n')
+ cursor.fg.red().write('ERR! ')
+ .fg.reset().write('not ok\n')
+ return process.exit(1)
}
- } else if (arguments.length >= 2) {
- console.log.apply(console, [].slice.call(arguments, 1))
- }
- prog.info('done', 'ok')
-})
+ if (command == 'list') {
+ var versions = arguments[1]
+ if (versions.length > 0) {
+ versions.forEach(function (version) {
+ console.log(version)
+ })
+ } else {
+ prog.info('No node development files installed. Use `node-gyp install` to install a version.')
+ }
+ } else if (arguments.length >= 2) {
+ console.log.apply(console, [].slice.call(arguments, 1))
+ }
+ process.nextTick(run)
+ })
+}
process.on('exit', function (code) {
if (!completed && !code) {
diff --git a/node_modules/node-gyp/legacy/common.gypi b/node_modules/node-gyp/legacy/common.gypi
index 6e13b6091..f67e6da3e 100644
--- a/node_modules/node-gyp/legacy/common.gypi
+++ b/node_modules/node-gyp/legacy/common.gypi
@@ -161,6 +161,7 @@
'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'PREBINDING': 'NO', # No -Wl,-prebind
+ 'MACOSX_DEPLOYMENT_TARGET': '10.5',
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
diff --git a/node_modules/node-gyp/lib/build.js b/node_modules/node-gyp/lib/build.js
index 3ffc4c791..92f21336c 100644
--- a/node_modules/node-gyp/lib/build.js
+++ b/node_modules/node-gyp/lib/build.js
@@ -5,12 +5,11 @@ module.exports = exports = build
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, path = require('path')
, glob = require('glob')
, which = require('which')
- , asyncEmit = require('./util/asyncEmit')
- , createHook = require('./util/hook')
+ , mkdirp = require('./util/mkdirp')
, win = process.platform == 'win32'
exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module'
@@ -21,14 +20,12 @@ function build (gyp, argv, callback) {
var command = win ? 'msbuild' : 'make'
, buildDir = path.resolve('build')
, configPath = path.resolve(buildDir, 'config.gypi')
+ , buildType
, config
- , emitter
+ , arch
+ , version
- createHook('gyp-build.js', function (err, _e) {
- if (err) return callback(err)
- emitter = _e
- loadConfigGypi()
- })
+ loadConfigGypi()
/**
* Load the "config.gypi" file that was generated during "configure".
@@ -45,6 +42,23 @@ function build (gyp, argv, callback) {
return
}
config = JSON.parse(data.replace(/\#.+\n/, ''))
+
+ // get the 'arch', 'buildType', and 'version' vars from the config
+ buildType = config.target_defaults.default_configuration
+ arch = config.variables.target_arch
+ version = config.variables.target_version
+
+ if ('debug' in gyp.opts) {
+ buildType = gyp.opts.debug ? 'Debug' : 'Release'
+ }
+ if (!buildType) {
+ buildType = 'Release'
+ }
+
+ gyp.verbose('build type:', buildType)
+ gyp.verbose('architecture:', arch)
+ gyp.verbose('node version:', version)
+
if (win) {
findSolutionFile()
} else {
@@ -54,7 +68,7 @@ function build (gyp, argv, callback) {
}
/**
- * On Windows, find first build/*.sln file.
+ * On Windows, find the first build/*.sln file.
*/
function findSolutionFile () {
@@ -69,6 +83,10 @@ function build (gyp, argv, callback) {
})
}
+ /**
+ * Uses node-which to locate the msbuild / make executable.
+ */
+
function doWhich () {
// First make sure we have the build command in the PATH
which(command, function (err, execPath) {
@@ -83,7 +101,7 @@ function build (gyp, argv, callback) {
return
}
gyp.verbose('`which` succeeded for `' + command + '`', execPath)
- build()
+ copyNodeLib()
})
}
@@ -109,21 +127,40 @@ function build (gyp, argv, callback) {
return
}
command = msbuild
- build()
+ copyNodeLib()
})
}
/**
- * Actually spawn the process and compile the module.
+ * Copies the node.lib file for the current target architecture into the
+ * current proper dev dir location.
*/
- function build () {
- var buildType = config.target_defaults.default_configuration
- , platform = config.variables.target_arch == 'x64' ? '64' : '32'
+ function copyNodeLib () {
+ if (!win) return doBuild()
- if (gyp.opts.debug) {
- buildType = 'Debug'
- }
+ var devDir = path.resolve(gyp.devDir, version)
+ , buildDir = path.resolve(devDir, buildType)
+ , archNodeLibPath = path.resolve(devDir, arch, 'node.lib')
+ , buildNodeLibPath = path.resolve(buildDir, 'node.lib')
+
+ mkdirp(buildDir, function (err, isNew) {
+ if (err) return callback(err)
+ gyp.verbose('"' + buildType + '" dir needed to be created?', isNew)
+ var rs = fs.createReadStream(archNodeLibPath)
+ , ws = fs.createWriteStream(buildNodeLibPath)
+ rs.pipe(ws)
+ rs.on('error', callback)
+ ws.on('error', callback)
+ rs.on('end', doBuild)
+ })
+ }
+
+ /**
+ * Actually spawn the process and compile the module.
+ */
+
+ function doBuild () {
// Enable Verbose build
if (!win && gyp.opts.verbose) {
@@ -140,7 +177,8 @@ function build (gyp, argv, callback) {
// Specify the build type, Release by default
if (win) {
- argv.push('/p:Configuration=' + buildType + ';Platform=Win' + platform)
+ var p = arch === 'x64' ? 'x64' : 'Win32'
+ argv.push('/p:Configuration=' + buildType + ';Platform=' + p)
} else {
argv.push('BUILDTYPE=' + buildType)
// Invoke the Makefile in the 'build' dir.
@@ -158,11 +196,8 @@ function build (gyp, argv, callback) {
}
}
- asyncEmit(emitter, 'before', function (err) {
- if (err) return callback(err)
- var proc = gyp.spawn(command, argv)
- proc.on('exit', onExit)
- })
+ var proc = gyp.spawn(command, argv)
+ proc.on('exit', onExit)
}
/**
@@ -170,16 +205,13 @@ function build (gyp, argv, callback) {
*/
function onExit (code, signal) {
- asyncEmit(emitter, 'after', function (err) {
- if (err) return callback(err)
- if (code !== 0) {
- return callback(new Error('`' + command + '` failed with exit code: ' + code))
- }
- if (signal) {
- return callback(new Error('`' + command + '` got signal: ' + signal))
- }
- callback()
- })
+ if (code !== 0) {
+ return callback(new Error('`' + command + '` failed with exit code: ' + code))
+ }
+ if (signal) {
+ return callback(new Error('`' + command + '` got signal: ' + signal))
+ }
+ callback()
}
}
diff --git a/node_modules/node-gyp/lib/clean.js b/node_modules/node-gyp/lib/clean.js
index a8efc1bd7..1e5611451 100644
--- a/node_modules/node-gyp/lib/clean.js
+++ b/node_modules/node-gyp/lib/clean.js
@@ -8,35 +8,14 @@ exports.usage = 'Removes any generated build files and the "out" dir'
*/
var rm = require('rimraf')
- , asyncEmit = require('./util/asyncEmit')
- , createHook = require('./util/hook')
function clean (gyp, argv, callback) {
// Remove the 'build' dir
var buildDir = 'build'
- , emitter
-
- createHook('gyp-clean.js', function (err, _e) {
- if (err) return callback(err)
- emitter = _e
- asyncEmit(emitter, 'before', function (err) {
- if (err) return callback(err)
- doClean()
- })
- })
-
- function doClean () {
- gyp.verbose('removing "build" directory')
- rm(buildDir, after)
- }
-
- function after () {
- asyncEmit(emitter, 'after', function (err) {
- if (err) return callback(err)
- callback()
- })
- }
+
+ gyp.verbose('removing "build" directory')
+ rm(buildDir, callback)
}
diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js
index c1c99e7d9..c25ad8ff3 100644
--- a/node_modules/node-gyp/lib/configure.js
+++ b/node_modules/node-gyp/lib/configure.js
@@ -5,34 +5,25 @@ module.exports = exports = configure
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, path = require('path')
, glob = require('glob')
, which = require('which')
, semver = require('semver')
, mkdirp = require('./util/mkdirp')
- , createHook = require('./util/hook')
- , asyncEmit = require('./util/asyncEmit')
, win = process.platform == 'win32'
exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'
function configure (gyp, argv, callback) {
- var python = gyp.opts.python || 'python'
+ var python = process.env.PYTHON || gyp.opts.python || 'python'
, buildDir = path.resolve('build')
, configPath
- , emitter
, versionStr
, version
- // Very first step is to load up the user-defined 'gyp-configure.js' file if it
- // exists. We relay filecycle events using the eventemitter returned from this
- createHook('gyp-configure.js', function (err, _e) {
- if (err) return callback(err)
- emitter = _e
- checkPython()
- })
+ checkPython()
// Make sure that Python is in the $PATH
function checkPython () {
@@ -46,7 +37,7 @@ function configure (gyp, argv, callback) {
return
}
gyp.verbose('`which` succeeded for `' + python + '`', execPath)
- getVersion()
+ getTargetVersion()
})
}
@@ -54,7 +45,7 @@ function configure (gyp, argv, callback) {
// We're gonna glob C:\python2*
function guessPython () {
gyp.verbose('could not find "' + python + '". guessing location')
- var rootDir = process.env.HOMEDIR || process.env.SystemDrive || 'C:\\'
+ var rootDir = process.env.HOMEDRIVE || process.env.SystemDrive || 'C:\\'
if (rootDir[rootDir.length - 1] !== '\\') {
rootDir += '\\'
}
@@ -70,15 +61,19 @@ function configure (gyp, argv, callback) {
return
}
python = pythonPath
- getVersion()
+ getTargetVersion()
})
}
function failNoPython () {
- callback(new Error('Python does not seem to be installed'))
+ callback(new Error('Can\'t find Python, you can set the PYTHON env variable.'))
}
- function getVersion () {
+ function getTargetVersion () {
+
+ // '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
@@ -114,23 +109,65 @@ function configure (gyp, argv, callback) {
if (err) return callback(err)
gyp.verbose('creating build/config.gypi file')
- var config = {}
configPath = path.resolve(buildDir, 'config.gypi')
- config.target_defaults = {
- cflags: []
- , default_configuration: gyp.opts.debug ? 'Debug' : 'Release'
- , defines: []
- , include_dirs: []
- , libraries: []
+ var config = process.config || {}
+ , defaults = config.target_defaults
+ , variables = config.variables
+
+ if (!defaults) {
+ defaults = config.target_defaults = {}
+ }
+ if (!variables) {
+ variables = config.variables = {}
+ }
+ if (!defaults.cflags) {
+ defaults.cflags = []
+ }
+ if (!defaults.defines) {
+ defaults.defines = []
+ }
+ if (!defaults.include_dirs) {
+ defaults.include_dirs = []
+ }
+ if (!defaults.libraries) {
+ defaults.libraries = []
}
- config.variables = {
- target_arch: gyp.opts.arch || process.arch || 'ia32'
+ // set the default_configuration prop
+ if ('debug' in gyp.opts) {
+ defaults.default_configuration = gyp.opts.debug ? 'Debug' : 'Release'
+ }
+ if (!defaults.default_configuration) {
+ defaults.default_configuration = 'Release'
}
+ // set the target_arch variable
+ variables.target_arch = gyp.opts.arch || process.arch || 'ia32'
+
+ // also set the target_version variable
+ variables.target_version = version
+
+ // loop through the rest of the opts and add the unknown ones as variables.
+ // this allows for module-specific configure flags like:
+ //
+ // $ node-gyp configure --shared-libxml2
+ Object.keys(gyp.opts).forEach(function (opt) {
+ if (opt === 'argv') return
+ if (opt in gyp.configDefs) return
+ variables[opt.replace(/-/g, '_')] = gyp.opts[opt]
+ })
+
+ // ensures that any boolean values from `process.config` get stringified
+ function boolsToString (k, v) {
+ if (typeof v === 'boolean')
+ return String(v)
+ return v
+ }
+
+ // now write out the config.gypi file to the build/ dir
var prefix = '# Do not edit. File was generated by node-gyp\'s "configure" step'
- , json = JSON.stringify(config, null, 2)
+ , json = JSON.stringify(config, boolsToString, 2)
gyp.verbose('writing out config file', configPath)
fs.writeFile(configPath, [prefix, json, ''].join('\n'), runGypAddon)
}
@@ -138,8 +175,8 @@ function configure (gyp, argv, callback) {
function runGypAddon (err) {
if (err) return callback(err)
- var devDir = path.resolve(process.env.HOME, '.node-gyp', version)
- , gyp_addon = path.resolve(devDir, 'tools', 'gyp_addon')
+ // location of the `gyp_addon` python script for the target node version
+ var gyp_addon = path.resolve(gyp.devDir, version, 'tools', 'gyp_addon')
if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) {
if (win) {
@@ -176,12 +213,8 @@ function configure (gyp, argv, callback) {
// execute `gyp_addon` from the current target node version
argv.unshift(gyp_addon)
- asyncEmit(emitter, 'before', function (err) {
- if (err) return callback(err)
-
- var cp = gyp.spawn(python, argv)
- cp.on('exit', onCpExit)
- })
+ var cp = gyp.spawn(python, argv)
+ cp.on('exit', onCpExit)
}
/**
@@ -189,16 +222,12 @@ function configure (gyp, argv, callback) {
*/
function onCpExit (code, signal) {
- asyncEmit(emitter, 'after', function (err) {
- if (err) {
- callback(err)
- } else if (code !== 0) {
- callback(new Error('`gyp_addon` failed with exit code: ' + code))
- } else {
- // we're done
- callback()
- }
- })
+ if (code !== 0) {
+ callback(new Error('`gyp_addon` failed with exit code: ' + code))
+ } else {
+ // we're done
+ callback()
+ }
}
}
diff --git a/node_modules/node-gyp/lib/install.js b/node_modules/node-gyp/lib/install.js
index 8ad484d4e..2cf399364 100644
--- a/node_modules/node-gyp/lib/install.js
+++ b/node_modules/node-gyp/lib/install.js
@@ -7,16 +7,16 @@ exports.usage = 'Install node development files for the specified node version.'
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, tar = require('tar')
, rm = require('rimraf')
, path = require('path')
, zlib = require('zlib')
- , mkdir = require('mkdirp')
, semver = require('semver')
, fstream = require('fstream')
, request = require('request')
, minimatch = require('minimatch')
+ , mkdir = require('./util/mkdirp')
, distUrl = 'http://nodejs.org/dist'
, win = process.platform == 'win32'
@@ -53,7 +53,7 @@ function install (gyp, argv, callback) {
gyp.verbose('installing legacy version?', isLegacy)
if (semver.lt(versionStr, '0.6.0')) {
- return callback(new Error('Minimum target version is `0.6` or greater. Got: ' + versionStr))
+ return callback(new Error('Minimum target version is `0.6.0` or greater. Got: ' + versionStr))
}
// 0.x.y-pre versions are not published yet. Use previous release.
@@ -67,11 +67,10 @@ function install (gyp, argv, callback) {
version = version.slice(1, 4).join('.')
gyp.verbose('installing version', version)
+ // the directory where the dev files will be installed
+ var devDir = path.resolve(gyp.devDir, version)
- // TODO: Make ~/.node-gyp configurable
- var devDir = path.resolve(process.env.HOME, '.node-gyp', version)
-
- // If '--ensure' was passed, then don't *always* install the version,
+ // If '--ensure' was passed, then don't *always* install the version;
// check if it is already installed, and only install when needed
if (gyp.opts.ensure) {
gyp.verbose('--ensure was passed, so won\'t reinstall if already installed')
@@ -107,7 +106,7 @@ function install (gyp, argv, callback) {
go()
}
- function download(url,onError) {
+ function download (url, onError) {
gyp.info('downloading:', url)
var requestOpts = {
uri: url
@@ -129,11 +128,14 @@ function install (gyp, argv, callback) {
function go () {
// first create the dir for the node dev files
- mkdir(devDir, function (err) {
+ mkdir(devDir, function (err, created) {
if (err) return cb(err)
- // TODO: Detect if it was actually created or if it already existed
- gyp.verbose('created:', devDir)
+ if (created) {
+ gyp.verbose('created:', devDir)
+ } else {
+ gyp.verbose('directory already existed:', devDir)
+ }
// now download the node tarball
var tarballUrl = distUrl + '/v' + version + '/node-v' + version + '.tar.gz'
@@ -242,40 +244,56 @@ function install (gyp, argv, callback) {
function downloadNodeLib (done) {
gyp.verbose('on Windows; need to download `node.lib`...')
- // TODO: windows 64-bit support
- var releaseDir = path.resolve(devDir, 'Release')
- , debugDir = path.resolve(devDir, 'Debug')
- , nodeLibUrl = distUrl + '/v' + version + '/node.lib'
-
- gyp.verbose('Release dir', releaseDir)
- gyp.verbose('Debug dir', debugDir)
- gyp.verbose('`node.lib` url', nodeLibUrl)
- // TODO: parallelize mkdirs
- mkdir(releaseDir, function (err) {
+ var dir32 = path.resolve(devDir, 'ia32')
+ , dir64 = path.resolve(devDir, 'x64')
+ , nodeLibPath32 = path.resolve(dir32, 'node.lib')
+ , nodeLibPath64 = path.resolve(dir64, 'node.lib')
+ , nodeLibUrl32 = distUrl + '/v' + version + '/node.lib'
+ , nodeLibUrl64 = distUrl + '/v' + version + '/x64/node.lib'
+
+ gyp.verbose('32-bit node.lib dir', dir32)
+ gyp.verbose('64-bit node.lib dir', dir64)
+ gyp.verbose('`node.lib` 32-bit url', nodeLibUrl32)
+ gyp.verbose('`node.lib` 64-bit url', nodeLibUrl64)
+
+ var async = 2
+ mkdir(dir32, function (err) {
+ if (err) return done(err)
+ gyp.verbose('streaming 32-bit node.lib to:', nodeLibPath32)
+
+ var req = download(nodeLibUrl32)
+ req.on('error', done)
+ req.on('response', function (res) {
+ if (res.statusCode !== 200) {
+ done(new Error(res.statusCode + ' status code downloading 32-bit node.lib'))
+ }
+ })
+ req.on('end', function () {
+ --async || done()
+ })
+
+ var ws = fs.createWriteStream(nodeLibPath32)
+ ws.on('error', cb)
+ req.pipe(ws)
+ })
+ mkdir(dir64, function (err) {
if (err) return done(err)
- mkdir(debugDir, function (err) {
- if (err) return done(err)
- // TODO: clean this mess up, written in a hastemode-9000
- var badDownload = false
- var res = download(nodeLibUrl, function (err, res) {
- if (err || res.statusCode != 200) {
- badDownload = true
- done(err || new Error(res.statusCode + ' status code downloading node.lib'))
- }
- })
- var releaseDirNodeLib = path.resolve(releaseDir, 'node.lib')
- , debugDirNodeLib = path.resolve(debugDir, 'node.lib')
- , rws = fs.createWriteStream(releaseDirNodeLib)
- , dws = fs.createWriteStream(debugDirNodeLib)
- gyp.verbose('streaming to', releaseDirNodeLib)
- gyp.verbose('streaming to', debugDirNodeLib)
- res.pipe(rws)
- res.pipe(dws)
- res.on('end', function () {
- if (badDownload) return
- done()
- })
+ gyp.verbose('streaming 64-bit node.lib to:', nodeLibPath64)
+
+ var req = download(nodeLibUrl64)
+ req.on('error', done)
+ req.on('response', function (res) {
+ if (res.statusCode !== 200) {
+ done(new Error(res.statusCode + ' status code downloading 64-bit node.lib'))
+ }
})
+ req.on('end', function () {
+ --async || done()
+ })
+
+ var ws = fs.createWriteStream(nodeLibPath64)
+ ws.on('error', cb)
+ req.pipe(ws)
})
}
diff --git a/node_modules/node-gyp/lib/list.js b/node_modules/node-gyp/lib/list.js
index 6ecf1ba86..64c4ef73f 100644
--- a/node_modules/node-gyp/lib/list.js
+++ b/node_modules/node-gyp/lib/list.js
@@ -7,18 +7,15 @@ exports.usage = 'Prints a listing of the currently installed node development fi
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, path = require('path')
function list (gyp, args, callback) {
- // TODO: Make ~/.node-gyp configurable
- var nodeGypDir = path.resolve(process.env.HOME, '.node-gyp')
-
- gyp.verbose('using node-gyp dir', nodeGypDir)
+ gyp.verbose('using node-gyp dir', gyp.devDir)
// readdir the node-gyp dir
- fs.readdir(nodeGypDir, onreaddir)
+ fs.readdir(gyp.devDir, onreaddir)
function onreaddir (err, versions) {
if (err && err.code != 'ENOENT') {
diff --git a/node_modules/node-gyp/lib/node-gyp.js b/node_modules/node-gyp/lib/node-gyp.js
index efa53435e..1b014e6cd 100644
--- a/node_modules/node-gyp/lib/node-gyp.js
+++ b/node_modules/node-gyp/lib/node-gyp.js
@@ -5,7 +5,7 @@ module.exports = exports = gyp
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, path = require('path')
, nopt = require('nopt')
, child_process = require('child_process')
@@ -38,13 +38,24 @@ function gyp () {
function Gyp () {
var me = this
+ // set the dir where node-gyp dev files get installed
+ // TODO: make this configurable?
+ // see: https://github.com/TooTallNate/node-gyp/issues/21
+ var homeDir = process.env.HOME || process.env.USERPROFILE
+ this.devDir = path.resolve(homeDir, '.node-gyp')
+
this.commands = {}
+
commands.forEach(function (command) {
me.commands[command] = function (argv, callback) {
me.verbose('command', command, argv)
return require('./' + command)(me, argv, callback)
}
})
+
+ Object.keys(aliases).forEach(function (alias) {
+ me.commands[alias] = me.commands[aliases[alias]]
+ })
}
inherits(Gyp, EE)
exports.Gyp = Gyp
@@ -56,9 +67,14 @@ var proto = Gyp.prototype
proto.package = require('../package')
+/**
+ * nopt configuration definitions
+ */
+
proto.configDefs = {
help: Boolean // everywhere
, arch: String // 'configure'
+ , directory: String // bin
, msvs_version: String // 'configure'
, debug: Boolean // 'build'
, ensure: Boolean // 'install'
@@ -67,14 +83,33 @@ proto.configDefs = {
, proxy: String // 'install'
}
-proto.shorthands = {}
+/**
+ * nopt shorthands
+ */
+
+proto.shorthands = {
+ release: '--no-debug'
+ , C: '--directory'
+}
+
+/**
+ * Parses the given argv array and sets the 'opts',
+ * 'argv' and 'command' properties.
+ */
proto.parseArgv = function parseOpts (argv) {
this.opts = nopt(this.configDefs, this.shorthands, argv)
this.argv = this.opts.argv.remain.slice()
- var command = this.argv.shift()
- this.command = aliases[command] || command
+ var commands = []
+ this.argv.slice().forEach(function (arg) {
+ if (arg in this.commands) {
+ this.argv.splice(this.argv.indexOf(arg), 1)
+ commands.push(arg)
+ }
+ }, this)
+
+ this.todo = commands
}
/**
@@ -100,6 +135,11 @@ proto.info = function info () {
args.unshift('info')
this.emit.apply(this, args)
}
+proto.warn = function warn () {
+ var args = Array.prototype.slice.call(arguments)
+ args.unshift('warn')
+ this.emit.apply(this, args)
+}
proto.verbose = function verbose () {
var args = Array.prototype.slice.call(arguments)
diff --git a/node_modules/node-gyp/lib/remove.js b/node_modules/node-gyp/lib/remove.js
index a19404066..2844ec06f 100644
--- a/node_modules/node-gyp/lib/remove.js
+++ b/node_modules/node-gyp/lib/remove.js
@@ -14,10 +14,7 @@ var fs = require('fs')
function remove (gyp, argv, callback) {
- // TODO: Make ~/.node-gyp configurable
- var nodeGypDir = path.resolve(process.env.HOME, '.node-gyp')
-
- gyp.verbose('using node-gyp dir', nodeGypDir)
+ gyp.verbose('using node-gyp dir', gyp.devDir)
// get the user-specified version to remove
var v = argv[0] || gyp.opts.target
@@ -36,7 +33,7 @@ function remove (gyp, argv, callback) {
// flatten the version Array into a String
version = version.slice(1, 4).join('.')
- var versionPath = path.resolve(nodeGypDir, version)
+ var versionPath = path.resolve(gyp.devDir, version)
gyp.verbose('removing development files for version', version)
// first check if its even installed
diff --git a/node_modules/node-gyp/lib/util/asyncEmit.js b/node_modules/node-gyp/lib/util/asyncEmit.js
deleted file mode 100644
index eb3d29ffc..000000000
--- a/node_modules/node-gyp/lib/util/asyncEmit.js
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/**
- * An `asyncEmit()` function that accepts an EventEmitter, an Array of args, and
- * a callback function. If the emitter listener function has an arity
- * > args.length then there is an assumed callback function on the emitter, which
- * means that it is doing some async work. We have to wait for the callbacks for
- * any async listener functions.
- *
- * It works like this:
- *
- * var emitter = new EventEmitter
- *
- * // this is an async listener
- * emitter.on('something', function (val, done) {
- * // val may be any number of input arguments
- * setTimeout(function () {
- * done()
- * }, 1000)
- * })
- *
- * // this is a sync listener, no callback function
- * emitter.on('something', function (val) {
- *
- * })
- *
- * asyncEmit(emitter, 'something', [ 5 ], function (err) {
- * if (err) throw err
- * console.log('DONE!')
- * })
- */
-
-module.exports = asyncEmit
-function asyncEmit (emitter, eventName, args, callback) {
-
- if (typeof args == 'function') {
- callback = args
- args = []
- }
-
- var async = emitter.listeners(eventName).filter(function (func) {
- return func.length > args.length
- }).length
-
- var argv = [ eventName ].concat(args)
-
- // callback function
- argv.push(function (err) {
- if (err && !callback.called) {
- callback.called = true
- callback(err)
- }
- --async || callback()
- })
-
- // no async listeners
- if (async === 0) {
- process.nextTick(callback)
- }
-
- return emitter.emit.apply(emitter, argv)
-}
diff --git a/node_modules/node-gyp/lib/util/hook.js b/node_modules/node-gyp/lib/util/hook.js
deleted file mode 100644
index d31cc2e8a..000000000
--- a/node_modules/node-gyp/lib/util/hook.js
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/**
- * This is our "Hook" class that allows a script to hook into the lifecyle of the
- * "configure", "build" and "clean" commands. It's basically a hack into the
- * module.js file to allow custom hooks into the module-space, specifically to
- * make the global scope act as an EventEmitter.
- */
-
-var fs = require('fs')
- , path = require('path')
- , Module = require('module')
- , EventEmitter = require('events').EventEmitter
- , functions = Object.keys(EventEmitter.prototype).filter(function (k) {
- return typeof EventEmitter.prototype[k] == 'function'
- })
- , boilerplate = functions.map(function (k) {
- return 'var ' + k + ' = module.emitter.' + k + '.bind(module.emitter);'
- }).join('')
-
-module.exports = createHook
-function createHook (filename, callback) {
-
- var emitter = new EventEmitter
-
- // first read the file contents
- fs.readFile(filename, 'utf8', function (err, code) {
- if (err) {
- if (err.code == 'ENOENT') {
- // hook file doesn't exist, oh well
- callback(null, emitter)
- } else {
- callback(err)
- }
- return
- }
- // got a hook file, now execute it
- var mod = new Module(filename)
- mod.filename = filename
- mod.paths = Module._nodeModulePaths(filename)
- mod.emitter = emitter
- try {
- mod._compile(boilerplate + code, filename)
- } catch (e) {
- return callback(e)
- }
- callback(null, emitter)
- })
-}
diff --git a/node_modules/node-gyp/node_modules/ansi/package.json b/node_modules/node-gyp/node_modules/ansi/package.json
index 259382f82..9352a0ba2 100644
--- a/node_modules/node-gyp/node_modules/ansi/package.json
+++ b/node_modules/node-gyp/node_modules/ansi/package.json
@@ -41,8 +41,8 @@
"dependencies": {},
"optionalDependencies": {},
"_engineSupported": true,
- "_npmVersion": "1.1.13",
- "_nodeVersion": "v0.7.7-pre",
+ "_npmVersion": "1.1.16",
+ "_nodeVersion": "v0.7.8-pre",
"_defaultsLoaded": true,
"_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 952ea1b95..83e88f623 100644
--- a/node_modules/node-gyp/node_modules/glob/package.json
+++ b/node_modules/node-gyp/node_modules/glob/package.json
@@ -36,8 +36,8 @@
"_id": "glob@3.1.9",
"optionalDependencies": {},
"_engineSupported": true,
- "_npmVersion": "1.1.13",
- "_nodeVersion": "v0.7.7-pre",
+ "_npmVersion": "1.1.16",
+ "_nodeVersion": "v0.7.8-pre",
"_defaultsLoaded": true,
"_from": "glob@3"
}
diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json
index 3dc04578f..19628593a 100644
--- a/node_modules/node-gyp/package.json
+++ b/node_modules/node-gyp/package.json
@@ -10,8 +10,8 @@
"bindings",
"gyp"
],
- "version": "0.3.9",
- "installVersion": 5,
+ "version": "0.4.1",
+ "installVersion": 7,
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
@@ -47,15 +47,15 @@
"name": "isaacs",
"email": "i@izs.me"
},
- "_id": "node-gyp@0.3.9",
+ "_id": "node-gyp@0.4.1",
"devDependencies": {},
"optionalDependencies": {},
"_engineSupported": true,
- "_npmVersion": "1.1.13",
- "_nodeVersion": "v0.7.7-pre",
+ "_npmVersion": "1.1.16",
+ "_nodeVersion": "v0.7.8-pre",
"_defaultsLoaded": true,
"dist": {
- "shasum": "78c01d4b662c55607e7220b8c8e2a1f25390474a"
+ "shasum": "05a017b115527b63fdec1321d0b5888bc5d7b04f"
},
- "_from": "node-gyp@~0.3.7"
+ "_from": "node-gyp@latest"
}
diff --git a/package.json b/package.json
index 68a494227..8982fcc40 100644
--- a/package.json
+++ b/package.json
@@ -53,7 +53,7 @@
"mkdirp": "0.3",
"read": "0",
"lru-cache": "1",
- "node-gyp": "~0.3.7",
+ "node-gyp": "~0.4.1",
"fstream-npm": "0 >=0.0.4",
"uid-number": "0",
"archy": "0",
@@ -77,7 +77,6 @@
"block-stream",
"inherits",
"mkdirp",
- "fast-list",
"read",
"lru-cache",
"node-gyp",