2023-11-08 01:25:05 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromSourcehut
|
|
|
|
, qbe
|
2024-02-17 22:14:33 +01:00
|
|
|
, gitUpdater
|
2023-11-08 01:25:05 +01:00
|
|
|
}:
|
|
|
|
let
|
2024-02-05 12:26:38 +01:00
|
|
|
platform = lib.toLower stdenv.hostPlatform.uname.system;
|
|
|
|
arch = stdenv.hostPlatform.uname.processor;
|
2024-03-01 16:40:06 +01:00
|
|
|
qbePlatform = {
|
|
|
|
x86_64 = "amd64_sysv";
|
|
|
|
aarch64 = "arm64";
|
|
|
|
riscv64 = "rv64";
|
|
|
|
}.${arch};
|
2023-11-08 01:25:05 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "harec";
|
2024-02-17 22:14:33 +01:00
|
|
|
version = "0.24.0";
|
2023-11-08 01:25:05 +01:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~sircmpwn";
|
|
|
|
repo = "harec";
|
2024-02-17 22:14:33 +01:00
|
|
|
rev = finalAttrs.version;
|
|
|
|
hash = "sha256-NOfoCT/wKZ3CXYzXZq7plXcun+MXQicfzBOmetXN7Qs=";
|
2023-11-08 01:25:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-02-17 22:14:33 +01:00
|
|
|
qbe
|
2023-11-08 01:25:05 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-02-17 22:14:33 +01:00
|
|
|
qbe
|
2023-11-08 01:25:05 +01:00
|
|
|
];
|
|
|
|
|
2024-02-05 12:26:38 +01:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${builtins.placeholder "out"}"
|
|
|
|
"ARCH=${arch}"
|
2024-02-17 22:14:33 +01:00
|
|
|
"VERSION=${finalAttrs.version}-nixpkgs"
|
2024-03-01 16:40:06 +01:00
|
|
|
"QBEFLAGS=-t${qbePlatform}"
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"AS=${stdenv.cc.targetPrefix}as"
|
|
|
|
"LD=${stdenv.cc.targetPrefix}ld"
|
2024-02-05 12:26:38 +01:00
|
|
|
];
|
|
|
|
|
2023-11-08 01:25:05 +01:00
|
|
|
strictDeps = true;
|
2024-02-05 12:26:38 +01:00
|
|
|
|
2023-11-08 01:25:05 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2024-02-05 12:26:38 +01:00
|
|
|
postConfigure = ''
|
|
|
|
ln -s configs/${platform}.mk config.mk
|
|
|
|
'';
|
|
|
|
|
2023-11-08 01:25:05 +01:00
|
|
|
passthru = {
|
2024-02-17 22:14:33 +01:00
|
|
|
updateScript = gitUpdater { };
|
2023-11-08 01:25:05 +01: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-05 12:26:38 +01:00
|
|
|
lib.intersectLists (freebsd ++ openbsd ++ linux) (aarch64 ++ x86_64 ++ riscv64);
|
2023-11-08 01:25:05 +01:00
|
|
|
badPlatforms = lib.platforms.darwin;
|
|
|
|
};
|
|
|
|
})
|