Skip to content

Commit c41efe4

Browse files
saperMylesBorins
authored andcommitted
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: #8171 Ref: #8027 Ref: #7808 Ref: nodejs/node-gyp#855 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 50ae37e commit c41efe4

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

configure

+2
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ def configure_node(o):
769769
if options.enable_static:
770770
o['variables']['node_target_type'] = 'static_library'
771771

772+
o['variables']['node_module_version'] = 46
773+
772774
if options.linked_module:
773775
o['variables']['library_files'] = options.linked_module
774776

node.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'node_enable_v8_vtunejit%': 'false',
1616
'node_target_type%': 'executable',
1717
'node_core_target_name%': 'node',
18+
'node_module_version%': '',
1819
'library_files': [
1920
'src/node.js',
2021
'lib/_debug_agent.js',

test/parallel/test-module-version.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
const 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, 46);

0 commit comments

Comments
 (0)