pkgname=chan-sccp
pkgver=4.2.2
pkgrel=0
release=6497
pkgdesc="Chan-SCCP channel driver for Asterisk"
url="http://chan-sccp-b.sourceforge.net/";
arch="all"
license="GPL2"
depends=""
makedepends="asterisk-dev"
install=""
subpackages="${pkgname}-gen_sccpconf ${pkgname}-doc"
source="http://downloads.sourceforge.net/project/chan-sccp-b/V${pkgver:0:1}/Chan_SCCP-${pkgver}_STABLE_r${release}.tar.gz"
_builddir="$srcdir"/Chan_SCCP-${pkgver}_STABLE_r${release}

build() {
	cd "$_builddir"
	./configure --prefix=/usr
	make || return 1
	cd contrib/gen_sccpconf
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

gen_sccpconf() {
	pkgdesc="SCCP Config Generator"
	cd "$_builddir"/contrib/gen_sccpconf
	make DESTDIR="$subpkgdir" install || return 1
	rm -fr "$subpkgdir"/usr/share
}

doc() {
	arch="noarch"
	cd "$_builddir"/conf
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
	cp -r . "$subpkgdir"/usr/share/doc/$pkgname
	chmod -x "$subpkgdir"/usr/share/doc/$pkgname/*.sql
}
md5sums="49aaffef2efeb5b67d24b7e977adf03d  Chan_SCCP-4.2.2_STABLE_r6497.tar.gz"
sha256sums="73bb1aec157f78b1823f4fb474d3a4981beefa01be1dcfb934a6d10117f291fc  Chan_SCCP-4.2.2_STABLE_r6497.tar.gz"
sha512sums="643150456e03ce659e34bbf97f18cab132cc4ac17059a8c9ea1e93faab832464183a43959a59e48292a563e30a2395c273c8150d36e49c1efa37037271a3de05  Chan_SCCP-4.2.2_STABLE_r6497.tar.gz"