nixpkgs/pkgs/development/interpreters/trealla/default.nix

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

95 lines
2.6 KiB
Nix
Raw Normal View History

2023-07-10 16:38:46 +00:00
{ lib
, stdenv
, fetchFromGitHub
, libffi
, openssl
, readline
, valgrind
, xxd
, gitUpdater
2023-07-10 16:38:46 +00:00
, checkLeaks ? false
, enableFFI ? true
, enableSSL ? true
, enableThreads ? true
, lineEditingLibrary ? "isocline"
2023-07-10 16:38:46 +00:00
}:
2021-03-08 05:06:59 +00:00
2023-07-10 16:38:46 +00:00
assert lib.elem lineEditingLibrary [ "isocline" "readline" ];
stdenv.mkDerivation (finalAttrs: {
2021-03-08 05:06:59 +00:00
pname = "trealla";
2023-08-20 00:13:39 +00:00
version = "2.24.21";
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}";
2023-08-20 00:13:39 +00:00
hash = "sha256-zpHdZiDtNcQko+gn92fiGWSvYT4aQ4t6nYFwf6zu0cA=";
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 ?='
'';
2023-07-10 16:38:46 +00:00
nativeBuildInputs = [
xxd
2021-03-08 05:06:59 +00:00
];
2023-07-10 16:38:46 +00:00
buildInputs =
lib.optional enableFFI libffi
++ lib.optional enableSSL openssl
++ lib.optional (lineEditingLibrary == "readline") readline;
nativeCheckInputs = lib.optionals finalAttrs.doCheck [ valgrind ];
2023-07-10 16:38:46 +00:00
strictDeps = true;
2023-07-10 16:38:46 +00:00
makeFlags = [
"GIT_VERSION=\"v${finalAttrs.version}\""
]
++ lib.optional (lineEditingLibrary == "isocline") "ISOCLINE=1"
++ lib.optional (!enableFFI) "NOFFI=1"
++ lib.optional (!enableSSL) "NOSSL=1"
++ lib.optional enableThreads "THREADS=1";
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
2023-07-10 16:38:46 +00:00
checkFlags = [
"test"
] ++ lib.optional checkLeaks "leaks";
passthru.updateScript = gitUpdater { };
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 = "A 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;
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
})