151 lines
5.1 KiB
Bash
151 lines
5.1 KiB
Bash
# This is an example PKGBUILD file. Use this as a start to creating your own,
|
|
# and remove these comments. For more information, see 'man PKGBUILD'.
|
|
# NOTE: Please fill out the license field for your package! If it is unknown,
|
|
# then please put 'unknown'.
|
|
|
|
# Maintainer: Future Linux Team <future_linux@163.com>
|
|
pkgname=(openldap libldap)
|
|
pkgbase=openldap
|
|
pkgver=2.6.8
|
|
pkgrel=2
|
|
pkgdesc="Lightweight Directory Access Protocol (LDAP) client and server"
|
|
arch=('x86_64')
|
|
url="https://www.openldap.org/"
|
|
license=('custom')
|
|
makedepends=('libtool' 'libsasl' 'util-linux' 'chrpath' 'unixodbc' 'libsodium' 'systemd')
|
|
options=('!makeflags' 'emptydirs' '!lto')
|
|
source=(https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pkgbase}-${pkgver}.tgz
|
|
openldap.tmpfiles)
|
|
sha256sums=(48969323e94e3be3b03c6a132942dcba7ef8d545f2ad35401709019f696c3c4e
|
|
072effe3fd6db5c6a331b4867d4fa539ea871587c54d3cbc392cead790b04300)
|
|
|
|
# extra modules found in contrib/slapd-modules
|
|
_extra_modules=(
|
|
'nssov'
|
|
'autogroup'
|
|
'lastbind'
|
|
'passwd/sha2'
|
|
'allowed'
|
|
'noopsrch'
|
|
)
|
|
|
|
prepare() {
|
|
cd ${pkgbase}-${pkgver}
|
|
|
|
# change perms from 0644 to 0755
|
|
sed -i 's|-m 644 $(LIBRARY)|-m 755 $(LIBRARY)|' libraries/{liblber,libldap}/Makefile.in
|
|
|
|
# change rundir to /run/openldap
|
|
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
|
|
sed -i 's|%LOCALSTATEDIR%/run|/run/openldap|' servers/slapd/slapd.{conf,ldif}
|
|
sed -i 's|-$(MKDIR) $(DESTDIR)$(localstatedir)/run|-$(MKDIR) $(DESTDIR)/run/openldap|' servers/slapd/Makefile.in
|
|
|
|
# modify upstream systemd service
|
|
sed -i -e "s|EnvironmentFile.*|EnvironmentFile=-/etc/conf.d/slapd|" -e "s/slapd -d 0/\0 -u ldap -g ldap/" servers/slapd/slapd.service
|
|
|
|
autoconf
|
|
}
|
|
|
|
build() {
|
|
cd ${pkgbase}-${pkgver}
|
|
|
|
${CONFIGURE} \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var/lib/openldap \
|
|
--enable-dynamic \
|
|
--enable-syslog \
|
|
--enable-ipv6 \
|
|
--enable-local \
|
|
--enable-crypt \
|
|
--enable-spasswd \
|
|
--enable-modules \
|
|
--enable-backends \
|
|
--enable-argon2 \
|
|
--with-argon2=libsodium \
|
|
--disable-wt \
|
|
--enable-overlays=mod \
|
|
--with-cyrus-sasl \
|
|
--with-threads
|
|
|
|
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
|
|
make
|
|
|
|
# build extra modules
|
|
for module in ${_extra_modules[@]}; do
|
|
make -C contrib/slapd-modules/${module} \
|
|
OPT="${CFLAGS} ${CPPFLAGS}" \
|
|
prefix=/usr \
|
|
libdir=/usr/lib64 \
|
|
sysconfdir=/etc/openldap
|
|
done
|
|
}
|
|
|
|
package_libldap() {
|
|
pkgdesc="Lightweight Directory Access Protocol (LDAP) client libraries"
|
|
depends=('libsasl')
|
|
backup=(etc/openldap/ldap.conf)
|
|
|
|
cd ${pkgbase}-${pkgver}
|
|
|
|
for dir in include libraries doc/man/man3 ; do
|
|
pushd ${dir}
|
|
make DESTDIR=${pkgdir} install
|
|
popd
|
|
done
|
|
|
|
install -Dm644 -t ${pkgdir}/usr/share/man/man5 doc/man/man5/ldap.conf.5
|
|
|
|
# remove duplicate conf files
|
|
rm ${pkgdir}/etc/openldap/*.default
|
|
|
|
# shared library versioning
|
|
ln -sf liblber.so ${pkgdir}/usr/lib64/liblber.so.2
|
|
ln -sf libldap.so ${pkgdir}/usr/lib64/libldap.so.2
|
|
}
|
|
|
|
package_openldap() {
|
|
pkgdesc="Lightweight Directory Access Protocol (LDAP) client and server"
|
|
depends=("libldap>=${pkgver}" 'libtool' 'unixodbc' 'perl' 'systemd' 'libsodium')
|
|
backup=(etc/openldap/slapd.conf
|
|
etc/openldap/slapd.ldif)
|
|
install=${pkgname}.install
|
|
|
|
cd ${pkgbase}-${pkgver}
|
|
|
|
for dir in clients servers doc/man/man{1,5,8}; do
|
|
pushd ${dir}
|
|
make DESTDIR=${pkgdir} install
|
|
popd
|
|
done
|
|
|
|
# install extra modules
|
|
for module in ${_extra_modules[@]}; do
|
|
make -C contrib/slapd-modules/${module} \
|
|
prefix=/usr \
|
|
libdir=/usr/lib64 \
|
|
sysconfdir=/etc/openldap \
|
|
DESTDIR=${pkgdir} install
|
|
|
|
# passwd/sha2 has no man page, so skip it
|
|
if [ -f contrib/slapd-modules/${module}/slapo-${module}.5 ]; then
|
|
install -m644 -t ${pkgdir}/usr/share/man/man5 \
|
|
contrib/slapd-modules/${module}/slapo-${module}.5
|
|
fi
|
|
done
|
|
|
|
# should be in libldap package
|
|
rm ${pkgdir}/usr/share/man/man5/ldap.conf.5
|
|
|
|
# let systemd-tmpfiles generate this directory
|
|
rm -r ${pkgdir}/run
|
|
|
|
# get rid of duplicate conf files
|
|
rm ${pkgdir}/etc/openldap/*.default
|
|
ln -s ../lib64/slapd ${pkgdir}/usr/bin/slapd
|
|
chown root:439 ${pkgdir}/etc/openldap/slapd.{conf,ldif}
|
|
chmod 640 ${pkgdir}/etc/openldap/slapd.{conf,ldif}
|
|
|
|
# systemd integration
|
|
install -Dm644 ${srcdir}/openldap.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/openldap.conf
|
|
}
|