2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, libffi
|
|
|
|
, openssl
|
|
|
|
, readline
|
|
|
|
, valgrind
|
|
|
|
, xxd
|
2023-08-22 20:05:09 +00:00
|
|
|
, gitUpdater
|
2023-07-15 17:15:38 +00:00
|
|
|
, checkLeaks ? false
|
|
|
|
, enableFFI ? true
|
|
|
|
, enableSSL ? true
|
|
|
|
, enableThreads ? true
|
2023-08-22 20:05:09 +00:00
|
|
|
, lineEditingLibrary ? "isocline"
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
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";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "2.34.0";
|
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}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-cqIiPeQO/M8MtpHRomN/fzxIq7TgUwZSvL3PFCVsEnY=";
|
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 =
|
2024-02-07 01:22:34 +00:00
|
|
|
lib.optionals enableFFI [ libffi ]
|
|
|
|
++ lib.optionals enableSSL [ openssl ]
|
|
|
|
++ lib.optionals (lineEditingLibrary == "readline") [ readline ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeCheckInputs = lib.optionals finalAttrs.finalPackage.doCheck [ valgrind ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
strictDeps = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"GIT_VERSION=\"v${finalAttrs.version}\""
|
|
|
|
]
|
2024-02-07 01:22:34 +00:00
|
|
|
++ lib.optionals (lineEditingLibrary == "isocline") [ "ISOCLINE=1" ]
|
|
|
|
++ lib.optionals (!enableFFI) [ "NOFFI=1" ]
|
|
|
|
++ lib.optionals (!enableSSL) [ "NOSSL=1" ]
|
|
|
|
++ lib.optionals enableThreads [ "THREADS=1" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
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"
|
2024-02-07 01:22:34 +00:00
|
|
|
] ++ lib.optionals checkLeaks [ "leaks" ];
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
|
|
|
|
meta = {
|
2023-07-15 17:15:38 +00:00
|
|
|
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
|
|
|
})
|