Skip to content

Commit 6a47a07

Browse files
committed
build: add node_module_version to config.gypi
Enable targetting of a different node version than the currently running one when building binary modules. Based on 410296c37 PR-URL: #7808 Ref: nodejs/node-gyp#855
1 parent 7f44ecf commit 6a47a07

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ def configure_node(o):
546546
else:
547547
o['variables']['node_tag'] = ''
548548

549+
o['variables']['node_module_version'] = 11
550+
549551

550552
def configure_libz(o):
551553
o['variables']['node_shared_zlib'] = b(options.shared_zlib)

node.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'node_use_openssl%': 'true',
1414
'node_use_systemtap%': 'false',
1515
'node_shared_openssl%': 'false',
16+
'node_module_version%': '',
1617
'library_files': [
1718
'src/node.js',
1819
'lib/_debugger.js',

test/simple/test-module-version.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
var assert = require('assert');
4+
5+
// Check for existence
6+
assert(process.config.variables.hasOwnProperty('node_module_version'));
7+
8+
// Ensure that `node_module_version` is an Integer
9+
assert(!Number.isNaN(parseInt(process.config.variables.node_module_version)));
10+
assert.strictEqual(process.config.variables.node_module_version, 11);

0 commit comments

Comments
 (0)