From 91a82bfcabc9fa3eb731e85664acf073af4277ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Wed, 20 Jul 2016 08:44:28 +0000 Subject: [PATCH] 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 nodejs/node@410296c37 PR-URL: https://github.com/nodejs/node/pull/8027 Ref: https://github.com/nodejs/node/pull/7808 Ref: https://github.com/nodejs/node-gyp/pull/855 --- configure | 2 ++ node.gyp | 1 + test/simple/test-module-version.js | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/simple/test-module-version.js diff --git a/configure b/configure index 06f32a5e15073c..950e5dc8622284 100755 --- a/configure +++ b/configure @@ -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) diff --git a/node.gyp b/node.gyp index 4ee8d04f890ca6..80a378881e324b 100644 --- a/node.gyp +++ b/node.gyp @@ -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', diff --git a/test/simple/test-module-version.js b/test/simple/test-module-version.js new file mode 100644 index 00000000000000..85489a4e674072 --- /dev/null +++ b/test/simple/test-module-version.js @@ -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);