APKBUILD 7.39 KB
Newer Older
1
# Contributor: Valery Kartel <valery.kartel@gmail.com>
2
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
Michael Mason's avatar
Michael Mason committed
3
# Contributor: Michael Mason <ms13sp@gmail.com>
4
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
Michael Mason's avatar
Michael Mason committed
5
pkgname=dovecot
6
pkgver=2.2.34
7
_pkgvermajor=2.2
8
pkgrel=3
TBK's avatar
TBK committed
9
_pigeonholever=0.4.21
10
_pluginextdataver=39
11
_pigeonholevermajor=${_pigeonholever%.*}
Michael Mason's avatar
Michael Mason committed
12 13
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
14
arch="all"
15
options="!check"
16
license="LGPL-2.0-or-later"
17
depends="libressl"
Natanael Copa's avatar
Natanael Copa committed
18 19
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
20
makedepends="libcap-dev zlib-dev libressl-dev bzip2-dev postgresql-dev
21
	mariadb-connector-c-dev sqlite-dev heimdal-dev openldap-dev linux-headers autoconf
22
	automake libtool expat-dev clucene-dev"
23
install="dovecot.pre-install dovecot.post-install"
24 25 26
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
27
	$pkgname-fts-solr:_fts_solr $pkgname-fts-lucene:_fts_lucene
Natanael Copa's avatar
Natanael Copa committed
28
	"
29 30 31
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
Natanael Copa's avatar
Natanael Copa committed
32
	skip-iconv-check.patch
33
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
34
	dovecot.initd
35
	extdata.conf
Michael Mason's avatar
Michael Mason committed
36
	"
37
options="libtool"
38 39 40
builddir="$srcdir/$pkgname-$pkgver"
_builddirpigeonhole="$srcdir/$pkgname-${_pkgvermajor}-pigeonhole-$_pigeonholever"
_builddirpluginextdata="$srcdir/pigeonhole-${_pigeonholevermajor/./-}-sieve-extdata-$_pluginextdataver"
41

42 43 44 45 46
# secfixes:
#   2.2.34-r0:
#     - CVE-2017-15130
#     - CVE-2017-14461
#     - CVE-2017-15132
47 48

_configure() {
49 50 51 52
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
53
		--localstatedir=/var \
Natanael Copa's avatar
Natanael Copa committed
54
		--sysconfdir=/etc \
Michael Mason's avatar
Michael Mason committed
55 56
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
57 58 59 60 61 62 63
		--disable-static \
		"$@"
}

build() {
	cd "$builddir"
	_configure \
64 65
		--with-gssapi=plugin \
		--with-ldap=plugin \
66 67 68 69
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
70 71
		--with-solr \
		--with-lucene \
72
		--with-ssl=openssl \
73
		--with-ssldir=/etc/ssl/dovecot \
74 75
		--with-rundir=/run/dovecot
	make
76 77 78

	# Build pigeonhole plugin
	cd "$_builddirpigeonhole"
79
	_configure \
80
		--with-dovecot="$builddir" \
81
		--with-ldap=plugin
82
	make
83 84 85

	# Build the extdata plugin
	cd "$_builddirpluginextdata"
86
	./autogen.sh
87
	_configure \
88
		--with-dovecot="$builddir" \
89 90
		--with-pigeonhole="$_builddirpigeonhole"
	make
91
}
Michael Mason's avatar
Michael Mason committed
92

Natanael Copa's avatar
Natanael Copa committed
93 94 95 96 97 98
check() {
	cd "$builddir"
	make check
}


99
package() {
100
	cd "$builddir"
101
	make DESTDIR="$pkgdir" install
102

103 104 105
	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
Natanael Copa's avatar
Natanael Copa committed
106 107

	# default config
108 109 110 111 112
	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 \
113
		"$pkgdir"/etc/dovecot/
114 115 116
	rm -fr "$pkgdir"/usr/share/doc/dovecot/example-config

	# fix ssl dirs in default config
Natanael Copa's avatar
Natanael Copa committed
117 118
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
119
		"$pkgdir"/etc/dovecot/conf.d/10-ssl.conf
120 121 122 123
	# 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,' \
124
		"$pkgdir"/etc/dovecot/conf.d/10-auth.conf
125 126 127 128


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

131 132
	# Installing extdata plugin
	cd "$_builddirpluginextdata"
133
	make install DESTDIR="$pkgdir"
134

135 136
	# Moving config in the correct place
	mv "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/* \
137
		"$pkgdir"/etc/dovecot/conf.d
Michael Mason's avatar
Michael Mason committed
138 139
}

140 141 142 143 144 145
_mv() {
	local i
	while [ $# -gt 0 ]; do
		local dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
146
		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
147 148 149 150
		shift
	done
}

151 152
dev() {
	default_dev
153
	mkdir -p "$subpkgdir"/usr/lib/dovecot
154 155 156
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}
157

158
_sieve() {
159 160
	pkgdesc="Sieve plugin for dovecot"
	depends="$pkgname"
161 162
	_mv $(cd "$pkgdir" && find usr -name '*sieve_extprograms*')
	_mv $(cd "$pkgdir" && find usr -name '*sieve_imapsieve*')
163
	_mv $(cd "$pkgdir" && find usr -name '*sieve*')
164 165 166 167
	_mv $(cd "$pkgdir" && find usr -name '*pigeonhole*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*sieve*')
}

168
_sieve_ldap() {
169
	pkgdesc="Sieve plugin for dovecot (ldap support)"
170 171 172 173 174 175
	depends="$pkgname-pigeonhole-plugin $pkgname-ldap"
	_mv $(cd "$pkgdir" && find usr -name '*_sieve_storage_ldap_*')
	mkdir -p "$subpkgdir"
}

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

183 184
pgsql() {
	pkgdesc="postgresql driver for dovecot"
185 186
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
187 188 189 190
}

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

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

201 202
gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
203 204
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
205 206 207
}

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

214 215 216 217 218
sql() {
	pkgdesc="SQL plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*-sql.*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-sql.conf*')
Natanael Copa's avatar
Natanael Copa committed
219
}
220

221 222 223 224 225 226 227 228 229 230 231
_fts_solr() {
	pkgdesc="FTS-Solr plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*fts*solr*')
}

_fts_lucene() {
	pkgdesc="FTS-Lucene plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*fts*lucene*')
}
232
sha512sums="9f08a7116a08a08495aa0e7b4cb6b11a924ea61006970487946e338bc79bba7fd7619c345cbf278a74de285d548af04fc66eaaee508185b8b9d7335cf5612055  dovecot-2.2.34.tar.gz
TBK's avatar
TBK committed
233
4751f449ede1b05173c706b414ebf9f7f670ff78589ce6f0b687c32c9abe6dae8b3064ed1b20e893d9ec0147b0139ce479e1d74ebe94747c33f2d8ca177912de  dovecot-2.2-pigeonhole-0.4.21.tar.gz
234
832a80264fb9bd3021c4e192eb7594c203100783df547aff35acf4dc4d8de5eddfd676fcc5a07a0691d9bb6eb884c9497a692b72a2af5bf9e9bb7a2d3f38923e  39.tar.gz
Natanael Copa's avatar
Natanael Copa committed
235
09bae967d35b9e5d7d91c81337e1bf5e5aba3abb7b0ab06427f1a0d6f9bb5b2f2e39306cfe45d80488110fc0414e3e2515c0265286c1584d80f8af366d1568a9  skip-iconv-check.patch
236
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
237
d2758a22e5b3d1d1be867fd237466a1b5fe7ecd4355fdc51fa9e5ceab48a862f8a5d83992d2ae17a3e0b2c611ff92d0de833d7e1c5f00c6f4bfb94403dbda8e4  dovecot.initd
238
7aa66cbd2a520d863fc8ff2ec48520c6fe4629ec345545b362e16c3072843f5315c6e12513ed86200d66b7c55e17f5bb21c7a12d86721968a9e03cc595dc5bcd  extdata.conf"