2015-05-28 08:53:47 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, perl
|
|
|
|
, yacc, bootstrap_cmds
|
2009-11-06 12:57:29 +00:00
|
|
|
|
2015-05-28 08:53:47 +01:00
|
|
|
# Optional Dependencies
|
|
|
|
, libedit ? null, readline ? null, ncurses ? null, libverto ? null
|
2015-05-29 18:12:00 +01:00
|
|
|
, openldap ? null
|
2015-05-28 08:53:47 +01:00
|
|
|
|
|
|
|
# Crypto Dependencies
|
|
|
|
, openssl ? null, nss ? null, nspr ? null
|
|
|
|
|
|
|
|
# Extra Arguments
|
|
|
|
, prefix ? ""
|
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv;
|
2009-11-06 12:57:29 +00:00
|
|
|
let
|
2015-05-28 08:53:47 +01:00
|
|
|
libOnly = prefix == "lib";
|
|
|
|
|
|
|
|
optOpenssl = shouldUsePkg openssl;
|
|
|
|
optNss = shouldUsePkg nss;
|
|
|
|
optNspr = shouldUsePkg nspr;
|
|
|
|
optLibedit = if libOnly then null else shouldUsePkg libedit;
|
|
|
|
optReadline = if libOnly then null else shouldUsePkg readline;
|
|
|
|
optNcurses = if libOnly then null else shouldUsePkg ncurses;
|
|
|
|
optLibverto = shouldUsePkg libverto;
|
|
|
|
optOpenldap = if libOnly then null else shouldUsePkg openldap;
|
|
|
|
|
|
|
|
# Prefer the openssl implementation
|
|
|
|
cryptoStr = if optOpenssl != null then "openssl"
|
|
|
|
else if optNss != null && optNspr != null then "nss"
|
|
|
|
else "builtin";
|
|
|
|
|
|
|
|
cryptoInputs = {
|
|
|
|
"openssl" = [ optOpenssl ];
|
|
|
|
"nss" = [ optNss optNspr ];
|
|
|
|
"builtin" = [ ];
|
|
|
|
}.${cryptoStr};
|
|
|
|
|
|
|
|
tlsStr = if optOpenssl != null then "openssl"
|
|
|
|
else "no";
|
2009-11-06 12:57:29 +00:00
|
|
|
|
2015-05-28 08:53:47 +01:00
|
|
|
tlsInputs = {
|
|
|
|
"openssl" = [ optOpenssl ];
|
|
|
|
"no" = [ ];
|
|
|
|
}.${tlsStr};
|
|
|
|
|
|
|
|
# Libedit is less buggy in krb5, readline breaks tests
|
|
|
|
lineParserStr = if optLibedit != null then "libedit"
|
|
|
|
else if optReadline != null && optNcurses != null then "readline"
|
|
|
|
else "no";
|
|
|
|
|
|
|
|
lineParserInputs = {
|
|
|
|
"libedit" = [ optLibedit ];
|
|
|
|
"readline" = [ optReadline optNcurses ];
|
|
|
|
"no" = [ ];
|
|
|
|
}.${lineParserStr};
|
|
|
|
in
|
|
|
|
with stdenv.lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "${prefix}krb5-${version}";
|
|
|
|
version = "1.13.2";
|
2009-11-06 12:57:29 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-05-28 08:53:47 +01:00
|
|
|
url = "${meta.homepage}dist/krb5/1.13/krb5-${version}-signed.tar";
|
|
|
|
sha256 = "1qbdzyrws7d0q4filsibh28z54pd5l987jr0ygv43iq9085w6a75";
|
2009-11-06 12:57:29 +00:00
|
|
|
};
|
|
|
|
|
2015-05-28 08:53:47 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig perl ];
|
|
|
|
buildInputs = [ yacc optOpenssl optLibverto optOpenldap ]
|
|
|
|
++ cryptoInputs ++ tlsInputs ++ lineParserInputs
|
2015-04-06 20:21:43 +01:00
|
|
|
# Provides the mig command used by the build scripts
|
2015-05-28 08:53:47 +01:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin bootstrap_cmds;
|
2009-11-06 12:57:29 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
tar -xf $src
|
2015-05-28 08:53:47 +01:00
|
|
|
tar -xzf krb5-${version}.tar.gz
|
|
|
|
cd krb5-${version}/src
|
2009-11-06 12:57:29 +00:00
|
|
|
'';
|
|
|
|
|
2015-05-28 08:53:47 +01:00
|
|
|
configureFlags = [
|
|
|
|
(mkOther "sysconfdir" "/etc")
|
|
|
|
(mkOther "localstatedir" "/var")
|
|
|
|
(mkEnable false "athena" null)
|
|
|
|
(mkWith false "vague-errors" null)
|
|
|
|
(mkWith true "crypto-impl" cryptoStr)
|
|
|
|
(mkWith true "pkinit-crypto-impl" cryptoStr)
|
|
|
|
(mkWith true "tls-impl" tlsStr)
|
|
|
|
(mkEnable true "aesni" null)
|
|
|
|
(mkEnable true "kdc-lookaside-cache" null)
|
|
|
|
(mkEnable (optOpenssl != null) "pkinit" null)
|
|
|
|
(mkWith (lineParserStr == "libedit") "libedit" null)
|
|
|
|
(mkWith (lineParserStr == "readline") "readline" null)
|
|
|
|
(mkWith (optLibverto != null) "system-verto" null)
|
|
|
|
(mkWith (optOpenldap != null) "ldap" null)
|
|
|
|
(mkWith false "tcl" null)
|
2015-05-29 18:12:00 +01:00
|
|
|
(mkWith false "system-db" null) # Requires db v1.85
|
2015-05-28 08:53:47 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = optionalString libOnly ''
|
|
|
|
(cd util; make)
|
|
|
|
(cd include; make)
|
|
|
|
(cd lib; make)
|
|
|
|
(cd build-tools; make)
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = optionalString libOnly ''
|
|
|
|
mkdir -p $out/{bin,include/{gssapi,gssrpc,kadm5,krb5},lib/pkgconfig,sbin,share/{et,man/man1}}
|
2015-05-29 18:12:00 +01:00
|
|
|
|
2015-05-28 08:53:47 +01:00
|
|
|
(cd util; make install)
|
|
|
|
(cd include; make install)
|
|
|
|
(cd lib; make install)
|
|
|
|
(cd build-tools; make install)
|
2015-05-29 18:12:00 +01:00
|
|
|
|
|
|
|
rm -rf $out/{sbin,share}
|
|
|
|
find $out/bin -type f | grep -v 'krb5-config' | xargs rm
|
2015-05-28 08:53:47 +01:00
|
|
|
'';
|
2013-03-20 22:36:17 +00:00
|
|
|
|
2013-05-01 12:11:46 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2014-12-30 09:03:29 +00:00
|
|
|
meta = with stdenv.lib; {
|
2015-05-28 08:53:47 +01:00
|
|
|
homepage = http://web.mit.edu/kerberos/;
|
2013-03-20 22:36:17 +00:00
|
|
|
description = "MIT Kerberos 5";
|
|
|
|
license = "MPL";
|
2015-04-06 20:21:43 +01:00
|
|
|
platforms = platforms.unix;
|
2014-12-30 09:03:29 +00:00
|
|
|
maintainers = with maintainers; [ wkennington ];
|
2009-11-06 12:57:29 +00:00
|
|
|
};
|
2015-03-05 00:48:20 +00:00
|
|
|
|
|
|
|
passthru.implementation = "krb5";
|
2015-05-28 08:53:47 +01:00
|
|
|
}
|