Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / cyrus-sasl / default.nix
blob883b30c6a576c24cd0066ab917042afce8c225d7
1 { lib, stdenv, fetchurl, fetchpatch, openssl, openldap, libkrb5, db, gettext
2 , pam, libxcrypt, fixDarwinDylibNames, autoreconfHook, enableLdap ? false
3 , buildPackages, pruneLibtoolFiles, nixosTests }:
5 stdenv.mkDerivation rec {
6   pname = "cyrus-sasl";
7   version = "2.1.28";
9   src = fetchurl {
10     urls =
11       [ "https://github.com/cyrusimap/${pname}/releases/download/${pname}-${version}/${pname}-${version}.tar.gz"
12         "http://www.cyrusimap.org/releases/${pname}-${version}.tar.gz"
13         "http://www.cyrusimap.org/releases/old/${pname}-${version}.tar.gz"
14       ];
15     sha256 = "sha256-fM/Gq9Ae1nwaCSSzU+Um8bdmsh9C1FYu5jWo6/xbs4w=";
16   };
18   patches = [
19     # Fix cross-compilation
20     ./cyrus-sasl-ac-try-run-fix.patch
21     # make compatible with openssl3. can probably be dropped with any release after 2.1.28
22     (fetchpatch {
23       url = "https://github.com/cyrusimap/cyrus-sasl/compare/cb549ef71c5bb646fe583697ebdcaba93267a237...c2bd3afbca57f176d8c650670ce371444bb7fcc0.patch";
24       hash = "sha256-bYeIkvle1Ms7Lnoob4eLd4RbPFHtPkKRZvfHNCBJY/s=";
25     })
26   ];
28   outputs = [ "bin" "dev" "out" "man" "devdoc" ];
30   depsBuildBuild = [ buildPackages.stdenv.cc ];
31   nativeBuildInputs = [ autoreconfHook pruneLibtoolFiles ]
32     ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
33   buildInputs =
34     [ openssl db gettext libkrb5 libxcrypt ]
35     ++ lib.optional enableLdap openldap
36     ++ lib.optional stdenv.isLinux pam;
38   configureFlags = [
39     "--with-openssl=${openssl.dev}"
40     "--with-plugindir=${placeholder "out"}/lib/sasl2"
41     "--with-saslauthd=/run/saslauthd"
42     "--enable-login"
43     "--enable-shared"
44   ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
46   installFlags = lib.optionals stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
48   passthru.tests = {
49     inherit (nixosTests) parsedmarc postfix;
50   };
52   meta = with lib; {
53     homepage = "https://www.cyrusimap.org/sasl";
54     description = "Library for adding authentication support to connection-based protocols";
55     platforms = platforms.unix;
56     license = licenses.bsdOriginal;
57   };