# $Id: PKGBUILD 127530 2015-02-10 18:29:41Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Ryan Coyner <rcoyner@gmail.com>

pkgbase=mod_wsgi
pkgname=($pkgbase 'mod_wsgi2')
pkgver=4.4.8
pkgrel=1
pkgdesc='Python2 WSGI adapter module for Apache'
arch=('x86_64' 'i686')
url='http://www.modwsgi.org/'
license=('APACHE')
makedepends=('apache' 'python' 'python2' 'git')
install='mod_wsgi.install'
source=("git://github.com/GrahamDumpleton/mod_wsgi#tag=$pkgver")
md5sums=('SKIP')

build() {
  cp -r "$pkgbase" py2

  # Build the Python 3 version
  cd "$pkgbase"
  ./configure --prefix=/usr \
    --with-apxs=/usr/bin/apxs \
    --with-python=/usr/bin/python
  make LDLIBS='-lpython3 -lpthread -ldl -lutil -lm'

  # Build the Python 2 version
  cd "$srcdir/py2"
  ./configure \
    --prefix=/usr \
    --with-apxs=/usr/bin/apxs \
    --with-python=/usr/bin/python2
  make
}

package_mod_wsgi() {
  pkgdesc='Python WSGI adapter module for Apache'
  depends=('apache' 'python')
  conflicts=('mod_wsgi2')

  make -C "$pkgbase" DESTDIR="$pkgdir" install
}

package_mod_wsgi2() {
  pkgdesc='Python2 WSGI adapter module for Apache'
  depends=('apache' 'python2')
  conflicts=('mod_wsgi')

  make -C py2 DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
