From f0ee4a8524218edb81fe0be3fce56b7f15b2dae1 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Thu, 24 Nov 2022 19:02:15 +0100 Subject: lang/rust: fix build on armv7 the same way as for powerpc --- .../rust/files/patch-compiler_rustc__llvm_build.rs | 42 ++++++++++++++++++++++ .../powerpc/patch-compiler_rustc__llvm_build.rs | 29 --------------- 2 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 lang/rust/files/patch-compiler_rustc__llvm_build.rs delete mode 100644 lang/rust/files/powerpc/patch-compiler_rustc__llvm_build.rs (limited to 'lang/rust/files') diff --git a/lang/rust/files/patch-compiler_rustc__llvm_build.rs b/lang/rust/files/patch-compiler_rustc__llvm_build.rs new file mode 100644 index 000000000000..4509c7b9d54c --- /dev/null +++ b/lang/rust/files/patch-compiler_rustc__llvm_build.rs @@ -0,0 +1,42 @@ +From cbeec86a5594ef6ca36d0ea24b4cb7e3dbaded87 Mon Sep 17 00:00:00 2001 +From: pkubaj +Date: Fri, 18 Nov 2022 12:36:49 +0000 +Subject: [PATCH] Fix build on powerpc-unknown-freebsd + +Probably also fixes build on arm and mips*. Related to https://github.com/rust-lang/rust/issues/104220 +--- + compiler/rustc_llvm/build.rs | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs +index d35e4191cc0b1..afdf9ac8883e9 100644 +--- compiler/rustc_llvm/build.rs ++++ compiler/rustc_llvm/build.rs +@@ -237,18 +237,21 @@ fn main() { + + if !is_crossed { + cmd.arg("--system-libs"); +- } else if target.contains("windows-gnu") { +- println!("cargo:rustc-link-lib=shell32"); +- println!("cargo:rustc-link-lib=uuid"); +- } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { +- println!("cargo:rustc-link-lib=z"); +- } else if target.starts_with("arm") ++ } ++ ++ if target.starts_with("arm") + || target.starts_with("mips-") + || target.starts_with("mipsel-") + || target.starts_with("powerpc-") + { + // 32-bit targets need to link libatomic. + println!("cargo:rustc-link-lib=atomic"); ++ println!("cargo:rustc-link-lib=z"); ++ } else if target.contains("windows-gnu") { ++ println!("cargo:rustc-link-lib=shell32"); ++ println!("cargo:rustc-link-lib=uuid"); ++ } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { ++ println!("cargo:rustc-link-lib=z"); + } + cmd.args(&components); + diff --git a/lang/rust/files/powerpc/patch-compiler_rustc__llvm_build.rs b/lang/rust/files/powerpc/patch-compiler_rustc__llvm_build.rs deleted file mode 100644 index efe5542e0e1b..000000000000 --- a/lang/rust/files/powerpc/patch-compiler_rustc__llvm_build.rs +++ /dev/null @@ -1,29 +0,0 @@ ---- compiler/rustc_llvm/build.rs.orig 2022-11-15 08:26:08.366900000 +0100 -+++ compiler/rustc_llvm/build.rs 2022-11-15 08:29:07.101616000 +0100 -@@ -235,20 +235,18 @@ fn main() { - let mut cmd = Command::new(&llvm_config); - cmd.arg(llvm_link_arg).arg("--libs"); - -- if !is_crossed { -+ if target.starts_with("arm") -+ || target.starts_with("powerpc-") -+ { -+ println!("cargo:rustc-link-lib=atomic"); -+ println!("cargo:rustc-link-lib=z"); -+ } else if !is_crossed { - cmd.arg("--system-libs"); - } else if target.contains("windows-gnu") { - println!("cargo:rustc-link-lib=shell32"); - println!("cargo:rustc-link-lib=uuid"); - } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { - println!("cargo:rustc-link-lib=z"); -- } else if target.starts_with("arm") -- || target.starts_with("mips-") -- || target.starts_with("mipsel-") -- || target.starts_with("powerpc-") -- { -- // 32-bit targets need to link libatomic. -- println!("cargo:rustc-link-lib=atomic"); - } - cmd.args(&components); - -- cgit v1.2.3