Gitlab has successfully been upgraded to 14.0.10 🎉. Enjoy!

APKBUILD 7.47 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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
5
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
Michael Mason's avatar
Michael Mason committed
6
pkgname=dovecot
7
pkgver=2.3.2.1
TBK's avatar
TBK committed
8
_pkgvermajor=2.3
9
pkgrel=3
10
_pigeonholever=0.5.2
11
_pigeonholevermajor=${_pigeonholever%.*}
Michael Mason's avatar
Michael Mason committed
12
pkgdesc="IMAP and POP3 server"
TBK's avatar
TBK committed
13
url="https://www.dovecot.org/"
14
arch="all"
TBK's avatar
TBK committed
15
options="libtool"
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"
Jakub Jirutka's avatar
Jakub Jirutka committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
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
	"
37
install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade"
Jakub Jirutka's avatar
Jakub Jirutka committed
38 39 40 41
subpackages="
	$pkgname-doc
	$pkgname-dev
	$pkgname-openrc
42 43 44
	$pkgname-lmtpd
	$pkgname-pop3d
	$pkgname-submissiond
Jakub Jirutka's avatar
Jakub Jirutka committed
45 46 47 48 49 50 51 52 53 54
	$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
55
	"
TBK's avatar
TBK committed
56 57
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
58
	skip-iconv-check.patch
59
	split-protocols.patch
60
	default-config.patch
61
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
62 63
	dovecot.initd
	"
Jakub Jirutka's avatar
Jakub Jirutka committed
64 65
builddir="$srcdir/$pkgname-$pkgver"
_builddir_pigeonhole="$srcdir/$pkgname-$_pkgvermajor-pigeonhole-$_pigeonholever"
66

67
# secfixes:
TBK's avatar
TBK committed
68
#   2.3.1-r0:
69 70 71
#     - CVE-2017-15130
#     - CVE-2017-14461
#     - CVE-2017-15132
72 73

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

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

	# Build pigeonhole plugin
Jakub Jirutka's avatar
Jakub Jirutka committed
103
	cd "$_builddir_pigeonhole"
104
	_configure \
105
		--with-dovecot="$builddir" \
106
		--with-ldap=plugin
107
	make
108
}
Michael Mason's avatar
Michael Mason committed
109

Natanael Copa's avatar
Natanael Copa committed
110 111 112 113 114
check() {
	cd "$builddir"
	make check
}

115
package() {
116
	cd "$builddir"
Jakub Jirutka's avatar
Jakub Jirutka committed
117

118
	make DESTDIR="$pkgdir" install
119

Jakub Jirutka's avatar
Jakub Jirutka committed
120 121 122 123 124
	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
125 126

	# default config
Jakub Jirutka's avatar
Jakub Jirutka committed
127 128 129 130 131 132 133 134 135
	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
136 137
	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
138 139 140 141
		./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
142 143
	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
144
		./etc/dovecot/conf.d/10-auth.conf
145 146


Jakub Jirutka's avatar
Jakub Jirutka committed
147 148
	# Installing pigeonhole plugin.
	cd "$_builddir_pigeonhole"
149
	make install DESTDIR="$pkgdir"
150 151 152

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

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

159 160
dev() {
	default_dev
161
	mkdir -p "$subpkgdir"/usr/lib/dovecot
162 163 164
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}
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
lmtpd() {
	pkgdesc="$pkgdesc (LMTP server)"
	_protocol lmtp
}

pop3d() {
	pkgdesc="$pkgdesc (POP3 daemon)"
	_protocol pop3
}

submissiond() {
	pkgdesc="$pkgdesc (mail submission agent)"
	_protocol submission
}

_protocol() {
	depends="$pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"  # for backward compatibility
	local name="$1"
	local protocolsd="$subpkgdir/usr/share/dovecot/protocols.d"

	cd "$pkgdir"
	_submv usr/libexec/dovecot/$name*
	_submv etc/dovecot/conf.d/*-$name.conf

	mkdir -p "$protocolsd"
	echo "protocols = \$protocol $name" \
		> "$protocolsd"/${subpkgname#$pkgname-}.conf
}

196
_sieve() {
Jakub Jirutka's avatar
Jakub Jirutka committed
197
	pkgdesc="Sieve and managesieve plugin for Dovecot"
198
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
199 200 201 202 203 204 205

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

208
_sieve_ldap() {
Jakub Jirutka's avatar
Jakub Jirutka committed
209
	pkgdesc="Sieve and managesieve plugin for Dovecot (LDAP support)"
210
	depends="$pkgname-pigeonhole-plugin=$pkgver-r$pkgrel $pkgname-ldap=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
211 212 213

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

216
pgsql() {
Jakub Jirutka's avatar
Jakub Jirutka committed
217
	pkgdesc="PostgreSQL driver for Dovecot"
218
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
219 220 221

	cd "$pkgdir"
	_submv $(find usr/ -name '*_pgsql*')
222 223 224
}

mysql() {
Jakub Jirutka's avatar
Jakub Jirutka committed
225
	pkgdesc="MySQL driver for Dovecot"
226
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
227 228 229

	cd "$pkgdir"
	_submv $(find usr/ -name '*_mysql*')
230 231 232
}

sqlite() {
Jakub Jirutka's avatar
Jakub Jirutka committed
233
	pkgdesc="SQLite driver for Dovecot"
234
	depends="$pkgname-sql=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
235 236 237

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

240
gssapi() {
Jakub Jirutka's avatar
Jakub Jirutka committed
241
	pkgdesc="GSSAPI auth plugin for Dovecot"
242
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
243 244 245

	cd "$pkgdir"
	_submv $(find usr/ -name '*_gssapi*')
246 247 248
}

ldap() {
Jakub Jirutka's avatar
Jakub Jirutka committed
249
	pkgdesc="LDAP auth plugin for Dovecot"
250
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
251 252 253 254

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

257 258
sql() {
	pkgdesc="SQL plugin for dovecot"
259
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
260 261 262 263

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

266 267
_fts_solr() {
	pkgdesc="FTS-Solr plugin for dovecot"
268
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
269 270 271

	cd "$pkgdir"
	_submv $(find usr/ -name '*fts*solr*')
272 273 274 275
}

_fts_lucene() {
	pkgdesc="FTS-Lucene plugin for dovecot"
276
	depends="$pkgname=$pkgver-r$pkgrel"
Jakub Jirutka's avatar
Jakub Jirutka committed
277 278 279 280 281 282 283 284 285 286 287 288 289 290

	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
291
}
TBK's avatar
TBK committed
292

293 294
sha512sums="c085a0d04925485423086736a3c7d919ad0ca9efeff005890382da5333edb68c7d23ccb89fbe2ac44f8f016fc993bf2c669e450794c3ab13463676cbb47c7bf7  dovecot-2.3.2.1.tar.gz
6bc24d9241f94db795a012346d9bc94b5cc7d7ce0175c03213c2b5d179d80dec95e9bdbd50bed628c8f9f7c51639e692ba5e429212a3b4a654c1e4764ac4f11c  dovecot-2.3-pigeonhole-0.5.2.tar.gz
TBK's avatar
TBK committed
295
fe4fbeaedb377d809f105d9dbaf7c1b961aa99f246b77189a73b491dc1ae0aa9c68678dde90420ec53ec877c08f735b42d23edb13117d7268420e001aa30967a  skip-iconv-check.patch
296
794875dbf0ded1e82c5c3823660cf6996a7920079149cd8eed54231a53580d931b966dfb17185ab65e565e108545ecf6591bae82f935ab1b6ff65bb8ee93d7d5  split-protocols.patch
297
0d8f89c7ba6f884719b5f9fc89e8b2efbdc3e181de308abf9b1c1b0e42282f4df72c7bf62f574686967c10a8677356560c965713b9d146e2770aab17e95bcc07  default-config.patch
298
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
299
d91951b81150d7a3ef6a674c0dc7b012f538164dac4b9d27a6801d31da6813b764995a438f69b6a680463e1b60a3b4f2959654f68e565fe116ea60312d5e5e70  dovecot.initd"