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

                              
                  


                   
                   

                                                                     
                                                  

                                                                    
                                                                   
                         
                     
                          

         




                                                             



                                     
                                      
                                           

                                           




                                    

                                              
                        
 
 


                                      

                                              
                                                                               
                                                                                














                                                                                        
                                                                       
                                                  

 

























                                                          
                                                                
                                                   

                                                     
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dovecot
pkgver=1.2.13
pkgrel=1
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
license="LGPL-2.1"
depends="openssl"
pkgusers="dovecot"
pkggroups="dovecot"
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-doc $pkgname-dev $pkgname-pgsql $pkgname-mysql
	$pkgname-sqlite"
source="http://www.dovecot.org/releases/1.2/$pkgname-$pkgver.tar.gz
	dovecot.logrotate
	dovecot.initd
	2281223b9cb9.patch
	"

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

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

	./configure --prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc/dovecot \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-sql=plugin \
		--with-sql-drivers \
		--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
	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/\#\}/\}/
		    }' \
		-e 's,#log_path =.*,log_path = /var/log/dovecot.log,' \
		"$pkgdir"/etc/dovecot/dovecot.conf
}

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

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