Comparing version 0.2.2 to 0.3.0
@@ -11,5 +11,5 @@ | ||
, glob = require('glob') | ||
, semver = require('semver') | ||
, createHook = require('./util/hook') | ||
, asyncEmit = require('./util/asyncEmit') | ||
, nodeVersion = require('./util/node_version') | ||
, win = process.platform == 'win32' | ||
@@ -23,2 +23,3 @@ | ||
, emitter | ||
, versionStr | ||
, version | ||
@@ -37,9 +38,14 @@ | ||
// if --target was given, then ensure that version is installed | ||
version = nodeVersion.parse(gyp.opts.target) | ||
gyp.verbose('compiling against --target node version', version) | ||
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 | ||
version = nodeVersion.parse(process.versions.node) | ||
gyp.verbose('no --target version specified, falling back to host node version', 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)) | ||
} | ||
version = version.slice(1, 4).join('.') | ||
gyp.opts.ensure = true | ||
@@ -81,2 +87,5 @@ gyp.commands.install([ version ], go) | ||
// enforce use of the "binding.gyp" file | ||
argv.unshift('binding.gyp') | ||
// execute `gyp_addon` from the current target node version | ||
@@ -83,0 +92,0 @@ argv.unshift(gyp_addon) |
@@ -16,16 +16,8 @@ | ||
, mkdir = require('mkdirp') | ||
, semver = require('semver') | ||
, fstream = require('fstream') | ||
, request = require('request') | ||
, minimatch = require('minimatch') | ||
, nodeVersion = require('./util/node_version') | ||
, distUrl = 'http://nodejs.org/dist' | ||
, win = process.platform == 'win32' | ||
// a map for legacy releases: | ||
// 0.6.10 is the first 0.6 release to have node.lib | ||
// 0.7.2 is the first 0.7 release to have node.lib | ||
, nodeLibMap = { | ||
'0.6': 10 | ||
, '0.7': 1 | ||
// otherwise use the .0 patch release | ||
} | ||
@@ -50,18 +42,27 @@ function install (gyp, argv, callback) { | ||
// Determine which node dev files minor version we are installing | ||
var version = nodeVersion.parse(argv[0] || gyp.opts.target) | ||
gyp.verbose('installing version', version) | ||
// Determine which node dev files version we are installing | ||
var versionStr = argv[0] || gyp.opts.target | ||
if (!versionStr) { | ||
return callback(new Error('You must specify a version number to install. Ex: "0.6.12"')) | ||
} | ||
// parse the version to normalize and ensure it's valid | ||
var version = semver.parse(versionStr) | ||
if (!version) { | ||
return callback(new Error('Invalid version number: ' + versionStr)) | ||
} | ||
// "legacy" versions are 0.7 and 0.6 | ||
var isLegacy = nodeVersion.lessThan(version, 0, 8) | ||
var isLegacy = semver.lt(versionStr, '0.8.0') | ||
gyp.verbose('installing legacy version?', isLegacy) | ||
if (!version) { | ||
return callback(new Error('You must specify a version to install (like "0.7")')) | ||
if (semver.lt(versionStr, '0.6.0')) { | ||
return callback(new Error('Minimum target version is `0.6` or greater. Got: ' + versionStr)) | ||
} | ||
if (nodeVersion.lessThan(version, 0, 6)) { | ||
return callback(new Error('Minimum target version is `0.6` or greater. Got: ' + version)) | ||
} | ||
// flatten version into String | ||
version = version.slice(1, 4).join('.') | ||
gyp.verbose('installing version', version) | ||
// TODO: Make ~/.node-gyp configurable | ||
@@ -117,4 +118,3 @@ var devDir = path.resolve(process.env.HOME, '.node-gyp', version) | ||
// now download the node tarball | ||
// TODO: download the newest version instead of the .0 release | ||
var tarballUrl = distUrl + '/v' + version + '.0/node-v' + version + '.0.tar.gz' | ||
var tarballUrl = distUrl + '/v' + version + '/node-v' + version + '.tar.gz' | ||
, badDownload = false | ||
@@ -248,6 +248,6 @@ , parser = tar.Parse() | ||
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') | ||
, patchVersion = nodeLibMap[version] || '0' | ||
, nodeLibUrl = distUrl + '/v' + version + '.' + patchVersion + '/node.lib' | ||
, nodeLibUrl = distUrl + '/v' + version + '/node.lib' | ||
@@ -254,0 +254,0 @@ gyp.verbose('Release dir', releaseDir) |
@@ -19,2 +19,3 @@ | ||
, 'configure' | ||
, 'rebuild' | ||
// Development Header File management commands | ||
@@ -21,0 +22,0 @@ , 'install' |
@@ -13,3 +13,3 @@ | ||
, path = require('path') | ||
, nodeVersion = require('./util/node_version') | ||
, semver = require('semver') | ||
@@ -23,7 +23,23 @@ function remove (gyp, argv, callback) { | ||
var version = nodeVersion.parse(argv[0] || gyp.opts.target) | ||
, versionPath = path.resolve(nodeGypDir, version) | ||
// get the user-specified version to remove | ||
var v = argv[0] || gyp.opts.target | ||
if (!v) { | ||
return callback(new Error('You must specify a version number to remove. Ex: "0.6.12"')) | ||
} | ||
// parse the version to normalize and make sure it's valid | ||
var version = semver.parse(v) | ||
if (!version) { | ||
return callback(new Error('Invalid version number: ' + v)) | ||
} | ||
// flatten the version Array into a String | ||
version = version.slice(1, 4).join('.') | ||
var versionPath = path.resolve(nodeGypDir, version) | ||
gyp.verbose('removing development files for version', version) | ||
// first check if its even installed | ||
fs.stat(versionPath, function (err, stat) { | ||
@@ -30,0 +46,0 @@ if (err) { |
{ "name": "node-gyp" | ||
, "description": "Node.js native addon build tool" | ||
, "keywords": [ "native", "addon", "module", "c", "c++", "bindings", "gyp" ] | ||
, "version": "0.2.2" | ||
, "installVersion": 3 | ||
, "version": "0.3.0" | ||
, "installVersion": 4 | ||
, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)" | ||
@@ -20,2 +20,3 @@ , "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-gyp.git" } | ||
, "rimraf": "2" | ||
, "semver": "1" | ||
, "tar": "~0.1.12" | ||
@@ -22,0 +23,0 @@ , "which": "1" |
@@ -9,3 +9,3 @@ node-gyp | ||
program which is removed for node `v0.8`. If you have a native addon for node that | ||
still has a `wscript` file, then you should definitely add a `bindings.gyp` file | ||
still has a `wscript` file, then you should definitely add a `binding.gyp` file | ||
to support the latest versions of node. | ||
@@ -82,3 +82,3 @@ | ||
Previously when node had `node-waf` you had to write a `wscript` file. The | ||
replacement for that is the `bindings.gyp` file, which describes the configuration | ||
replacement for that is the `binding.gyp` file, which describes the configuration | ||
to build your module in a JSON-like format. A barebones `gyp` file appropriate for | ||
@@ -91,4 +91,4 @@ building a node addon looks like: | ||
{ | ||
'target_name': 'bindings', | ||
'sources': [ 'src/bindings.cc' ] | ||
'target_name': 'binding', | ||
'sources': [ 'src/binding.cc' ] | ||
} | ||
@@ -149,2 +149,1 @@ ] | ||
[msvc]: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express | ||
[node-bindings]: https://github.com/TooTallNate/node-bindings |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
907610
915
11
146
+ Addedsemver@1
+ Addedsemver@1.1.4(transitive)