# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=anytun
pkgver=0.3.8
pkgrel=12
pkgdesc="Secure anycast tunneling protocol implementation for flexible and fault-tolerant VPNs"
options="!check !fhs" # No testsuite, /var/run dirs created in package()
url="https://www.anytun.org/"
arch="all"
license="GPL-3.0-or-later"
depends_dev="openssl-dev>3 boost-dev linux-headers"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://www.anytun.org/download/anytun-$pkgver.tar.gz
	fix-iostream.patch
	boost-1740.patch
	$pkgname.initd"

builddir="$srcdir"/$pkgname-$pkgver/src

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--use-ssl-crypto \
		--examplesdir=/usr/share/docs
	make
}

package() {
	mkdir -p $pkgdir/var/run/anytun  $pkgdir/var/run/anytun-controld  &>/dev/null
	make install DESTDIR="$pkgdir"
	rm "$pkgdir"/etc/init.d/$pkgname
	install -Dm 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
c1631983c0f1d735792ae1775aedb87241ae94ccd9cda12885790ecb09e0279518d3414c41945f385b2b30ad20db6a4c68fc526d7d6f777f2929c0d23174f699  anytun-0.3.8.tar.gz
8c2eece0357666867f8cd9c7ef9307bcf88b9172ac033c18bd33ba470b3c19ad722c7eeafcda3a9ae95539d86ab04285fe5d7fa9766630f689c58e2c3fb239c3  fix-iostream.patch
8fa427facf23cd87faed1d531b6b22a74cac41c1a8aae247748d737d1ee92b70d31d38b3bc1c9976c325df26c769ad3cfb2651ff1ec52fc9cb19962d31975945  boost-1740.patch
8ca2691139ed42474fa9d2e81e8c43ae6ec48c61d07055e6436cddb6d43521a735e315ce1e99d7ef253e8d15515416df92db51fd77e7e13f6c58c820fb9d0ffb  anytun.initd
"
