17 stdenv.mkDerivation rec {
22 url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
23 hash = "sha256-0qKh1x3z13OWscFq11AuZ030RuBgcrDlpOlBw9BsDUY=";
26 # TODO: separate "out" and "bin"
34 enableParallelBuilding = true;
46 ] ++ lib.optionals (stdenv.isLinux) [
47 libxcrypt # causes linking issues on *-darwin
51 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
52 MACOSX_DEPLOYMENT_TARGET=10.16
60 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
61 "--with-yielding_select=yes"
62 "ac_cv_func_memcmp_working=yes"
63 ] ++ lib.optional stdenv.isFreeBSD "--with-pic";
65 NIX_CFLAGS_COMPILE = [ "-DLDAPI_SOCK=\"/run/openldap/ldapi\"" ];
68 "CC=${stdenv.cc.targetPrefix}cc"
69 "STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
71 "prefix=${placeholder "out"}"
73 "systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
74 # contrib modules require these
75 "moduledir=${placeholder "out"}/lib/modules"
76 "mandir=${placeholder "out"}/share/man"
79 extraContribModules = [
80 # https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules
87 for module in $extraContribModules; do
88 make $makeFlags CC=$CC -C contrib/slapd-modules/$module
93 substituteInPlace tests/scripts/all \
94 --replace "/bin/rm" "rm"
95 # fails saying "SASL(-1): generic failure: internal error: failed to init cipher 'rc4'"
96 rm tests/scripts/test076-authid-rewrite
101 # The directory is empty and serve no purpose.
107 "prefix=${placeholder "out"}"
108 "sysconfdir=${placeholder "out"}/etc"
109 "moduledir=${placeholder "out"}/lib/modules"
114 for module in $extraContribModules; do
115 make $installFlags install -C contrib/slapd-modules/$module
117 chmod +x "$out"/lib/*.{so,dylib}
121 homepage = "https://www.openldap.org/";
122 description = "An open source implementation of the Lightweight Directory Access Protocol";
123 license = licenses.openldap;
124 maintainers = with maintainers; [ ajs124 das_j hexa ];
125 platforms = platforms.unix;