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: 2825760665 ("rutabaga_gfx: init at 0.1.2")
This commit is contained in:
Alyssa Ross 2024-05-11 10:38:30 +02:00
parent 0c9055e823
commit 19bb0a96f4
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0

View File

@ -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";