#!/bin/sh
#
# Copyright 2004 Dagmar d'Surreal <rivyqntzne@tznvy.pbz>
# Available under the terms of the GNU GPL.
#

NAME="openldap-client"
VERSION="2.3.21"
REVISION="1"

PKG_SOURCEURL='ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${NAME%%-client}-$VERSION.tgz'
PKG_NEEDSTATIC=y
PKG_PATCH[0]="openldap-ntlm.diff"
PKG_PATCH[1]="slapdpiddirfix-2.3.20.diff"

# This makes things land in /var/run instead of /var/lib/run.
PKG_LOCALSTATEDIR=/var

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

#configfile /etc/openldap/slapd.conf
configfile /etc/openldap/ldap.conf

cflags
prepare
applypatch 0 0
applypatch 1 1
analyzesource
configure --disable-slapd --with-threads --with-tls --enable-dynamic
# This and more may be needed if you want to build a slapd for your own use!
#	configure --enable-ldbm --enable-wrappers --enable-crypt
#		--enable-lmpasswd --disable-debug
make
makeinstall
tidydocumentation

spewdo "chmod 755 $PKG_STAGEROOT$PKG_PREFIX/lib/lib*.so.*"
spewdo "cd $PKG_STAGEROOT$PKG_PREFIX/bin ; rm ldapadd ; ln -s ldapmodify ldapadd"
# If you wish to build the slapd for your own package, uncomment this:
#spewdo "createdirectory $PKG_STAGEROOT/$PKG_LOCALSTATEDIR/run/slapd"

analyzebinaries
finalizepackage
packagize
cleanup
