rutabaga_gfx: fix building with llvm

This commit is contained in:
Tristan Ross
2025-02-03 10:59:58 -08:00
parent d30faab98e
commit 32cd540d89
2 changed files with 27 additions and 0 deletions
@@ -0,0 +1,20 @@
diff --git a/rutabaga_gfx/build.rs b/rutabaga_gfx/build.rs
index bd5a9be96..d2244c4c6 100644
--- a/rutabaga_gfx/build.rs
+++ b/rutabaga_gfx/build.rs
@@ -194,9 +194,14 @@ fn gfxstream() -> Result<()> {
pkg_config::Config::new().probe("libdrm")?;
}
+ let mut use_clang = target_os.contains("macos");
+ if std::env::var("USE_CLANG").is_ok() {
+ use_clang = true;
+ }
+
// Need to link against libc++ or libstdc++. Apple is clang-only, while by default other
// Unix platforms use libstdc++.
- if target_os.contains("macos") {
+ if use_clang {
println!("cargo:rustc-link-lib=dylib=c++");
} else if target_os.contains("linux") || target_os.contains("nto") {
println!("cargo:rustc-link-lib=dylib=stdc++");
+7
View File
@@ -40,8 +40,15 @@ stdenv.mkDerivation (finalAttrs: {
})
# Install the dylib on Darwin.
./darwin-install.patch
# Patch for libc++, drop in next update
# https://chromium.googlesource.com/crosvm/crosvm/+/8ae3c23b2e3899de33b973fc636909f1eb3dc98c
./link-cxx.patch
];
env = lib.optionalAttrs stdenv.hostPlatform.useLLVM {
USE_CLANG = true;
};
nativeBuildInputs = [
cargo
pkg-config