# Contributor: <xmingske@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gvpe
pkgver=2.25
pkgrel=4
pkgdesc="GNU Virtual Private Ethernet"
url="http://software.schmorp.de/pkg/gvpe.html"
arch="all"
license="GPL-2.0"
depends=""
makedepends="libressl-dev libev-dev zlib-dev gmp-dev linux-headers"
source="http://ftp.gnu.org/gnu/$pkgname/${pkgname}-${pkgver}.tar.gz
	compile-fix.patch
	gvpe.conf.example
	gvpe.confd
	gvpe.initd
	if-up
	"
subpackages="$pkgname-doc"

builddir="${srcdir}"/${pkgname}-${pkgver}

prepare() {
	default_prepare || return 1
	update_config_guess || return 1
}

build() {
	cd "${builddir}"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-digest=ripemd160 \
		--enable-cipher=aes-128 \
		--enable-dns \
		|| return 1
	make || return 1
}

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

md5sums="bb2693eabef3ad3edd35281e8a1f45d4  gvpe-2.25.tar.gz
a088e8eafbd41af426bb061895df7c4b  compile-fix.patch
e5b50e89647e61c5604f851c7e626cfb  gvpe.conf.example
4c91460929c60a38672f01387d3a5ec9  gvpe.confd
b2c8d263618be5e8499a5f41259a92f5  gvpe.initd
7ff92030381c36f6c87c391b077b4d71  if-up"
sha256sums="73c32d9a28fadd6aa531e0fed27c7a96bc0e5e9a5626ebf70368eaad3dbb51bf  gvpe-2.25.tar.gz
03b2bc73ff8d887bef74119f57cb18e4e3d5bb47e5b6fae59f78e4e0a7728422  compile-fix.patch
3e49a5dde5b7942275470b3e52c45960aa9d41d584c1cd642958cb737707687f  gvpe.conf.example
800c6703435c50fa5d5ed2a43f388bfa9008d3ec296c100924e6d33c701cc673  gvpe.confd
d2cc530904ed0649f578c431271108e378946634c347d3b9aeb69e142f2ec029  gvpe.initd
01117b94a98e5295fb8236277c8d02cbb4d1e69e9de7a925156ee02ce300b069  if-up"
sha512sums="9122efde787641603c91e067f03f4534c137e5cd274b1d096652cc176335bef6b36662fae1ab2330af6ca17043249086c1c7ee0643f8854154938e161e452e3d  gvpe-2.25.tar.gz
a90b621bdeef103c68a51792e482557f9e077f28b643be3ca5ae2e3bcc4448c4467d70808c3aa7118fae9b8a81eb41f17d81ff2bbd5020f03cba51e8152f7814  compile-fix.patch
05ace600cb1e8470a07aca739c38e82ee452538ae0a0217754df18824e33e59bc69a52a1b4791a03153935179a7dc35163da8ea70153792e01689f2ed82e084d  gvpe.conf.example
0ac701cf0b65653bc31392f0a5a5706cf71b3baaf646e6c09d4763700e8e1725ae2ae3dcac72b34b4023eb6cc96eed7a57b827e24a1dab2bda03623c665a1060  gvpe.confd
aa4ee3f5c600ad42879d2b489c2593e72588a56e233571fbe845846c3b4cc2d73929fe378f7ea8d92a606e88c6287ff13ebf445cc277d604d23d3f055a4c198c  gvpe.initd
b5fba91937a024f346e1a81658da0fcd6892b9ac6c7015f8da26ef60f026bd6809847d256b7b1da461c60fc208a1d8fa8e5d9c0d492c0240e4c554931b211524  if-up"
