]> Git — Sourcephile - sourcephile-nix.git/blob - pkgs/development/libraries/openldap/default.nix
postfix: fix submissions/smtpd auth
[sourcephile-nix.git] / pkgs / development / libraries / openldap / default.nix
1 { stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
2
3 stdenv.mkDerivation rec {
4 name = "openldap-2.4.48";
5
6 src = fetchurl {
7 url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${name}.tgz";
8 sha256 = "0k87qra4kirb6xgja4q1jyw6piwb9v8b8g6gkxq4plawmgy3ylnr";
9 };
10
11 # TODO: separate "out" and "bin"
12 outputs = [ "out" "dev" "man" "devdoc" ];
13
14 enableParallelBuilding = true;
15
16 nativeBuildInputs = [ groff ];
17
18 buildInputs = [ openssl cyrus_sasl db libtool ];
19
20 # Disable install stripping as it breaks cross-compiling.
21 # We strip binaries anyway in fixupPhase.
22 makeFlags= [
23 "STRIP="
24 "prefix=$(out)"
25 "moduledir=$(out)/lib/modules"
26 ];
27
28 configureFlags = [
29 "--enable-overlays"
30 "--disable-dependency-tracking" # speeds up one-time build
31 "--enable-modules"
32 "--sysconfdir=/etc"
33 "--localstatedir=/var"
34 "--enable-crypt"
35 ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
36 "--with-yielding_select=yes"
37 "ac_cv_func_memcmp_working=yes"
38 ] ++ stdenv.lib.optional (openssl == null) "--without-tls"
39 ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
40 ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
41
42 postBuild = ''
43 make $makeFlags -C contrib/slapd-modules/passwd/sha2
44 make $makeFlags -C contrib/slapd-modules/passwd/pbkdf2
45 '';
46
47 doCheck = false; # needs a running LDAP server
48
49 installFlags = [
50 "sysconfdir=$(out)/etc"
51 "localstatedir=$(out)/var"
52 "moduledir=$(out)/lib/modules"
53 ];
54
55 postInstall = ''
56 make $installFlags install -C contrib/slapd-modules/passwd/sha2
57 make $installFlags install -C contrib/slapd-modules/passwd/pbkdf2
58 chmod +x "$out"/lib/*.{so,dylib}
59 '';
60
61 # 1. Fixup broken libtool
62 # 2. Libraries left in the build location confuse `patchelf --shrink-rpath`
63 # Delete these to let patchelf discover the right path instead.
64 # FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98
65 # is in Nixpkgs patchelf.
66 preFixup = ''
67 sed -e 's,-lsasl2,-L${cyrus_sasl.out}/lib -lsasl2,' \
68 -e 's,-lssl,-L${openssl.out}/lib -lssl,' \
69 -i $out/lib/libldap.la -i $out/lib/libldap_r.la
70
71 rm -rf $out/var
72 rm -r libraries/*/.libs
73 rm -r contrib/slapd-modules/passwd/*/.libs
74 '';
75
76 meta = with stdenv.lib; {
77 homepage = http://www.openldap.org/;
78 description = "An open source implementation of the Lightweight Directory Access Protocol";
79 license = licenses.openldap;
80 maintainers = with maintainers; [ lovek323 ];
81 platforms = platforms.unix;
82 };
83 }