nixpkgs/pkgs/development/libraries/kerberos/krb5.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

120 lines
3.4 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, pkg-config, perl, bison, bootstrap_cmds
2023-03-16 06:38:35 +00:00
, openssl, openldap, libedit, keyutils, libverto
# for passthru.tests
, bind
, curl
2022-07-09 19:13:09 +00:00
, nixosTests
, openssh
, postgresql
, python3
# Extra Arguments
, type ? ""
2018-07-21 02:40:20 +00:00
# This is called "staticOnly" because krb5 does not support
# builting both static and shared, see below.
, staticOnly ? false
2023-03-16 06:38:35 +00:00
, withVerto ? false
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
let
libOnly = type == "lib";
2015-05-28 07:53:47 +00:00
in
stdenv.mkDerivation rec {
2022-02-23 23:29:36 +00:00
pname = "${type}krb5";
2022-12-19 01:06:51 +00:00
version = "1.20.1";
src = fetchurl {
2022-07-07 17:16:53 +00:00
url = "https://kerberos.org/dist/krb5/${lib.versions.majorMinor version}/krb5-${version}.tar.gz";
2022-12-19 01:06:51 +00:00
sha256 = "sha256-cErtSbGetacXizSyhzYg7CmdsIdS1qhXT5XUGHmriFE=";
};
2017-12-17 13:51:32 +00:00
outputs = [ "out" "dev" ];
configureFlags = [ "--localstatedir=/var/lib" ]
2018-07-21 02:40:20 +00:00
# krb5's ./configure does not allow passing --enable-shared and --enable-static at the same time.
# See https://bbs.archlinux.org/viewtopic.php?pid=1576737#p1576737
++ lib.optionals staticOnly [ "--enable-static" "--disable-shared" ]
2023-03-16 06:38:35 +00:00
++ lib.optional withVerto "--with-system-verto"
2022-07-07 17:16:53 +00:00
++ lib.optional stdenv.isFreeBSD ''WARN_CFLAGS=""''
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform)
2017-10-17 21:05:19 +00:00
[ "krb5_cv_attr_constructor_destructor=yes,yes"
"ac_cv_func_regcomp=yes"
"ac_cv_printf_positional=yes"
];
nativeBuildInputs = [ pkg-config perl ]
2022-07-07 17:16:53 +00:00
++ lib.optional (!libOnly) bison
# Provides the mig command used by the build scripts
2022-07-07 17:16:53 +00:00
++ lib.optional stdenv.isDarwin bootstrap_cmds;
buildInputs = [ openssl ]
2022-07-07 17:16:53 +00:00
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "bionic" && !(stdenv.hostPlatform.useLLVM or false)) [ keyutils ]
2023-03-16 06:38:35 +00:00
++ lib.optionals (!libOnly) [ openldap libedit ]
++ lib.optionals withVerto [ libverto ];
2022-07-07 15:25:27 +00:00
sourceRoot = "krb5-${version}/src";
postPatch = ''
substituteInPlace config/shlib.conf \
--replace "'ld " "'${stdenv.cc.targetPrefix}ld "
'';
libFolders = [ "util" "include" "lib" "build-tools" ];
2022-07-07 17:16:53 +00:00
buildPhase = lib.optionalString libOnly ''
runHook preBuild
MAKE="make -j $NIX_BUILD_CORES"
for folder in $libFolders; do
$MAKE -C $folder
done
runHook postBuild
'';
2022-07-07 17:16:53 +00:00
installPhase = lib.optionalString libOnly ''
runHook preInstall
2017-12-17 13:51:32 +00:00
mkdir -p "$out"/{bin,sbin,lib/pkgconfig,share/{et,man/man1}} \
"$dev"/include/{gssapi,gssrpc,kadm5,krb5}
for folder in $libFolders; do
$MAKE -C $folder install
done
runHook postInstall
2017-12-17 13:51:32 +00:00
'';
# not via outputBin, due to reference from libkrb5.so
postInstall = ''
moveToOutput bin/krb5-config "$dev"
'';
2013-03-20 22:36:17 +00:00
enableParallelBuilding = true;
doCheck = false; # fails with "No suitable file for testing purposes"
2022-07-07 17:16:53 +00:00
meta = with lib; {
2013-03-20 22:36:17 +00:00
description = "MIT Kerberos 5";
homepage = "http://web.mit.edu/kerberos/";
license = licenses.mit;
2018-11-22 21:25:05 +00:00
platforms = platforms.unix ++ platforms.windows;
};
2015-03-05 00:48:20 +00:00
2022-07-09 19:13:09 +00:00
passthru = {
implementation = "krb5";
tests = {
inherit (nixosTests) kerberos;
inherit (python3.pkgs) requests-credssp;
bind = bind.override { enableGSSAPI = true; };
curl = curl.override { gssSupport = true; };
openssh = openssh.override { withKerberos = true; };
postgresql = postgresql.override { gssSupport = true; };
};
2022-07-09 19:13:09 +00:00
};
}