167 lines
5.3 KiB
Diff
167 lines
5.3 KiB
Diff
From bc552079ad526a8b7da12c091e384d640407c7ea Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
|
|
<jan.christian@gruenhage.xyz>
|
|
Date: Tue, 17 Aug 2021 17:33:02 +0200
|
|
Subject: [PATCH] Fixes compilation on a bunch of targets
|
|
|
|
Considering that this changes generated files, I've not submitted this
|
|
patch directly. Instead, the original source has received a PR over at
|
|
https://github.com/vector-im/element-builder/pull/58.
|
|
---
|
|
package.json | 1 +
|
|
scripts/hak/target.js | 82 +++++++++++++++++++++++++++++++++++++------
|
|
yarn.lock | 2 +-
|
|
3 files changed, 74 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/package.json b/package.json
|
|
index c958137..3b371d2 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -57,6 +57,7 @@
|
|
"allchange": "^1.0.6",
|
|
"asar": "^2.0.1",
|
|
"chokidar": "^3.5.2",
|
|
+ "detect-libc": "^1.0.3",
|
|
"electron": "13.5",
|
|
"electron-builder": "22.11.4",
|
|
"electron-builder-squirrel-windows": "22.11.4",
|
|
diff --git a/scripts/hak/target.js b/scripts/hak/target.js
|
|
index 0a965fc..07349fc 100644
|
|
--- a/scripts/hak/target.js
|
|
+++ b/scripts/hak/target.js
|
|
@@ -25,11 +25,26 @@ limitations under the License.
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.isHost = exports.isHostId = exports.getHost = exports.ENABLED_TARGETS = exports.TARGETS = void 0;
|
|
+const detect_libc_1 = require("detect-libc");
|
|
const aarch64AppleDarwin = {
|
|
id: 'aarch64-apple-darwin',
|
|
platform: 'darwin',
|
|
arch: 'arm64',
|
|
};
|
|
+const x8664AppleDarwin = {
|
|
+ id: 'x86_64-apple-darwin',
|
|
+ platform: 'darwin',
|
|
+ arch: 'x64',
|
|
+};
|
|
+const universalAppleDarwin = {
|
|
+ id: 'universal-apple-darwin',
|
|
+ platform: 'darwin',
|
|
+ arch: 'universal',
|
|
+ subtargets: [
|
|
+ aarch64AppleDarwin,
|
|
+ x8664AppleDarwin,
|
|
+ ],
|
|
+};
|
|
const i686PcWindowsMsvc = {
|
|
id: 'i686-pc-windows-msvc',
|
|
platform: 'win32',
|
|
@@ -42,34 +57,81 @@ const x8664PcWindowsMsvc = {
|
|
arch: 'x64',
|
|
vcVarsArch: 'amd64',
|
|
};
|
|
-const x8664AppleDarwin = {
|
|
- id: 'x86_64-apple-darwin',
|
|
- platform: 'darwin',
|
|
- arch: 'x64',
|
|
-};
|
|
const x8664UnknownLinuxGnu = {
|
|
id: 'x86_64-unknown-linux-gnu',
|
|
platform: 'linux',
|
|
arch: 'x64',
|
|
+ libC: 'glibc',
|
|
+};
|
|
+const x8664UnknownLinuxMusl = {
|
|
+ id: 'x86_64-unknown-linux-musl',
|
|
+ platform: 'linux',
|
|
+ arch: 'x64',
|
|
+ libC: 'musl',
|
|
+};
|
|
+const i686UnknownLinuxGnu = {
|
|
+ id: 'i686-unknown-linux-gnu',
|
|
+ platform: 'linux',
|
|
+ arch: 'ia32',
|
|
+ libC: 'glibc',
|
|
+};
|
|
+const i686UnknownLinuxMusl = {
|
|
+ id: 'i686-unknown-linux-musl',
|
|
+ platform: 'linux',
|
|
+ arch: 'ia32',
|
|
+ libC: 'musl',
|
|
+};
|
|
+const aarch64UnknownLinuxGnu = {
|
|
+ id: 'aarch64-unknown-linux-gnu',
|
|
+ platform: 'linux',
|
|
+ arch: 'arm64',
|
|
+ libC: 'glibc',
|
|
+};
|
|
+const aarch64UnknownLinuxMusl = {
|
|
+ id: 'aarch64-unknown-linux-musl',
|
|
+ platform: 'linux',
|
|
+ arch: 'arm64',
|
|
+ libC: 'musl',
|
|
+};
|
|
+const powerpc64leUnknownLinuxGnu = {
|
|
+ id: 'powerpc64le-unknown-linux-gnu',
|
|
+ platform: 'linux',
|
|
+ arch: 'ppc64',
|
|
+ libC: 'glibc',
|
|
+};
|
|
+const powerpc64leUnknownLinuxMusl = {
|
|
+ id: 'powerpc64le-unknown-linux-musl',
|
|
+ platform: 'linux',
|
|
+ arch: 'ppc64',
|
|
+ libC: 'musl',
|
|
};
|
|
exports.TARGETS = {
|
|
'aarch64-apple-darwin': aarch64AppleDarwin,
|
|
+ 'x86_64-apple-darwin': x8664AppleDarwin,
|
|
+ 'universal-apple-darwin': universalAppleDarwin,
|
|
'i686-pc-windows-msvc': i686PcWindowsMsvc,
|
|
'x86_64-pc-windows-msvc': x8664PcWindowsMsvc,
|
|
- 'x86_64-apple-darwin': x8664AppleDarwin,
|
|
+ 'i686-unknown-linux-musl': i686UnknownLinuxMusl,
|
|
+ 'i686-unknown-linux-gnu': i686UnknownLinuxGnu,
|
|
+ 'x86_64-unknown-linux-musl': x8664UnknownLinuxMusl,
|
|
'x86_64-unknown-linux-gnu': x8664UnknownLinuxGnu,
|
|
+ 'aarch64-unknown-linux-musl': aarch64UnknownLinuxMusl,
|
|
+ 'aarch64-unknown-linux-gnu': aarch64UnknownLinuxGnu,
|
|
+ 'powerpc64le-unknown-linux-musl': powerpc64leUnknownLinuxMusl,
|
|
+ 'powerpc64le-unknown-linux-gnu': powerpc64leUnknownLinuxGnu,
|
|
};
|
|
// The set of targets we build by default, sorted by increasing complexity so
|
|
// that we fail fast when the native host target fails.
|
|
exports.ENABLED_TARGETS = [
|
|
- exports.TARGETS['x86_64-apple-darwin'],
|
|
- exports.TARGETS['aarch64-apple-darwin'],
|
|
+ exports.TARGETS['universal-apple-darwin'],
|
|
exports.TARGETS['x86_64-unknown-linux-gnu'],
|
|
- exports.TARGETS['i686-pc-windows-msvc'],
|
|
+ exports.TARGETS['x86_64-pc-windows-msvc'],
|
|
];
|
|
function getHost() {
|
|
return Object.values(exports.TARGETS).find(target => (target.platform === process.platform &&
|
|
- target.arch === process.arch));
|
|
+ target.arch === process.arch &&
|
|
+ (process.platform !== 'linux' ||
|
|
+ target.libC === detect_libc_1.family)));
|
|
}
|
|
exports.getHost = getHost;
|
|
function isHostId(id) {
|
|
diff --git a/yarn.lock b/yarn.lock
|
|
index ae661ba..782282f 100644
|
|
--- a/yarn.lock
|
|
+++ b/yarn.lock
|
|
@@ -1778,7 +1778,7 @@ deprecation@^2.0.0, deprecation@^2.3.1:
|
|
resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919"
|
|
integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==
|
|
|
|
-detect-libc@^1.0.2:
|
|
+detect-libc@^1.0.2, detect-libc@^1.0.3:
|
|
version "1.0.3"
|
|
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
|
|
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
|
|
--
|
|
2.34.1
|
|
|