2024-06-20 14:57:18 +00:00
|
|
|
{
|
2024-09-19 14:19:46 +00:00
|
|
|
_experimental-update-script-combinators,
|
2024-06-20 14:57:18 +00:00
|
|
|
fetchFromSourcehut,
|
|
|
|
gitUpdater,
|
|
|
|
lib,
|
|
|
|
qbe,
|
|
|
|
stdenv,
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-02-07 01:22:34 +00:00
|
|
|
platform = lib.toLower stdenv.hostPlatform.uname.system;
|
|
|
|
arch = stdenv.hostPlatform.uname.processor;
|
2024-06-20 14:57:18 +00:00
|
|
|
qbePlatform =
|
|
|
|
{
|
|
|
|
x86_64 = "amd64_sysv";
|
|
|
|
aarch64 = "arm64";
|
|
|
|
riscv64 = "rv64";
|
|
|
|
}
|
|
|
|
.${arch};
|
2024-01-02 11:29:13 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "harec";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.24.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~sircmpwn";
|
|
|
|
repo = "harec";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-YCUBdPYr/44stW9k54QoUEhNkti6ULJkVBphx7xhmKo=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeBuildInputs = [ qbe ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
buildInputs = [ qbe ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${builtins.placeholder "out"}"
|
|
|
|
"ARCH=${arch}"
|
2024-02-29 20:09:43 +00:00
|
|
|
"VERSION=${finalAttrs.version}-nixpkgs"
|
2024-04-21 15:54:59 +00:00
|
|
|
"QBEFLAGS=-t${qbePlatform}"
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"AS=${stdenv.cc.targetPrefix}as"
|
|
|
|
"LD=${stdenv.cc.targetPrefix}ld"
|
2024-02-07 01:22:34 +00:00
|
|
|
];
|
|
|
|
|
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 = {
|
2024-09-19 14:19:46 +00:00
|
|
|
updateScript = _experimental-update-script-combinators.sequence (
|
|
|
|
builtins.map (item: item.command) [
|
|
|
|
(gitUpdater {
|
|
|
|
attrPath = "harec";
|
|
|
|
ignoredVersions = [ "-rc[0-9]{1,}" ];
|
|
|
|
})
|
|
|
|
(gitUpdater {
|
|
|
|
attrPath = "hare";
|
|
|
|
url = "https://git.sr.ht/~sircmpwn/hare";
|
|
|
|
ignoredVersions = [ "-rc[0-9]{1,}" ];
|
|
|
|
})
|
|
|
|
]
|
|
|
|
);
|
2024-06-20 14:57:18 +00:00
|
|
|
# To be kept in sync with the hare package.
|
|
|
|
inherit qbe;
|
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
|
2024-06-20 14:57:18 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
})
|