nixpkgs/pkgs/development/interpreters/trealla/default.nix
Ben Siraphob 014968da10 Update pkgs/development/interpreters/trealla/default.nix
Co-authored-by: Gabriel Dougherty <gabrieljosephdougherty@gmail.com>
2023-03-06 12:49:42 -06:00

55 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, readline, openssl, libffi, valgrind, withThread ? true, withSSL ? true, xxd }:
stdenv.mkDerivation rec {
pname = "trealla";
version = "2.8.6";
src = fetchFromGitHub {
owner = "trealla-prolog";
repo = "trealla";
rev = "v${version}";
sha256 = "sha256-0sAPexGKriaJVhBDRsopRYD8xrJAaXZiscCcwfWdEgQ=";
};
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 ];
buildInputs = [ readline openssl libffi ];
checkInputs = lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [ valgrind ];
enableParallelBuilding = true;
installPhase = ''
install -Dm755 -t $out/bin tpl
'';
doCheck = true;
preCheck = ''
# 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
'';
meta = with lib; {
description = "A compact, efficient Prolog interpreter written in ANSI C";
homepage = "https://github.com/trealla-prolog/trealla";
license = licenses.mit;
maintainers = with maintainers; [ siraben ];
mainProgram = "tpl";
platforms = platforms.all;
};
}