17 lineEditingLibrary ? "isocline",
20 assert lib.elem lineEditingLibrary [
24 stdenv.mkDerivation (finalAttrs: {
28 src = fetchFromGitHub {
29 owner = "trealla-prolog";
31 rev = "v${finalAttrs.version}";
32 hash = "sha256-ajTEagfMWiwJYZ1spKeamyeB1Rc7SeORUSWZO0fg408=";
36 substituteInPlace Makefile \
37 --replace '-I/usr/local/include' "" \
38 --replace '-L/usr/local/lib' "" \
39 --replace 'GIT_VERSION :=' 'GIT_VERSION ?='
42 nativeBuildInputs = [ xxd ];
45 lib.optionals enableFFI [ libffi ]
46 ++ lib.optionals enableSSL [ openssl ]
47 ++ lib.optionals (lineEditingLibrary == "readline") [ readline ];
49 nativeCheckInputs = lib.optionals finalAttrs.finalPackage.doCheck [ valgrind ];
54 [ "GIT_VERSION=\"v${finalAttrs.version}\"" ]
55 ++ lib.optionals (lineEditingLibrary == "isocline") [ "ISOCLINE=1" ]
56 ++ lib.optionals (!enableFFI) [ "NOFFI=1" ]
57 ++ lib.optionals (!enableSSL) [ "NOSSL=1" ]
58 ++ lib.optionals enableThreads [ "THREADS=1" ];
60 enableParallelBuilding = true;
64 install -Dm755 -t $out/bin tpl
68 doCheck = !valgrind.meta.broken;
70 checkFlags = [ "test" ] ++ lib.optionals checkLeaks [ "leaks" ];
74 version = testers.testVersion {
75 package = finalAttrs.finalPackage;
76 version = "v${finalAttrs.version}";
82 homepage = "https://trealla-prolog.github.io/trealla/";
83 description = "Compact, efficient Prolog interpreter written in ANSI C";
85 Trealla is a compact, efficient Prolog interpreter with ISO Prolog
87 Trealla is not WAM-based. It uses tree-walking, structure-sharing and
88 deep-binding. Source is byte-code compiled to an AST that is interpreted
89 at runtime. The intent and continued aim of Trealla is to be a small,
90 easily ported, Prolog core.
91 The name Trealla comes from the Liaden Universe books by Lee & Miller
92 (where it doesn't seem to mean anything) and also a reference to the
93 Trealla region of Western Australia.
95 changelog = "https://github.com/trealla-prolog/trealla/releases/tag/v${finalAttrs.version}";
96 license = lib.licenses.mit;
97 maintainers = with lib.maintainers; [
102 platforms = lib.platforms.all;
103 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;