aboutsummaryrefslogtreecommitdiffstats
path: root/main/dovecot/APKBUILD
blob: cc1686c6f57a77e7271196bf55e49c18370b27a1 (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
# 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.24
pkgrel=0
_pigeonholever=0.4.14
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
arch="all"
license="LGPL2+"
depends="openssl"
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers"
install="dovecot.pre-install dovecot.post-install"
subpackages="$pkgname-doc $pkgname-dev
	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
	$pkgname-gssapi $pkgname-ldap $pkgname-pigeonhole-plugin:_pigeonhole
	"
source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
	http://pigeonhole.dovecot.org/releases/2.2/$pkgname-2.2-pigeonhole-$_pigeonholever.tar.gz
	hide-dl-errors.patch
	dovecot.logrotate
	dovecot.initd
	"
options="libtool"

_builddir="$srcdir"/$pkgname-$pkgver
_builddirpigeonhole="$srcdir"/$pkgname-2.2-pigeonhole-$_pigeonholever

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--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 \
		|| return 1
	make || return 1

	# 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" \
		--disable-static \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1

	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/ || return 1
	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 || return 1
	# 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 || return 1


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

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

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

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

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*')
}

md5sums="91576b3411b436234ca5f63e1bbab60d  dovecot-2.2.24.tar.gz
27e47fb731f2948d6905b12b6184705f  dovecot-2.2-pigeonhole-0.4.14.tar.gz
49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
df6d43508a82903a97e3a2a5b8436d3d  dovecot.logrotate
f0c227ab4e2593f6d410440b82103de1  dovecot.initd"
sha256sums="71c86891ea8deb5703d3dbbc3ea31ce2cbf7638f1aa395d9e8794d3ff7aebeb7  dovecot-2.2.24.tar.gz
dff30a636c1516158f3e159c669a254569c9dabaa6ecfa3669379101ea5b3300  dovecot-2.2-pigeonhole-0.4.14.tar.gz
d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
d0fef8cd8200549877d7594cf458d6b33f05b31f95f1fd9a8368e8471c082735  dovecot.logrotate
1a3c845c216bb6f9633d27a8c1c0d01b591942c463bddb5ae835f162bd7fb4bf  dovecot.initd"
sha512sums="90d98996e75353ae631c1e2da2520cc340928f427276c757316714892d7b281745284bf4cb30459eecdb9c96b7d9450eb6801e002e6acafc8669deb2b5e65a81  dovecot-2.2.24.tar.gz
97e72a3046a5975d416e49a900a9d801224c6de944aea4fd80b0e9c571af68d4e11c4a152ab6048abd9867a31eb4d8e3e648165489fb4a2b57a9a2929760247e  dovecot-2.2-pigeonhole-0.4.14.tar.gz
1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
6ec75a8396f4d826390e69aa8177593573eaf0e0ab537b2a4720573e04c92ff615f39e1559b48313b2cd2f03704cd977bb594a568ecc5dd22e38926c12f3c48c  dovecot.initd"