APKBUILD 6.29 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.25
7
pkgrel=1
8
_pigeonholever=0.4.14
Michael Mason's avatar
Michael Mason committed
9 10
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
11
arch="all"
12
license="LGPL2+"
13
depends="openssl"
Natanael Copa's avatar
Natanael Copa committed
14 15
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
16
makedepends="libcap-dev zlib-dev libressl-dev bzip2-dev postgresql-dev
17
	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers"
18
install="dovecot.pre-install dovecot.post-install"
19 20
subpackages="$pkgname-doc $pkgname-dev
	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
21
	$pkgname-gssapi $pkgname-ldap $pkgname-pigeonhole-plugin:_pigeonhole
Natanael Copa's avatar
Natanael Copa committed
22
	"
Natanael Copa's avatar
Natanael Copa committed
23
source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
24
	http://pigeonhole.dovecot.org/releases/2.2/$pkgname-2.2-pigeonhole-$_pigeonholever.tar.gz
25
	hide-dl-errors.patch
26
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
27 28
	dovecot.initd
	"
29
options="libtool"
Michael Mason's avatar
Michael Mason committed
30

31
_builddir="$srcdir"/$pkgname-$pkgver
32
_builddirpigeonhole="$srcdir"/$pkgname-2.2-pigeonhole-$_pigeonholever
33

34
prepare() {
35 36 37 38 39
	cd "$_builddir"
	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
40
	done
41 42
}

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

	# Build pigeonhole plugin
	cd "$_builddirpigeonhole"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-dovecot="$_builddir" \
		--disable-static \
		|| return 1
	make || return 1
79
}
Michael Mason's avatar
Michael Mason committed
80

81
package() {
82
	cd "$_builddir"
83 84
	make DESTDIR="$pkgdir" install || return 1

85 86 87
	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
88 89

	# default config
90 91 92 93 94 95 96 97 98
	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
99 100
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
101 102 103 104 105 106
		"$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
107 108 109 110 111 112 113 114 115


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

	# 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
116 117
}

118 119 120 121 122 123
_mv() {
	local i
	while [ $# -gt 0 ]; do
		local dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
124
		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
125 126 127 128
		shift
	done
}

129 130 131 132 133
dev() {
	default_dev
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}
134

135
_pigeonhole() {
136 137 138 139 140 141 142
	pkgdesc="Sieve plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*sieve*')
	_mv $(cd "$pkgdir" && find usr -name '*pigeonhole*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*sieve*')
}

143 144
pgsql() {
	pkgdesc="postgresql driver for dovecot"
145 146
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
147 148 149 150
}

mysql() {
	pkgdesc="mysql driver for dovecot"
151 152
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_mysql*')
153 154 155 156
}

sqlite() {
	pkgdesc="sqlite driver for dovecot"
157 158
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_sqlite*')
159 160
}

161 162
gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
163 164
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
165 166 167
}

ldap() {
168 169 170 171
	pkgdesc="LDAP auth plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_ldap*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-ldap.conf*')
172 173
}

174 175 176 177 178
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
179 180
}

181
md5sums="8f62ea76489c47c369cbbe0b19818448  dovecot-2.2.25.tar.gz
182
27e47fb731f2948d6905b12b6184705f  dovecot-2.2-pigeonhole-0.4.14.tar.gz
Natanael Copa's avatar
Natanael Copa committed
183
49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
184 185
df6d43508a82903a97e3a2a5b8436d3d  dovecot.logrotate
f0c227ab4e2593f6d410440b82103de1  dovecot.initd"
186
sha256sums="d8d9f32c846397f7c22749a84c5cf6f59c55ff7ded3dc9f07749a255182f9667  dovecot-2.2.25.tar.gz
187
dff30a636c1516158f3e159c669a254569c9dabaa6ecfa3669379101ea5b3300  dovecot-2.2-pigeonhole-0.4.14.tar.gz
188
d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
189 190
d0fef8cd8200549877d7594cf458d6b33f05b31f95f1fd9a8368e8471c082735  dovecot.logrotate
1a3c845c216bb6f9633d27a8c1c0d01b591942c463bddb5ae835f162bd7fb4bf  dovecot.initd"
191
sha512sums="b38d815a727723dbeccf844be4bf05509fc4808ac1a25ba482da7ca25f30c5c57107b6064791326b39aa80bd45b61043266b451ee33ece3521bdbffca57fdecf  dovecot-2.2.25.tar.gz
192
97e72a3046a5975d416e49a900a9d801224c6de944aea4fd80b0e9c571af68d4e11c4a152ab6048abd9867a31eb4d8e3e648165489fb4a2b57a9a2929760247e  dovecot-2.2-pigeonhole-0.4.14.tar.gz
193
1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
194 195
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
6ec75a8396f4d826390e69aa8177593573eaf0e0ab537b2a4720573e04c92ff615f39e1559b48313b2cd2f03704cd977bb594a568ecc5dd22e38926c12f3c48c  dovecot.initd"