Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Fix handling of build flag and empty env #2718

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ function afterBuild(options) {
*/

function build(options) {
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat(
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
})).concat(options.args);
var libargs = ['ext', 'cflags', 'ldflags', 'library'].reduce(function(prev, cur) {
var arg = `libsass_${cur}`;
var env = process.env[arg.toUpperCase()];
if (env) {
return prev.push(['--', arg, '=', env].join(''));
} else {
return prev;
}
}, []);
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose']
.concat(libargs)
.concat(options.args);

console.log('Building:', [process.execPath].concat(args).join(' '));

Expand Down