2019-06-16 21:59:06 +02:00
|
|
|
{ stdenv, fetchgit, jdk, gmp, readline, openssl, unixODBC, zlib
|
|
|
|
, libarchive, db, pcre, libedit, libossp_uuid, libXpm
|
2018-08-02 19:36:48 +02:00
|
|
|
, libSM, libXt, freetype, pkgconfig, fontconfig, makeWrapper ? stdenv.isDarwin
|
2019-04-25 16:25:19 +02:00
|
|
|
, git, cacert, cmake, libyaml
|
|
|
|
, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
|
|
|
|
, extraPacks ? []
|
2014-01-13 17:10:11 +01:00
|
|
|
}:
|
2008-03-06 22:53:54 +01:00
|
|
|
|
2011-09-19 18:38:16 +02:00
|
|
|
let
|
2019-04-25 16:25:19 +02:00
|
|
|
version = "8.1.4";
|
|
|
|
packInstall = swiplPath: pack:
|
|
|
|
''${swiplPath}/bin/swipl -g "pack_install(${pack}, [package_directory(\"${swiplPath}/lib/swipl/pack\"), silent(true), interactive(false)])." -t "halt."
|
|
|
|
'';
|
2011-09-19 18:38:16 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2010-12-04 12:16:39 +01:00
|
|
|
name = "swi-prolog-${version}";
|
2008-03-06 22:53:54 +01:00
|
|
|
|
2019-04-25 16:25:19 +02:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/SWI-Prolog/swipl-devel";
|
|
|
|
rev = "V${version}";
|
|
|
|
sha256 = "0qxa6f5dypwczxajlf0l736adbjb17cbak3qsh5g04hpv2bxm6dh";
|
2008-03-06 22:53:54 +01:00
|
|
|
};
|
|
|
|
|
2019-04-25 16:25:19 +02:00
|
|
|
buildInputs = [ cacert git cmake gmp readline openssl
|
|
|
|
libarchive libyaml db pcre libedit libossp_uuid
|
|
|
|
zlib pkgconfig ]
|
|
|
|
++ extraLibraries
|
2016-10-13 08:36:49 +02:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin makeWrapper;
|
2014-01-13 17:10:11 +01:00
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-24 18:10:58 +01:00
|
|
|
|
2018-07-25 23:44:21 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--with-world"
|
|
|
|
"--enable-gmp"
|
|
|
|
"--enable-shared"
|
|
|
|
];
|
2014-01-13 17:10:11 +01:00
|
|
|
|
2019-04-25 16:25:19 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
${cmake}/bin/cmake -DCMAKE_INSTALL_PREFIX=$out ..
|
|
|
|
cd ../
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
make clean
|
|
|
|
mkdir -p $out/lib/swipl/pack
|
|
|
|
''
|
|
|
|
+ builtins.concatStringsSep "\n"
|
|
|
|
( builtins.map (packInstall "$out") extraPacks
|
|
|
|
);
|
2009-12-09 15:07:09 +01:00
|
|
|
|
2016-10-13 08:36:49 +02:00
|
|
|
# For macOS: still not fixed in upstream: "abort trap 6" when called
|
|
|
|
# through symlink, so wrap binary.
|
|
|
|
# We reinvent wrapProgram here but omit argv0 pass in order to not
|
|
|
|
# break PAKCS package build. This is also safe for SWI-Prolog, since
|
|
|
|
# there is no wrapping environment and hence no need to spoof $0
|
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
local prog="$out/bin/swipl"
|
|
|
|
local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
|
|
|
|
mv $prog $hidden
|
|
|
|
makeWrapper $hidden $prog
|
|
|
|
'';
|
|
|
|
|
2008-03-06 22:53:54 +01:00
|
|
|
meta = {
|
|
|
|
homepage = http://www.swi-prolog.org/;
|
2009-11-18 10:39:59 +01:00
|
|
|
description = "A Prolog compiler and interpreter";
|
2008-03-06 22:53:54 +01:00
|
|
|
license = "LGPL";
|
2011-09-19 18:38:16 +02:00
|
|
|
|
2016-10-13 08:36:49 +02:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2019-03-05 12:30:59 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.meditans ];
|
2008-03-06 22:53:54 +01:00
|
|
|
};
|
|
|
|
}
|