### this file is sourced not run
PKGBUILD=1
PKGARCH=x86_64

# source: james
# release tarball
PKGVER=2.8
TARBALL=n2n-ntop-$PKGVER.tar.gz
MD5SUM=a24cb0d7e7815bf4103e6852c9c50d50
SRC_URL=https://github.com/ntop/n2n/archive/$PKGVER.tar.gz
BUNDLE=

# git-master tarball
#PKGVER=
#MD5SUM=
#hash=
#hash7=${hash#???????}; hash7=${hash%$hash7}
#TARBALL=n2n-ntop-$PKGVER-$hash7.tar.gz
#SRC_URL=https://github.com/ntop/n2n/archive/$hash.tar.gz

SLACKREQ='openssl libzstd libpcap' # 
SLACKDESC="n2n-v2-ntop: n2n-v2-ntop $PKGVER (Simple peer-to-peer VPN)
n2n-v2-ntop: 
n2n-v2-ntop: n2n is a layer-two peer-to-peer virtual private network (VPN) which 
n2n-v2-ntop: allows users to exploit features typical of P2P applications at 
n2n-v2-ntop: network instead of application level. This means that users can gain 
n2n-v2-ntop: native IP visibility (e.g. two PCs belonging to the same n2n network 
n2n-v2-ntop: can ping each other) and be reachable with the same network IP 
n2n-v2-ntop: address regardless of the network where they currently belong.
n2n-v2-ntop:
n2n-v2-ntop: This is ntop's version of n2n-v2
n2n-v2-ntop: https://github.com/ntop/n2n
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	CONFFLAGS="$CONFFLAGS --with-zstd --with-openssl"
	
	cd /tmp/n2n* &&
	./autogen.sh &&
	pkg_build_autoconf &&
	
	# rename bins
	mv /usr/sbin/{edge,n2n-v2-edge}               &&
	mv /usr/sbin/{supernode,n2n-v2-supernode}     &&
	mv /usr/sbin/{n2n-benchmark,n2n-v2-benchmark} &&
	mv /usr/sbin/{n2n-decode,n2n-v2-decode}       &&

	# rename docs
	mv /usr/share/man/man7/{n2n,n2n-v2}.7.gz                 &&
	mv /usr/share/man/man1/{supernode,n2n-v2-supernode}.1.gz &&
	mv /usr/share/man/man8/{edge,n2n-v2-edge}.8.gz           &&

	# install addition docs
	mkdir -p /usr/share/doc/n2n-v2                 &&
	install -m644 README.md /usr/share/doc/n2n-v2  &&
	install -m644 doc/* /usr/share/doc/n2n-v2      &&
	
	pkg_build_slackdesc
}
