Skip to content

Commit 1bcdcdb

Browse files
gitkraken-jacobwianhattendorf
authored andcommitted
make patch system support OS-specific patches
1 parent fc3743c commit 1bcdcdb

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

utils/acquireOpenSSL.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ class HashVerify extends stream.Transform {
4242
}
4343

4444
// currently this only needs to be done on linux
45-
const applyOpenSSLPatches = async (buildCwd) => {
45+
const applyOpenSSLPatches = async (buildCwd, operatingSystem) => {
4646
try {
4747
for (const patchFilename of await fse.readdir(opensslPatchPath)) {
48-
if (patchFilename.split(".").pop() === "patch") {
48+
if (patchFilename.split(".").pop() === "patch" && patchFilename.split("-")[1] === operatingSystem) {
4949
console.log(`applying ${patchFilename}`);
5050
await execPromise(`patch -up0 -i ${path.join(opensslPatchPath, patchFilename)}`, {
5151
cwd: buildCwd
@@ -80,6 +80,8 @@ const buildDarwin = async (buildCwd, macOsDeploymentTarget) => {
8080
cwd: buildCwd
8181
}, { pipeOutput: true });
8282

83+
await applyOpenSSLPatches(buildCwd, "linux");
84+
8385
// only build the libraries, not the tests/fuzzer or apps
8486
await execPromise("make build_libs", {
8587
cwd: buildCwd
@@ -117,7 +119,7 @@ const buildLinux = async (buildCwd) => {
117119
cwd: buildCwd
118120
}, { pipeOutput: true });
119121

120-
await applyOpenSSLPatches(buildCwd);
122+
await applyOpenSSLPatches(buildCwd, "linux");
121123

122124
// only build the libraries, not the tests/fuzzer or apps
123125
await execPromise("make build_libs", {
@@ -136,6 +138,8 @@ const buildLinux = async (buildCwd) => {
136138
};
137139

138140
const buildWin32 = async (buildCwd) => {
141+
await applyOpenSSLPatches(buildCwd, "win32");
142+
139143
const vcvarsallArch = process.arch === "x64" ? "x64" : "x86";
140144
const programFilesPath = (vcvarsallArch === "x64"
141145
? process.env["ProgramFiles(x86)"]

vendor/patches/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ Patches will be applied from 000 to 999
55

66
### Naming Convention
77

8-
`<number 3 digits>-<description>.patch`
8+
`<number 3 digits>-<operating system>-<description>.patch`
9+
10+
Operating system is either "win32", "darwin", or "linux".
911

1012
### Content
1113

vendor/patches/openssl/001-unix_force_getentropy_dso_lookup.patch renamed to vendor/patches/openssl/001-linux-force_getentropy_dso_lookup.patch

File renamed without changes.

0 commit comments

Comments
 (0)