2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2022-06-26 10:26:21 +00:00
|
|
|
, fetchpatch
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
# dependencies
|
2021-03-09 03:18:52 +00:00
|
|
|
, cyrus_sasl
|
2022-06-16 17:23:12 +00:00
|
|
|
, db
|
|
|
|
, groff
|
|
|
|
, libsodium
|
|
|
|
, libtool
|
|
|
|
, openssl
|
|
|
|
, systemdMinimal
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-11-21 19:51:51 +00:00
|
|
|
pname = "openldap";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "2.6.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-11-21 19:51:51 +00:00
|
|
|
url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
|
2022-06-16 17:23:12 +00:00
|
|
|
hash = "sha256-gdCTRSMutiSG7PWsrNLFbAxFtKbIwGZhLn9CGiOhz4c";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
patches = [
|
|
|
|
# ITS#9840 - ldif-filter: fix parallel build failure
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/7d977f51e6dfa570a471d163b9e8255bdd3dc12f.patch";
|
|
|
|
hash = "sha256:1vid6pj2gmqywbghnd380x19ml241ldc1fyslb6br6q27zpgbdlp";
|
|
|
|
})
|
|
|
|
# ITS#9840 - libraries/Makefile.in: ignore the mkdir errors
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/71f24015c312171c00ce94c9ff9b9c6664bdca8d.patch";
|
|
|
|
hash = "sha256:1a81vv6nkhgiadnj4g1wyzgzdp2zd151h0vkwvv9gzmqvhwcnc04";
|
|
|
|
})
|
|
|
|
# ITS#7165 back-mdb: check for stale readers on
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/7e7f01c301db454e8c507999c77b55a1d97efc21.patch";
|
|
|
|
hash = "sha256:1fc2yck2gn3zlpfqjdn56ar206npi8cmb8yg5ny4lww0ygmyzdfz";
|
|
|
|
})
|
|
|
|
# ITS#9858 back-mdb: delay indexer task startup
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/ac061c684cc79d64ab4089fe3020921a0064a307.patch";
|
|
|
|
hash = "sha256:01f0y50zlcj6n5mfkmb0di4p5vrlgn31zccx4a9k5m8vzxaqmw9d";
|
|
|
|
})
|
|
|
|
# ITS#9858 back-mdb: fix index reconfig
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/c43c7a937cfb3a781f99b458b7ad71eb564a2bc2.patch";
|
|
|
|
hash = "sha256:02yh0c8cyx14iir5qhfam5shrg5d3115s2nv0pmqdj6najrqc5mm";
|
|
|
|
})
|
|
|
|
# ITS#9157: check for NULL ld
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openldap/openldap/commit/6675535cd6ad01f9519ecd5d75061a74bdf095c7.patch";
|
|
|
|
hash = "sha256:0dali5ifcwba8400s065f0fizl9h44i0mzb06qgxhygff6yfrgif";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# TODO: separate "out" and "bin"
|
2022-06-16 17:23:12 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
"man"
|
|
|
|
"devdoc"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
groff
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildInputs = [
|
|
|
|
cyrus_sasl
|
|
|
|
db
|
|
|
|
libsodium
|
|
|
|
libtool
|
|
|
|
openssl
|
|
|
|
] ++ lib.optionals (stdenv.isLinux) [
|
|
|
|
systemdMinimal
|
2020-07-18 16:06:22 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.16
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configureFlags = [
|
2022-06-16 17:23:12 +00:00
|
|
|
"--enable-argon2"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--enable-crypt"
|
2022-06-16 17:23:12 +00:00
|
|
|
"--enable-modules"
|
|
|
|
"--enable-overlays"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-yielding_select=yes"
|
|
|
|
"ac_cv_func_memcmp_working=yes"
|
2022-06-16 17:23:12 +00:00
|
|
|
] ++ lib.optional stdenv.isFreeBSD "--with-pic";
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
makeFlags = [
|
2022-06-16 17:23:12 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
|
|
|
|
"prefix=${placeholder "out"}"
|
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
|
|
|
"systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
|
|
|
# contrib modules require these
|
|
|
|
"moduledir=${placeholder "out"}/lib/modules"
|
|
|
|
"mandir=${placeholder "out"}/share/man"
|
|
|
|
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
|
|
|
# Can be unconditional, doing it like this to prevent a mass rebuild.
|
|
|
|
"STRIP_OPTS="
|
|
|
|
];
|
|
|
|
|
|
|
|
extraContribModules = [
|
|
|
|
# https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules
|
|
|
|
"passwd/sha2"
|
|
|
|
"passwd/pbkdf2"
|
|
|
|
"passwd/totp"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
postBuild = ''
|
2022-06-26 10:26:21 +00:00
|
|
|
for module in $extraContribModules; do
|
2022-06-16 17:23:12 +00:00
|
|
|
make $makeFlags CC=$CC -C contrib/slapd-modules/$module
|
|
|
|
done
|
2020-05-29 06:06:01 +00:00
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace tests/scripts/all \
|
|
|
|
--replace "/bin/rm" "rm"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# The directory is empty and serve no purpose.
|
2020-04-24 23:36:52 +00:00
|
|
|
preFixup = ''
|
2021-03-09 03:18:52 +00:00
|
|
|
rm -r $out/var
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
installFlags = [
|
|
|
|
"prefix=${placeholder "out"}"
|
|
|
|
"moduledir=${placeholder "out"}/lib/modules"
|
|
|
|
"INSTALL=install"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
2022-06-26 10:26:21 +00:00
|
|
|
for module in $extraContribModules; do
|
2022-06-16 17:23:12 +00:00
|
|
|
make $installFlags install -C contrib/slapd-modules/$module
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
chmod +x "$out"/lib/*.{so,dylib}
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.openldap.org/";
|
|
|
|
description = "An open source implementation of the Lightweight Directory Access Protocol";
|
|
|
|
license = licenses.openldap;
|
2022-06-16 17:23:12 +00:00
|
|
|
maintainers = with maintainers; [ ajs124 das_j hexa ];
|
2022-06-26 10:26:21 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|