35 lines
812 B
Nix
35 lines
812 B
Nix
{ stdenv, qbe, hareAs, hareCc, hareLd }:
|
|
let
|
|
arch = stdenv.hostPlatform.uname.processor;
|
|
qbePlatform = {
|
|
x86_64 = "amd64_apple";
|
|
aarch64 = "arm64_apple";
|
|
}.${arch};
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "harec";
|
|
version = "0.24";
|
|
src = builtins.fetchGit {
|
|
url = "https://github.com/hshq/harelang-harec";
|
|
ref = "master";
|
|
rev = "51446fdef8b39df1fbf4fa2644d3f51f020f974a";
|
|
};
|
|
buildInputs = [ qbe ];
|
|
nativeBuildInputs = [ qbe ];
|
|
doCheck = true;
|
|
|
|
makeFlags = [
|
|
"PREFIX=${builtins.placeholder "out"}"
|
|
"ARCH=${arch}"
|
|
"VERSION=${finalAttrs.version}-nixpkgs"
|
|
"QBEFLAGS=-t${qbePlatform}"
|
|
"CC=${hareCc}/bin/hare-cc"
|
|
"AS=${hareAs}/bin/hare-as"
|
|
"LD=${hareLd}/bin/hare-ld"
|
|
];
|
|
|
|
postConfigure = ''
|
|
ln -s configs/darwin.mk config.mk
|
|
'';
|
|
})
|