From 501210d3a4c1109342795a84e1bafe344fa4433f Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Wed, 24 Oct 2018 17:29:52 -0700 Subject: [PATCH 1/2] Clean up libssh2 configure step --- generate/templates/templates/binding.gyp | 6 +----- utils/configureLibssh2.js | 18 ++---------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index dbe70ab5c..3ba0b1e3d 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -5,12 +5,10 @@ ["OS=='win'", { "variables": { "is_electron%": "1", - "openssl_include_dir%": "<(module_root_dir)\\vendor\\openssl" } }, { "variables": { "is_electron%": "1", - "openssl_include_dir%": "<(module_root_dir)/vendor/openssl" } }] ], @@ -19,12 +17,10 @@ ["OS=='win'", { "variables": { "is_electron%": "0", - "openssl_include_dir%": "<(node_root_dir)\\include\\node" } }, { "variables": { "is_electron%": "0", - "openssl_include_dir%": "<(node_root_dir)/include/node" } }] ] @@ -50,7 +46,7 @@ "target_name": "configureLibssh2", "actions": [{ "action_name": "configure", - "action": ["node", "utils/configureLibssh2.js", "<(openssl_include_dir)", "<(is_electron)"], + "action": ["node", "utils/configureLibssh2.js"], "inputs": [""], "outputs": [""] }], diff --git a/utils/configureLibssh2.js b/utils/configureLibssh2.js index 3ee8cd933..befdb4594 100644 --- a/utils/configureLibssh2.js +++ b/utils/configureLibssh2.js @@ -1,5 +1,5 @@ var cp = require("child_process"); -var fse = require('fs-extra'); +var fse = require("fs-extra"); var path = require("path"); const libssh2VendorDirectory = path.resolve(__dirname, "..", "vendor", "libssh2"); @@ -19,27 +19,13 @@ module.exports = function retrieveExternalDependencies() { // Run the `configure` script on Linux return new Promise(function(resolve, reject) { - - var opensslDir = process.argv[2]; - var isElectron = process.argv[3] === "1"; - var opensslIncludes = isElectron ? path.join(opensslDir, "includes") : opensslDir; - var newEnv = {}; Object.keys(process.env).forEach(function(key) { newEnv[key] = process.env[key]; }); - newEnv.CPPFLAGS = newEnv.CPPFLAGS || ""; - newEnv.CPPFLAGS += ` -I${opensslIncludes}`; - newEnv.CPPFLAGS = newEnv.CPPFLAGS.trim(); - - var maybeLibsslPrefix = ""; - if (isElectron) { - maybeLibsslPrefix = ` --with-libssl-prefix=${opensslDir}`; - } - cp.exec( - libssh2ConfigureScript + maybeLibsslPrefix, + libssh2ConfigureScript, { cwd: libssh2VendorDirectory, env: newEnv From 6085c6c3ae661399b1c455cb645bbef2da80d323 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Mon, 7 Jan 2019 16:22:36 -0700 Subject: [PATCH 2/2] Simplify is_electron condition --- generate/templates/templates/binding.gyp | 28 +++++------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 3ba0b1e3d..a0d1a88d9 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -1,29 +1,13 @@ { "conditions": [ ["(OS=='win' and node_root_dir.split('\\\\')[-1].startswith('iojs')) or (OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs'))", { - "conditions": [ - ["OS=='win'", { - "variables": { - "is_electron%": "1", - } - }, { - "variables": { - "is_electron%": "1", - } - }] - ], + "variables": { + "is_electron%": "1", + } }, { - "conditions": [ - ["OS=='win'", { - "variables": { - "is_electron%": "0", - } - }, { - "variables": { - "is_electron%": "0", - } - }] - ] + "variables": { + "is_electron%": "0", + } }] ],