72 lines
1.4 KiB
Nix
72 lines
1.4 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
makeWrapper,
|
|
scdoc,
|
|
substituteAll,
|
|
qbe,
|
|
harec,
|
|
binutils-unwrapped,
|
|
tzdata
|
|
}:
|
|
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 = "hare";
|
|
version = "0.24";
|
|
src = builtins.fetchGit {
|
|
url = "https://git.sr.ht/~sircmpwn/hare";
|
|
ref = "master";
|
|
rev = "0cd51184a7acdfd4ef20195d1648622b04477293";
|
|
};
|
|
|
|
patches = [
|
|
];
|
|
|
|
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;
|
|
})
|