2019-06-16 19:59:06 +00:00
|
|
|
{ stdenv, fetchgit, jdk, gmp, readline, openssl, unixODBC, zlib
|
|
|
|
, libarchive, db, pcre, libedit, libossp_uuid, libXpm
|
2018-08-02 17:36:48 +00:00
|
|
|
, libSM, libXt, freetype, pkgconfig, fontconfig, makeWrapper ? stdenv.isDarwin
|
2019-04-25 14:25:19 +00:00
|
|
|
, git, cacert, cmake, libyaml
|
2019-10-08 06:59:12 +00:00
|
|
|
, libjpeg, libX11, libXext, libXft, libXinerama
|
2019-04-25 14:25:19 +00:00
|
|
|
, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
|
|
|
|
, extraPacks ? []
|
2019-10-08 06:59:12 +00:00
|
|
|
, withGui ? false
|
2014-01-13 16:10:11 +00:00
|
|
|
}:
|
2008-03-06 21:53:54 +00:00
|
|
|
|
2011-09-19 16:38:16 +00:00
|
|
|
let
|
2019-09-13 15:49:05 +00:00
|
|
|
version = "8.1.15";
|
2019-04-25 14:25:19 +00:00
|
|
|
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 16:38:16 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "swi-prolog";
|
|
|
|
inherit version;
|
2008-03-06 21:53:54 +00:00
|
|
|
|
2019-04-25 14:25:19 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/SWI-Prolog/swipl-devel";
|
|
|
|
rev = "V${version}";
|
2019-09-13 15:49:05 +00:00
|
|
|
sha256 = "0czbrscx2s4079nmwvipp9cnwfny16m3fpnp823llm7wyljchgvq";
|
2008-03-06 21:53:54 +00:00
|
|
|
};
|
|
|
|
|
2019-04-25 14:25:19 +00:00
|
|
|
buildInputs = [ cacert git cmake gmp readline openssl
|
|
|
|
libarchive libyaml db pcre libedit libossp_uuid
|
|
|
|
zlib pkgconfig ]
|
2019-10-08 06:59:12 +00:00
|
|
|
++ stdenv.lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ]
|
2019-04-25 14:25:19 +00:00
|
|
|
++ extraLibraries
|
2016-10-13 06:36:49 +00:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin makeWrapper;
|
2014-01-13 16:10:11 +00:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-24 17:10:58 +00:00
|
|
|
|
2018-07-25 21:44:21 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-world"
|
|
|
|
"--enable-gmp"
|
|
|
|
"--enable-shared"
|
|
|
|
];
|
2014-01-13 16:10:11 +00:00
|
|
|
|
2019-04-25 14:25:19 +00: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 14:07:09 +00:00
|
|
|
|
2016-10-13 06:36:49 +00: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 21:53:54 +00:00
|
|
|
meta = {
|
|
|
|
homepage = http://www.swi-prolog.org/;
|
2009-11-18 09:39:59 +00:00
|
|
|
description = "A Prolog compiler and interpreter";
|
2008-03-06 21:53:54 +00:00
|
|
|
license = "LGPL";
|
2011-09-19 16:38:16 +00:00
|
|
|
|
2019-10-08 06:59:12 +00:00
|
|
|
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.optionals (!withGui) stdenv.lib.platforms.darwin;
|
2019-03-05 11:30:59 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.meditans ];
|
2008-03-06 21:53:54 +00:00
|
|
|
};
|
|
|
|
}
|