| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9bc5b39 commit ad00c9a
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,9 @@ module.exports = function install() { | |||
| 30 | 30 | ||
| 31 | 31 | return new Promise(function(resolve, reject) { | |
| 32 | 32 | const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js"); | |
| 33 | - var spawnedNodePreGyp = spawn(nodePreGyp, args, { | ||
| 33 | + | ||
| 34 | + const nodePreGypPath = path.resolve(path.join(__dirname, "..", "node_modules", "@mapbox", "node-pre-gyp", "bin", nodePreGyp)); | ||
| 35 | + var spawnedNodePreGyp = spawn(nodePreGypPath, args, { | ||
| 34 | 36 | env: { | |
| 35 | 37 | ...process.env, | |
| 36 | 38 | npm_config_node_gyp: gypPath | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,26 @@ const vendorPath = path.resolve(import.meta.dirname, "..", "vendor"); | |||
| 19 | 19 | const opensslPatchPath = path.join(vendorPath, "patches", "openssl"); | |
| 20 | 20 | const extractPath = path.join(vendorPath, "openssl"); | |
| 21 | 21 | ||
| 22 | + const convertArch = (archStr) => { | ||
| 23 | + const convertedArch = { | ||
| 24 | + 'ia32': 'x86', | ||
| 25 | + 'x86': 'x86', | ||
| 26 | + 'x64': 'x64', | ||
| 27 | + 'arm64': 'arm64' | ||
| 28 | + }[archStr]; | ||
| 29 | + | ||
| 30 | + if (!convertedArch) { | ||
| 31 | + throw new Error('unsupported architecture'); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + return convertedArch; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + const hostArch = convertArch(process.arch); | ||
| 38 | + const targetArch = process.env.npm_config_arch | ||
| 39 | + ? convertArch(process.env.npm_config_arch) | ||
| 40 | + : hostArch; | ||
| 41 | + | ||
| 22 | 42 | const pathsToIncludeForPackage = [ | |
| 23 | 43 | "include", "lib" | |
| 24 | 44 | ]; | |
@@ -82,8 +102,10 @@ const buildDarwin = async (buildCwd, macOsDeploymentTarget) => { | |||
| 82 | 102 | throw new Error("Expected macOsDeploymentTarget to be specified"); | |
| 83 | 103 | } | |
| 84 | 104 | ||
| 105 | + const buildConfig = targetArch === "x64" ? "darwin64-x86_64-cc" : "darwin64-arm64-cc"; | ||
| 106 | + | ||
| 85 | 107 | const configureArgs = [ | |
| 86 | - process.arch === "x64" ? "darwin64-x86_64-cc" : "darwin64-arm64-cc", | ||
| 108 | + buildConfig, | ||
| 87 | 109 | // speed up ecdh on little-endian platforms with 128bit int support | |
| 88 | 110 | "enable-ec_nistp_64_gcc_128", | |
| 89 | 111 | // compile static libraries | |
@@ -107,7 +129,7 @@ const buildDarwin = async (buildCwd, macOsDeploymentTarget) => { | |||
| 107 | 129 | ||
| 108 | 130 | await applyOpenSSLPatches(buildCwd, "darwin"); | |
| 109 | 131 | ||
| 110 | - // only build the libraries, not the tests/fuzzer or apps | ||
| 132 | + // only build the libraries, not the fuzzer or apps | ||
| 111 | 133 | await execPromise("make build_libs", { | |
| 112 | 134 | cwd: buildCwd | |
| 113 | 135 | }, { pipeOutput: true }); | |
@@ -123,8 +145,10 @@ const buildDarwin = async (buildCwd, macOsDeploymentTarget) => { | |||
| 123 | 145 | }; | |
| 124 | 146 | ||
| 125 | 147 | const buildLinux = async (buildCwd) => { | |
| 148 | + const buildConfig = targetArch === "x64" ? "linux-x86_64" : "linux-aarch64"; | ||
| 149 | + | ||
| 126 | 150 | const configureArgs = [ | |
| 127 | - "linux-x86_64", | ||
| 151 | + buildConfig, | ||
| 128 | 152 | // Electron(at least on centos7) imports the libcups library at runtime, which has a | |
| 129 | 153 | // dependency on the system libssl/libcrypto which causes symbol conflicts and segfaults. | |
| 130 | 154 | // To fix this we need to hide all the openssl symbols to prevent them from being overridden | |
@@ -146,7 +170,7 @@ const buildLinux = async (buildCwd) => { | |||
| 146 | 170 | ||
| 147 | 171 | await applyOpenSSLPatches(buildCwd, "linux"); | |
| 148 | 172 | ||
| 149 | - // only build the libraries, not the tests/fuzzer or apps | ||
| 173 | + // only build the libraries, not the fuzzer or apps | ||
| 150 | 174 | await execPromise("make build_libs", { | |
| 151 | 175 | cwd: buildCwd | |
| 152 | 176 | }, { pipeOutput: true }); | |
@@ -232,6 +256,11 @@ const buildWin32 = async (buildCwd, vsBuildArch) => { | |||
| 232 | 256 | vcTarget = "VC-WIN32"; | |
| 233 | 257 | break; | |
| 234 | 258 | } | |
| 259 | + | ||
| 260 | + case "arm64": { | ||
| 261 | + vcTarget = "VC-WIN64-ARM"; | ||
| 262 | + break; | ||
| 263 | + } | ||
| 235 | 264 | ||
| 236 | 265 | default: { | |
| 237 | 266 | throw new Error(`Unknown vsBuildArch: ${vsBuildArch}`); | |
@@ -382,15 +411,8 @@ const downloadOpenSSLIfNecessary = async ({ | |||
| 382 | 411 | console.log("Download finished."); | |
| 383 | 412 | } | |
| 384 | 413 | ||
| 385 | - export const getOpenSSLPackageName = () => { | ||
| 386 | - let arch = process.arch; | ||
| 387 | - if (process.platform === "win32" && ( | ||
| 388 | - process.arch === "ia32" || process.env.NODEGIT_VS_BUILD_ARCH === "x86" | ||
| 389 | - )) { | ||
| 390 | - arch = "x86"; | ||
| 391 | - } | ||
| 392 | - | ||
| 393 | - return `openssl-${OPENSSL_VERSION}-${process.platform}-${arch}.tar.gz`; | ||
| 414 | + const getOpenSSLPackageName = () => { | ||
| 415 | + return `openssl-${OPENSSL_VERSION}-${process.platform}-${targetArch}.tar.gz`; | ||
| 394 | 416 | } | |
| 395 | 417 | ||
| 396 | 418 | export const getOpenSSLPackagePath = () => path.join(import.meta.dirname, getOpenSSLPackageName()); | |
@@ -450,18 +472,10 @@ const acquireOpenSSL = async () => { | |||
| 450 | 472 | } | |
| 451 | 473 | } | |
| 452 | 474 | ||
| 453 | - let vsBuildArch; | ||
| 454 | - if (process.platform === "win32") { | ||
| 455 | - vsBuildArch = process.env.NODEGIT_VS_BUILD_ARCH || (process.arch === "x64" ? "x64" : "x86"); | ||
| 456 | - if (!["x64", "x86"].includes(vsBuildArch)) { | ||
| 457 | - throw new Error(`Invalid vsBuildArch: ${vsBuildArch}`); | ||
| 458 | - } | ||
| 459 | - } | ||
| 460 | - | ||
| 461 | 475 | await buildOpenSSLIfNecessary({ | |
| 462 | 476 | openSSLVersion: OPENSSL_VERSION, | |
| 463 | 477 | macOsDeploymentTarget, | |
| 464 | - vsBuildArch | ||
| 478 | + vsBuildArch: process.platform === "win32" ? targetArch : undefined | ||
| 465 | 479 | }); | |
| 466 | 480 | if (process.env.NODEGIT_OPENSSL_BUILD_PACKAGE) { | |
| 467 | 481 | await buildPackage(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -315,13 +315,22 @@ | |||
| 315 | 315 | # Workaround of a strange bug: | |
| 316 | 316 | # TargetMachine + static_library + x64 = nothing. | |
| 317 | 317 | "conditions": [ | |
| 318 | - ["target_arch=='x64'", { | ||
| 319 | - "VCLibrarianTool": { | ||
| 320 | - "AdditionalOptions": [ | ||
| 321 | - "/MACHINE:X64", | ||
| 322 | - ], | ||
| 318 | + [ | ||
| 319 | + "target_arch=='x64'", { | ||
| 320 | + "VCLibrarianTool": { | ||
| 321 | + "AdditionalOptions": [ | ||
| 322 | + "/MACHINE:X64", | ||
| 323 | + ], | ||
| 324 | + }, | ||
| 325 | + }, | ||
| 326 | + "target_arch=='arm64'", { | ||
| 327 | + "VCLibrarianTool": { | ||
| 328 | + "AdditionalOptions": [ | ||
| 329 | + "/MACHINE:ARM64", | ||
| 330 | + ], | ||
| 331 | + }, | ||
| 323 | 332 | }, | |
| 324 | - }, { | ||
| 333 | + { | ||
| 325 | 334 | "VCLibrarianTool": { | |
| 326 | 335 | "AdditionalOptions": [ | |
| 327 | 336 | "/MACHINE:x86", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments