2021-03-14 17:50:12 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, perl, bison, bootstrap_cmds
|
2023-03-16 06:38:35 +00:00
|
|
|
, openssl, openldap, libedit, keyutils, libverto
|
2022-12-26 17:10:11 +00:00
|
|
|
|
|
|
|
# for passthru.tests
|
|
|
|
, bind
|
|
|
|
, curl
|
2022-07-09 19:13:09 +00:00
|
|
|
, nixosTests
|
2022-12-26 17:10:11 +00:00
|
|
|
, openssh
|
|
|
|
, postgresql
|
|
|
|
, python3
|
2015-06-27 05:04:45 +00:00
|
|
|
|
|
|
|
# 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
|
2015-06-27 05:04:45 +00:00
|
|
|
}:
|
2009-11-06 12:57:29 +00:00
|
|
|
|
2020-06-26 20:44:45 +00:00
|
|
|
# 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.
|
|
|
|
|
2009-11-06 12:57:29 +00:00
|
|
|
let
|
2015-06-27 05:04:45 +00:00
|
|
|
libOnly = type == "lib";
|
2015-05-28 07:53:47 +00:00
|
|
|
in
|
2015-06-27 05:04:45 +00:00
|
|
|
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";
|
2009-11-06 12:57:29 +00:00
|
|
|
|
|
|
|
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=";
|
2009-11-06 12:57:29 +00:00
|
|
|
};
|
|
|
|
|
2017-12-17 13:51:32 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2022-07-07 13:59:46 +00:00
|
|
|
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
|
2022-10-06 16:38:53 +00:00
|
|
|
++ 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"
|
|
|
|
];
|
2015-11-26 17:33:58 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config perl ]
|
2022-07-07 17:16:53 +00:00
|
|
|
++ lib.optional (!libOnly) bison
|
2015-04-06 19:21:43 +00:00
|
|
|
# Provides the mig command used by the build scripts
|
2022-07-07 17:16:53 +00:00
|
|
|
++ lib.optional stdenv.isDarwin bootstrap_cmds;
|
2019-04-12 00:51:48 +00:00
|
|
|
|
2015-06-27 05:04:45 +00:00
|
|
|
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 ];
|
2009-11-06 12:57:29 +00:00
|
|
|
|
2022-07-07 15:25:27 +00:00
|
|
|
sourceRoot = "krb5-${version}/src";
|
2009-11-06 12:57:29 +00:00
|
|
|
|
2023-01-25 21:46:17 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace config/shlib.conf \
|
|
|
|
--replace "'ld " "'${stdenv.cc.targetPrefix}ld "
|
|
|
|
'';
|
|
|
|
|
2022-07-07 17:13:03 +00:00
|
|
|
libFolders = [ "util" "include" "lib" "build-tools" ];
|
|
|
|
|
2022-07-07 17:16:53 +00:00
|
|
|
buildPhase = lib.optionalString libOnly ''
|
2022-07-07 17:13:03 +00:00
|
|
|
runHook preBuild
|
|
|
|
|
treewide: drop -l$NIX_BUILD_CORES
Passing `-l$NIX_BUILD_CORES` improperly limits the overall system load.
For a build machine which is configured to run `$B` builds where each
build gets `total cores / B` cores (`$C`), passing `-l $C` to make will
improperly limit the load to `$C` instead of `$B * $C`.
This effect becomes quite pronounced on machines with 80 cores, with
40 simultaneous builds and a cores limit of 2. On a machine with this
configuration, Nix will run 40 builds and make will limit the overall
system load to approximately 2. A build machine with this many cores
can happily run with a load approaching 80.
A non-solution is to oversubscribe the machine, by picking a larger
`$C`. However, there is no way to divide the number of cores in a way
which fairly subdivides the available cores when `$B` is greater than
1.
There has been exploration of passing a jobserver in to the sandbox,
or sharing a jobserver between all the builds. This is one option, but
relatively complicated and only supports make. Lots of other software
uses its own implementation of `-j` and doesn't support either `-l` or
the Make jobserver.
For the case of an interactive user machine, the user should limit
overall system load using `$B`, `$C`, and optionally systemd's
cpu/network/io limiting features.
Making this change should significantly improve the utilization of our
build farm, and improve the throughput of Hydra.
2022-09-22 15:17:14 +00:00
|
|
|
MAKE="make -j $NIX_BUILD_CORES"
|
2022-07-07 17:13:03 +00:00
|
|
|
for folder in $libFolders; do
|
|
|
|
$MAKE -C $folder
|
|
|
|
done
|
|
|
|
|
|
|
|
runHook postBuild
|
2015-06-27 05:04:45 +00:00
|
|
|
'';
|
|
|
|
|
2022-07-07 17:16:53 +00:00
|
|
|
installPhase = lib.optionalString libOnly ''
|
2022-07-07 17:13:03 +00:00
|
|
|
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}
|
2022-07-07 17:13:03 +00:00
|
|
|
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 = ''
|
2018-03-01 09:20:51 +00:00
|
|
|
moveToOutput bin/krb5-config "$dev"
|
2015-06-27 05:04:45 +00:00
|
|
|
'';
|
2013-03-20 22:36:17 +00:00
|
|
|
|
2013-05-01 11:11:46 +00:00
|
|
|
enableParallelBuilding = true;
|
2018-04-25 03:20:18 +00:00
|
|
|
doCheck = false; # fails with "No suitable file for testing purposes"
|
2013-05-01 11:11:46 +00:00
|
|
|
|
2022-07-07 17:16:53 +00:00
|
|
|
meta = with lib; {
|
2013-03-20 22:36:17 +00:00
|
|
|
description = "MIT Kerberos 5";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://web.mit.edu/kerberos/";
|
2015-06-27 05:04:45 +00:00
|
|
|
license = licenses.mit;
|
2018-11-22 21:25:05 +00:00
|
|
|
platforms = platforms.unix ++ platforms.windows;
|
2009-11-06 12:57:29 +00:00
|
|
|
};
|
2015-03-05 00:48:20 +00:00
|
|
|
|
2022-07-09 19:13:09 +00:00
|
|
|
passthru = {
|
|
|
|
implementation = "krb5";
|
2022-12-26 17:10:11 +00:00
|
|
|
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
|
|
|
};
|
2015-06-27 05:04:45 +00:00
|
|
|
}
|