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

# source: CLFS 2017.07
TARBALL=iputils-s20150815.tar.xz
MD5SUM=d184faea97095265452dce19ef98daf6
BUNDLE=fatdog-base-8.2.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$BUNDLE

SLACKREQ=''
SLACKDESC="iputils: iputils $PKGVER (Little collection of IP utilities)
iputils: 
iputils: This package contains the very basic of utilities that depends on 
iputils: nothing. It has ping, rdisc, clockdiff, tracepath, tracepath6 and 
iputils: traceroute6. This package is only included for completeness. You 
iputils: should not use this package: use a more complete and functional 
iputils: package such as net-tools or inet-utils.
iputils: 
iputils: 
iputils: 
iputils: 
"


### 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
}

### prepare
pkg_prepare() {
	if pkg_prepare_default; then
		cd tmp/iputils*
		# upstream fixes
		patch -Np1 -i $SRC_DIR/iputils-s20150815-build-1.patch
	fi
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/iputils*
	
	make CC="gcc ${BUILD64}" USE_CAP=no \
	TARGETS="clockdiff ping rdisc tracepath tracepath6 traceroute6" &&

	install -v -m755 ping /bin &&
	install -v -m755 clockdiff /usr/bin &&
	install -v -m755 rdisc /usr/bin &&
	install -v -m755 tracepath /usr/bin &&
	install -v -m755 trace{path,route}6 /usr/bin &&
	install -v -m644 doc/*.8 /usr/share/man/man8 && 
	ln -sfv ping /bin/ping4 &&
	ln -sfv ping /bin/ping6 &&
	
	pkg_build_slackdesc
}


