Skip to content

Commit 26d8a48

Browse files
committed
Add BINDINGS_JOBS env var to customise node-gyp --jobs argument
1 parent 24bff92 commit 26d8a48

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

install/install.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,16 @@ process.env['OPENCV4NODEJS_DEFINES'] = defines.join('\n')
7777
process.env['OPENCV4NODEJS_INCLUDES'] = includes.join('\n')
7878
process.env['OPENCV4NODEJS_LIBRARIES'] = libs.join('\n')
7979

80-
const flags = process.env.BINDINGS_DEBUG ? '--jobs max --debug' : '--jobs max'
81-
const nodegypCmd = 'node-gyp rebuild ' + flags
80+
const flags = [];
81+
if (process.env.BINDINGS_JOBS) {
82+
flags.push('--jobs ' + process.env.BINDINGS_JOBS);
83+
} else {
84+
flags.push('--jobs max');
85+
}
86+
if (process.env.BINDINGS_DEBUG) {
87+
flags.push('--debug');
88+
}
89+
const nodegypCmd = 'node-gyp rebuild ' + flags.join(' ')
8290
log.info('install', `spawning node gyp process: ${nodegypCmd}`)
8391
const child = child_process.exec(nodegypCmd, { maxBuffer: Infinity }, function(err, stdout, stderr) {
8492
const _err = err || stderr

0 commit comments

Comments
 (0)