# $Id: PKGBUILD 97639 2013-09-26 10:12:42Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: Manolis Tzanidakis <manolis@archlinux.org>
# Contributor: Simon Lackerbauer <calypso "at" strpg.org>

pkgname=phpmyadmin
pkgver=4.0.7
pkgrel=1
pkgdesc='PHP and hence web-based tool to administrate MySQL over the WWW'
arch=('any')
url="http://www.phpmyadmin.net"
license=('GPL')
depends=('mariadb-clients' 'php')
optdepends=('php-mcrypt: to use phpMyAdmin internal authentication'
			'python')
backup=(etc/webapps/phpmyadmin/.htaccess
		etc/webapps/phpmyadmin/config.inc.php)
source=(http://downloads.sourceforge.net/sourceforge/$pkgname/phpMyAdmin-$pkgver-all-languages.tar.bz2)
install=$pkgname.install
sha256sums=('a891b33f8f9641f5c57b4dd5a78627ad366ea99ac59cb44beded8978a8d4968f')

package() {
  _instdir="$pkgdir"/usr/share/webapps/phpMyAdmin
  mkdir -p "$_instdir" "$pkgdir"/etc/webapps/phpmyadmin
  cd "$_instdir"

  cp -ra $srcdir/phpMyAdmin-${pkgver}-all-languages/* .
  echo "deny from all" >"$pkgdir"/etc/webapps/phpmyadmin/.htaccess

  ln -s /etc/webapps/phpmyadmin/.htaccess "$_instdir"/.htaccess
  ln -s /etc/webapps/phpmyadmin/config.inc.php "$_instdir"/config.inc.php
  cp "$_instdir"/config.sample.inc.php "$pkgdir"/etc/webapps/phpmyadmin/config.inc.php

  cat >"$pkgdir"/etc/webapps/phpmyadmin/apache.example.conf <<EOF
	Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
	<Directory "/usr/share/webapps/phpMyAdmin">
		AllowOverride All
		Options FollowSymlinks
		Order allow,deny
		Allow from all
		php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:/usr/share/pear/"
	</Directory>
EOF
}
