# $Id: PKGBUILD 108975 2014-04-08 13:24:11Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=roundcubemail
pkgver=1.0.0
pkgrel=1
pkgdesc="A PHP web-based mail client"
arch=('any')
url="http://www.roundcube.net"
license=('GPL')
depends=('php')
optdepends=('python2')
backup=('etc/webapps/roundcubemail/.htaccess'
	'etc/webapps/roundcubemail/apache.conf')
install=roundcubemail.install
options=('!strip')
source=(http://downloads.sourceforge.net/sourceforge/roundcubemail/roundcubemail-${pkgver/rc/-rc}.tar.gz
	apache.conf)
md5sums=('325f79deeadb8993ca8a20f0077f2535'
         '9ef887b19632239911b287ce0e270ae8')

package() {
  mkdir -p ${pkgdir}/etc/webapps/roundcubemail
  mkdir -p ${pkgdir}/usr/share/webapps
  mkdir -p ${pkgdir}/var/log
  cd ${pkgdir}/usr/share/webapps
  cp -ra ${srcdir}/roundcubemail-${pkgver/rc/-rc} roundcubemail
  cd roundcubemail

  mv .htaccess $pkgdir/etc/webapps/roundcubemail/
  ln -s /etc/webapps/roundcubemail/.htaccess .htaccess

  mv config $pkgdir/etc/webapps/roundcubemail/
  ln -s /etc/webapps/roundcubemail/config config

  mv logs $pkgdir/var/log/roundcubemail
  ln -s /var/log/roundcubemail logs

  install -Dm0644 $srcdir/apache.conf $pkgdir/etc/webapps/roundcubemail/apache.conf
}
