void-packages/srcpkgs/chromium/patches/build-support-musl.patch

79 lines
2.4 KiB
Diff

--- a/build/toolchain/toolchain.gni
+++ b/build/toolchain/toolchain.gni
@@ -51,6 +51,10 @@
}
}
+declare_args() {
+ is_musl = false
+}
+
# Extension for shared library files (including leading dot).
if (is_apple) {
shlib_extension = ".dylib"
--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -185,11 +185,23 @@
rust_abi_target = ""
if (is_linux || is_chromeos) {
if (current_cpu == "arm64") {
- rust_abi_target = "aarch64-unknown-linux-gnu"
+ if (is_musl) {
+ rust_abi_target = "aarch64-unknown-linux-musl"
+ } else {
+ rust_abi_target = "aarch64-unknown-linux-gnu"
+ }
} else if (current_cpu == "x86") {
- rust_abi_target = "i686-unknown-linux-gnu"
+ if (is_musl) {
+ rust_abi_target = "i686-unknown-linux-musl"
+ } else {
+ rust_abi_target = "i686-unknown-linux-gnu"
+ }
} else if (current_cpu == "x64") {
- rust_abi_target = "x86_64-unknown-linux-gnu"
+ if (is_musl) {
+ rust_abi_target = "x86_64-unknown-linux-musl"
+ } else {
+ rust_abi_target = "x86_64-unknown-linux-gnu"
+ }
} else if (current_cpu == "arm") {
if (arm_float_abi == "hard") {
float_suffix = "hf"
@@ -198,15 +210,31 @@
}
if (arm_arch == "armv7-a" || arm_arch == "armv7") {
# No way to inform Rust about the -a suffix.
- rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
+ if (is_musl) {
+ rust_abi_target = "armv7-unknown-linux-musleabi" + float_suffix
+ } else {
+ rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
+ }
} else {
- rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
+ if (is_musl) {
+ rust_abi_target = "arm-unknown-linux-musleabi" + float_suffix
+ } else {
+ rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
+ }
}
} else if (current_cpu == "riscv64") {
- rust_abi_target = "riscv64gc-unknown-linux-gnu"
+ if (is_musl) {
+ rust_abi_target = "riscv64gc-unknown-linux-musl"
+ } else {
+ rust_abi_target = "riscv64gc-unknown-linux-gnu"
+ }
} else {
# Best guess for other future platforms.
- rust_abi_target = current_cpu + "-unknown-linux-gnu"
+ if (is_musl) {
+ rust_abi_target = current_cpu + "-unknown-linux-musl"
+ } else {
+ rust_abi_target = current_cpu + "-unknown-linux-gnu"
+ }
}
} else if (is_android) {
import("//build/config/android/abi.gni")