Unverified Commit 5cfabd15 authored by Tristan Ross's avatar Tristan Ross Committed by GitHub
Browse files

rutabaga_gfx: fix building with llvm (#376889)

parents cc845261 32cd540d
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
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 −0
Original line number Diff line number Diff line
@@ -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