APKBUILD 7.54 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 7 8 9
pkgver=2.2.26.0
pkgrel=0
_majorpkgver=${pkgver%.*.*}
_pigeonholever=0.4.16
10 11
_majorpigeonholever=${_pigeonholever%.*}
_pluginextdataver=39
Michael Mason's avatar
Michael Mason committed
12 13
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
14
arch="all"
15
license="LGPL2+"
16
depends="libressl"
Natanael Copa's avatar
Natanael Copa committed
17 18
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
19
makedepends="libcap-dev zlib-dev libressl-dev bzip2-dev postgresql-dev
20 21
	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers autoconf
	automake libtool"
22
install="dovecot.pre-install dovecot.post-install"
23 24
subpackages="$pkgname-doc $pkgname-dev
	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
25
	$pkgname-gssapi $pkgname-ldap $pkgname-pigeonhole-plugin:_pigeonhole
26
	$pkgname-pigeonhole-plugin-extdata:_pluginextdata
Natanael Copa's avatar
Natanael Copa committed
27
	"
28 29
source="http://www.dovecot.org/releases/$_majorpkgver/$pkgname-$pkgver.tar.gz
	http://pigeonhole.dovecot.org/releases/$_majorpkgver/$pkgname-$_majorpkgver-pigeonhole-$_pigeonholever.tar.gz
30
	http://hg.rename-it.nl/pigeonhole-0.4-sieve-extdata/archive/$_pluginextdataver.tar.gz
31
	hide-dl-errors.patch
32
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
33 34
	dovecot.initd
	"
35
options="libtool"
Michael Mason's avatar
Michael Mason committed
36

37
builddir="$srcdir"/$pkgname-$pkgver
38
_builddirpigeonhole="$srcdir"/$pkgname-$_majorpkgver-pigeonhole-$_pigeonholever
39
_builddirpluginextdata="$srcdir"/pigeonhole-0-4-sieve-extdata-$_pluginextdataver
40

41
prepare() {
42
	cd "$builddir"
43 44 45 46
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
Natanael Copa's avatar
Natanael Copa committed
47
	done
48 49
}

Michael Mason's avatar
Michael Mason committed
50
build() {
51
	cd "$builddir"
52 53 54 55
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
56
		--localstatedir=/var \
Natanael Copa's avatar
Natanael Copa committed
57
		--sysconfdir=/etc \
Michael Mason's avatar
Michael Mason committed
58 59
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
60 61
		--with-gssapi=plugin \
		--with-ldap=plugin \
62 63 64 65
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
66
		--with-ssl=openssl \
67 68
		--with-ssldir=/etc/ssl/dovecot \
		--with-rundir=/run/dovecot \
69
		|| return 1
Michael Mason's avatar
Michael Mason committed
70
	make || return 1
71 72 73 74 75 76 77 78 79 80 81

	# Build pigeonhole plugin
	cd "$_builddirpigeonhole"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
82
		--with-dovecot="$builddir" \
83 84 85
		--disable-static \
		|| return 1
	make || return 1
86 87 88 89 90 91 92 93 94 95 96 97 98 99

	# Build the extdata plugin
	cd "$_builddirpluginextdata"
	./autogen.sh || return 1
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-dovecot="$builddir" \
		--with-pigeonhole="$_builddirpigeonhole" \
		|| return 1
	make || return 1
100
}
Michael Mason's avatar
Michael Mason committed
101

102
package() {
103
	cd "$builddir"
104 105
	make DESTDIR="$pkgdir" install || return 1

106 107 108
	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
109 110

	# default config
111 112 113 114 115 116 117 118 119
	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
Natanael Copa's avatar
Natanael Copa committed
120 121
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
122 123 124 125 126 127
		"$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
128 129 130 131 132 133


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

134 135 136 137
	# Installing extdata plugin
	cd "$_builddirpluginextdata"
	make install DESTDIR="$pkgdir" || return 1

138 139 140
	# Moving config in the correct place
	mv "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/* \
		"$pkgdir"/etc/dovecot/conf.d || return 1
Michael Mason's avatar
Michael Mason committed
141 142
}

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

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

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

169 170 171 172 173 174
_pluginextdata() {
	pkgdesc="Pigeonhole Sieve Extdata Plugin"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*sieve_extdata*')
}

175 176
pgsql() {
	pkgdesc="postgresql driver for dovecot"
177 178
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
179 180 181 182
}

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

sqlite() {
	pkgdesc="sqlite driver for dovecot"
189 190
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_sqlite*')
191 192
}

193 194
gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
195 196
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
197 198 199
}

ldap() {
200 201 202 203
	pkgdesc="LDAP auth plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_ldap*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-ldap.conf*')
204 205
}

206 207 208 209 210
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
211
}
212 213
md5sums="85bc42328de41d1eb8d6d3f1db666db8  dovecot-2.2.26.0.tar.gz
e03eed707b39cffc4b2a82867de45d9c  dovecot-2.2-pigeonhole-0.4.16.tar.gz
214
5d26d326856d00ce04c620b549d58f79  39.tar.gz
Natanael Copa's avatar
Natanael Copa committed
215
49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
216 217
df6d43508a82903a97e3a2a5b8436d3d  dovecot.logrotate
f0c227ab4e2593f6d410440b82103de1  dovecot.initd"
218 219
sha256sums="f692a1f39de36cd15f6681f7fee5fba2ef3e72b529acbee02b23422e16926f05  dovecot-2.2.26.0.tar.gz
8f0b98f18062d6e241eef74ebe16cc167cd246361cbe6657d94f0ecc5d7d3234  dovecot-2.2-pigeonhole-0.4.16.tar.gz
220
da70fb0ce0424e9cad2c03834bd826a3685deb5a986ec5b87ae7c525055256d5  39.tar.gz
221
d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
222 223
d0fef8cd8200549877d7594cf458d6b33f05b31f95f1fd9a8368e8471c082735  dovecot.logrotate
1a3c845c216bb6f9633d27a8c1c0d01b591942c463bddb5ae835f162bd7fb4bf  dovecot.initd"
224 225
sha512sums="7b4c170efd964eabbd9a0166164e53b7964b90fc245bab1c3328bf199c4880288c89811dcfd9833f899057921eefb4451c561f3b3d725df9ea346df8fde82a3d  dovecot-2.2.26.0.tar.gz
5f59fb35dbe638f8ddd19c0fd0f3fbd6fec1fa238f3781b94c50a8f7ce72a53ac1381a6f8ad9bcc90df1edfa2b263a6dfba88521578e55ce4b3d840bed022b79  dovecot-2.2-pigeonhole-0.4.16.tar.gz
226
832a80264fb9bd3021c4e192eb7594c203100783df547aff35acf4dc4d8de5eddfd676fcc5a07a0691d9bb6eb884c9497a692b72a2af5bf9e9bb7a2d3f38923e  39.tar.gz
227
1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
228 229
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
6ec75a8396f4d826390e69aa8177593573eaf0e0ab537b2a4720573e04c92ff615f39e1559b48313b2cd2f03704cd977bb594a568ecc5dd22e38926c12f3c48c  dovecot.initd"