Skip to content

Commit

Permalink
build: add node_module_version to config.gypi
Browse files Browse the repository at this point in the history
Enable targetting of a different node version than
the currently running one when building binary modules.

Based on nodejs/node@410296c37

PR-URL: nodejs#8027
Ref: nodejs#7808
Ref: nodejs/node-gyp#855
  • Loading branch information
saper authored and bnoordhuis committed Dec 20, 2016
1 parent c130b31 commit 91a82bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ def configure_node(o):
if options.v8_options:
o['variables']['node_v8_options'] = options.v8_options.replace('"', '\\"')

o['variables']['node_module_version'] = 14


def configure_libz(o):
o['variables']['node_shared_zlib'] = b(options.shared_zlib)
Expand Down
1 change: 1 addition & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'node_shared_openssl%': 'false',
'node_use_mdb%': 'false',
'node_v8_options%': '',
'node_module_version%': '',
'library_files': [
'src/node.js',
'lib/_debugger.js',
Expand Down
10 changes: 10 additions & 0 deletions test/simple/test-module-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';
require('../common');
var assert = require('assert');

// Check for existence
assert(process.config.variables.hasOwnProperty('node_module_version'));

// Ensure that `node_module_version` is an Integer
assert(!Number.isNaN(parseInt(process.config.variables.node_module_version)));
assert.strictEqual(process.config.variables.node_module_version, 14);

0 comments on commit 91a82bf

Please sign in to comment.