aboutsummaryrefslogblamecommitdiffstats
path: root/main/dovecot/APKBUILD
blob: 44b28aa5d712d7be742680546e8893b03b8cc4fb (plain) (tree)
1
2
3
4
5
6
7
8
9
                                               
                                                   
               
            
        

                              
          
                  
                 

                            
                   

                                                                     
                                                  


                                                                    
                         
                     
                                          

         

                                     

 



                                     
                                      
                                   

                                           
                                   


                               

                                              
                        
 
 


                                      

                                              
                                                                               
                                                                                

                        
                                                              
                                                                        
                                                              

                                             
                                                                         



                                                                                  

 

























                                                          






                                                        
                                                               
                                                   
                                               
                                                                     
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dovecot
pkgver=2.0.8
pkgrel=0
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
arch="all"
license="LGPL-2.1"
depends="openssl"
pkgusers="dovecot dovenull"
pkggroups="dovecot dovenull"
depends="logrotate"
makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
	mysql-dev sqlite-dev"
install="dovecot.pre-install dovecot.post-install"
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
	dovecot.logrotate
	dovecot.initd
	dovecot-sample-config.post-install
	"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
}

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

	./configure --prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--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
	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 defautl 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
}

_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')
}

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="01b1c193469dfd14bf026a1516bea30c  dovecot-2.0.8.tar.gz
aec5cc797ab2acf72ce3b6bb1030345f  dovecot.logrotate
c58b474dca20e6e60fa4f1f5b9c726e1  dovecot.initd
95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"