2023-02-16 17:41:37 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, readline, openssl, libffi, valgrind, withThread ? true, withSSL ? true, xxd }:
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "trealla";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "2.8.6";
|
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";
|
|
|
|
rev = "v${version}";
|
2023-03-04 12:14:45 +00:00
|
|
|
sha256 = "sha256-0sAPexGKriaJVhBDRsopRYD8xrJAaXZiscCcwfWdEgQ=";
|
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 ?='
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"GIT_VERSION=\"v${version}\""
|
|
|
|
(lib.optionalString withThread "THREADS=1")
|
|
|
|
(lib.optionalString (!withSSL) "NOSSL=1")
|
|
|
|
(lib.optionalString stdenv.isDarwin "NOLDLIBS=1")
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ xxd ];
|
2022-09-30 11:47:45 +00:00
|
|
|
buildInputs = [ readline openssl libffi ];
|
2023-03-08 16:32:21 +00:00
|
|
|
checkInputs = lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [ valgrind ];
|
2022-09-30 11:47:45 +00:00
|
|
|
enableParallelBuilding = true;
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 -t $out/bin tpl
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
preCheck = ''
|
2022-09-30 11:47:45 +00:00
|
|
|
# Disable tests due to floating point error
|
|
|
|
rm tests/issues-OLD/test081.pl
|
|
|
|
rm tests/issues-OLD/test585.pl
|
|
|
|
# Disable test due to Unicode issues
|
|
|
|
rm tests/issues-OLD/test252.pl
|
2021-03-23 19:22:30 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A compact, efficient Prolog interpreter written in ANSI C";
|
2022-09-30 11:47:45 +00:00
|
|
|
homepage = "https://github.com/trealla-prolog/trealla";
|
2021-03-23 19:22:30 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ siraben ];
|
2022-04-27 09:35:20 +00:00
|
|
|
mainProgram = "tpl";
|
2021-03-23 19:22:30 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|