Browse Source

install: update install.js to use `process.config`

Now that the node_prefix is available from within node, we can use it :)
v0.9.1-release
Nathan Rajlich 13 years ago
parent
commit
7cb0f5f84a
  1. 4
      Makefile
  2. 12
      tools/installer.js

4
Makefile

@ -33,10 +33,10 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/z
tools/gyp_node -f make tools/gyp_node -f make
install: all install: all
out/Release/node tools/installer.js ./config.gypi install out/Release/node tools/installer.js install
uninstall: uninstall:
out/Release/node tools/installer.js ./config.gypi uninstall out/Release/node tools/installer.js uninstall
clean: clean:
-rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node

12
tools/installer.js

@ -1,21 +1,15 @@
var fs = require('fs'), var fs = require('fs'),
path = require('path'), path = require('path'),
exec = require('child_process').exec, exec = require('child_process').exec,
options = fs.readFileSync(process.argv[2]).toString(), cmd = process.argv[2];
cmd = process.argv[3];
if (cmd !== 'install' && cmd !== 'uninstall') { if (cmd !== 'install' && cmd !== 'uninstall') {
console.error('Unknown command: ' + cmd); console.error('Unknown command: ' + cmd);
process.exit(1); process.exit(1);
} }
// Python pprint.pprint() uses single quotes instead of double. // Use the built-in config reported by the current process
// awful. var variables = process.config.variables,
options = options.replace(/'/gi, '"')
// Parse options file and remove first comment line
options = JSON.parse(options.split('\n').slice(1).join(''));
var variables = options.variables,
node_prefix = variables.node_prefix || '/usr/local'; node_prefix = variables.node_prefix || '/usr/local';
// Execution queue // Execution queue

Loading…
Cancel
Save