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

29 30
_builddir="$srcdir"/$pkgname-$pkgver

31
prepare() {
32 33 34 35 36
	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
37
	done
38 39
}

Michael Mason's avatar
Michael Mason committed
40
build() {
41
	cd "$_builddir"
42 43 44 45
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
46
		--localstatedir=/var \
Natanael Copa's avatar
Natanael Copa committed
47
		--sysconfdir=/etc \
Michael Mason's avatar
Michael Mason committed
48 49
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
50 51
		--with-gssapi=plugin \
		--with-ldap=plugin \
52 53 54 55
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
56
		--with-ssl=openssl \
57 58
		--with-ssldir=/etc/ssl/dovecot \
		--with-rundir=/run/dovecot \
59
		|| return 1
Michael Mason's avatar
Michael Mason committed
60
	make || return 1
61
}
Michael Mason's avatar
Michael Mason committed
62

63
package() {
64
	cd "$_builddir"
65 66
	make DESTDIR="$pkgdir" install || return 1

67 68 69
	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
70 71

	# default config
72 73 74 75 76 77 78 79 80
	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
81 82
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
83 84 85 86 87 88
		"$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
Michael Mason's avatar
Michael Mason committed
89 90
}

91 92 93 94 95 96
_mv() {
	local i
	while [ $# -gt 0 ]; do
		local dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
97
		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
98 99 100 101
		shift
	done
}

102 103 104 105 106
dev() {
	default_dev
	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
		"$subpkgdir"/usr/lib/dovecot/
}
107 108 109

pgsql() {
	pkgdesc="postgresql driver for dovecot"
110 111
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
112 113 114 115
}

mysql() {
	pkgdesc="mysql driver for dovecot"
116 117
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_mysql*')
118 119 120 121
}

sqlite() {
	pkgdesc="sqlite driver for dovecot"
122 123
	depends="$pkgname-sql"
	_mv $(cd "$pkgdir" && find usr -name '*_sqlite*')
124 125
}

126 127
gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
128 129
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
130 131 132
}

ldap() {
133 134 135 136
	pkgdesc="LDAP auth plugin for dovecot"
	depends="$pkgname"
	_mv $(cd "$pkgdir" && find usr -name '*_ldap*')
	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-ldap.conf*')
137 138
}

139 140 141 142 143
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
144 145
}

146
md5sums="0d2855c19b0603b417cd70613b4a9f36  dovecot-2.2.23.tar.gz
Natanael Copa's avatar
Natanael Copa committed
147
49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
148 149 150
df6d43508a82903a97e3a2a5b8436d3d  dovecot.logrotate
f0c227ab4e2593f6d410440b82103de1  dovecot.initd"
sha256sums="5d834be43fe8f6f61d9b0fb139bf1db2a4da313aeebd7bf09e4bf6bcb1c9e441  dovecot-2.2.23.tar.gz
151
d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
152 153 154
d0fef8cd8200549877d7594cf458d6b33f05b31f95f1fd9a8368e8471c082735  dovecot.logrotate
1a3c845c216bb6f9633d27a8c1c0d01b591942c463bddb5ae835f162bd7fb4bf  dovecot.initd"
sha512sums="704d86dcef8b217a54db1d1ae3c1e0d6303827fedd7150aec83e805512cd1c5befc88da44660e7a40765ad6800c14d399f8c7621e84125a7732d68fee7f18d82  dovecot-2.2.23.tar.gz
155
1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
156 157
9f19698ab45969f1f94dc4bddf6de59317daee93c9421c81f2dbf8a7efe6acf89689f1d30f60f536737bb9526c315215d2bce694db27e7b8d7896036a59c31f0  dovecot.logrotate
6ec75a8396f4d826390e69aa8177593573eaf0e0ab537b2a4720573e04c92ff615f39e1559b48313b2cd2f03704cd977bb594a568ecc5dd22e38926c12f3c48c  dovecot.initd"