APKBUILD 2.64 KB
Newer Older
Michael Mason's avatar
Michael Mason committed
1
# Contributor: Michael Mason <ms13sp@gmail.com>
2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
Michael Mason's avatar
Michael Mason committed
3
pkgname=dovecot
4
pkgver=1.2.13
5
pkgrel=1
Michael Mason's avatar
Michael Mason committed
6 7
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
8
license="LGPL-2.1"
9 10 11
depends="openssl"
pkgusers="dovecot"
pkggroups="dovecot"
12
depends="logrotate"
13 14
makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
	mysql-dev sqlite-dev"
15
install="dovecot.pre-install dovecot.post-install"
16 17
subpackages="$pkgname-doc $pkgname-dev $pkgname-pgsql $pkgname-mysql
	$pkgname-sqlite"
18
source="http://www.dovecot.org/releases/1.2/$pkgname-$pkgver.tar.gz
19
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
20
	dovecot.initd
21
	2281223b9cb9.patch
Michael Mason's avatar
Michael Mason committed
22 23
	"

24 25 26 27 28
prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	patch -p1 -i "$srcdir"/2281223b9cb9.patch || return 1
}

Michael Mason's avatar
Michael Mason committed
29 30 31 32
build() {
	cd "$srcdir/$pkgname-$pkgver"

	./configure --prefix=/usr \
33
		--localstatedir=/var \
34
		--sysconfdir=/etc/dovecot \
Michael Mason's avatar
Michael Mason committed
35 36
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
37 38 39 40 41
		--with-sql=plugin \
		--with-sql-drivers \
		--with-mysql \
		--with-sqlite \
		--with-pgsql \
42 43
		--with-ssl=openssl || return 1

Michael Mason's avatar
Michael Mason committed
44
	make || return 1
45
}
Michael Mason's avatar
Michael Mason committed
46

47 48 49
package() {
	cd "$srcdir/$pkgname-$pkgver"
	make DESTDIR="$pkgdir" install
50 51
	install -d "$pkgdir"/var/run/dovecot \
		"$pkgdir"/etc/ssl/dovecot
52
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
53
	install -D "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
	install doc/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
	mv "$pkgdir"/etc/dovecot/dovecot-example.conf \
		"$pkgdir"/etc/dovecot/dovecot.conf || return 1
	
	# fix ssl dirs in defautl config and set defautl passdb to passwd
	sed -i -e 's,^#ssl_cert_file =.*,ssl_cert_file = /etc/ssl/dovecot/server.pem,' \
		-e 's,^#ssl_key_file =.*,ssl_key_file = /etc/ssl/dovecot/server.key,' \
		-e '/passdb pam {/,/^$/{
			s/passdb pam/\#passdb pam/
			s/}/\#}/
		    }' \
		-e '/\#passdb passwd {/,/^$/{
			s/\#passdb passwd/passdb passwd/
			s/\#\}/\}/
		    }' \
69
		-e 's,#log_path =.*,log_path = /var/log/dovecot.log,' \
70
		"$pkgdir"/etc/dovecot/dovecot.conf
Michael Mason's avatar
Michael Mason committed
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
_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')
}

99
md5sums="aaee3b5fd59e01780305553248f686bc  dovecot-1.2.13.tar.gz
100
aec5cc797ab2acf72ce3b6bb1030345f  dovecot.logrotate
101 102
c58b474dca20e6e60fa4f1f5b9c726e1  dovecot.initd
c8581417ce7946668839a9d0fcd93ee8  2281223b9cb9.patch"