swiProlog: fix build on darwin

This commit is contained in:
Mario Rodas 2019-10-14 22:30:00 -05:00
parent a388e920f3
commit ed79857170
No known key found for this signature in database
GPG Key ID: 4C4BEFD7B18DC5E8
2 changed files with 21 additions and 41 deletions

View File

@ -1,7 +1,7 @@
{ stdenv, fetchgit, jdk, gmp, readline, openssl, unixODBC, zlib { stdenv, fetchFromGitHub, jdk, gmp, readline, openssl, unixODBC, zlib
, libarchive, db, pcre, libedit, libossp_uuid, libXpm , libarchive, db, pcre, libedit, libossp_uuid, libXpm
, libSM, libXt, freetype, pkgconfig, fontconfig, makeWrapper ? stdenv.isDarwin , libSM, libXt, freetype, pkgconfig, fontconfig
, git, cacert, cmake, libyaml , cmake, libyaml, Security
, libjpeg, libX11, libXext, libXft, libXinerama , libjpeg, libX11, libXext, libXft, libXinerama
, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ] , extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
, extraPacks ? [] , extraPacks ? []
@ -18,58 +18,35 @@ stdenv.mkDerivation {
pname = "swi-prolog"; pname = "swi-prolog";
inherit version; inherit version;
src = fetchgit { src = fetchFromGitHub {
url = "https://github.com/SWI-Prolog/swipl-devel"; owner = "SWI-Prolog";
repo = "swipl-devel";
rev = "V${version}"; rev = "V${version}";
sha256 = "0czbrscx2s4079nmwvipp9cnwfny16m3fpnp823llm7wyljchgvq"; sha256 = "0czbrscx2s4079nmwvipp9cnwfny16m3fpnp823llm7wyljchgvq";
fetchSubmodules = true;
}; };
buildInputs = [ cacert git cmake gmp readline openssl nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ gmp readline openssl
libarchive libyaml db pcre libedit libossp_uuid libarchive libyaml db pcre libedit libossp_uuid
zlib pkgconfig ] zlib ]
++ stdenv.lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ] ++ stdenv.lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ]
++ extraLibraries ++ extraLibraries
++ stdenv.lib.optional stdenv.isDarwin makeWrapper; ++ stdenv.lib.optional stdenv.isDarwin Security;
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
configureFlags = [ cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ];
"--with-world"
"--enable-gmp"
"--enable-shared"
];
installPhase = '' postInstall = builtins.concatStringsSep "\n"
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 ( builtins.map (packInstall "$out") extraPacks
); );
# 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
'';
meta = { meta = {
homepage = http://www.swi-prolog.org/; homepage = "https://www.swi-prolog.org";
description = "A Prolog compiler and interpreter"; description = "A Prolog compiler and interpreter";
license = "LGPL"; license = stdenv.lib.licenses.bsd2;
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.optionals (!withGui) stdenv.lib.platforms.darwin; platforms = stdenv.lib.platforms.linux ++ stdenv.lib.optionals (!withGui) stdenv.lib.platforms.darwin;
maintainers = [ stdenv.lib.maintainers.meditans ]; maintainers = [ stdenv.lib.maintainers.meditans ];

View File

@ -8540,8 +8540,11 @@ in
swift = callPackage ../development/compilers/swift { }; swift = callPackage ../development/compilers/swift { };
swiProlog = callPackage ../development/compilers/swi-prolog { }; swiProlog = callPackage ../development/compilers/swi-prolog {
swiPrologWithGui = callPackage ../development/compilers/swi-prolog { withGui = true; }; openssl = openssl_1_0_2;
inherit (darwin.apple_sdk.frameworks) Security;
};
swiPrologWithGui = swiProlog.override { withGui = true; };
tbb = callPackage ../development/libraries/tbb { }; tbb = callPackage ../development/libraries/tbb { };