64 lines
1.1 KiB
Nix
64 lines
1.1 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
makeWrapper,
|
|
scdoc,
|
|
qbe,
|
|
hare-src,
|
|
harec,
|
|
binutils-unwrapped,
|
|
tzdata
|
|
}:
|
|
let
|
|
arch = stdenv.hostPlatform.uname.processor;
|
|
qbePlatform = {
|
|
x86_64 = "amd64_sysv";
|
|
aarch64 = "arm64";
|
|
riscv64 = "rv64";
|
|
}.${arch};
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "hare";
|
|
version = "0.24";
|
|
src = hare-src;
|
|
|
|
nativeBuildInputs = [
|
|
harec
|
|
makeWrapper
|
|
qbe
|
|
scdoc
|
|
];
|
|
|
|
buildInputs = [
|
|
binutils-unwrapped
|
|
harec
|
|
qbe
|
|
tzdata
|
|
];
|
|
|
|
makeFlags = [
|
|
"HARECACHE=.harecache"
|
|
"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"
|
|
# Strip the variable of an empty $(SRCDIR)/hare/third-party, since nix does
|
|
# not follow the FHS.
|
|
"HAREPATH=$(SRCDIR)/hare/stdlib"
|
|
];
|
|
|
|
postConfigure = ''
|
|
ln -s configs/linux.mk config.mk
|
|
'';
|
|
|
|
postFixup = ''
|
|
wrapProgram $out/bin/hare \
|
|
--prefix PATH : ${lib.makeBinPath [binutils-unwrapped harec qbe]}
|
|
'';
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
})
|