# $Id: PKGBUILD 239446 2015-05-16 11:40:43Z pierre $
# Maintainer: tobias <tobias@justdreams.de>
# Modified by: eliott <eliott@cactuswax.net>
# Original by Benjamin Andresen, klapmuetz [at] gmail [dot] com

pkgname=fcgi
pkgver=2.4.0
pkgrel=10
depends=('gcc-libs')
pkgdesc="FASTCgi (fcgi) is a language independent, high performant extension to CGI"
arch=('i686' 'x86_64')
license=('custom')
options=('!makeflags')
url="http://www.fastcgi.com"
source=("http://www.fastcgi.com/dist/${pkgname}-${pkgver}.tar.gz"
        'fcgi-2.4.0-configure.in.patch' 'fcgi-2.4.0-Makefile.am-CPPFLAGS.patch'
        'fcgi-2.4.0-gcc44_fixes.patch' 'fcgi-2.4.0-poll.patch')
md5sums=('d15060a813b91383a9f3c66faf84867e'
         '7e901968aa90168b6cdfc8323ca59868'
         '8c07165aed574b853326ae25fe9af291'
         '2e72c834db21da6af3f77dd2b36727a2'
         '02900e5f2400ed2982db1e02c4a17aa8')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  # Patches by Fedora:
  # http://pkgs.fedoraproject.org/cgit/fcgi.git/tree/
  patch -p1 -i "${srcdir}/fcgi-2.4.0-configure.in.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-Makefile.am-CPPFLAGS.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-gcc44_fixes.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-poll.patch"

  libtoolize --automake --copy --force
  aclocal
  autoheader
  automake --add-missing --force-missing --copy
  autoconf
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 LICENSE.TERMS "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
