From e9e69993b209e6a93a5605378c403c09b9264279 Mon Sep 17 00:00:00 2001 From: Alex Ivanov Date: Thu, 13 Oct 2016 09:36:49 +0300 Subject: [PATCH] swiProlog: fixed for darwin --- .../compilers/swi-prolog/default.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/swi-prolog/default.nix b/pkgs/development/compilers/swi-prolog/default.nix index b6d6388c74b9..79f7e5256b21 100644 --- a/pkgs/development/compilers/swi-prolog/default.nix +++ b/pkgs/development/compilers/swi-prolog/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, gmp, readline, openssl, libjpeg, unixODBC, zlib , libXinerama, libXft, libXpm, libSM, libXt, freetype, pkgconfig -, fontconfig +, fontconfig, makeWrapper ? stdenv.isDarwin }: let @@ -15,7 +15,8 @@ stdenv.mkDerivation { }; buildInputs = [ gmp readline openssl libjpeg unixODBC libXinerama - libXft libXpm libSM libXt zlib freetype pkgconfig fontconfig ]; + libXft libXpm libSM libXt zlib freetype pkgconfig fontconfig ] + ++ stdenv.lib.optional stdenv.isDarwin makeWrapper; hardeningDisable = [ "format" ]; @@ -23,12 +24,24 @@ stdenv.mkDerivation { buildFlags = "world"; + # 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/; description = "A Prolog compiler and interpreter"; license = "LGPL"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.unix; maintainers = [ stdenv.lib.maintainers.peti ]; }; }