Skip to content

Commit

Permalink
Update configure.js
Browse files Browse the repository at this point in the history
Fixes nodejs#65. Build failure when builddir contains spaces.
Solution by @trentm.
See trentm@bbd979b
  • Loading branch information
Glavin001 committed Jan 6, 2014
1 parent 7e98c99 commit 6bfb29b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/configure.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

module.exports = exports = configure

/**
Expand Down Expand Up @@ -175,7 +174,7 @@ function configure (gyp, argv, callback) {

var config = process.config || {}
, defaults = config.target_defaults
, variables = config.variables
, variablesa = config.variables

// default "config.variables"
if (!variables) variables = config.variables = {}
Expand Down Expand Up @@ -303,13 +302,18 @@ function configure (gyp, argv, callback) {
// Windows expects an absolute path
output_dir = buildDir
}

argv.push('-I', addon_gypi)
argv.push('-I', common_gypi)

// Fix for spaces and other special characters in path.
function shellEscape(str) {
return str.replace(/(["\s'$`\\])/g, '\\$1');
};

argv.push('-I', shellEscape(addon_gypi))
argv.push('-I', shellEscape(common_gypi))
argv.push('-Dlibrary=shared_library')
argv.push('-Dvisibility=default')
argv.push('-Dnode_root_dir=' + nodeDir)
argv.push('-Dmodule_root_dir=' + process.cwd())
argv.push('-Dnode_root_dir=' + shellEscape(nodeDir))
argv.push('-Dmodule_root_dir=' + shellEscape(process.cwd()))
argv.push('--depth=.')

// tell gyp to write the Makefile/Solution files into output_dir
Expand Down

0 comments on commit 6bfb29b

Please sign in to comment.