summaryrefslogtreecommitdiff
path: root/extra/openldap/PKGBUILD
blob: 33a3b20008f45461647efd13a11cdf70c321699e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# $Id: PKGBUILD 109957 2011-02-14 13:18:22Z andrea $
# Maintainer:
# Contributor: Judd Vinet <jvinet@zeroflux.org>

pkgname=openldap
pkgver=2.4.24
pkgrel=1
pkgdesc="LDAP Server"
arch=('i686' 'x86_64' 'mips64el')
license=('custom')
url="http://www.openldap.org/"
backup=('etc/openldap/slapd.conf' 'etc/default/slapd' 'etc/conf.d/slapd')
depends=("libldap>=${pkgver}" 'db' 'tcp_wrappers' 'libfetch' 'util-linux-ng')
provides=('openldap-clients')
replaces=('openldap-clients')
source=("ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${pkgname}-${pkgver}.tgz"
        'slapd'
        'slapd.default')
md5sums=('116fe1e23a7b67686d5e62274367e6c0'
         '832354417c495f29affd2c772808959d'
         '6be69f6b7e522cb64cce8703da81ed32')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
   
  export LIBS=-ldb
  ./configure --prefix=/usr \
              --mandir=/usr/share/man \
              --libexecdir=/usr/sbin \
              --sysconfdir=/etc \
              --localstatedir=/var/lib/openldap \
              --enable-bdb \
              --enable-crypt \
              --enable-dynamic \
              --with-threads \
              --enable-wrappers \
              --enable-spasswd \
              --with-cyrus-sasl
  
  find . -name 'Makefile' -exec \
  	sed -e 's|$(LDAP_LIBDIR)/liblber/liblber.la|/usr/lib/liblber-2.4.so.2|g' \
	    -e 's|$(LDAP_LIBDIR)/libldap/libldap.la|/usr/lib/libldap-2.4.so.2|g' \
	    -e 's|$(LDAP_LIBDIR)/libldap_r/libldap_r.la|/usr/lib/libldap_r-2.4.so.2|g' \
	    -i {} \;

  cd include
  make

  cd ../libraries
  for dir in liblutil librewrite liblunicode; do
    pushd ${dir}
    make depend
    make
    popd
  done

  cd ../servers
  make depend
  make

  cd ../clients
  make depend
  make

  cd ../doc/man
  for dir in man{1,5,8}; do
    pushd ${dir}
    make
    popd
  done
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  
  cd servers
  make DESTDIR=${pkgdir} install

  cd ../clients
  make DESTDIR=${pkgdir} install

  cd ../doc/man
  for dir in man{1,5,8}; do
    pushd ${dir}
    make DESTDIR=${pkgdir} install
    popd
  done
  rm ${pkgdir}/usr/share/man/man5/ldap.conf.5

  cd ../..

  install -dm700 ${pkgdir}/etc/openldap/slapd.d
  install -Dm755 ${srcdir}/slapd ${pkgdir}/etc/rc.d/slapd
  install -Dm644 ${srcdir}/slapd.default ${pkgdir}/etc/conf.d/slapd
  install -dm700 ${pkgdir}/var/lib/openldap
  
  # get rid of duplicate default conf files
  rm ${pkgdir}/etc/openldap/*.default

  # hack to fix screwed up dirs
  sed -e 's|^pidfile[[:space:]].*$|pidfile   /var/run/slapd.pid|g' \
      -e 's|^argsfile[[:space:]].*$|argsfile  /var/run/slapd.args|g' \
      -i ${pkgdir}/etc/openldap/slapd.conf
      
  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
}