pkgname=lighttpd
pkgver=1.4.19
pkgrel=25
pkgdesc="lighttpd is a secure, fast, compliant and very flexible web-server"
arch=(i686 x86_64)
url="http://www.lighttpd.net/"
depends=('pcre' 'openssl' 'zlib' 'bzip2' 'attr')
makedepends=('fcgi' 'libmysqlclient'  'lua' 'gdbm'  \
             'libxml2' 'vim' 'pkgconfig' 'sqlite3')
backup=('etc/lighttpd/lighttpd.conf' 'etc/logrotate.d/lighttpd' \
        'etc/conf.d/lighttpd' 'etc/conf.d/spawn-php' \
        'home/lighttpd/html/index.html')
options=('!libtool')
install=$pkgname.install
source=(http://www.lighttpd.net/download/$pkgname-$pkgver.tar.gz \
        index.html $pkgname.rc.d $pkgname.conf.d $pkgname.logrotate.d \
        spawn-php.rc.d spawn-php.conf.d tweakconf.vim lighttpd.conf)
md5sums=('8f6756452138f5da384251f849b329f2' '85593eb67b928fec79b1efb3fa3cce84'\
         '6d05e499e47425e99bf809c88bd4969d' '14565fa5d30c60941190ceb32b1b551f'\
         'a8c31344b90328c5b751d965d79c5047' 'df940132363030eafcf7009a5322048f'\
         '1ba657b113b7e473fb301631a7e2e1a4' 'e799c48f7cee46db089f90030cec935a')

build() {
  cd $startdir/src/$pkgname-$pkgver
  ./configure --prefix=/usr --libdir=/usr/lib/lighttpd \
     --with-gdbm --with-lua --with-memcache \
    --with-openssl=/usr/include/openssl \
    --with-mysql=/usr/bin/mysql_config \
    --with-webdav-props --with-attr \
    --without-fam 
  make || return 1
  make DESTDIR=$startdir/pkg install || return 1

   # install configuration scripts and daemons
  #install -Dm644 ../index.html $startdir/pkg/data/srv/httpd/htdocs/index.html
  install -Dm755 ../lighttpd.rc.d $startdir/pkg/etc/rc.d/lighttpd
  install -Dm644 ../lighttpd.conf.d $startdir/pkg/etc/conf.d/lighttpd
  install -Dm644 ../lighttpd.logrotate.d $startdir/pkg/etc/logrotate.d/lighttpd
  install -Dm755 ../spawn-php.rc.d $startdir/pkg/etc/rc.d/spawn-php
  install -Dm644 ../spawn-php.conf.d $startdir/pkg/etc/conf.d/spawn-php

   # show some mercy on docfiles
#  mkdir -p $startdir/pkg/usr/share/lighttpd
#  install -m644 doc/*.txt $startdir/pkg/usr/share/lighttpd

  install -Dm644 doc/lighttpd.conf $startdir/pkg/etc/lighttpd/lighttpd.conf
  ex $startdir/pkg/etc/lighttpd/lighttpd.conf < $startdir/src/tweakconf.vim
  install -Dm644 $startdir/src/lighttpd.conf $startdir/pkg/etc/lighttpd/lighttpd.conf
}