harec: enable cross-compilation

This commit is contained in:
Coutinho de Souza 2024-03-01 12:40:06 -03:00
parent 1bdb07e199
commit f8b46d2bbd
No known key found for this signature in database
GPG key ID: 59081FCB8F9AABB5

View file

@ -7,6 +7,11 @@
let
platform = lib.toLower stdenv.hostPlatform.uname.system;
arch = stdenv.hostPlatform.uname.processor;
qbePlatform = {
x86_64 = "amd64_sysv";
aarch64 = "arm64";
riscv64 = "rv64";
}.${arch};
in
stdenv.mkDerivation (finalAttrs: {
pname = "harec";
@ -31,6 +36,10 @@ stdenv.mkDerivation (finalAttrs: {
"PREFIX=${builtins.placeholder "out"}"
"ARCH=${arch}"
"VERSION=${finalAttrs.version}-nixpkgs"
"QBEFLAGS=-t${qbePlatform}"
"CC=${stdenv.cc.targetPrefix}cc"
"AS=${stdenv.cc.targetPrefix}as"
"LD=${stdenv.cc.targetPrefix}ld"
];
strictDeps = true;