# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
pkgname=captagent
pkgver=6.3.0
pkgrel=1
pkgdesc="HEP Capture Agent for HOMER"
url="https://github.com/sipcapture/captagent"
arch="all"
license="GPL-3.0"
makedepends="autoconf automake bison expat-dev flex flex-dev json-c-dev
             libgcrypt-dev libpcap-dev libtool libuv-dev linux-headers libressl-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/captagent/archive/$pkgver.tar.gz
        $pkgname.initd
        ac-fix.patch"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir" && ./build.sh && ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc &&
		make
}

package() {
	cd "$builddir" && make install DESTDIR="$pkgdir" && \
		install -D "$srcdir"/$pkgname.initd \
			"$pkgdir"/etc/init.d/$pkgname && \
		rm "$pkgdir"/usr/lib/$pkgname/modules/*.a
}

sha512sums="4730d9974105293480a75a688e0313bb71d9b52bc7b52f9cd15cf0f58010835e96eacf7c955355e9a8fa4b74c75f909549eac56683b344acd44c2584890f1511  captagent-6.3.0.tar.gz
750326291fc65fa9a3568f6961f2d6b950baa715e75ad7fc8263956cc91c50445e2e041d8f73675a350ba0d55786908564b439396376d8105fb69332e8aefc27  captagent.initd
61a4845597aa825c939dc354d168bccb51865c9e0273df1fd376bd61b6d639fee8909c2bb5ed616cb69388aa528b11ef43c25ec905e517e4c6af80537cef15b1  ac-fix.patch"
