1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
{
lib,
fetchFromGitHub,
libffi,
openssl,
readline,
stdenv,
testers,
valgrind,
xxd,
# Boolean flags
checkLeaks ? false,
enableFFI ? true,
enableSSL ? true,
enableThreads ? true,
# Configurable inputs
lineEditingLibrary ? "isocline",
}:
assert lib.elem lineEditingLibrary [
"isocline"
"readline"
];
stdenv.mkDerivation (finalAttrs: {
pname = "trealla";
version = "2.53.48";
src = fetchFromGitHub {
owner = "trealla-prolog";
repo = "trealla";
rev = "v${finalAttrs.version}";
hash = "sha256-yxx4Mi1CrgFWIWbRq2wsNs6D7OL1OkeA4QyTYf158aU=";
};
postPatch = ''
substituteInPlace Makefile \
--replace '-I/usr/local/include' "" \
--replace '-L/usr/local/lib' "" \
--replace 'GIT_VERSION :=' 'GIT_VERSION ?='
'';
nativeBuildInputs = [ xxd ];
buildInputs =
lib.optionals enableFFI [ libffi ]
++ lib.optionals enableSSL [ openssl ]
++ lib.optionals (lineEditingLibrary == "readline") [ readline ];
nativeCheckInputs = lib.optionals finalAttrs.finalPackage.doCheck [ valgrind ];
strictDeps = true;
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" ];
enableParallelBuilding = true;
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin tpl
runHook postInstall
'';
doCheck = !valgrind.meta.broken;
checkFlags = [ "test" ] ++ lib.optionals checkLeaks [ "leaks" ];
passthru = {
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
version = "v${finalAttrs.version}";
};
};
};
meta = {
homepage = "https://trealla-prolog.github.io/trealla/";
description = "Compact, efficient Prolog interpreter written in ANSI C";
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";
platforms = lib.platforms.all;
broken = stdenv.isDarwin && stdenv.isx86_64;
};
})
|