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

# This is an LFS 11.3 package, not CLFS (CLFS uses iputils)
TARBALL=inetutils-$PKGVER.tar.xz
MD5SUM=319d65bb5a6f1847c4810651f3b4ba74
BUNDLE=fatdog-base-11.3.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/900/$BUNDLE

SLACKREQ='libncurses libreadline'
SLACKDESC="inetutils: inetutils $PKGVER (Basic networking utilities)  
inetutils:  
inetutils: The Inetutils package contains programs for basic networking 
inetutils: (clients only - servers are disabled).  
inetutils: 
inetutils: 
inetutils: 
inetutils: 
inetutils: 
inetutils: 
inetutils:
"

### 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/inetutils*
	
	# LFS 7.5
	# james: LFS 7.4 disable ifconfig. LFS 7.5 enabled it, but I still disable it here
	#        because it does not seem to work properly. Get ifconfig from net-tools package.
	# james: LFS 8.1 - still disable ifconfig
	# james: LFS 11.3 - build it but use a "iu-" prefix
	#echo '#define PATH_PROCNET_DEV "/proc/net/dev"' >> ifconfig/system/linux.h  &&
	./configure --prefix=/usr  \
		--localstatedir=/var   \
		--disable-logger       \
		--disable-whois        \
		--disable-rcp          \
		--disable-rexec        \
		--disable-rlogin       \
		--disable-rsh          \
		--disable-servers      \
		&&
	make $MAKEFLAGS && make install &&
		
	# FHS
	mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin &&	
	mv -v /usr/bin/ifconfig /sbin/iu-ifconfig &&
	mv -v /usr/share/man/man1/{,iu-}ifconfig.1  &&
	pkg_build_slackdesc
}
