APKBUILD 2.7 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 5
pkgver=2.0.13
pkgrel=0
Michael Mason's avatar
Michael Mason committed
6 7
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
8
arch="all"
9
license="LGPL-2.1"
Leonardo Arena's avatar
Leonardo Arena committed
10
depends="openssl logrotate"
Natanael Copa's avatar
Natanael Copa committed
11 12
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
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"
Natanael Copa's avatar
Natanael Copa committed
16 17 18
subpackages="$pkgname-sample-config:config $pkgname-doc $pkgname-dev
	$pkgname-pgsql $pkgname-mysql $pkgname-sqlite"
source="http://www.dovecot.org/releases/2.0/$pkgname-$pkgver.tar.gz
19
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
20
	dovecot.initd
Natanael Copa's avatar
Natanael Copa committed
21
	dovecot-sample-config.post-install
Michael Mason's avatar
Michael Mason committed
22 23
	"

24 25 26 27
prepare() {
	cd "$srcdir"/$pkgname-$pkgver
}

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

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

Michael Mason's avatar
Michael Mason committed
42
	make || return 1
43
}
Michael Mason's avatar
Michael Mason committed
44

45 46 47
package() {
	cd "$srcdir/$pkgname-$pkgver"
	make DESTDIR="$pkgdir" install
48 49
	install -d "$pkgdir"/var/run/dovecot \
		"$pkgdir"/etc/ssl/dovecot
50
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
51
	install -D "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot
Natanael Copa's avatar
Natanael Copa committed
52 53

	# default config
54
	install doc/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
Natanael Copa's avatar
Natanael Copa committed
55
	cp "$pkgdir"/usr/share/doc/dovecot/example-config/dovecot.conf \
56
		"$pkgdir"/etc/dovecot/dovecot.conf || return 1
Natanael Copa's avatar
Natanael Copa committed
57 58
	mkdir -p "$pkgdir"/etc/dovecot/conf.d

59
	# fix ssl dirs in defautl config and set defautl passdb to passwd
Natanael Copa's avatar
Natanael Copa committed
60 61 62 63
	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
Michael Mason's avatar
Michael Mason committed
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
_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')
}

Natanael Copa's avatar
Natanael Copa committed
92 93 94 95 96 97 98
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
}

99
md5sums="fd8a0702275a61332db7353dadff0f92  dovecot-2.0.13.tar.gz
100
aec5cc797ab2acf72ce3b6bb1030345f  dovecot.logrotate
101
01067b40dfd74dfb79b946af1e680745  dovecot.initd
Natanael Copa's avatar
Natanael Copa committed
102
95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"