| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 39e7621 commit 38d64f2
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ | |||
| 3 | 3 | "is_electron%": "<!(node ./utils/isBuildingForElectron.js <(node_root_dir))", | |
| 4 | 4 | "is_IBMi%": "<!(node -p \"os.platform() == 'aix' && os.type() == 'OS400' ? 1 : 0\")", | |
| 5 | 5 | "electron_openssl_root%": "<!(node ./utils/getElectronOpenSSLRoot.js <(module_root_dir))", | |
| 6 | + "electron_openssl_static%": "<!(node -p \"process.platform !== 'linux' || process.env.NODEGIT_OPENSSL_STATIC_LINK === '1' ? 1 : 0\")", | ||
| 6 | 7 | "macOS_deployment_target": "10.11" | |
| 7 | 8 | }, | |
| 8 | 9 | ||
@@ -175,15 +176,21 @@ | |||
| 175 | 176 | "-std=c++14" | |
| 176 | 177 | ], | |
| 177 | 178 | "conditions": [ | |
| 178 | - ["<(is_electron) == 1", { | ||
| 179 | + ["<(is_electron) == 1 and <(electron_openssl_static) == 1", { | ||
| 179 | 180 | "include_dirs": [ | |
| 180 | 181 | "<(electron_openssl_root)/include" | |
| 181 | 182 | ], | |
| 182 | 183 | "libraries": [ | |
| 183 | - # this order is signifcant on centos7 apparently... | ||
| 184 | + # this order is significant on centos7 apparently... | ||
| 184 | 185 | "<(electron_openssl_root)/lib/libssl.a", | |
| 185 | 186 | "<(electron_openssl_root)/lib/libcrypto.a" | |
| 186 | 187 | ] | |
| 188 | + }], | ||
| 189 | + ["<(is_electron) == 1 and <(electron_openssl_static) != 1", { | ||
| 190 | + "libraries": [ | ||
| 191 | + "-lcrypto", | ||
| 192 | + "-lssl" | ||
| 193 | + ] | ||
| 187 | 194 | }] | |
| 188 | 195 | ], | |
| 189 | 196 | }], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,7 +65,7 @@ npm install nodegit --msvs_version=2013 | |||
| 65 | 65 | ``` | |
| 66 | 66 | ||
| 67 | 67 | ### Electron and OpenSSL ### | |
| 68 | - A local version of OpenSSL is required when building for Electron on Windows and macOS. This is due to Electron using BoringSSL, as we are not able to link to it like we are OpenSSL in Node. | ||
| 68 | + A local version of OpenSSL is required when building for Electron on Windows and macOS. This is due to Electron using BoringSSL, as we are not able to link to it like we are OpenSSL in Node. Additionally, OpenSSL can be statically linked on Linux by setting the `NODEGIT_OPENSSL_STATIC_LINK` environment variable to `1`. | ||
| 69 | 69 | ||
| 70 | 70 | `acquireOpenSSL.js` will attempt to download and build OpenSSL locally. On macOS, this should Just Work(tm). On Windows, things are a little trickier. | |
| 71 | 71 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -196,6 +196,16 @@ const makeOnStreamDownloadProgress = () => { | |||
| 196 | 196 | }; | |
| 197 | 197 | ||
| 198 | 198 | const buildOpenSSLIfNecessary = async (openSSLVersion, macOsDeploymentTarget) => { | |
| 199 | + if (process.platform !== "darwin" && process.platform !== "win32" && process.platform !== 'linux') { | ||
| 200 | + console.log(`Skipping OpenSSL build, not required on ${process.platform}`); | ||
| 201 | + return; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + if (process.platform === 'linux' && process.env.NODEGIT_OPENSSL_STATIC_LINK !== '1') { | ||
| 205 | + console.log(`Skipping OpenSSL build, NODEGIT_OPENSSL_STATIC_LINK !== 1`); | ||
| 206 | + return; | ||
| 207 | + } | ||
| 208 | + | ||
| 199 | 209 | await removeOpenSSLIfOudated(openSSLVersion); | |
| 200 | 210 | ||
| 201 | 211 | try { | |
@@ -225,7 +235,7 @@ const buildOpenSSLIfNecessary = async (openSSLVersion, macOsDeploymentTarget) => | |||
| 225 | 235 | ||
| 226 | 236 | if (process.platform === "darwin") { | |
| 227 | 237 | await buildDarwin(buildCwd, macOsDeploymentTarget); | |
| 228 | - } else if (process.platform === "linux") { | ||
| 238 | + } else if (process.platform === "linux" && process.env.NODEGIT_OPENSSL_STATIC_LINK === '1') { | ||
| 229 | 239 | await buildLinux(buildCwd); | |
| 230 | 240 | } else if (process.platform === "win32") { | |
| 231 | 241 | await buildWin32(buildCwd); | |
@@ -237,6 +247,16 @@ const buildOpenSSLIfNecessary = async (openSSLVersion, macOsDeploymentTarget) => | |||
| 237 | 247 | } | |
| 238 | 248 | ||
| 239 | 249 | const downloadOpenSSLIfNecessary = async (downloadBinUrl, maybeDownloadSha256) => { | |
| 250 | + if (process.platform !== "darwin" && process.platform !== "win32" && process.platform !== 'linux') { | ||
| 251 | + console.log(`Skipping OpenSSL download, not required on ${process.platform}`); | ||
| 252 | + return; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + if (process.platform === 'linux' && process.env.NODEGIT_OPENSSL_STATIC_LINK !== '1') { | ||
| 256 | + console.log(`Skipping OpenSSL download, NODEGIT_OPENSSL_STATIC_LINK !== 1`); | ||
| 257 | + return; | ||
| 258 | + } | ||
| 259 | + | ||
| 240 | 260 | try { | |
| 241 | 261 | await fs.stat(extractPath); | |
| 242 | 262 | console.log("Skipping OpenSSL download, dir exists"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,9 +25,11 @@ module.exports = function retrieveExternalDependencies() { | |||
| 25 | 25 | newEnv[key] = process.env[key]; | |
| 26 | 26 | }); | |
| 27 | 27 | ||
| 28 | - let cpArgs = `--with-libssl-prefix=${opensslVendorDirectory}`; | ||
| 28 | + let cpArgs = process.env.NODEGIT_OPENSSL_STATIC_LINK === '1' | ||
| 29 | + ? ` --with-libssl-prefix=${opensslVendorDirectory}` | ||
| 30 | + : ''; | ||
| 29 | 31 | cp.exec( | |
| 30 | - `${libssh2ConfigureScript} ${cpArgs}`, | ||
| 32 | + `${libssh2ConfigureScript}${cpArgs}`, | ||
| 31 | 33 | { | |
| 32 | 34 | cwd: libssh2VendorDirectory, | |
| 33 | 35 | env: newEnv | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ | |||
| 11 | 11 | "is_clang%": 0, | |
| 12 | 12 | "is_IBMi%": "<!(node -p \"os.platform() == 'aix' && os.type() == 'OS400' ? 1 : 0\")", | |
| 13 | 13 | "electron_openssl_root%": "<!(node ../utils/getElectronOpenSSLRoot.js <(module_root_dir))", | |
| 14 | + "electron_openssl_static%": "<!(node -p \"process.platform !== 'linux' || process.env.NODEGIT_OPENSSL_STATIC_LINK === '1' ? 1 : 0\")", | ||
| 14 | 15 | }, | |
| 15 | 16 | "targets": [ | |
| 16 | 17 | { | |
@@ -362,7 +363,7 @@ | |||
| 362 | 363 | }], | |
| 363 | 364 | ["OS=='mac' or OS=='linux' or OS.endswith('bsd') or <(is_IBMi) == 1", { | |
| 364 | 365 | "conditions": [ | |
| 365 | - ["<(is_electron) == 1", { | ||
| 366 | + ["<(is_electron) == 1 and <(electron_openssl_static) == 1", { | ||
| 366 | 367 | "include_dirs": [ | |
| 367 | 368 | "<(electron_openssl_root)/include" | |
| 368 | 369 | ] | |
@@ -622,7 +623,7 @@ | |||
| 622 | 623 | "conditions": [ | |
| 623 | 624 | ["OS=='mac' or OS=='linux' or OS.endswith('bsd') or <(is_IBMi) == 1", { | |
| 624 | 625 | "conditions": [ | |
| 625 | - ["<(is_electron) == 1", { | ||
| 626 | + ["<(is_electron) == 1 and <(electron_openssl_static) == 1", { | ||
| 626 | 627 | "include_dirs": [ | |
| 627 | 628 | "<(electron_openssl_root)/include" | |
| 628 | 629 | ] | |
@@ -702,7 +703,7 @@ | |||
| 702 | 703 | }], | |
| 703 | 704 | ["OS=='linux'", { | |
| 704 | 705 | "conditions": [ | |
| 705 | - ["<(is_electron) == 1", { | ||
| 706 | + ["<(is_electron) == 1 and <(electron_openssl_static) == 1", { | ||
| 706 | 707 | "include_dirs": ["<(electron_openssl_root)/include"] | |
| 707 | 708 | }] | |
| 708 | 709 | ], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments