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
, libSM, libXt, freetype, pkgconfig, fontconfig, makeWrapper ? stdenv.isDarwin
, git, cacert, cmake, libyaml
, libSM, libXt, freetype, pkgconfig, fontconfig
, cmake, libyaml, Security
, libjpeg, libX11, libXext, libXft, libXinerama
, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
, extraPacks ? []
@ -18,58 +18,35 @@ stdenv.mkDerivation {
pname = "swi-prolog";
inherit version;
src = fetchgit {
url = "https://github.com/SWI-Prolog/swipl-devel";
src = fetchFromGitHub {
owner = "SWI-Prolog";
repo = "swipl-devel";
rev = "V${version}";
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
zlib pkgconfig ]
zlib ]
++ stdenv.lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ]
++ extraLibraries
++ stdenv.lib.optional stdenv.isDarwin makeWrapper;
++ stdenv.lib.optional stdenv.isDarwin Security;
hardeningDisable = [ "format" ];
configureFlags = [
"--with-world"
"--enable-gmp"
"--enable-shared"
];
cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ];
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"
postInstall = 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.
# 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 = {
homepage = http://www.swi-prolog.org/;
homepage = "https://www.swi-prolog.org";
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;
maintainers = [ stdenv.lib.maintainers.meditans ];

View file

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