#
# OpenSWAN IPSec with KLIPS module PKGBUILD
#
# 2011-03-03 for Plugbox Linux 2.6.37
#

pkgname=openswan
pkgver=2.6.33
pkgrel=1
pkgdesc="Open Source implementation of IPsec for the Linux operating system"
url="http://www.openswan.org"
license=('GPL' 'BSD' 'custom')
arch=('arm')
provides=('KLIPS')
optdepends=('iproute: routing support' 'xl2tpd: for L2TP/IPSec tunnel')
makedepends=('make' 'gcc' 'bison' 'flex')
options=(!docs) #HTML docs do not build anyway
backup=(etc/ipsec.conf
        etc/ipsec.d/policies/{block,clear,clear-or-private,private,private-or-clear})
source=(http://www.openswan.org/download/openswan-$pkgver.tar.gz)

md5sums=('7e9c28585307b7ad4f59737debb0d940')

build() {

  cd $srcdir/openswan-$pkgver

  # Custom compiler flags break the build
  unset CFLAGS

  # Make openswan
  make programs || return 1
  make install

  # Make KLIPS
  export KERNELSRC=/usr/src/linux-`uname -r`/
  make module
  make module_install
}
