Gitlab has successfully been upgraded to 14.0.10 🎉. Enjoy!

APKBUILD 7.69 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.4.1
TBK's avatar
TBK committed
8
_pkgvermajor=2.3
9 10
pkgrel=0
_pigeonholever=0.5.4
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="openssl"
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
makedepends="
	autoconf
	automake
	bzip2-dev
	clucene-dev
	expat-dev
	heimdal-dev
	libcap-dev
28
	openssl-dev
Jakub Jirutka's avatar
Jakub Jirutka committed
29 30 31 32 33 34 35 36
	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
	dovecot.initd
63
	mysql-fix-double-close.patch
Michael Mason's avatar
Michael Mason committed
64
	"
Jakub Jirutka's avatar
Jakub Jirutka committed
65 66
builddir="$srcdir/$pkgname-$pkgver"
_builddir_pigeonhole="$srcdir/$pkgname-$_pkgvermajor-pigeonhole-$_pigeonholever"
67

68
# secfixes:
69 70
#   2.3.4.1-r0:
#     - CVE-2019-3814
TBK's avatar
TBK committed
71
#   2.3.1-r0:
72 73 74
#     - CVE-2017-15130
#     - CVE-2017-14461
#     - CVE-2017-15132
75 76

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

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

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

Natanael Copa's avatar
Natanael Copa committed
113 114 115 116 117
check() {
	cd "$builddir"
	make check
}

118
package() {
119
	cd "$builddir"
Jakub Jirutka's avatar
Jakub Jirutka committed
120

121
	make DESTDIR="$pkgdir" install
122

Jakub Jirutka's avatar
Jakub Jirutka committed
123 124 125 126 127
	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
128 129

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


Jakub Jirutka's avatar
Jakub Jirutka committed
150 151
	# Installing pigeonhole plugin.
	cd "$_builddir_pigeonhole"
152
	make install DESTDIR="$pkgdir"
153 154 155

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

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

162 163
dev() {
	default_dev
164
	mkdir -p "$subpkgdir"/usr/lib/dovecot
165 166 167
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}
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
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"
195
	echo "protocols = \$protocols $name" \
196 197 198
		> "$protocolsd"/${subpkgname#$pkgname-}.conf
}

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

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

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

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

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

	cd "$pkgdir"
	_submv $(find usr/ -name '*_pgsql*')
225 226 227
}

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

	cd "$pkgdir"
	_submv $(find usr/ -name '*_mysql*')
233 234 235
}

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

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

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

	cd "$pkgdir"
	_submv $(find usr/ -name '*_gssapi*')
249 250 251
}

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

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

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

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

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

	cd "$pkgdir"
	_submv $(find usr/ -name '*fts*solr*')
275 276 277 278
}

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

	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
294
}
TBK's avatar
TBK committed
295

296 297
sha512sums="ff21aa0f0cae17dfa66617291688856727412defa48bad2b6be057cb509fbec1c2e134afbfee69929d06b8692a0fcbd8451671ba02860e1673ae1c9483c2c17e  dovecot-2.3.4.1.tar.gz
9c82cce7540f8ab66e2e370e0220c99048d6ac53ed680cd763e0b03d0200e2451cee4303ef97b87a16e7248e1c73b92ba91b47a2a20c75cb2cd62695a28046f3  dovecot-2.3-pigeonhole-0.5.4.tar.gz
TBK's avatar
TBK committed
298
fe4fbeaedb377d809f105d9dbaf7c1b961aa99f246b77189a73b491dc1ae0aa9c68678dde90420ec53ec877c08f735b42d23edb13117d7268420e001aa30967a  skip-iconv-check.patch
299
794875dbf0ded1e82c5c3823660cf6996a7920079149cd8eed54231a53580d931b966dfb17185ab65e565e108545ecf6591bae82f935ab1b6ff65bb8ee93d7d5  split-protocols.patch
300
0d8f89c7ba6f884719b5f9fc89e8b2efbdc3e181de308abf9b1c1b0e42282f4df72c7bf62f574686967c10a8677356560c965713b9d146e2770aab17e95bcc07  default-config.patch
301
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
302 303
d91951b81150d7a3ef6a674c0dc7b012f538164dac4b9d27a6801d31da6813b764995a438f69b6a680463e1b60a3b4f2959654f68e565fe116ea60312d5e5e70  dovecot.initd
07500fdc27e8e76f8325e7160e3ac0dfd80e3dcb6d310499ea3b7d6c7899809bbb76c01aec78c4b8b9bf80cd8260dbc26726a612357d30f3b3c8be80f77f9abd  mysql-fix-double-close.patch"