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

# source: james
TARBALL=n2n_v2_fork-2015.03.tar.bz2
MD5SUM=3daf9f8c501f06f671f678b74813e3a9
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

SLACKREQ='openssl iproute2' # 
SLACKDESC='n2n-v2: n2n-v2 2015.03 (Simple peer-to-peer VPN)
n2n-v2: 
n2n-v2: n2n is a layer-two peer-to-peer virtual private network (VPN) which 
n2n-v2: allows users to exploit features typical of P2P applications at 
n2n-v2: network instead of application level. This means that users can gain 
n2n-v2: native IP visibility (e.g. two PCs belonging to the same n2n network 
n2n-v2: can ping each other) and be reachable with the same network IP 
n2n-v2: address regardless of the network where they currently belong.
n2n-v2:
n2n-v2: Original website is http://www.ntop.org/products/n2n/; this package 
n2n-v2: is actually a fork from https://github.com/lukablurr/n2n_v2_fork/
'

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/n2n* &&
	
	# build
	touch /sbin/ip && # pretend that /sbin/ip exists to tell it to use iproute
	make $MAKEFLAGS DEBUG= && make install DESTDIR=/tmp/xxx &&
	
	# rename and install
	mkdir -p /usr/sbin /usr/share/man/{man1,man7,man8} /usr/share/doc/n2n_v2 &&
	install -m 755 /tmp/xxx/usr/sbin/edge /usr/sbin/n2n-edge &&
	install -m 755 /tmp/xxx/usr/sbin/supernode /usr/sbin/n2n-supernode &&
	install -m 644 edge.8 /usr/share/man/man8/n2n-edge.8 &&
	install -m 644 supernode.1 /usr/share/man/man1/n2n-supernode.1 &&
	install -m 644 n2n_v2.7 /usr/share/man/man7/n2n_v2.7 &&
	
	install -m 644 HACKING /usr/share/doc/n2n_v2 &&
	install -m 644 README /usr/share/doc/n2n_v2 &&
	install -m 644 gen_keyfile.py /usr/share/doc/n2n_v2 &&
	
	pkg_build_slackdesc &&
	rm -f /sbin/ip
}
