nixpkgs/pkgs/by-name/tr/trealla/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.8 KiB
Nix
Raw Normal View History

2024-05-19 14:49:43 +00:00
{
lib,
fetchFromGitHub,
libffi,
openssl,
readline,
stdenv,
2024-05-19 23:08:42 +00:00
testers,
2024-05-19 14:49:43 +00:00
valgrind,
xxd,
# Boolean flags
checkLeaks ? false,
enableFFI ? true,
enableSSL ? true,
enableThreads ? true,
# Configurable inputs
lineEditingLibrary ? "isocline",
2023-07-10 16:38:46 +00:00
}:
2021-03-08 05:06:59 +00:00
2024-05-19 14:49:43 +00:00
assert lib.elem lineEditingLibrary [
"isocline"
"readline"
];
2023-07-10 16:38:46 +00:00
stdenv.mkDerivation (finalAttrs: {
2021-03-08 05:06:59 +00:00
pname = "trealla";
2024-08-20 08:34:31 +00:00
version = "2.55.22";
2021-03-08 05:06:59 +00:00
src = fetchFromGitHub {
2022-09-25 06:46:46 +00:00
owner = "trealla-prolog";
2021-03-08 05:06:59 +00:00
repo = "trealla";
2023-07-10 16:38:46 +00:00
rev = "v${finalAttrs.version}";
2024-08-20 08:34:31 +00:00
hash = "sha256-qrOVirSJKLF3fzUoD5lxxtj0Uv67WgxEsdG/GNVLZvk=";
2021-03-08 05:06:59 +00:00
};
postPatch = ''
substituteInPlace Makefile \
--replace '-I/usr/local/include' "" \
--replace '-L/usr/local/lib' "" \
--replace 'GIT_VERSION :=' 'GIT_VERSION ?='
'';
2024-05-19 14:49:43 +00:00
nativeBuildInputs = [ xxd ];
2021-03-08 05:06:59 +00:00
2023-07-10 16:38:46 +00:00
buildInputs =
2024-01-24 15:18:00 +00:00
lib.optionals enableFFI [ libffi ]
++ lib.optionals enableSSL [ openssl ]
++ lib.optionals (lineEditingLibrary == "readline") [ readline ];
2023-07-10 16:38:46 +00:00
nativeCheckInputs = lib.optionals finalAttrs.finalPackage.doCheck [ valgrind ];
2023-07-10 16:38:46 +00:00
strictDeps = true;
2023-07-10 16:38:46 +00:00
2024-05-19 14:49:43 +00:00
makeFlags =
[ "GIT_VERSION=\"v${finalAttrs.version}\"" ]
++ lib.optionals (lineEditingLibrary == "isocline") [ "ISOCLINE=1" ]
++ lib.optionals (!enableFFI) [ "NOFFI=1" ]
++ lib.optionals (!enableSSL) [ "NOSSL=1" ]
++ lib.optionals enableThreads [ "THREADS=1" ];
2023-07-10 16:38:46 +00:00
2022-09-25 06:46:46 +00:00
enableParallelBuilding = true;
2021-03-08 05:06:59 +00:00
installPhase = ''
2023-07-10 16:38:46 +00:00
runHook preInstall
2021-03-08 05:06:59 +00:00
install -Dm755 -t $out/bin tpl
2023-07-10 16:38:46 +00:00
runHook postInstall
2021-03-08 05:06:59 +00:00
'';
doCheck = !valgrind.meta.broken;
2021-03-08 05:06:59 +00:00
2024-05-19 14:49:43 +00:00
checkFlags = [ "test" ] ++ lib.optionals checkLeaks [ "leaks" ];
2023-07-10 16:38:46 +00:00
2024-05-19 23:08:42 +00:00
passthru = {
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
version = "v${finalAttrs.version}";
};
};
};
meta = {
2023-07-10 16:38:46 +00:00
homepage = "https://trealla-prolog.github.io/trealla/";
2021-03-08 05:06:59 +00:00
description = "Compact, efficient Prolog interpreter written in ANSI C";
2023-07-10 16:38:46 +00:00
longDescription = ''
Trealla is a compact, efficient Prolog interpreter with ISO Prolog
aspirations.
Trealla is not WAM-based. It uses tree-walking, structure-sharing and
deep-binding. Source is byte-code compiled to an AST that is interpreted
at runtime. The intent and continued aim of Trealla is to be a small,
easily ported, Prolog core.
The name Trealla comes from the Liaden Universe books by Lee & Miller
(where it doesn't seem to mean anything) and also a reference to the
Trealla region of Western Australia.
'';
changelog = "https://github.com/trealla-prolog/trealla/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
2024-05-19 14:49:43 +00:00
maintainers = with lib.maintainers; [
siraben
AndersonTorres
];
mainProgram = "tpl";
2023-07-10 16:38:46 +00:00
platforms = lib.platforms.all;
2023-07-12 00:11:26 +00:00
broken = stdenv.isDarwin && stdenv.isx86_64;
2021-03-08 05:06:59 +00:00
};
2023-07-10 16:38:46 +00:00
})