jobcore/openldap/PKGBUILD
2024-01-30 23:06:44 +02:00

182 lines
5.5 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcoreextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=openldap
pkgname=('openldap' 'libldap')
pkgdesc='Lightweight Directory Access Protocol (LDAP) client, libraries, and server, w/o ipv6 & systemd'
pkgver=2.6.7
pkgrel=01
url='https://www.openldap.org'
source=($url/software/download/OpenLDAP/openldap-release/$pkgbase-$pkgver.tgz{,.asc}
openldap.tmpfiles
openldap.sysusers)
# extra modules found in contrib/slapd-modules
_extra_modules=(
'nssov'
'autogroup'
'lastbind'
'passwd/sha2'
'allowed'
'noopsrch'
)
makedepends=('libtool' 'libsasl' 'util-linux' 'chrpath' 'unixodbc' 'libsodium')
#options=('!makeflags' 'emptydirs' '!lto')
options=('!makeflags' 'emptydirs')
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
}
build() {
cd $pkgbase-$pkgver
autoconf
./configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--localstatedir=/var/lib/openldap \
--sbindir=/usr/bin \
--enable-dynamic \
--enable-syslog \
--disable-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 \
libexecdir=/usr/lib \
sysconfdir=/etc/openldap
done
}
#
# if a test fails comment this out and makepkg without the -f option
#
#check() {
# cd $pkgbase-$pkgver
# make test
#}
#
#
package_libldap() {
pkgdesc='Lightweight Directory Access Protocol (LDAP) client libraries without ipv6'
depends=('libsasl' 'e2fsprogs')
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/lib/liblber.so.2
ln -sf libldap.so $pkgdir/usr/lib/libldap.so.2
# license
install -Dm644 -t $pkgdir/usr/share/licenses/$pkgname LICENSE
}
package_openldap() {
pkgdesc='Lightweight Directory Access Protocol (LDAP) client and server without ipv6'
depends=("libldap>=$pkgver" 'libtool' 'unixodbc' 'perl' 'libsodium')
backup=('etc/openldap/slapd.conf' 'etc/openldap/slapd.ldif')
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 \
libexecdir=/usr/lib \
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 ../lib/slapd "${pkgdir}"/usr/bin/slapd
chown root:439 "${pkgdir}"/etc/openldap/slapd.{conf,ldif}
chmod 640 "${pkgdir}"/etc/openldap/slapd.{conf,ldif}
install -dm700 -o 439 -g 439 "${pkgdir}"/var/lib/openldap
chown -R 439:439 "${pkgdir}"/var/lib/openldap
install -dm700 -o 439 -g 439 "${pkgdir}"/etc/openldap/slapd.d
install -Dm644 "${srcdir}"/openldap.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/openldap.conf
install -Dm644 "${srcdir}"/openldap.sysusers "${pkgdir}"/usr/lib/sysusers.d/openldap.conf
install -Dm644 -t "${pkgdir}"/usr/share/licenses/"${pkgname}" LICENSE
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=(custom)
validpgpkeys=('3CE269B5398BC8B785645E987F67D5FD1CE1CBCE') # OpenLDAP Project <project@openldap.org> https://www.openldap.org/software/download/OpenLDAP/gpg-pubkey.txt
sha256sums=(cd775f625c944ed78a3da18a03b03b08eea73c8aabc97b41bb336e9a10954930 # openldap-2.6.7.tgz
38b0852ee709c5943d557cdd2207186c86c5c702853a839a7e273616c8d06f8c # openldap-2.6.7.tgz.asc
0be46138e53ff2fa6d4b4c06bfbdd2100426e0bd2ed29bf3419ade6b5974e9a0 # openldap.tmpfiles
c6e3fa72138edfebb4ecb17f677e217c885ff9eef805b5c8ad1c09169bb0ff8e) # openldap.sysusers
## 8e6aef7928f691e5b65a198705de9a3e42d3ef01d6f8f3dd3ae8e0c072dc3fa6 libldap-2.6.7-01-x86_64.pkg.tar.lz
## 63ce83f747a259a0f2238f03b8b097f445596f182c56f04312d99a218848fdaa openldap-2.6.7-01-x86_64.pkg.tar.lz