aboutsummaryrefslogtreecommitdiffstats
path: root/main/dovecot/APKBUILD
blob: 9d94bd3ed04202ca4d4dc8246d36a4e12ca65f17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dovecot
pkgver=2.2.18
pkgrel=1
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
arch="all"
license="LGPL2+"
depends="openssl"
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers"
install="dovecot.pre-install dovecot.post-install"
subpackages="$pkgname-sample-config:config $pkgname-doc $pkgname-dev
	$pkgname-pgsql $pkgname-mysql $pkgname-sqlite $pkgname-gssapi
	$pkgname-ldap"
patches="
	hide-dl-errors.patch
	"
source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
	$patches
	dovecot.logrotate
	dovecot.initd
	dovecot-sample-config.post-install
	"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	for i in $patches; do
		msg $i
		patch -p1 -i "$srcdir"/$i || return 1
	done
}

build() {
	cd "$srcdir/$pkgname-$pkgver"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-gssapi=plugin \
		--with-ldap=plugin \
		--with-sql=plugin \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
		--with-ssl=openssl \
		|| return 1

	make || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	make DESTDIR="$pkgdir" install || return 1
	rm "$pkgdir"/usr/lib/dovecot/*.la \
		"$pkgdir"/usr/lib/dovecot/*/*.la || return 1

	install -d "$pkgdir"/var/run/dovecot \
		"$pkgdir"/etc/ssl/dovecot
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot

	# default config
	install doc/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
	cp "$pkgdir"/usr/share/doc/dovecot/example-config/dovecot.conf \
		"$pkgdir"/etc/dovecot/dovecot.conf || return 1
	mkdir -p "$pkgdir"/etc/dovecot/conf.d

	# fix ssl dirs in default config and set defautl passdb to passwd
	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
		"$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/10-ssl.conf\
		|| return 1

	# install ssl config by default
	cp "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/10-ssl.conf\
		"$pkgdir"/etc/dovecot/conf.d/ || return 1
}

_mv() {
	local i
	while [ $# -gt 0 ]; do
		local dir=${1%/*}
		mkdir -p "$subpkgdir"/$dir
		mv "$pkgdir/$1" "$subpkgdir/$dir/"
		shift
	done
}


pgsql() {
	pkgdesc="postgresql driver for dovecot"
	_mv $(cd "$pkgdir" && find usr -name '*pgsql.so')
}

mysql() {
	pkgdesc="mysql driver for dovecot"
	_mv $(cd "$pkgdir" && find usr -name '*mysql.so')
}

sqlite() {
	pkgdesc="sqlite driver for dovecot"
	_mv $(cd "$pkgdir" && find usr -name '*sqlite.so')
}

gssapi() {
	pkgdesc="GSSAPI auth plugin for dovecot"
	_mv $(cd "$pkgdir" && find usr -name '*gssapi.so')
}

ldap() {
	pkgdesc="LDAP plugin for dovecot"
	_mv $(cd "$pkgdir" && find usr -name '*ldap.so')
}

config() {
	pkgdesc="Sample configuration files for dovecot"
	install="dovecot-sample-config.post-install"
	_mv usr/share/doc/dovecot/example-config
	mkdir -p "$subpkgdir"/etc/dovecot/conf.d
}

md5sums="1e42eb3b69544c447ad882d7858f3630  dovecot-2.2.18.tar.gz
49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
2a63d966ce4d9c63cecf99d183c394a0  dovecot.initd
95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"
sha256sums="b6d8468cea47f1227f47b80618f7fb872e2b2e9d3302adc107a005dd083865bb  dovecot-2.2.18.tar.gz
d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
e6dd8e654a66aeb84ae63959de290ccf6ba05d890232a107edf1bb83a88767bb  dovecot.initd
7dab0591eca7fe1473ae7b39ed9ae0d7d51617ffea01252ace5c3aa68150693f  dovecot-sample-config.post-install"
sha512sums="227fa9c55070ce305d41faebb0fe15df86cb70427dd4043a01837095228b5504121fccaecfbf47fab3426334449b637bffdfe9a93ee2322bb8ff8d69de4967c7  dovecot-2.2.18.tar.gz
1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
984b24d331e0d837c2c16db1e6e3d5a7fd43b1cfb3e0b1450402dfc7f9cc59ed5a13c553a34864c045a8ffc274ddb728e46e68e2483caef56e98775c219ee687  dovecot.initd
c5665334b0664ae29f52c022a8ffc2e520cfc506e399d2e614464dd5770caade794eeaf3406fe8ded1d927b06672d0597e2fe53d32fbfaf9f4cf025bce792a5b  dovecot-sample-config.post-install"