node-pre-gyp
Advanced tools
Comparing version 0.4.1 to 0.4.2
# node-pre-gyp changelog | ||
## 0.4.2 | ||
- Added support for `--target` flag to request cross-compile against a specific node/node-webkit version. | ||
- Added preliminary support for node-webkit | ||
- Fixed support for `--target_arch` option being respected in all cases. | ||
## 0.4.1 | ||
@@ -4,0 +10,0 @@ |
module.exports = exports = build | ||
exports.usage = 'Attempts to compile the module by dispatching to node-gyp' | ||
exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp' | ||
@@ -10,8 +10,8 @@ var fs = require('fs') | ||
function build(gyp, argv, callback) { | ||
var node_gyp_args = []; | ||
var gyp_args = []; | ||
if (argv.length && argv[0] == 'rebuild') { | ||
node_gyp_args.push('rebuild'); | ||
gyp_args.push('rebuild'); | ||
} else { | ||
node_gyp_args.push('configure'); | ||
node_gyp_args.push('build'); | ||
gyp_args.push('configure'); | ||
gyp_args.push('build'); | ||
} | ||
@@ -23,5 +23,5 @@ var package_json = JSON.parse(fs.readFileSync('./package.json')); | ||
command_line_opts = command_line_opts.filter(function(opt) { return opt.length > 2 && opt.slice(0,2) == '--'}); | ||
compile.run_gyp(node_gyp_args.concat(command_line_opts),gyp.opts,function(err,opts) { | ||
compile.run_gyp(gyp_args.concat(command_line_opts),gyp.opts,function(err,opts) { | ||
return callback(err); | ||
}); | ||
} |
@@ -9,2 +9,3 @@ | ||
, path = require('path') | ||
, exists = require('fs').exists || require('path').exists | ||
, log = require('npmlog') | ||
@@ -19,5 +20,10 @@ , versioning = require('./util/versioning.js') | ||
var binary_module = path.join(to,opts.module_name + '.node'); | ||
console.log('Removing "%s"', binary_module) | ||
rm(binary_module, callback); | ||
exists(binary_module,function(found) { | ||
if (found) { | ||
console.log('Removing "%s"', binary_module) | ||
return rm(binary_module, callback); | ||
} | ||
return callback(); | ||
}) | ||
}); | ||
} |
@@ -143,5 +143,2 @@ | ||
if (existsAsync(binary_module,function(found) { | ||
if (!found) { | ||
console.log('did not find ' + process.cwd() + ' ' + binary_module) | ||
} | ||
if (found) { | ||
@@ -170,2 +167,3 @@ test_binary.validate(opts,function(err) { | ||
} else { | ||
log.info('check','checked for "' + path.join(process.cwd(),binary_module) + '" (not found)') | ||
place_binary(from,to,opts,function(err) { | ||
@@ -172,0 +170,0 @@ if (err && should_do_fallback_build) { |
@@ -19,4 +19,7 @@ | ||
var shell_cmd = 'node-gyp'; | ||
if (opts.runtime && opts.runtime == 'node-webkit') { | ||
shell_cmd = 'nw-gyp'; | ||
} | ||
if (win) { | ||
shell_cmd = 'node-gyp.cmd'; | ||
shell_cmd += '.cmd'; | ||
} | ||
@@ -23,0 +26,0 @@ var cmd = cp.spawn(shell_cmd, args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]}); |
@@ -17,2 +17,3 @@ module.exports = exports; | ||
var args = []; | ||
var options = {} | ||
var shell_cmd; | ||
@@ -23,3 +24,7 @@ var arch_names = { | ||
} | ||
if (process.platform === 'darwin' && arch_names[opts.target_arch]) { | ||
var nw = (opts.runtime && opts.runtime === 'node-webkit'); | ||
if (nw) { | ||
shell_cmd = 'node-webkit'; | ||
options.timeout = 5000; | ||
} else if (process.platform === 'darwin' && arch_names[opts.target_arch]) { | ||
shell_cmd = 'arch'; | ||
@@ -36,8 +41,12 @@ args.push(arch_names[opts.target_arch]); | ||
log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ')); | ||
cp.execFile(shell_cmd, args, function(err, stdout, stderr) { | ||
cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) { | ||
// check for normal timeout for node-webkit | ||
if (err && nw && err.killed == true && err.signal.indexOf('SIG') > -1) { | ||
return callback(); | ||
} | ||
if (err || stderr) { | ||
return callback(new Error(err && err.message || stderr)); | ||
} | ||
} | ||
return callback(); | ||
}); | ||
} |
@@ -16,2 +16,4 @@ | ||
, cp = require('child_process') | ||
, abi_crosswalk = require('./abi_crosswalk.json') | ||
, nw_crosswalk = require('./nw_crosswalk.json') | ||
@@ -28,7 +30,34 @@ function eval_template(template,opts) { | ||
function get_node_abi() { | ||
// process.versions.modules added in >= v0.10.4 and v0.11.7 | ||
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e | ||
return process.versions.modules ? 'node-v' + (+process.versions.modules) : | ||
'v8-' + process.versions.v8.split('.').slice(0,2).join('.'); | ||
function get_node_abi(runtime, target) { | ||
if (target) { | ||
// abi_crosswalk generated with ./scripts/abi_crosswalk.js | ||
var abi = ''; | ||
if (runtime === 'node-webkit') { | ||
var node_version = nw_crosswalk[target]; | ||
if (!node_version) { | ||
throw new Error("node-webkit version '"+target+"' not supported"); | ||
} | ||
abi = abi_crosswalk[node_version].node_abi; | ||
} else { | ||
abi = abi_crosswalk[target].node_abi; | ||
} | ||
if (!abi) { | ||
throw new Error("Unsupported target version: " + target); | ||
} | ||
if (abi > 1) { | ||
return runtime+'-v' + (+abi); | ||
} else { | ||
// no support for node-webkit unless > 0.10.x | ||
if (runtime != 'node') { | ||
throw new Error("Runtime '" + runtime + "' unsupported for target version: " + target); | ||
} | ||
abi = abi_crosswalk[target].v8; | ||
return 'v8-' + abi; | ||
} | ||
} else { | ||
// process.versions.modules added in >= v0.10.4 and v0.11.7 | ||
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e | ||
return process.versions.modules ? runtime+'-v' + (+process.versions.modules) : | ||
'v8-' + process.versions.v8.split('.').slice(0,2).join('.'); | ||
} | ||
} | ||
@@ -72,2 +101,3 @@ | ||
var module_version = semver.parse(v); | ||
var runtime = options.runtime || 'node'; | ||
var opts = { | ||
@@ -81,5 +111,7 @@ configuration: (options.debug === true) ? 'Debug' : 'Release' | ||
, patch: module_version.patch | ||
, node_abi: get_node_abi() | ||
, platform: process.platform | ||
, arch: process.arch | ||
, runtime: runtime | ||
, node_abi: get_node_abi(runtime,options.target) | ||
, target: options.target || '' | ||
, platform: options.target_platform || process.platform | ||
, arch: options.target_arch || process.arch | ||
, target_arch: options.target_arch || process.arch | ||
@@ -86,0 +118,0 @@ , module_main: package_json.main |
{ | ||
"name": "node-pre-gyp", | ||
"description": "Node.js native addon binary install tool", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"keywords": [ | ||
@@ -30,3 +30,3 @@ "native", | ||
"mkdirp":"~0.3.5", | ||
"aws-sdk": "~2.0.0-rc6", | ||
"aws-sdk": "~2.0.0-rc9 ", | ||
"rc":"~0.3.2", | ||
@@ -33,0 +33,0 @@ "rimraf":"~2.2.5" |
@@ -55,22 +55,35 @@ # node-pre-gyp | ||
```js | ||
"binary": { | ||
"module_name": "node_sqlite3", | ||
"module_path": "./lib/binding/", | ||
"remote_uri": "http://node-sqlite3.s3.amazonaws.com", | ||
"template": "{configuration}/{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz" | ||
}, | ||
"binary": { | ||
"module_name": "node_sqlite3", | ||
"module_path": "./lib/binding/", | ||
"remote_uri": "http://node-sqlite3.s3.amazonaws.com", | ||
"template": "{configuration}/{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz" | ||
} | ||
``` | ||
**3) Build and package your app** | ||
**3) Add node-pre-gyp as a bundled dependency** | ||
```sh | ||
node-pre-gyp build package | ||
```js | ||
"dependencies" : { | ||
"node-pre-gyp": "~0.4.0", | ||
}, | ||
"bundledDependencies":["node-pre-gyp"], | ||
``` | ||
**4) Publish the tarball** | ||
**4) Build and package your app** | ||
```sh | ||
node-pre-gyp publish | ||
``` | ||
Install node-pre-gyp globally: | ||
npm install -g node-pre-gyp | ||
Then build and package your app: | ||
node-pre-gyp build package | ||
**5) Publish the tarball** | ||
Once packaged, now you can publish: | ||
node-pre-gyp publish | ||
Currently the `publish` command pushes your binary to S3. This requires: | ||
@@ -88,7 +101,7 @@ | ||
**5) Automating builds** | ||
**6) Automating builds** | ||
Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated. See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux. On windows consider using a script [like this](https://github.com/mapbox/node-sqlite3/blob/master/scripts/build.bat) to quickly create and publish binaries. | ||
**6) You're done!** | ||
**7) You're done!** | ||
@@ -95,0 +108,0 @@ Now publish your package to the npm registry. Users will now be able to install your module from a binary. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
77421
61
1468
289
31
13
Updatedaws-sdk@~2.0.0-rc9