2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromSourcehut
|
|
|
|
, qbe
|
|
|
|
, fetchgit
|
2024-02-07 01:22:34 +00:00
|
|
|
, unstableGitUpdater
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
# harec needs the dbgfile and dbgloc features implemented up to this commit.
|
2024-02-07 01:22:34 +00:00
|
|
|
# This can be dropped once 1.2 is released. For a possible release date, see:
|
2024-01-02 11:29:13 +00:00
|
|
|
# https://lists.sr.ht/~mpu/qbe/%3CZPkmHE9KLohoEohE%40cloudsdale.the-delta.net.eu.org%3E
|
|
|
|
qbe' = qbe.overrideAttrs (_old: {
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "1.1-unstable-2024-01-12";
|
2024-01-02 11:29:13 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "git://c9x.me/qbe.git";
|
2024-02-07 01:22:34 +00:00
|
|
|
rev = "85287081c4a25785dec1ec48c488a5879b3c37ac";
|
|
|
|
hash = "sha256-7bVbxUU/HXJXLtAxhoK0URmPtjGwMSZrPkx8WKl52Mg=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
});
|
2024-02-07 01:22:34 +00:00
|
|
|
|
|
|
|
platform = lib.toLower stdenv.hostPlatform.uname.system;
|
|
|
|
arch = stdenv.hostPlatform.uname.processor;
|
2024-01-02 11:29:13 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "harec";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "0-unstable-2024-01-29";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~sircmpwn";
|
|
|
|
repo = "harec";
|
2024-02-07 01:22:34 +00:00
|
|
|
rev = "f9e17e633845d8d38566b4ea32db0a29ac85d96e";
|
|
|
|
hash = "sha256-Xy9VOcDtbJUz3z6Vk8bqH41VbAFKtJ9fzPGEwVz8KQM=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
qbe'
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
qbe'
|
|
|
|
];
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${builtins.placeholder "out"}"
|
|
|
|
"ARCH=${arch}"
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
strictDeps = true;
|
2024-02-07 01:22:34 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
postConfigure = ''
|
|
|
|
ln -s configs/${platform}.mk config.mk
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
passthru = {
|
|
|
|
# We create this attribute so that the `hare` package can access the
|
|
|
|
# overwritten `qbe`.
|
|
|
|
qbeUnstable = qbe';
|
2024-02-07 01:22:34 +00:00
|
|
|
updateScript = unstableGitUpdater { };
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://harelang.org/";
|
|
|
|
description = "Bootstrapping Hare compiler written in C for POSIX systems";
|
|
|
|
license = lib.licenses.gpl3Only;
|
|
|
|
maintainers = with lib.maintainers; [ onemoresuza ];
|
|
|
|
mainProgram = "harec";
|
|
|
|
# The upstream developers do not like proprietary operating systems; see
|
|
|
|
# https://harelang.org/platforms/
|
|
|
|
# UPDATE: https://github.com/hshq/harelang provides a MacOS port
|
|
|
|
platforms = with lib.platforms;
|
2024-02-07 01:22:34 +00:00
|
|
|
lib.intersectLists (freebsd ++ openbsd ++ linux) (aarch64 ++ x86_64 ++ riscv64);
|
2024-01-02 11:29:13 +00:00
|
|
|
badPlatforms = lib.platforms.darwin;
|
|
|
|
};
|
|
|
|
})
|