36 lines
859 B
Nix
36 lines
859 B
Nix
{ lib, stdenv, qbe }:
|
|
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";
|
|
version = "0.24";
|
|
src = builtins.fetchGit {
|
|
url = "github.com/hshq/harelang-harec";
|
|
ref = "master";
|
|
rev = "51446fdef8b39df1fbf4fa2644d3f51f020f974a";
|
|
};
|
|
buildInputs = [ qbe ];
|
|
nativeBuildInputs = [ qbe ];
|
|
|
|
makeFlags = [
|
|
"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"
|
|
];
|
|
|
|
postConfigure = ''
|
|
ln -s configs/darwin.mk config.mk
|
|
'';
|
|
})
|