# $Id: PKGBUILD 118027 2014-08-28 13:49:56Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Antonio Rojas <nqn1976 @ gmail.com>
# Based on owncloud-git PKGBUILD by Alexander Ovsyannikov

pkgname=owncloud
pkgver=7.0.2
pkgrel=1
pkgdesc="A cloud server to store your files centrally on a hardware controlled by you"
arch=('any')
url="http://owncloud.org/"
license=('GPL')
depends=('php-gd')
optdepends=('php-apache: to use the Apache web server'
	    'php-sqlite: to use the SQLite database backend'
	    'php-pgsql: to use the PostgreSQL database backend'
	    'php-ldap: LDAP authentication'
	    'php-intl'
	    'php-apcu'
	    'php-xcache'
	    'mariadb: to use the MySQL database backend'
	    'smbclient: to mount SAMBA shares'
	    'php-mcrypt'
#	    'php-imagick: file preview'
	    'ffmpeg: file preview'
	    'libreoffice-common: file preview')
makedepends=()
options=('!strip')
backup=('etc/webapps/owncloud/apache.example.conf')
source=("http://download.owncloud.org/community/$pkgname-${pkgver}.tar.bz2"{,.asc}
	'apache.example.conf')
md5sums=('4af57e093878917d80004f7151f9282e'
         'SKIP'
         '64c6edf88bcbb37d063e4bf77b39237f')

package() {
  # install license
  install -d ${pkgdir}/usr/share/licenses/${pkgname}
  cp ${srcdir}/${pkgname}/COPYING-* ${pkgdir}/usr/share/licenses/${pkgname}

  # install project
  install -d ${pkgdir}/usr/share/webapps/
  cp -a ${srcdir}/${pkgname} ${pkgdir}/usr/share/webapps/

  # install apache config file
  install -d  ${pkgdir}/etc/webapps/${pkgname}
  install -m 644 ${srcdir}/apache.example.conf  ${pkgdir}/etc/webapps/${pkgname}

  # move config to /etc
  mv ${pkgdir}/usr/share/webapps/owncloud/config ${pkgdir}/etc/webapps/${pkgname}/config
  chown -R http:http ${pkgdir}/etc/webapps/${pkgname}/config
  ln -s /etc/webapps/${pkgname}/config ${pkgdir}/usr/share/webapps/owncloud/config
}
