# Contributor: <xmingske@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gvpe
pkgver=3.1
pkgrel=6
pkgdesc="GNU Virtual Private Ethernet"
url="http://software.schmorp.de/pkg/gvpe.html"
arch="all"
license="GPL-2.0-or-later"
makedepends="openssl-dev>3 libev-dev zlib-dev gmp-dev linux-headers"
source="https://ftp.gnu.org/gnu/gvpe/gvpe-$pkgver.tar.gz
	compile-fix.patch
	musl-getopt_long.patch
	gvpe.conf.example
	gvpe.confd
	gvpe.initd
	if-up
	"
subpackages="$pkgname-doc $pkgname-openrc"
options="!check"

prepare() {
 	default_prepare
	update_config_guess
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-cipher=aes-128 \
		--enable-dns
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -D -m0644 "$srcdir"/gvpe.confd "$pkgdir"/etc/conf.d/gvpe
	install -D -m0644 "$srcdir"/gvpe.conf.example \
		"$pkgdir"/etc/gvpe/gvpe.conf.example
	install -D -m0755 "$srcdir"/if-up "$pkgdir"/etc/gvpe/if-up
	install -D -m0755 "$srcdir"/gvpe.initd "$pkgdir"/etc/init.d/gvpe
}

sha512sums="4deeefb5b9773e3eb46f5fcbff1fe61e64824f7b29615b84b3415ff2a240071d5e19f00a6ecac5dd491a8dbf8c9636efc4a9cde943dbdba5ef4c6bc04597840a  gvpe-3.1.tar.gz
a90b621bdeef103c68a51792e482557f9e077f28b643be3ca5ae2e3bcc4448c4467d70808c3aa7118fae9b8a81eb41f17d81ff2bbd5020f03cba51e8152f7814  compile-fix.patch
6e2124f7a88a8f584028389fd2cd233edae00434b9d13794cd662d3cea2bf401d0f265ecbd1f3961981b98ad74ff48299a22010a118c704d5c0240f645ec44cc  musl-getopt_long.patch
05ace600cb1e8470a07aca739c38e82ee452538ae0a0217754df18824e33e59bc69a52a1b4791a03153935179a7dc35163da8ea70153792e01689f2ed82e084d  gvpe.conf.example
0ac701cf0b65653bc31392f0a5a5706cf71b3baaf646e6c09d4763700e8e1725ae2ae3dcac72b34b4023eb6cc96eed7a57b827e24a1dab2bda03623c665a1060  gvpe.confd
aa4ee3f5c600ad42879d2b489c2593e72588a56e233571fbe845846c3b4cc2d73929fe378f7ea8d92a606e88c6287ff13ebf445cc277d604d23d3f055a4c198c  gvpe.initd
b5fba91937a024f346e1a81658da0fcd6892b9ac6c7015f8da26ef60f026bd6809847d256b7b1da461c60fc208a1d8fa8e5d9c0d492c0240e4c554931b211524  if-up"
