# Contributor: Jeff Bilyk <jbilyk@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=apache-mod-auth-radius
_pkgname=mod_auth_radius
pkgver=1.5.8
pkgrel=3
pkgdesc="Apache authentication module to become RADIUS client for AAA requests"
url="http://freeradius.org/mod_auth_radius/"
arch="all"
license="BSD"
depends="apache2"
makedepends="apache2-dev freeradius-dev"
install=""
source="ftp://ftp.freeradius.org/pub/radius/$_pkgname-$pkgver.tar
	mod-auth-radius.conf
	remote-ip.patch"

_builddir="$srcdir"/$_pkgname-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	apxs -c mod_auth_radius-2.0.c
}

package() {
	cd "$_builddir"
	mkdir -p "$pkgdir"/etc/apache2/conf.d
	mkdir -p "$pkgdir"/usr/lib/apache2
	/usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/build-1/libtool' mod_auth_radius-2.0.la "$pkgdir"/usr/lib/apache2/
	/usr/share/build-1/libtool --mode=install install mod_auth_radius-2.0.la "$pkgdir"/usr/lib/apache2/
	install -D -m644 ../../mod-auth-radius.conf "$pkgdir"/etc/apache2/conf.d/mod-auth-radius.conf
}

md5sums="87d8ef049736254cc09f8b34667f0e59  mod_auth_radius-1.5.8.tar
7021387d32ae7ccb3490ef06ef101b65  mod-auth-radius.conf
50775b28edbbf74fd1d99b85447740f9  remote-ip.patch"
sha256sums="6a16cb64c8e3da5ccef5db007d3ab3fa53274bdb37c5f6b1821a12de42aa6d93  mod_auth_radius-1.5.8.tar
de656ee2c41d1b05044728d314cae2fff1b1af225b71fc852bc2c244bf24754d  mod-auth-radius.conf
af286dc55ea23c8f5996f72f90c403514000b87de1a76c71f769208dfcffd556  remote-ip.patch"
sha512sums="0fcc43a44ea17b33595a850abb03ff6b92e100dfbeffc82caa9516f6eb7914fb463cb62286d624203a2c7035d05a107dda7b68c5cedf7de3b8be95b9266b6988  mod_auth_radius-1.5.8.tar
f5f8bb154e290c4f1d1af899b24ee2011d8fe88fbf31a3fd865e9dfd9927cc8e23cb022be996ec3c43ed79309814ad63efe7f3cd5b3ed670d23a572b3e561f54  mod-auth-radius.conf
85f58a7d09ee097f61fe691a4cbd777c4208e1daa880d46980c944903a33e70e4ecfacbcccd1d8b6fd175c661b7b0cde7081470c024a89d84f274d2bf3963e24  remote-ip.patch"
