at 23.05-pre 127 lines 3.0 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, fetchpatch 5 6# dependencies 7, cyrus_sasl 8, db 9, groff 10, libsodium 11, libtool 12, openssl 13, systemdMinimal 14, libxcrypt 15}: 16 17stdenv.mkDerivation rec { 18 pname = "openldap"; 19 version = "2.6.3"; 20 21 src = fetchurl { 22 url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz"; 23 hash = "sha256-0qKh1x3z13OWscFq11AuZ030RuBgcrDlpOlBw9BsDUY="; 24 }; 25 26 # TODO: separate "out" and "bin" 27 outputs = [ 28 "out" 29 "dev" 30 "man" 31 "devdoc" 32 ]; 33 34 enableParallelBuilding = true; 35 36 nativeBuildInputs = [ 37 groff 38 ]; 39 40 buildInputs = [ 41 cyrus_sasl 42 db 43 libsodium 44 libtool 45 openssl 46 ] ++ lib.optionals (stdenv.isLinux) [ 47 libxcrypt # causes linking issues on *-darwin 48 systemdMinimal 49 ]; 50 51 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' 52 MACOSX_DEPLOYMENT_TARGET=10.16 53 ''; 54 55 configureFlags = [ 56 "--enable-argon2" 57 "--enable-crypt" 58 "--enable-modules" 59 "--enable-overlays" 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"; 64 65 NIX_CFLAGS_COMPILE = [ "-DLDAPI_SOCK=\"/run/openldap/ldapi\"" ]; 66 67 makeFlags= [ 68 "CC=${stdenv.cc.targetPrefix}cc" 69 "STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase. 70 "STRIP_OPTS=" 71 "prefix=${placeholder "out"}" 72 "sysconfdir=/etc" 73 "systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" 74 # contrib modules require these 75 "moduledir=${placeholder "out"}/lib/modules" 76 "mandir=${placeholder "out"}/share/man" 77 ]; 78 79 extraContribModules = [ 80 # https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules 81 "passwd/sha2" 82 "passwd/pbkdf2" 83 "passwd/totp" 84 ]; 85 86 postBuild = '' 87 for module in $extraContribModules; do 88 make $makeFlags CC=$CC -C contrib/slapd-modules/$module 89 done 90 ''; 91 92 preCheck = '' 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 97 ''; 98 99 doCheck = true; 100 101 # The directory is empty and serve no purpose. 102 preFixup = '' 103 rm -r $out/var 104 ''; 105 106 installFlags = [ 107 "prefix=${placeholder "out"}" 108 "sysconfdir=${placeholder "out"}/etc" 109 "moduledir=${placeholder "out"}/lib/modules" 110 "INSTALL=install" 111 ]; 112 113 postInstall = '' 114 for module in $extraContribModules; do 115 make $installFlags install -C contrib/slapd-modules/$module 116 done 117 chmod +x "$out"/lib/*.{so,dylib} 118 ''; 119 120 meta = with lib; { 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; 126 }; 127}