2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, jdk, gmp, readline, openssl, unixODBC, zlib
|
2023-08-22 16:29:03 +00:00
|
|
|
, libarchive, db, pcre2, libedit, libossp_uuid, libxcrypt,libXpm
|
2021-01-19 06:50:56 +00:00
|
|
|
, libSM, libXt, freetype, pkg-config, fontconfig
|
2019-10-15 03:30:00 +00:00
|
|
|
, cmake, libyaml, Security
|
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 ]
|
2021-03-08 05:55:13 +00:00
|
|
|
# Packs must be installed from a local directory during the build, with dependencies
|
|
|
|
# resolved manually, e.g. to install the 'julian' pack, which depends on the 'delay', 'list_util' and 'typedef' packs:
|
|
|
|
# julian = pkgs.fetchzip {
|
|
|
|
# name = "swipl-pack-julian";
|
|
|
|
# url = "https://github.com/mndrix/julian/archive/v0.1.3.zip";
|
|
|
|
# sha256 = "1sgql7c21p3c5m14kwa0bcmlwn9fql612krn9h36gla1j9yjdfgy";
|
|
|
|
# };
|
|
|
|
# delay = pkgs.fetchzip {
|
|
|
|
# name = "swipl-pack-delay";
|
|
|
|
# url = "https://github.com/mndrix/delay/archive/v0.3.3.zip";
|
|
|
|
# sha256 = "0ira87afxnc2dnbbmgwmrr8qvary8lhzvhqwd52dccm6yqd3nybg";
|
|
|
|
# };
|
|
|
|
# list_util = pkgs.fetchzip {
|
|
|
|
# name = "swipl-pack-list_util";
|
|
|
|
# url = "https://github.com/mndrix/list_util/archive/v0.13.0.zip";
|
|
|
|
# sha256 = "0lx7vffflak0y8l8vg8k0g8qddwwn23ksbz02hi3f8rbarh1n89q";
|
|
|
|
# };
|
|
|
|
# typedef = builtins.fetchTarball {
|
|
|
|
# name = "swipl-pack-typedef";
|
|
|
|
# url = "https://raw.githubusercontent.com/samer--/prolog/master/typedef/release/typedef-0.1.9.tgz";
|
|
|
|
# sha256 = "056nqjn01g18fb1b2qivv9s7hb4azk24nx2d4kvkbmm1k91f44p3";
|
|
|
|
# };
|
|
|
|
# swiProlog = pkgs.swiProlog.override { extraPacks = map (dep-path: "'file://${dep-path}'") [
|
|
|
|
# julian delay list_util typedef
|
|
|
|
# ]; };
|
|
|
|
, 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
|
2023-06-23 16:41:59 +00:00
|
|
|
version = "9.1.10";
|
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-10-15 03:30:00 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SWI-Prolog";
|
|
|
|
repo = "swipl-devel";
|
2019-04-25 14:25:19 +00:00
|
|
|
rev = "V${version}";
|
2023-06-23 16:41:59 +00:00
|
|
|
sha256 = "sha256-hr9cI0Ww6RfZs99iM1hFVw4sOYZFZWr8Vzv6dognCTQ=";
|
2019-10-15 03:30:00 +00:00
|
|
|
fetchSubmodules = true;
|
2008-03-06 21:53:54 +00:00
|
|
|
};
|
|
|
|
|
2021-03-08 05:55:13 +00:00
|
|
|
# Add the packInstall path to the swipl pack search path
|
|
|
|
postPatch = ''
|
2021-05-11 19:10:57 +00:00
|
|
|
echo "user:file_search_path(pack, '$out/lib/swipl/pack')." >> boot/init.pl
|
2021-03-08 05:55:13 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2019-10-15 03:30:00 +00:00
|
|
|
|
|
|
|
buildInputs = [ gmp readline openssl
|
2023-08-22 16:29:03 +00:00
|
|
|
libarchive libyaml db pcre2 libedit libossp_uuid libxcrypt
|
2019-10-15 03:30:00 +00:00
|
|
|
zlib ]
|
2021-01-22 11:25:31 +00:00
|
|
|
++ lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ]
|
2019-04-25 14:25:19 +00:00
|
|
|
++ extraLibraries
|
2021-01-22 11:25:31 +00:00
|
|
|
++ lib.optional stdenv.isDarwin Security;
|
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
|
|
|
|
2019-10-15 03:30:00 +00:00
|
|
|
cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ];
|
2014-01-13 16:10:11 +00:00
|
|
|
|
2021-03-08 05:55:13 +00:00
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/lib/swipl/pack
|
|
|
|
'';
|
|
|
|
|
2019-10-15 03:30:00 +00:00
|
|
|
postInstall = builtins.concatStringsSep "\n"
|
2019-04-25 14:25:19 +00:00
|
|
|
( builtins.map (packInstall "$out") extraPacks
|
|
|
|
);
|
2009-12-09 14:07:09 +00:00
|
|
|
|
2008-03-06 21:53:54 +00:00
|
|
|
meta = {
|
2019-10-15 03:30:00 +00:00
|
|
|
homepage = "https://www.swi-prolog.org";
|
2009-11-18 09:39:59 +00:00
|
|
|
description = "A Prolog compiler and interpreter";
|
2021-01-22 11:25:31 +00:00
|
|
|
license = lib.licenses.bsd2;
|
2021-09-08 03:51:03 +00:00
|
|
|
mainProgram = "swipl";
|
2021-01-22 11:25:31 +00:00
|
|
|
platforms = lib.platforms.linux ++ lib.optionals (!withGui) lib.platforms.darwin;
|
|
|
|
maintainers = [ lib.maintainers.meditans ];
|
2008-03-06 21:53:54 +00:00
|
|
|
};
|
|
|
|
}
|