diff --git a/pkgs/development/compilers/swi-prolog/default.nix b/pkgs/development/compilers/swi-prolog/default.nix index 1aea771e4996..97b4a627540c 100644 --- a/pkgs/development/compilers/swi-prolog/default.nix +++ b/pkgs/development/compilers/swi-prolog/default.nix @@ -1,22 +1,30 @@ -{ stdenv, fetchurl, jdk, gmp, readline, openssl, libjpeg, unixODBC, zlib +{ stdenv, fetchgit, jdk, gmp, readline, openssl, libjpeg, unixODBC, zlib , libXinerama, libarchive, db, pcre, libedit, libossp_uuid, libXft, libXpm , libSM, libXt, freetype, pkgconfig, fontconfig, makeWrapper ? stdenv.isDarwin +, git, cacert, cmake, libyaml +, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ] +, extraPacks ? [] }: let - version = "7.6.4"; + 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." + ''; in stdenv.mkDerivation { name = "swi-prolog-${version}"; - src = fetchurl { - url = "http://www.swi-prolog.org/download/stable/src/swipl-${version}.tar.gz"; - sha256 = "14bq4sqs61maqpnmgy6687jjj0shwc27cpfsqbf056nrssmplg9d"; + src = fetchgit { + url = "https://github.com/SWI-Prolog/swipl-devel"; + rev = "V${version}"; + sha256 = "0qxa6f5dypwczxajlf0l736adbjb17cbak3qsh5g04hpv2bxm6dh"; }; - buildInputs = [ jdk gmp readline openssl libjpeg unixODBC libXinerama - libarchive db pcre libedit libossp_uuid libXft libXpm libSM libXt - zlib freetype pkgconfig fontconfig ] + buildInputs = [ cacert git cmake gmp readline openssl + libarchive libyaml db pcre libedit libossp_uuid + zlib pkgconfig ] + ++ extraLibraries ++ stdenv.lib.optional stdenv.isDarwin makeWrapper; hardeningDisable = [ "format" ]; @@ -27,7 +35,20 @@ stdenv.mkDerivation { "--enable-shared" ]; - buildFlags = "world"; + 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 + ); # For macOS: still not fixed in upstream: "abort trap 6" when called # through symlink, so wrap binary.