aboutsummaryrefslogtreecommitdiffstats
path: root/main/openldap/APKBUILD
blob: 13809a607ec6bea016f33250dc3cabb720282006 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=openldap
pkgver=2.4.32
pkgrel=2
pkgdesc="LDAP Server"
url="http://www.openldap.org/"
arch="all"
license="custom"
depends=
pkgusers="ldap"
pkggroups="ldap"
depends_dev="openssl-dev cyrus-sasl-dev util-linux-dev"
makedepends="$depends_dev db-dev groff unixodbc-dev libtool"
subpackages="$pkgname-dev $pkgname-doc libldap $pkgname-back-sql:sql
	$pkgname-back-bdb:bdb $pkgname-back-hdb:hdb $pkgname-back-ldap:ldap
	$pkgname-back-meta:meta	$pkgname-back-monitor:monitor $pkgname-clients"

install="$pkgname.pre-install"
source="ftp://ftp.$pkgname.org/pub/OpenLDAP/$pkgname-release/$pkgname-$pkgver.tgz
	openldap-2.4-ppolicy.patch
	openldap-2.4.11-libldap_r.patch
	slapd.initd
	slapd.confd
	slurpd.initd
	"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	sed -e '/^STRIP/s,-s,,g' \
		-i build/top.mk || return 1
}

# berkdb crypt ipv6 ssl 
build () {
	cd "$srcdir"/$pkgname-$pkgver

	./configure --prefix=/usr \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var/lib/openldap \
		--enable-slapd \
		--enable-crypt \
		--enable-modules \
		--enable-dynamic \
		--enable-bdb=mod \
		--enable-hdb=mod \
		--enable-dnssrv=mod \
		--enable-ldap=mod \
		--enable-meta=mod \
		--enable-monitor=mod \
		--enable-null=mod \
		--enable-passwd=mod \
		--enable-relay=mod \
		--enable-shell=mod \
		--enable-sock=mod \
		--enable-sql=mod \
		--enable-overlays=mod \
		--with-tls=openssl \
		--with-cyrus-sasl \
		|| return 1
	
	make || return 1
}

package() {
	cd "$srcdir"/$pkgname-$pkgver
	make DESTDIR="$pkgdir" install || return 1
	rm "$pkgdir"/usr/lib/openldap/*.la \
		"$pkgdir"/usr/lib/*.la || return 1

	install -d -o ldap -g ldap "$pkgdir"/var/run/openldap \
		"$pkgdir"/var/lib/openldap
	sed -i -e 's:/var/lib/openldap/run:/var/run/openldap:g' \
		-e 's:back_bdb.la:back_bdb.so:' \
		-e 's:back_hdb.la:back_hdb.so:' \
		-e 's:back_ldap.la:back_ldap.so:' \
		"$pkgdir"/etc/openldap/slapd.conf || return 1

	mv "$pkgdir"/usr/lib/slapd "$pkgdir"/usr/sbin/ || reteurn 1
	chgrp ldap "$pkgdir"/etc/openldap/slapd.conf
	chmod g+r "$pkgdir"/etc/openldap/slapd.conf
	chown -R ldap.ldap "$pkgdir"/var/lib/openldap/openldap-data
	chmod 700 "$pkgdir"/var/lib/openldap \
		"$pkgdir"/var/lib/openldap/openldap-data
	chown -R ldap.ldap "$pkgdir"/var/lib/openldap/openldap-data
		
	install -Dm755 "$srcdir"/slapd.initd "$pkgdir"/etc/init.d/slapd
	install -Dm755 "$srcdir"/slapd.confd "$pkgdir"/etc/conf.d/slapd
	install -Dm755 "$srcdir"/slurpd.initd "$pkgdir"/etc/init.d/slurpd
	# FIXME: symlinks in sbin are symlinked to /usr/lib/slapd 
	ln -s /usr/sbin/slapd "$pkgdir"/usr/lib/slapd
}

libldap() {
	pkgdesc="OpenLDAP libraries"
	depends=
	install=
	mkdir -p "$subpkgdir"/usr/lib "$subpkgdir"/etc/openldap
	mv "$pkgdir"/usr/lib/*.so* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/etc/openldap/ldap.conf "$subpkgdir"/etc/openldap/
}

_backend() {
	pkgdesc="OpenLDAP ${2:-$1} backend"
	mkdir -p "$subpkgdir"/usr/lib/openldap
	mv "$pkgdir"/usr/lib/openldap/back_$1* "$subpkgdir"/usr/lib/openldap/
}

bdb() {		_backend bdb ; }
hdb() {		_backend hdb ; }
sql() {		_backend sql ODBC; }
ldap() {	_backend ldap LDAP; }
meta() {	_backend meta; }
monitor() {	_backend monitor; }

clients() {
	pkgdesc="LDAP client utilities"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}


md5sums="6a3e85cf61860ca5e8a1eba6753dd9d0  openldap-2.4.32.tgz
2524e490ba334a760fa57057c16da7a9  openldap-2.4-ppolicy.patch
d19d0502f046078ecd737e29e7552fa8  openldap-2.4.11-libldap_r.patch
c47e20f041e4b352e662d5bd677c0a38  slapd.initd
b672311fca605c398240cd37a2ae080a  slapd.confd
fa5ce0005ef5f1160b6ff126f97aaa1a  slurpd.initd"