From 32cd540d89591b659ebaf7eb8763ede1afb9df71 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sat, 25 Jan 2025 22:02:28 -0800 Subject: [PATCH] rutabaga_gfx: fix building with llvm --- pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch | 20 ++++++++++++++++++++ pkgs/by-name/ru/rutabaga_gfx/package.nix | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch diff --git a/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch b/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch new file mode 100644 index 000000000000..b4672ee10a29 --- /dev/null +++ b/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch @@ -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++"); diff --git a/pkgs/by-name/ru/rutabaga_gfx/package.nix b/pkgs/by-name/ru/rutabaga_gfx/package.nix index 36592007c942..5a5c30b80fa2 100644 --- a/pkgs/by-name/ru/rutabaga_gfx/package.nix +++ b/pkgs/by-name/ru/rutabaga_gfx/package.nix @@ -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