aboutsummaryrefslogtreecommitdiffstats
path: root/main/dovecot/APKBUILD
blob: 382afbb425ff28f4359606feccd387e4bce9b027 (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dovecot
pkgver=2.2.32
_pkgvermajor=2.2
pkgrel=0
_pigeonholever=0.4.20
_pluginextdataver=39
_pigeonholevermajor=${_pigeonholever%.*}
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
arch="all"
options="!check"
license="LGPL2+"
depends="libressl"
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
makedepends="libcap-dev zlib-dev libressl-dev bzip2-dev postgresql-dev
	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers autoconf
	automake libtool"
install="dovecot.pre-install dovecot.post-install"
subpackages="$pkgname-doc $pkgname-dev $pkgname-pigeonhole-plugin-extdata:_sieve_extdata
	$pkgname-pigeonhole-plugin-ldap:_sieve_ldap $pkgname-pigeonhole-plugin:_sieve $pkgname-sql
	$pkgname-pgsql $pkgname-mysql $pkgname-sqlite $pkgname-gssapi $pkgname-ldap
	"
source="http://www.dovecot.org/releases/$_pkgvermajor/$pkgname-$pkgver.tar.gz
	http://pigeonhole.dovecot.org/releases/$_pkgvermajor/$pkgname-$_pkgvermajor-pigeonhole-$_pigeonholever.tar.gz
	http://hg.rename-it.nl/pigeonhole-${_pigeonholevermajor}-sieve-extdata/archive/$_pluginextdataver.tar.gz
	dovecot.logrotate
	dovecot.initd
	extdata.conf
	"
options="libtool"
builddir="$srcdir/$pkgname-$pkgver"
_builddirpigeonhole="$srcdir/$pkgname-${_pkgvermajor}-pigeonhole-$_pigeonholever"
_builddirpluginextdata="$srcdir/pigeonhole-${_pigeonholevermajor/./-}-sieve-extdata-$_pluginextdataver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libexecdir=/usr/lib/$pkgname \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-gssapi=plugin \
		--with-ldap=plugin \
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
		--with-ssl=openssl \
		--with-ssldir=/etc/ssl/dovecot \
		--with-rundir=/run/dovecot
	make

	# Build pigeonhole plugin
	cd "$_builddirpigeonhole"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-dovecot="$builddir" \
		--with-ldap=plugin \
		--disable-static
	make

	# Build the extdata plugin
	cd "$_builddirpluginextdata"
	./autogen.sh
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-dovecot="$builddir" \
		--with-pigeonhole="$_builddirpigeonhole"
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -d "$pkgdir"/etc/ssl/dovecot
	install -Dm755 "$srcdir"/dovecot.initd "$pkgdir"/etc/init.d/dovecot
	install -Dm644 "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot

	# default config
	rm "$pkgdir"/etc/dovecot/*
	rm "$pkgdir"/usr/share/doc/dovecot/mkcert.sh
	mv "$pkgdir"/usr/share/doc/dovecot/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
	mv "$pkgdir"/usr/share/doc/dovecot/example-config/dovecot* \
		"$pkgdir"/usr/share/doc/dovecot/example-config/conf.d \
		"$pkgdir"/etc/dovecot/
	rm -fr "$pkgdir"/usr/share/doc/dovecot/example-config

	# fix ssl dirs in default config
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
		"$pkgdir"/etc/dovecot/conf.d/10-ssl.conf
	# set default passdb to passwd and create appropriate 'users' file
	install -m 640 -o dovecot -g mail /dev/null "$pkgdir"/etc/dovecot/users
	sed -i -e 's,!include auth-system.conf.ext,!include auth-passwdfile.conf.ext,' \
		-e 's,#!include auth-passwdfile.conf.ext,#!include auth-system.conf.ext,' \
		"$pkgdir"/etc/dovecot/conf.d/10-auth.conf


	# Installing pigeonhole plugin
	cd "$_builddirpigeonhole"
	make install DESTDIR="$pkgdir"

	# Installing extdata plugin
	cd "$_builddirpluginextdata"
	make install DESTDIR="$pkgdir"

	# Moving config in the correct place
	mv "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/* \
		"$pkgdir"/etc/dovecot/conf.d
}

_mv() {
	local i
	while [ $# -gt 0 ]; do
		local dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
		shift
	done
}

dev() {
	default_dev
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}

_sieve() {
	pkgdesc="Sieve plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*sieve_extprograms*')
	_mv $(cd "$pkgdir" && find usr -name '*sieve_imapsieve*')
	_mv $(cd "$pkgdir" && find usr -name '*sieve*')
	_mv $(cd "$pkgdir" && find usr -name '*pigeonhole*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*sieve*')
}

_sieve_ldap() {
	pkdesc="Sieve plugin for dovecot (ldap support)"
	depends="$pkgname-pigeonhole-plugin $pkgname-ldap"
	_mv $(cd "$pkgdir" && find usr -name '*_sieve_storage_ldap_*')
	mkdir -p "$subpkgdir"
}

_sieve_extdata() {
	pkgdesc="Pigeonhole Sieve Extdata Plugin"
	depends="$pkgname-pigeonhole-plugin"
	_mv $(cd "$pkgdir" && find usr -name '*sieve_extdata*')
	install -Dm644 "$srcdir"/extdata.conf "$subpkgdir"/etc/dovecot/conf.d/90-sieve-extdata.conf
	install -Dm644 /dev/null "$subpkgdir"/etc/dovecot/sieve-extdata.dict
}

pgsql() {
	pkgdesc="postgresql driver for dovecot"
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
}

mysql() {
	pkgdesc="mysql driver for dovecot"
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_mysql*')
}

sqlite() {
	pkgdesc="sqlite driver for dovecot"
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_sqlite*')
}

gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
}

ldap() {
	pkgdesc="LDAP auth plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*[_-]ldap*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-ldap.conf*')
}

sql() {
	pkgdesc="SQL plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*-sql.*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-sql.conf*')
}

sha512sums="a26ce763fdea7d72ff9801d3b7d57a1f0d00278e4a1aa60d1be070fe5a6d2c6a15f266a519119492bee7a3e7a6b7d0732e9879e5c5841adbab8c0952cd1b7c7c  dovecot-2.2.32.tar.gz
84a28842be206e05cb96c07cf1c1b62c9c378ba4c952caa47cf79a44b9428e076f4182eadd9c4fb8f45d3605b881f91e8e520c41705017ac4039240d4bcace39  dovecot-2.2-pigeonhole-0.4.20.tar.gz
832a80264fb9bd3021c4e192eb7594c203100783df547aff35acf4dc4d8de5eddfd676fcc5a07a0691d9bb6eb884c9497a692b72a2af5bf9e9bb7a2d3f38923e  39.tar.gz
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
d2758a22e5b3d1d1be867fd237466a1b5fe7ecd4355fdc51fa9e5ceab48a862f8a5d83992d2ae17a3e0b2c611ff92d0de833d7e1c5f00c6f4bfb94403dbda8e4  dovecot.initd
7aa66cbd2a520d863fc8ff2ec48520c6fe4629ec345545b362e16c3072843f5315c6e12513ed86200d66b7c55e17f5bb21c7a12d86721968a9e03cc595dc5bcd  extdata.conf"