APKBUILD 6.6 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.3.2.1
TBK's avatar
TBK committed
7
_pkgvermajor=2.3
8
pkgrel=1
9
_pigeonholever=0.5.2
10
_pigeonholevermajor=${_pigeonholever%.*}
Michael Mason's avatar
Michael Mason committed
11
pkgdesc="IMAP and POP3 server"
TBK's avatar
TBK committed
12
url="https://www.dovecot.org/"
13
arch="all"
TBK's avatar
TBK committed
14
options="libtool"
15
license="LGPL-2.0-or-later"
16
depends="libressl"
Natanael Copa's avatar
Natanael Copa committed
17 18
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
Jakub Jirutka's avatar
Jakub Jirutka committed
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
makedepends="
	autoconf
	automake
	bzip2-dev
	clucene-dev
	expat-dev
	heimdal-dev
	libcap-dev
	libressl-dev
	libtool
	linux-headers
	mariadb-connector-c-dev
	openldap-dev
	postgresql-dev
	sqlite-dev
	zlib-dev
	"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="
	$pkgname-doc
	$pkgname-dev
	$pkgname-openrc
	$pkgname-pigeonhole-plugin-ldap:_sieve_ldap
	$pkgname-pigeonhole-plugin:_sieve
	$pkgname-sql
	$pkgname-pgsql
	$pkgname-mysql
	$pkgname-sqlite
	$pkgname-gssapi
	$pkgname-ldap
	$pkgname-fts-solr:_fts_solr
	$pkgname-fts-lucene:_fts_lucene
Natanael Copa's avatar
Natanael Copa committed
51
	"
TBK's avatar
TBK committed
52 53
source="https://www.dovecot.org/releases/$_pkgvermajor/$pkgname-$pkgver.tar.gz
	https://pigeonhole.dovecot.org/releases/$_pkgvermajor/$pkgname-$_pkgvermajor-pigeonhole-$_pigeonholever.tar.gz
Natanael Copa's avatar
Natanael Copa committed
54
	skip-iconv-check.patch
55
	default-config.patch
56
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
57 58
	dovecot.initd
	"
Jakub Jirutka's avatar
Jakub Jirutka committed
59 60
builddir="$srcdir/$pkgname-$pkgver"
_builddir_pigeonhole="$srcdir/$pkgname-$_pkgvermajor-pigeonhole-$_pigeonholever"
61

62
# secfixes:
TBK's avatar
TBK committed
63
#   2.3.1-r0:
64 65 66
#     - CVE-2017-15130
#     - CVE-2017-14461
#     - CVE-2017-15132
67 68

_configure() {
69 70 71 72
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
73
		--localstatedir=/var \
Natanael Copa's avatar
Natanael Copa committed
74
		--sysconfdir=/etc \
Michael Mason's avatar
Michael Mason committed
75 76
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
77 78 79 80 81 82 83
		--disable-static \
		"$@"
}

build() {
	cd "$builddir"
	_configure \
84 85
		--with-gssapi=plugin \
		--with-ldap=plugin \
86 87 88 89
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
90 91
		--with-solr \
		--with-lucene \
92
		--with-ssl=openssl \
93
		--with-ssldir=/etc/ssl/dovecot \
94 95
		--with-rundir=/run/dovecot
	make
96 97

	# Build pigeonhole plugin
Jakub Jirutka's avatar
Jakub Jirutka committed
98
	cd "$_builddir_pigeonhole"
99
	_configure \
100
		--with-dovecot="$builddir" \
101
		--with-ldap=plugin
102
	make
103
}
Michael Mason's avatar
Michael Mason committed
104

Natanael Copa's avatar
Natanael Copa committed
105 106 107 108 109
check() {
	cd "$builddir"
	make check
}

110
package() {
111
	cd "$builddir"
Jakub Jirutka's avatar
Jakub Jirutka committed
112

113
	make DESTDIR="$pkgdir" install
114

Jakub Jirutka's avatar
Jakub Jirutka committed
115 116 117 118 119
	cd "$pkgdir"

	install -d ./etc/ssl/dovecot
	install -D -m 755 "$srcdir"/dovecot.initd ./etc/init.d/dovecot
	install -D -m 644 "$srcdir"/dovecot.logrotate ./etc/logrotate.d/dovecot
Natanael Copa's avatar
Natanael Copa committed
120 121

	# default config
Jakub Jirutka's avatar
Jakub Jirutka committed
122 123 124 125 126 127 128 129 130
	rm ./etc/dovecot/*
	rm ./usr/share/doc/dovecot/mkcert.sh
	mv ./usr/share/doc/dovecot/dovecot-openssl.cnf ./etc/dovecot/
	mv ./usr/share/doc/dovecot/example-config/dovecot* \
		./usr/share/doc/dovecot/example-config/conf.d \
		./etc/dovecot/
	rm -fr ./usr/share/doc/dovecot/example-config

	# Fix SSL dirs in default config.
Natanael Copa's avatar
Natanael Copa committed
131 132
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
Jakub Jirutka's avatar
Jakub Jirutka committed
133 134 135 136
		./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 ./etc/dovecot/users
137 138
	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,' \
Jakub Jirutka's avatar
Jakub Jirutka committed
139
		./etc/dovecot/conf.d/10-auth.conf
140 141


Jakub Jirutka's avatar
Jakub Jirutka committed
142 143
	# Installing pigeonhole plugin.
	cd "$_builddir_pigeonhole"
144
	make install DESTDIR="$pkgdir"
145 146 147

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

	# Remove libtool archives.
	find "$pkgdir" -name '*.la' | xargs rm -f
Michael Mason's avatar
Michael Mason committed
152 153
}

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

161
_sieve() {
Jakub Jirutka's avatar
Jakub Jirutka committed
162
	pkgdesc="Sieve and managesieve plugin for Dovecot"
163
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
164 165 166 167 168 169 170

	cd "$pkgdir"
	_submv $(find usr/ -name '*sieve_extprograms*')
	_submv $(find usr/ -name '*sieve_imapsieve*')
	_submv $(find usr/ -name '*sieve*')
	_submv $(find usr/ -name '*pigeonhole*')
	_submv $(find etc/dovecot/ -name '*sieve*')
171 172
}

173
_sieve_ldap() {
Jakub Jirutka's avatar
Jakub Jirutka committed
174
	pkgdesc="Sieve and managesieve plugin for Dovecot (LDAP support)"
175
	depends="$pkgname-pigeonhole-plugin=$pkgver-r$pkgrel $pkgname-ldap=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
176 177 178

	cd "$pkgdir"
	_submv $(find usr/ -name '*_sieve_storage_ldap_*')
179 180
}

181
pgsql() {
Jakub Jirutka's avatar
Jakub Jirutka committed
182
	pkgdesc="PostgreSQL driver for Dovecot"
183
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
184 185 186

	cd "$pkgdir"
	_submv $(find usr/ -name '*_pgsql*')
187 188 189
}

mysql() {
Jakub Jirutka's avatar
Jakub Jirutka committed
190
	pkgdesc="MySQL driver for Dovecot"
191
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
192 193 194

	cd "$pkgdir"
	_submv $(find usr/ -name '*_mysql*')
195 196 197
}

sqlite() {
Jakub Jirutka's avatar
Jakub Jirutka committed
198
	pkgdesc="SQLite driver for Dovecot"
199
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
200 201 202

	cd "$pkgdir"
	_submv $(find usr/ -name '*_sqlite*')
203 204
}

205
gssapi() {
Jakub Jirutka's avatar
Jakub Jirutka committed
206
	pkgdesc="GSSAPI auth plugin for Dovecot"
207
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
208 209 210

	cd "$pkgdir"
	_submv $(find usr/ -name '*_gssapi*')
211 212 213
}

ldap() {
Jakub Jirutka's avatar
Jakub Jirutka committed
214
	pkgdesc="LDAP auth plugin for Dovecot"
215
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
216 217 218 219

	cd "$pkgdir"
	_submv $(find usr/ -name '*[_-]ldap*')
	_submv $(find etc/dovecot/ -name '*-ldap.conf*')
220 221
}

222 223
sql() {
	pkgdesc="SQL plugin for dovecot"
224
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
225 226 227 228

	cd "$pkgdir"
	_submv $(find usr/ -name '*-sql.*')
	_submv $(find etc/dovecot/ -name '*-sql.conf*')
Natanael Copa's avatar
Natanael Copa committed
229
}
230

231 232
_fts_solr() {
	pkgdesc="FTS-Solr plugin for dovecot"
233
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
234 235 236

	cd "$pkgdir"
	_submv $(find usr/ -name '*fts*solr*')
237 238 239 240
}

_fts_lucene() {
	pkgdesc="FTS-Lucene plugin for dovecot"
241
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
242 243 244 245 246 247 248 249 250 251 252 253 254 255

	cd "$pkgdir"
	_submv $(find usr/ -name '*fts*lucene*')
}

_submv() {
	local dir
	while [ $# -gt 0 ]; do
		dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
		shift
	done
256
}
TBK's avatar
TBK committed
257

258 259
sha512sums="c085a0d04925485423086736a3c7d919ad0ca9efeff005890382da5333edb68c7d23ccb89fbe2ac44f8f016fc993bf2c669e450794c3ab13463676cbb47c7bf7  dovecot-2.3.2.1.tar.gz
6bc24d9241f94db795a012346d9bc94b5cc7d7ce0175c03213c2b5d179d80dec95e9bdbd50bed628c8f9f7c51639e692ba5e429212a3b4a654c1e4764ac4f11c  dovecot-2.3-pigeonhole-0.5.2.tar.gz
TBK's avatar
TBK committed
260
fe4fbeaedb377d809f105d9dbaf7c1b961aa99f246b77189a73b491dc1ae0aa9c68678dde90420ec53ec877c08f735b42d23edb13117d7268420e001aa30967a  skip-iconv-check.patch
261
ba76394aac0dc16209855f7a9a66d6828e7cb198400d199cbb129a787f8037c2979eed1cb460bd9ed0914d084d8913959c0293c6dd29ea6b1c12c277fd643df0  default-config.patch
262
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
TBK's avatar
TBK committed
263
d2758a22e5b3d1d1be867fd237466a1b5fe7ecd4355fdc51fa9e5ceab48a862f8a5d83992d2ae17a3e0b2c611ff92d0de833d7e1c5f00c6f4bfb94403dbda8e4  dovecot.initd"