2 # Contributor: George Rawlinson <grawlinson@archlinux.org>
5 pkgname=('openldap' 'libldap')
9 url="https://www.openldap.org/"
11 makedepends=('libtool' 'libsasl' 'util-linux' 'chrpath' 'unixodbc' 'libsodium' 'systemd')
12 options=('!makeflags' 'emptydirs')
14 https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pkgbase}-${pkgver}.tgz{,.asc}
17 sha256sums=('d51704e50178430c06cf3d8aa174da66badf559747a47d920bb54b2d4aa40991'
19 '0be46138e53ff2fa6d4b4c06bfbdd2100426e0bd2ed29bf3419ade6b5974e9a0'
20 'c6e3fa72138edfebb4ecb17f677e217c885ff9eef805b5c8ad1c09169bb0ff8e')
21 validpgpkeys=('3CE269B5398BC8B785645E987F67D5FD1CE1CBCE') # OpenLDAP Project <project@openldap.org> https://www.openldap.org/software/download/OpenLDAP/gpg-pubkey.txt
24 # extra modules found in contrib/slapd-modules
35 cd ${pkgbase}-${pkgver}
37 # change perms from 0644 to 0755
38 sed -i 's|-m 644 $(LIBRARY)|-m 755 $(LIBRARY)|' libraries/{liblber,libldap}/Makefile.in
40 # change rundir to /run/openldap
41 sed -i 's|#define LDAPI_SOCK LDAP_RUNDIR LDAP_DIRSEP "run" LDAP_DIRSEP "ldapi"|#define LDAPI_SOCK LDAP_DIRSEP "run" LDAP_DIRSEP "openldap" LDAP_DIRSEP "ldapi"|' include/ldap_defaults.h
42 sed -i 's|%LOCALSTATEDIR%/run|/run/openldap|' servers/slapd/slapd.{conf,ldif}
43 sed -i 's|-$(MKDIR) $(DESTDIR)$(localstatedir)/run|-$(MKDIR) $(DESTDIR)/run/openldap|' servers/slapd/Makefile.in
45 # modify upstream systemd service
46 sed -i -e "s|EnvironmentFile.*|EnvironmentFile=-/etc/conf.d/slapd|" -e "s/slapd -d 0/\0 -u ldap -g ldap/" servers/slapd/slapd.service
50 cd ${pkgbase}-${pkgver}
54 --libexecdir=/usr/lib \
56 --localstatedir=/var/lib/openldap \
67 --with-argon2=libsodium \
69 --enable-overlays=mod \
73 sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
78 for module in "${_extra_modules[@]}"; do
79 make -C "contrib/slapd-modules/$module" \
80 OPT="$CFLAGS $CPPFLAGS" \
83 sysconfdir=/etc/openldap
88 cd ${pkgbase}-${pkgver}
93 pkgdesc="Lightweight Directory Access Protocol (LDAP) client libraries"
95 backup=('etc/openldap/ldap.conf')
97 cd ${pkgbase}-${pkgver}
98 for dir in include libraries doc/man/man3 ; do
100 make DESTDIR="${pkgdir}" install
103 install -Dm644 -t "$pkgdir/usr/share/man/man5" doc/man/man5/ldap.conf.5
105 # remove duplicate conf files
106 rm "${pkgdir}"/etc/openldap/*.default
108 # shared library versioning
109 ln -sf liblber.so "${pkgdir}"/usr/lib/liblber.so.2
110 ln -sf libldap.so "${pkgdir}"/usr/lib/libldap.so.2
113 install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
117 pkgdesc="Lightweight Directory Access Protocol (LDAP) client and server"
118 depends=("libldap>=${pkgver}" 'libtool' 'unixodbc' 'perl' 'systemd-libs' 'libsodium')
119 backup=('etc/openldap/slapd.conf' 'etc/openldap/slapd.ldif')
121 cd ${pkgbase}-${pkgver}
122 for dir in clients servers doc/man/man{1,5,8}; do
124 make DESTDIR="${pkgdir}" install
128 # install extra modules
129 for module in "${_extra_modules[@]}"; do
130 make -C "contrib/slapd-modules/$module" \
132 libexecdir=/usr/lib \
133 sysconfdir=/etc/openldap \
134 DESTDIR="$pkgdir" install
136 # passwd/sha2 has no man page, so skip it
137 if [ -f "contrib/slapd-modules/$module/slapo-$module.5" ]; then
138 install -m644 -t "$pkgdir/usr/share/man/man5" \
139 "contrib/slapd-modules/$module/slapo-$module.5"
143 # should be in libldap package
144 rm "${pkgdir}"/usr/share/man/man5/ldap.conf.5
146 # let systemd-tmpfiles generate this directory
147 rm -r "${pkgdir}"/run
149 # get rid of duplicate conf files
150 rm "${pkgdir}"/etc/openldap/*.default
152 ln -s ../lib/slapd "${pkgdir}"/usr/bin/slapd
154 chown root:439 "${pkgdir}"/etc/openldap/slapd.{conf,ldif}
155 chmod 640 "${pkgdir}"/etc/openldap/slapd.{conf,ldif}
157 # systemd integration
158 install -Dm644 "${srcdir}"/openldap.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/openldap.conf
159 install -Dm644 "${srcdir}"/openldap.sysusers "${pkgdir}"/usr/lib/sysusers.d/openldap.conf
162 install -Dm644 -t "${pkgdir}"/usr/share/licenses/"${pkgname}" LICENSE