Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

build: support make install "DESTDIR=/path"

  • Loading branch information...
commit ea50ebd36da2da4a7a8b5fe6e0925ecd113c9d59 1 parent e160213
skenqbx skenqbx authored bnoordhuis committed
Showing with 9 additions and 6 deletions.
  1. +2 −1  Makefile
  2. +7 −5 tools/installer.js
3  Makefile
View
@@ -2,6 +2,7 @@
BUILDTYPE ?= Release
PYTHON ?= python
+DESTDIR ?=
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
@@ -33,7 +34,7 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/z
tools/gyp_node -f make
install: all
- out/Release/node tools/installer.js install
+ out/Release/node tools/installer.js install $(DESTDIR)
uninstall:
out/Release/node tools/installer.js uninstall
12 tools/installer.js
View
@@ -1,7 +1,8 @@
var fs = require('fs'),
path = require('path'),
exec = require('child_process').exec,
- cmd = process.argv[2];
+ cmd = process.argv[2],
+ dest_dir = process.argv[3] || '';
if (cmd !== 'install' && cmd !== 'uninstall') {
console.error('Unknown command: ' + cmd);
@@ -26,7 +27,7 @@ function copy(src, dst, callback) {
return;
}
- dst = path.join(node_prefix, dst);
+ dst = path.join(dest_dir, node_prefix, dst);
var dir = dst.replace(/\/[^\/]*$/, '/');
// Create directory if hasn't done this yet
@@ -42,7 +43,7 @@ function copy(src, dst, callback) {
// Remove files
function remove(files) {
files.forEach(function(file) {
- file = path.join(node_prefix, file);
+ file = path.join(dest_dir, node_prefix, file);
queue.push('rm -rf ' + file);
});
}
@@ -127,9 +128,10 @@ if (cmd === 'install') {
if (variables.node_install_npm) {
copy('deps/npm', 'lib/node_modules/npm');
queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' +
- path.join(node_prefix, 'bin/npm'));
+ path.join(dest_dir, node_prefix, 'bin/npm'));
queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'),
- path.join(node_prefix, 'lib/node_modules/npm/bin/npm-cli.js')]);
+ path.join(dest_dir, node_prefix,
+ 'lib/node_modules/npm/bin/npm-cli.js')]);
}
} else {
remove([
Please sign in to comment.
Something went wrong with that request. Please try again.