| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,25 +6,45 @@ var rooted = function (dir) { | |||
| 6 | 6 | return escapedPathForShell; | |
| 7 | 7 | }; | |
| 8 | 8 | ||
| 9 | + var isWin64 = function() { | ||
| 10 | + return process.platform === "win32" && ( | ||
| 11 | + process.arch === "x64" || | ||
| 12 | + process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432") | ||
| 13 | + ); | ||
| 14 | + }; | ||
| 15 | + | ||
| 9 | 16 | module.exports = function retrieveExternalDependencies() { | |
| 10 | 17 | if (process.platform === "win32") { | |
| 11 | 18 | return Promise.resolve(""); | |
| 12 | 19 | } | |
| 13 | 20 | ||
| 14 | 21 | return new Promise(function(resolve, reject) { | |
| 15 | 22 | console.info("[nodegit] Configuring libssh2."); | |
| 16 | - var opensslDir = rooted("vendor/openssl/openssl"); | ||
| 23 | + var opensslDir; | ||
| 24 | + | ||
| 25 | + if (process.platform === "darwin") { | ||
| 26 | + opensslDir = "/usr/local/opt/openssl@1.1"; | ||
| 27 | + } else if (process.platform === "win32") { | ||
| 28 | + opensslDir = path.join(process.cwd(), "vendor", "win", "openssl"); | ||
| 29 | + } | ||
| 30 | + | ||
| 17 | 31 | var newEnv = {}; | |
| 18 | 32 | Object.keys(process.env).forEach(function(key) { | |
| 19 | 33 | newEnv[key] = process.env[key]; | |
| 20 | 34 | }); | |
| 21 | - newEnv.CPPFLAGS = newEnv.CPPFLAGS || ""; | ||
| 22 | - newEnv.CPPFLAGS += " -I" + path.join(opensslDir, "include"); | ||
| 23 | - newEnv.CPPFLAGS = newEnv.CPPFLAGS.trim(); | ||
| 35 | + | ||
| 36 | + const includeDirName = isWin64() ? "include64" : "include"; | ||
| 37 | + | ||
| 38 | + var maybeLibsslPrefix = ""; | ||
| 39 | + if (opensslDir) { | ||
| 40 | + newEnv.CPPFLAGS = newEnv.CPPFLAGS || ""; | ||
| 41 | + newEnv.CPPFLAGS += " -I" + path.join(opensslDir, includeDirName); | ||
| 42 | + newEnv.CPPFLAGS = newEnv.CPPFLAGS.trim(); | ||
| 43 | + maybeLibsslPrefix = ` --with-libssl-prefix=${opensslDir}`; | ||
| 44 | + } | ||
| 24 | 45 | ||
| 25 | 46 | cp.exec( | |
| 26 | - rooted("vendor/libssh2/configure") + | ||
| 27 | - " --with-libssl-prefix=" + opensslDir, | ||
| 47 | + rooted("vendor/libssh2/configure") + maybeLibsslPrefix, | ||
| 28 | 48 | {cwd: rooted("vendor/libssh2/"), env: newEnv}, | |
| 29 | 49 | function(err, stdout, stderr) { | |
| 30 | 50 | if (err) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments