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

# source: CLFS 3.0.0
TARBALL=iputils-s20121221.tar.bz2
MD5SUM=6072aef64205720dd1893b375e184171
SRC_URL=http://distro.ibiblio.org/fatdog/source/710/clfs-packages-3.0.0.tar
BUNDLE=clfs-packages-3.0.0.tar

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-s20121221-fixes-2.patch		
	fi
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/iputils*
	
	make CC="gcc ${BUILD64}" USE_CAP=no \
		IPV4_TARGETS="tracepath ping clockdiff rdisc" \
		IPV6_TARGETS="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 && 
	
	pkg_build_slackdesc
}


