@ -1,33 +1,48 @@
{ lib , stdenv , fetchurl , openssl , db , groff , libtool , libsodium
, withCyrusSasl ? true
{ lib
, stdenv
, fetchurl
# dependencies
, cyrus_sasl
, db
, groff
, libsodium
, libtool
, openssl
, systemdMinimal
} :
stdenv . mkDerivation rec {
pname = " o p e n l d a p " ;
version = " 2 . 4 . 5 8 " ;
version = " 2 . 6 . 2 " ;
src = fetchurl {
url = " h t t p s : / / w w w . o p e n l d a p . o r g / s o f t w a r e / d o w n l o a d / O p e n L D A P / o p e n l d a p - r e l e a s e / ${ pname } - ${ version } . t g z " ;
sha256 = " s h a 2 5 6 - V 7 W S V L 4 V 0 L 9 q m r P V F M H A V 3 e w I S M p F T M T S o f J R G j 4 9 H s = " ;
hash = " s h a 2 5 6 - g d C T R S M u t i S G 7 P W s r N L F b A x F t K b I w G Z h L n 9 C G i O h z 4 c " ;
} ;
# TODO: separate "out" and "bin"
outputs = [ " o u t " " d e v " " m a n " " d e v d o c " ] ;
outputs = [
" o u t "
" d e v "
" m a n "
" d e v d o c "
] ;
enableParallelBuilding = true ;
nativeBuildInputs = [ groff ] ;
buildInputs = [ openssl cyrus_sasl db libsodium libtool ] ;
nativeBuildInputs = [
groff
] ;
# Disable install stripping as it breaks cross-compiling.
# We strip binaries anyway in fixupPhase.
makeFlags = [
" S T R I P = "
" p r e f i x = $ ( o u t ) "
" m o d u l e d i r = $ ( o u t ) / l i b / m o d u l e s "
" C C = ${ stdenv . cc . targetPrefix } c c "
buildInputs = [
cyrus_sasl
db
libsodium
libtool
openssl
] ++ lib . optionals ( stdenv . isLinux ) [
systemdMinimal
] ;
preConfigure = lib . optionalString ( lib . versionAtLeast stdenv . hostPlatform . darwinMinVersion " 1 1 " ) ''
@ -35,56 +50,61 @@ stdenv.mkDerivation rec {
'' ;
configureFlags = [
" - - e n a b l e - o v e r l a y s "
" - - d i s a b l e - d e p e n d e n c y - t r a c k i n g " # speeds up one-time build
" - - e n a b l e - m o d u l e s "
" - - s y s c o n f d i r = / e t c "
" - - l o c a l s t a t e d i r = / v a r "
" - - e n a b l e - a r g o n 2 "
" - - e n a b l e - c r y p t "
" - - e n a b l e - m o d u l e s "
" - - e n a b l e - o v e r l a y s "
] ++ lib . optionals ( stdenv . hostPlatform != stdenv . buildPlatform ) [
" - - w i t h - y i e l d i n g _ s e l e c t = y e s "
" a c _ c v _ f u n c _ m e m c m p _ w o r k i n g = y e s "
] ++ lib . optional ( ! withCyrusSasl ) " - - w i t h o u t - c y r u s - s a s l "
++ lib . optional stdenv . isFreeBSD " - - w i t h - p i c " ;
] ++ lib . optional stdenv . isFreeBSD " - - w i t h - p i c " ;
makeFlags = [
" C C = ${ stdenv . cc . targetPrefix } c c "
" S T R I P = " # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
" p r e f i x = ${ placeholder " o u t " } "
" s y s c o n f d i r = ${ placeholder " o u t " } / e t c "
" s y s t e m d s y s t e m u n i t d i r = ${ placeholder " o u t " } / l i b / s y s t e m d / s y s t e m "
# contrib modules require these
" m o d u l e d i r = ${ placeholder " o u t " } / l i b / m o d u l e s "
" m a n d i r = ${ placeholder " o u t " } / s h a r e / m a n "
] ;
extraContribModules = [
# https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules
" p a s s w d / s h a 2 "
" p a s s w d / p b k d f 2 "
" p a s s w d / t o t p "
] ;
postBuild = ''
make $ makeFlags CC = $ CC - C contrib/slapd-modules/passwd/sha2
make $ makeFlags CC = $ CC - C contrib/slapd-modules/passwd/pbkdf2
make $ makeFlags CC = $ CC - C contrib/slapd-modules/passwd/argon2
for module in $ { lib . concatStringsSep " " extraContribModules } ; do
make $ makeFlags CC = $ CC - C contrib/slapd-modules / $ module
done
'' ;
doCheck = false ; # needs a running LDAP server
preCheck = ''
substituteInPlace tests/scripts/all \
- - replace " / b i n / r m " " r m "
'' ;
installFlags = [
" s y s c o n f d i r = $ ( o u t ) / e t c "
" l o c a l s t a t e d i r = $ ( o u t ) / v a r "
" m o d u l e d i r = $ ( o u t ) / l i b / m o d u l e s "
# The argon2 module hardcodes /usr/bin/install as the path for the
# `install` binary, which is overridden here.
" I N S T A L L = i n s t a l l "
] ;
doCheck = true ;
# 1. Libraries left in the build location confuse `patchelf --shrink-rpath`
# Delete these to let patchelf discover the right path instead.
# FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98
# is in Nixpkgs patchelf.
# 2. Fixup broken libtool for openssl and cyrus_sasl (if it is not disabled)
# The directory is empty and serve no purpose.
preFixup = ''
rm - r $ out/var
rm - r libraries /* / . l i b s
rm - r contrib/slapd-modules/passwd /* / . l i b s
for f in $ out/lib/libldap.la $ out/lib/libldap_r.la ; do
substituteInPlace " $ f " - - replace ' - lssl' ' - L $ { lib . getLib openssl } /lib - lssl'
'' + l i b . o p t i o n a l S t r i n g w i t h C y r u s S a s l ''
substituteInPlace " $ f " - - replace ' - lsasl2' ' - L $ { cyrus_sasl . out } /lib - lsasl2'
'' + ''
done
'' ;
installFlags = [
" p r e f i x = ${ placeholder " o u t " } "
" m o d u l e d i r = ${ placeholder " o u t " } / l i b / m o d u l e s "
" I N S T A L L = i n s t a l l "
] ;
postInstall = ''
make $ installFlags install - C contrib/slapd-modules/passwd/sha2
make $ installFlags install - C contrib/slapd-modules/passwd/pbkdf2
make $ installFlags install-lib - C contrib/slapd-modules/passwd/argon2
for module in $ { lib . concatStringsSep " " extraContribModules } ; do
make $ installFlags install - C contrib/slapd-modules / $ module
done
chmod + x " $ o u t " /lib /* . { s o , d y l i b }
'' ;
@ -92,7 +112,7 @@ stdenv.mkDerivation rec {
homepage = " h t t p s : / / w w w . o p e n l d a p . o r g / " ;
description = " A n o p e n s o u r c e i m p l e m e n t a t i o n o f t h e L i g h t w e i g h t D i r e c t o r y A c c e s s P r o t o c o l " ;
license = licenses . openldap ;
maintainers = with maintainers ; [ lovek323 ] ;
maintainers = with maintainers ; [ ajs124 das_j hexa ] ;
platforms = platforms . unix ;
} ;
}