2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromSourcehut
|
|
|
|
, qbe
|
2024-02-29 20:09:43 +00:00
|
|
|
, gitUpdater
|
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-04-21 15:54:59 +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-02-29 20:09:43 +00:00
|
|
|
version = "0.24.0";
|
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;
|
|
|
|
hash = "sha256-NOfoCT/wKZ3CXYzXZq7plXcun+MXQicfzBOmetXN7Qs=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-02-29 20:09:43 +00:00
|
|
|
qbe
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-02-29 20:09:43 +00:00
|
|
|
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-02-29 20:09:43 +00:00
|
|
|
updateScript = gitUpdater { };
|
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;
|
|
|
|
};
|
|
|
|
})
|