APKBUILD 2.71 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
Natanael Copa's avatar
Natanael Copa committed
4
pkgver=2.0.8
Natanael Copa's avatar
Natanael Copa committed
5
pkgrel=0
Michael Mason's avatar
Michael Mason committed
6 7
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
Natanael Copa's avatar
Natanael Copa committed
8
arch="x86 x86_64"
9
license="LGPL-2.1"
10
depends="openssl"
Natanael Copa's avatar
Natanael Copa committed
11 12
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
13
depends="logrotate"
14 15
makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
	mysql-dev sqlite-dev"
16
install="dovecot.pre-install dovecot.post-install"
Natanael Copa's avatar
Natanael Copa committed
17 18 19
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
20
	dovecot.logrotate
Michael Mason's avatar
Michael Mason committed
21
	dovecot.initd
Natanael Copa's avatar
Natanael Copa committed
22
	dovecot-sample-config.post-install
Michael Mason's avatar
Michael Mason committed
23 24
	"

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

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

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

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

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

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

60
	# fix ssl dirs in defautl config and set defautl passdb to passwd
Natanael Copa's avatar
Natanael Copa committed
61 62 63 64
	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
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
_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
93 94 95 96 97 98 99
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
}

Natanael Copa's avatar
Natanael Copa committed
100
md5sums="01b1c193469dfd14bf026a1516bea30c  dovecot-2.0.8.tar.gz
101
aec5cc797ab2acf72ce3b6bb1030345f  dovecot.logrotate
102
c58b474dca20e6e60fa4f1f5b9c726e1  dovecot.initd
Natanael Copa's avatar
Natanael Copa committed
103
95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"