aboutsummaryrefslogtreecommitdiffstats
path: root/main/openldap/APKBUILD
blob: 2c5eea08ccdaa58b12864681584252b55c6c7165 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=openldap
pkgver=2.4.40
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 mosquitto-dev"
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
	$pkgname-mqtt
	"

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
	0001-dbd-enabled-by-default.patch
	openldap-mqtt-overlay.patch
	CVE-2015-1546.patch
	slapd.initd
	slapd.confd
	slurpd.initd
	"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	update_config_sub || return 1
	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
	[ "$CLIBC" = "musl" ] && export CFLAGS="$CFLAGS -DNULL=0L"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--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

	#build mqtt overlay
        cd contrib/slapd-modules/mqtt
	make prefix=/usr libexec=/usr/lib
}

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

	#install mqtt overlay
        cd contrib/slapd-modules/mqtt
	make DESTDIR="$pkgdir" prefix=/usr libexec=/usr/lib install || return 1
	find "$pkgdir" -iname *.la -delete
}

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/
}

mqtt() {
	pkgdesc="OpenLDAP MQTT overlay"
	depends=$pkgname
	mkdir -p "$subpkgdir"/usr/lib/openldap
	mv "$pkgdir"/usr/lib/openldap/mqtt.* "$subpkgdir"/usr/lib/openldap
}

md5sums="423c1f23d2a0cb96b3e9baf7e9d7dda7  openldap-2.4.40.tgz
2524e490ba334a760fa57057c16da7a9  openldap-2.4-ppolicy.patch
d19d0502f046078ecd737e29e7552fa8  openldap-2.4.11-libldap_r.patch
7b4eec9a90d2f7f727e0f9cb4653887c  0001-dbd-enabled-by-default.patch
05266dddd5a9cc5de1b67ab62b6d26fb  openldap-mqtt-overlay.patch
09f2be28af8aaf2883446c85d854cfe8  CVE-2015-1546.patch
41d45b9ed59037dcdf640e395ace113c  slapd.initd
b672311fca605c398240cd37a2ae080a  slapd.confd
fa5ce0005ef5f1160b6ff126f97aaa1a  slurpd.initd"
sha256sums="d12611a5c25b6499293c2bb7b435dc2b174db73e83f5a8cb7e34f2ce5fa6dadb  openldap-2.4.40.tgz
355a8239355fcc5863ba7430d73af7ccad9e0211ae56180011d15d7418aa5b27  openldap-2.4-ppolicy.patch
3310a89d38bc39e6eb4333799d475411b274482b8bccab212b3edfd4385db70e  openldap-2.4.11-libldap_r.patch
8d1ee24c52928302acb876bc99cc75757eb15b278a10bfd3d43cabb332bcd3c4  0001-dbd-enabled-by-default.patch
5de1464a6ae154e1556f7faa9494caf7ca94d26a0ef2f7d5abdc6aa2513cc1c9  openldap-mqtt-overlay.patch
07d6feebc366c14e42b5027239e12d5ec2981714b6a61a1365981c20d9fd87de  CVE-2015-1546.patch
726efdbaceb1b907bb085b7996222a0bc83610730c5d6b9646b062e09f2ef964  slapd.initd
1ccb8a3b78b65b125b24779dd065cf8000e2d5e4da267bb0a892e730edd2055d  slapd.confd
9cfe54485585a1bd74dd167c27ad9e60a5dec7351b6a64804749f253bb6cfbad  slurpd.initd"
sha512sums="c803c4a82878891d60414d64dcb54a7c3f08675106ba13f50cba06034a97b3eee1c238761dd5ddad97d8c3f6675d9bbbec176d0340eb4a3bcd808f940baabab5  openldap-2.4.40.tgz
5d34d49eabe7cb66cf8284cc3bd9730fa23df4932df68549e242d250ee50d40c434ae074ebc720d5fbcd9d16587c9333c5598d30a5f1177caa61461ab7771f38  openldap-2.4-ppolicy.patch
44d97efb25d4f39ab10cd5571db43f3bfa7c617a5bb087085ae16c0298aca899b55c8742a502121ba743a73e6d77cd2056bc96cee63d6d0862dabc8fb5574357  openldap-2.4.11-libldap_r.patch
b0892e049feab931d6439374ecf2497c54fbf46daef622f9949f02a26cd4b20f73de7cff1e1d64894539dc599793ffbd61d7a5bba6e026f3966295cf6a39f1be  0001-dbd-enabled-by-default.patch
9c7f41279e91ed995c91e9a8c543c797d9294a93cf260afdc03ab5777e45ed045a4d6a4d4d0180b5dc387dc04babca01d818fbfa8168309df44f4500d2a430a4  openldap-mqtt-overlay.patch
9eb54e63fecc7ad59bf710803a7da275ea1de069d1a27d56ee01417d33035d90d89ab9903de82154f625c796145c1056d5a52ad8bfb8238c7ab5304c413fd25b  CVE-2015-1546.patch
723fb2546ac8a3672240139d4b7ec5041be961990fd8385171a53c737436d6307dc05671fcd190dd5e3b3ee21967a2a632ec8852fe84519fdea0c7f535c598ee  slapd.initd
8290769b63b3a5863622de2deb9269a0711ba5f4a225eb230d7c5097937b9d4e8cf5a998ee99232824e2335ae1b6e0114357b61c9611bc2460ebd195d12eabae  slapd.confd
69ee0d739d8c8c1cb2478d5c864f703cba215d0ceb399da941c0ebc91e7de87a4d99172670686a84a98e57bde94837777a8066d27f79b6b8bf4bcd72336ce775  slurpd.initd"