swiProlog: 9.2.5 -> 9.2.6, update dependencies

This commit is contained in:
Maren van Otterdijk 2024-07-26 21:53:38 +02:00
parent 72bc69dfde
commit e9017cc7f5

View File

@ -1,9 +1,37 @@
{ lib, stdenv, fetchFromGitHub, jdk, gmp, readline, openssl, unixODBC, zlib {
, libarchive, db, pcre2, libedit, libossp_uuid, libxcrypt,libXpm lib, stdenv, fetchFromGitHub,
, libSM, libXt, freetype, pkg-config, fontconfig cmake, ninja,
, cmake, libyaml, Security
, libjpeg, libX11, libXext, libXft, libXinerama libxcrypt, zlib, openssl,
, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ] gmp, gperftools, readline,
libedit, libarchive, Security,
# optional dependencies
withDb ? true,
db,
withJava ? true,
jdk,
withOdbc ? true,
unixODBC,
withPcre ? true,
pcre2,
withPython ? true,
python3,
withYaml ? true,
libyaml,
withGui ? false,
libX11, libXpm, libXext, libXft, libXinerama, libjpeg, libXt, libSM, freetype, fontconfig,
# gcc/g++ as runtime dependency
withNativeCompiler ? true
# Packs must be installed from a local directory during the build, with dependencies # 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: # resolved manually, e.g. to install the 'julian' pack, which depends on the 'delay', 'list_util' and 'typedef' packs:
# julian = pkgs.fetchzip { # julian = pkgs.fetchzip {
@ -30,15 +58,35 @@
# julian delay list_util typedef # julian delay list_util typedef
# ]; }; # ]; };
, extraPacks ? [] , extraPacks ? []
, withGui ? false , extraLibraries ? [] # removed option - see below
}: }:
let let
# minorVersion is even for stable, odd for unstable # minorVersion is even for stable, odd for unstable
version = "9.2.5"; version = "9.2.6";
# This package provides several with* options, which replaces the old extraLibraries option.
# This error should help users that still use this option find their way to these flags.
# We can probably remove this after one NixOS version.
extraLibraries' = if extraLibraries == [] then [] else throw
"option 'extraLibraries' removed - use 'with*' options (e.g., 'withJava'), or overrideAttrs to inject extra build dependencies";
packInstall = swiplPath: pack: packInstall = swiplPath: pack:
''${swiplPath}/bin/swipl -g "pack_install(${pack}, [package_directory(\"${swiplPath}/lib/swipl/pack\"), silent(true), interactive(false)])." -t "halt." ''${swiplPath}/bin/swipl -g "pack_install(${pack}, [package_directory(\"${swiplPath}/lib/swipl/extra-pack\"), silent(true), interactive(false)])." -t "halt."
''; '';
withGui' = withGui && !stdenv.isDarwin;
optionalDependencies = []
++ (lib.optional withDb db)
++ (lib.optional withJava jdk)
++ (lib.optional withOdbc unixODBC)
++ (lib.optional withPcre pcre2)
++ (lib.optional withPython python3)
++ (lib.optional withYaml libyaml)
++ (lib.optionals withGui' [ libXt libXext libXpm libXft libXinerama
libjpeg libSM freetype fontconfig
])
++ (lib.optional stdenv.isDarwin Security)
++ extraLibraries';
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "swi-prolog"; pname = "swi-prolog";
@ -51,30 +99,39 @@ stdenv.mkDerivation {
owner = "SWI-Prolog"; owner = "SWI-Prolog";
repo = "swipl"; repo = "swipl";
rev = "V${version}"; rev = "V${version}";
hash = "sha256-WbpYu6b0WPfKoAOkBZduWK20vwOYuDUDpJuj19qzPtw="; hash = "sha256-FgEn+Ht45++GFpfcdaJ5In5x+NyIOopSlSAs+t7sPDE=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
# Add the packInstall path to the swipl pack search path # Add the packInstall path to the swipl pack search path
postPatch = '' postPatch = ''
echo "user:file_search_path(pack, '$out/lib/swipl/pack')." >> boot/init.pl echo "user:file_search_path(pack, '$out/lib/swipl/extra-pack')." >> boot/init.pl
''; '';
nativeBuildInputs = [ cmake pkg-config ]; nativeBuildInputs = [ cmake ninja ];
buildInputs = [ gmp readline openssl buildInputs = [
libarchive libyaml db pcre2 libedit libossp_uuid libxcrypt libarchive
zlib ] libxcrypt
++ lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ] zlib
++ extraLibraries openssl
++ lib.optional stdenv.isDarwin Security; gperftools
gmp
readline
libedit
] ++ optionalDependencies;
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ]; cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ]
++ lib.optionals (!withNativeCompiler) [
# without these options, the build will embed full compiler paths
"-DSWIPL_CC=${if stdenv.isDarwin then "clang" else "gcc"}"
"-DSWIPL_CXX=${if stdenv.isDarwin then "clang++" else "g++"}"
];
preInstall = '' preInstall = ''
mkdir -p $out/lib/swipl/pack mkdir -p $out/lib/swipl/extra-pack
''; '';
postInstall = builtins.concatStringsSep "\n" postInstall = builtins.concatStringsSep "\n"
@ -87,6 +144,6 @@ stdenv.mkDerivation {
license = lib.licenses.bsd2; license = lib.licenses.bsd2;
mainProgram = "swipl"; mainProgram = "swipl";
platforms = lib.platforms.linux ++ lib.optionals (!withGui) lib.platforms.darwin; platforms = lib.platforms.linux ++ lib.optionals (!withGui) lib.platforms.darwin;
maintainers = [ lib.maintainers.meditans ]; maintainers = [ lib.maintainers.meditans lib.maintainers.matko ];
}; };
} }