From a971dcf80b0a02ec5ab6f8719d7d88212e452520 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 25 Jun 2025 14:29:09 +0200 Subject: [PATCH] rutabaga_gfx: 0.1.2 -> 0.1.6 Now uses Meson wrapping Cargo. --- .../ru/rutabaga_gfx/darwin-install.patch | 31 ---------- pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch | 20 ------ pkgs/by-name/ru/rutabaga_gfx/package.nix | 61 ++++++------------- 3 files changed, 20 insertions(+), 92 deletions(-) delete mode 100644 pkgs/by-name/ru/rutabaga_gfx/darwin-install.patch delete mode 100644 pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch diff --git a/pkgs/by-name/ru/rutabaga_gfx/darwin-install.patch b/pkgs/by-name/ru/rutabaga_gfx/darwin-install.patch deleted file mode 100644 index 0b68ec2beb85..000000000000 --- a/pkgs/by-name/ru/rutabaga_gfx/darwin-install.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/rutabaga_gfx/ffi/Makefile b/rutabaga_gfx/ffi/Makefile -index f8c7820bf..e88a6c308 100644 ---- a/rutabaga_gfx/ffi/Makefile -+++ b/rutabaga_gfx/ffi/Makefile -@@ -47,24 +47,16 @@ build: - cargo build $(gfxstream_feature) $(release) - - install: build --ifeq ($(UNAME), Linux) - install -D -m 755 $(OUT)/$(LIB_NAME) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) --endif - ifeq ($(UNAME), Darwin) -- install_name_tool -id $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME) -+ install_name_tool -id $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) - endif - - ln -sf $(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION_MAJOR) - ln -sf $(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME) - --ifeq ($(UNAME), Linux) - install -D -m 0644 $(SRC)/share/rutabaga_gfx_ffi.pc $(DESTDIR)$(libdir)/pkgconfig/rutabaga_gfx_ffi.pc - install -D -m 0644 $(SRC)/include/rutabaga_gfx_ffi.h $(DESTDIR)$(includedir)/rutabaga_gfx_ffi.h --endif --ifeq ($(UNAME), Darwin) -- install -m 0644 $(SRC)/share/rutabaga_gfx_ffi.pc $(DESTDIR)$(libdir)/pkgconfig/rutabaga_gfx_ffi.pc -- install -m 0644 $(SRC)/include/rutabaga_gfx_ffi.h $(DESTDIR)$(includedir)/rutabaga_gfx_ffi.h --endif - - clean: - cargo clean $(release) - diff --git a/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch b/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch deleted file mode 100644 index b4672ee10a29..000000000000 --- a/pkgs/by-name/ru/rutabaga_gfx/link-cxx.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 431b60f173f9..90c48333c658 100644 --- a/pkgs/by-name/ru/rutabaga_gfx/package.nix +++ b/pkgs/by-name/ru/rutabaga_gfx/package.nix @@ -2,61 +2,41 @@ lib, stdenv, fetchgit, - fetchpatch, cargo, + meson, + ninja, pkg-config, + rustc, rustPlatform, aemu, gfxstream, libdrm, libiconv, + withGfxstream ? lib.meta.availableOn stdenv.hostPlatform gfxstream, }: stdenv.mkDerivation (finalAttrs: { pname = "rutabaga_gfx"; - version = "0.1.2"; + version = "0.1.6"; src = fetchgit { url = "https://chromium.googlesource.com/crosvm/crosvm"; rev = "v${finalAttrs.version}-rutabaga-release"; fetchSubmodules = true; - hash = "sha256-0RJDKzeU7U6hc6CLKks8QcRs3fxN+/LYUbB0t6W790M="; - }; - - patches = [ - # Make gfxstream optional - # https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4860836 - (fetchpatch { - url = "https://chromium.googlesource.com/crosvm/crosvm/+/c3ad0e43eb12cbf737a6049e0134d483e337363f%5E%21/?format=TEXT"; - decode = "base64 -d"; - hash = "sha256-Ji1bK7jnRlg0OpDfCLcTHfPSiz3zYcdgsWL4n3EoIYI="; - }) - # Fix error in Makefile where it uses eight spaces instead of a tab - # https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4863380 - (fetchpatch { - url = "https://chromium.googlesource.com/crosvm/crosvm/+/fc415bccc43d36f63a2fd4c28878591bb1053450%5E%21/?format=TEXT"; - decode = "base64 -d"; - hash = "sha256-SLzlZ4o1+R2bGTPvA0a5emq97hOIIIHrubFhcQjqYwg="; - }) - # 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; + hash = "sha256-/zeWWL4Mdb/kIJ0J3nky5dastsZUOXm9YTXUjKCDJcY="; }; nativeBuildInputs = [ cargo + meson + ninja pkg-config + rustc rustPlatform.cargoSetupHook ]; buildInputs = [ libiconv ] - ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform gfxstream) ( + ++ lib.optionals withGfxstream ( [ aemu gfxstream @@ -68,25 +48,24 @@ stdenv.mkDerivation (finalAttrs: { cargoDeps = rustPlatform.fetchCargoVendor { inherit (finalAttrs) src; - hash = "sha256-53xCzKuXtnnbS0TWdQrh4Rwy+V+D9soK41ycYd656Uc="; + hash = "sha256-23F0WU//4xvP9xffxr+cQa0m0sSJjcWyz+usKBpDg20="; }; + mesonFlags = [ + (lib.mesonBool "gfxstream" withGfxstream) + ]; + CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec; "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; - postConfigure = '' + preConfigure = '' cd rutabaga_gfx/ffi - substituteInPlace Makefile --replace-fail pkg-config "$PKG_CONFIG" + chmod +x build.sh + patchShebangs build.sh + substituteInPlace build.sh \ + --replace-fail '"$BUILDTYPE"/"$SHARED_LIB"' '${stdenv.hostPlatform.rust.cargoShortTarget}/"$BUILDTYPE"/"$SHARED_LIB"' ''; - # make install always rebuilds - dontBuild = true; - - makeFlags = [ - "prefix=$(out)" - "OUT=target/${stdenv.hostPlatform.rust.cargoShortTarget}/release" - ]; - meta = with lib; { homepage = "https://crosvm.dev/book/appendix/rutabaga_gfx.html"; description = "cross-platform abstraction for GPU and display virtualization";