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

TARBALL=iproute2-$PKGVER.tar.xz
MD5SUM=f3ff4461e25dbc5ef1fb7a9167a9523d
BUNDLE=fatdog-base-11.3.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/900/$BUNDLE

SLACKREQ='libelf libbpf libmnl' # our iproute2 supports everything except SELinux
SLACKDESC="iproute2: iproute2 $PKGVER (IP networking utilities)  
iproute2:  
iproute2: The IPRoute2 package contains programs for basic and advanced 
iproute2: IP-based networking.  
iproute2: 
iproute2: 
iproute2: 
iproute2: 
iproute2: 
iproute2: 
iproute2:
"

### override download for LFS sources bundle
# $1-src-dir $2-tarball 
pkg_download() {
	echo downloading $BUNDLE for $TARBALL
	wget -P $1 $SRC_URL
	tar -xf $1/$BUNDLE --strip-components=1 -C $1 
	rm $1/$BUNDLE
}

### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/iproute2*
	
	# CLFS 2017.7: don't build docs for arpd (arpd won't be built anyway because it requires Berkeley db)
	#sed -i '/ARPD/d' Makefile &&
	#sed -i 's/arpd.8//' man/man8/Makefile &&
	#sed -i '/tc-simple/s@tc-skbmod.8 @@' man/man8/Makefile &&
	#rm -fv doc/arpd.sgml &&

	# LFS 11.3: don't build docs for arpd (arpd won't be built anyway because it requires Berkeley db)
	sed -i /ARPD/d Makefile &&
	rm -fv man/man8/arpd.8  &&
	
	# LFS 11.0: disable modules that require iptables
	# sed -i 's/.m_ipt.o//' tc/Makefile &&
	
	make $MAKEFLAGS CC="gcc ${BUILD64}" LIBDIR=/usr/$LIBDIR	&&
	make LIBDIR=/usr/$LIBDIR \
		DOCDIR=/usr/share/doc/iproute2-$PKGVER install &&

	pkg_build_slackdesc	
}
