From 19bb0a96f41e639ea0b33dc92f9caa94d27e5a38 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 11 May 2024 10:38:30 +0200 Subject: [PATCH] rutabaga_gfx: build for the right architecture Previously, cross compiling rutabaga_gfx looked like it worked, but it produced binaries for the build machine. This prevented cross-compiling QEMU with rutabaga_gfx support enabled. Fixes: 28257606653c ("rutabaga_gfx: init at 0.1.2") --- .../libraries/rutabaga_gfx/default.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/rutabaga_gfx/default.nix b/pkgs/development/libraries/rutabaga_gfx/default.nix index 687500272735..9b8f5bec42f3 100644 --- a/pkgs/development/libraries/rutabaga_gfx/default.nix +++ b/pkgs/development/libraries/rutabaga_gfx/default.nix @@ -54,14 +54,22 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-wuF3Isrp+u5J8jPQoPsIOWYGNKLSNa2pLfvladAWkLs="; }; + CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec; + "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER" = + "${stdenv.cc.targetPrefix}cc"; + + postConfigure = '' + cd rutabaga_gfx/ffi + substituteInPlace Makefile --replace-fail pkg-config "$PKG_CONFIG" + ''; + # make install always rebuilds dontBuild = true; - makeFlags = [ "prefix=$(out)" ]; - - preInstall = '' - cd rutabaga_gfx/ffi - ''; + makeFlags = [ + "prefix=$(out)" + "OUT=target/${stdenv.hostPlatform.rust.cargoShortTarget}/release" + ]; meta = with lib; { homepage = "https://crosvm.dev/book/appendix/rutabaga_gfx.html";