1 { lib, stdenv, fetchurl, openssl, db, groff, libtool
6 stdenv.mkDerivation rec {
11 url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
12 sha256 = "sha256-V7WSVL4V0L9qmrPVFMHAV3ewISMpFTMTSofJRGj49Hs=";
15 # TODO: separate "out" and "bin"
16 outputs = [ "out" "dev" "man" "devdoc" ];
18 enableParallelBuilding = true;
20 nativeBuildInputs = [ groff ];
22 buildInputs = [ openssl cyrus_sasl db libtool ];
24 # Disable install stripping as it breaks cross-compiling.
25 # We strip binaries anyway in fixupPhase.
29 "moduledir=$(out)/lib/modules"
30 "CC=${stdenv.cc.targetPrefix}cc"
35 "--disable-dependency-tracking" # speeds up one-time build
38 "--localstatedir=/var"
40 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
41 "--with-yielding_select=yes"
42 "ac_cv_func_memcmp_working=yes"
43 ] ++ lib.optional (!withCyrusSasl) "--without-cyrus-sasl"
44 ++ lib.optional stdenv.isFreeBSD "--with-pic";
47 make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/sha2
48 make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/pbkdf2
51 doCheck = false; # needs a running LDAP server
54 "sysconfdir=$(out)/etc"
55 "localstatedir=$(out)/var"
56 "moduledir=$(out)/lib/modules"
59 # 1. Libraries left in the build location confuse `patchelf --shrink-rpath`
60 # Delete these to let patchelf discover the right path instead.
61 # FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98
62 # is in Nixpkgs patchelf.
63 # 2. Fixup broken libtool for openssl and cyrus_sasl (if it is not disabled)
66 rm -r libraries/*/.libs
67 rm -r contrib/slapd-modules/passwd/*/.libs
68 for f in $out/lib/libldap.la $out/lib/libldap_r.la; do
69 substituteInPlace "$f" --replace '-lssl' '-L${openssl.out}/lib -lssl'
70 '' + lib.optionalString withCyrusSasl ''
71 substituteInPlace "$f" --replace '-lsasl2' '-L${cyrus_sasl.out}/lib -lsasl2'
77 make $installFlags install -C contrib/slapd-modules/passwd/sha2
78 make $installFlags install -C contrib/slapd-modules/passwd/pbkdf2
79 chmod +x "$out"/lib/*.{so,dylib}
83 homepage = "https://www.openldap.org/";
84 description = "An open source implementation of the Lightweight Directory Access Protocol";
85 license = licenses.openldap;
86 maintainers = with maintainers; [ lovek323 ];
87 platforms = platforms.unix;