aboutsummaryrefslogtreecommitdiff
path: root/node_modules/node-pre-gyp/lib/configure.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/node-pre-gyp/lib/configure.js
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/node-pre-gyp/lib/configure.js')
-rw-r--r--node_modules/node-pre-gyp/lib/configure.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/node_modules/node-pre-gyp/lib/configure.js b/node_modules/node-pre-gyp/lib/configure.js
new file mode 100644
index 00000000..a6e34382
--- /dev/null
+++ b/node_modules/node-pre-gyp/lib/configure.js
@@ -0,0 +1,52 @@
+"use strict";
+
+module.exports = exports = configure;
+
+exports.usage = 'Attempts to configure node-gyp or nw-gyp build';
+
+var napi = require('./util/napi.js');
+var compile = require('./util/compile.js');
+var handle_gyp_opts = require('./util/handle_gyp_opts.js');
+
+function configure(gyp, argv, callback) {
+ handle_gyp_opts(gyp,argv,function(err,result) {
+ var final_args = result.gyp.concat(result.pre);
+ // pull select node-gyp configure options out of the npm environ
+ var known_gyp_args = ['dist-url','python','nodedir','msvs_version'];
+ known_gyp_args.forEach(function(key) {
+ var val = gyp.opts[key] || gyp.opts[key.replace('-','_')];
+ if (val) {
+ final_args.push('--'+key+'='+val);
+ }
+ });
+ // --ensure=false tell node-gyp to re-install node development headers
+ // but it is only respected by node-gyp install, so we have to call install
+ // as a separate step if the user passes it
+ if (gyp.opts.ensure === false) {
+ var install_args = final_args.concat(['install','--ensure=false']);
+ compile.run_gyp(install_args,result.opts,function(err) {
+ if (err) return callback(err);
+ if (result.unparsed.length > 0) {
+ final_args = final_args.
+ concat(['--']).
+ concat(result.unparsed);
+ }
+ compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
+ return callback(err);
+ });
+ });
+ } else {
+ if (result.unparsed.length > 0) {
+ final_args = final_args.
+ concat(['--']).
+ concat(result.unparsed);
+ }
+ compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
+ if (!err && result.opts.napi_build_version) {
+ napi.swap_build_dir_out(result.opts.napi_build_version);
+ }
+ return callback(err);
+ });
+ }
+ });
+}