2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, libffi
|
|
|
|
, openssl
|
|
|
|
, readline
|
|
|
|
, valgrind
|
|
|
|
, xxd
|
|
|
|
, checkLeaks ? false
|
|
|
|
, enableFFI ? true
|
|
|
|
, enableSSL ? true
|
|
|
|
, enableThreads ? true
|
|
|
|
, lineEditingLibrary ? "readline"
|
|
|
|
}:
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
assert lib.elem lineEditingLibrary [ "isocline" "readline" ];
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-03-23 19:22:30 +00:00
|
|
|
pname = "trealla";
|
2023-08-04 22:07:22 +00:00
|
|
|
version = "2.23.35";
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-09-30 11:47:45 +00:00
|
|
|
owner = "trealla-prolog";
|
2021-03-23 19:22:30 +00:00
|
|
|
repo = "trealla";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2023-08-04 22:07:22 +00:00
|
|
|
hash = "sha256-yCVBjxO9tEKlyWo6RlK4EdyUxCkxp0z2EzJ2np0xOUU=";
|
2021-03-23 19:22:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace '-I/usr/local/include' "" \
|
|
|
|
--replace '-L/usr/local/lib' "" \
|
|
|
|
--replace 'GIT_VERSION :=' 'GIT_VERSION ?='
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
xxd
|
2021-03-23 19:22:30 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs =
|
|
|
|
lib.optional enableFFI libffi
|
|
|
|
++ lib.optional enableSSL openssl
|
|
|
|
++ lib.optional (lineEditingLibrary == "readline") readline;
|
|
|
|
|
|
|
|
checkInputs = lib.optionals finalAttrs.doCheck [ valgrind ];
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
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-30 11:47:45 +00:00
|
|
|
enableParallelBuilding = true;
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2023-07-15 17:15:38 +00:00
|
|
|
runHook preInstall
|
2021-03-23 19:22:30 +00:00
|
|
|
install -Dm755 -t $out/bin tpl
|
2023-07-15 17:15:38 +00:00
|
|
|
runHook postInstall
|
2021-03-23 19:22:30 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
doCheck = !valgrind.meta.broken;
|
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
"test"
|
|
|
|
] ++ lib.optional checkLeaks "leaks";
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://trealla-prolog.github.io/trealla/";
|
2021-03-23 19:22:30 +00:00
|
|
|
description = "A compact, efficient Prolog interpreter written in ANSI C";
|
2023-07-15 17:15:38 +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 ];
|
2022-04-27 09:35:20 +00:00
|
|
|
mainProgram = "tpl";
|
2023-07-15 17:15:38 +00:00
|
|
|
platforms = lib.platforms.all;
|
|
|
|
broken = stdenv.isDarwin && stdenv.isx86_64;
|
2021-03-23 19:22:30 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|