### this file is sourced not run
PKGVER=1.43.9
PKGBUILD=1
PKGARCH=i686

# LFS 7.5 updated to post-LFS 7.6 (2015-02-14) to LFS 8.1
TARBALL=e2fsprogs-$PKGVER.tar.gz
MD5SUM=8749ba4fbc25d1b13753b79f1f84b69d
BUNDLE=fatdog-base-8.2.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$BUNDLE

SLACKREQ=util-linux32
SLACKDESC="e2fsprogs32: e2fsprogs32 $PKGVER (Utilities for Linux ext filesystem)  
e2fsprogs32:  
e2fsprogs32: The E2fsprogs package contains the utilities for handling the ext2 
e2fsprogs32: file system. It also supports the ext3 and ext4 journaling file 
e2fsprogs32: systems.  
e2fsprogs32: 
e2fsprogs32: This contains the 32-bit libraries for e2fsprogs
e2fsprogs32: 
e2fsprogs32: 
e2fsprogs32: 
e2fsprogs32: 
"

# use standard downloads
### 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
}

### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share
}

### build
pkg_build() {
	cd /tmp/e2fs*
	
	mkdir -v build
	cd build

	# FHS - bins in /bin and /sbin (--with-root-prefix)
	# disable libs and bins installed by util-linux already
	PKG_CONFIG_PATH="${PKG_CONFIG_PATH32}" \
	CC="gcc ${BUILD32}" \
	../configure --prefix=/usr --bindir=/bin --with-root-prefix="" \
		--enable-elf-shlibs --disable-libblkid \
		--disable-libuuid --disable-fsck \
		--disable-uuidd
	
    make $MAKEFLAGS libs && 
    make install-libs &&
	chmod -v u+w /usr/$LIBDIR/{libcom_err,libe2p,libext2fs,libss}.a &&
	
	pkg_build_slackdesc &&
	rm -f /etc/ld.so.cache /var/cache/ldconfig/aux-cache
}
