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

TARBALL=bzip2-1.0.6.tar.gz
MD5SUM=00b516f4704d4a7cb50a1d97e6e8e15b
BUNDLE=fatdog-base-8.2.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$BUNDLE

SLACKREQ=
SLACKDESC="bzip2_32: bzip2_32 $PKGVER (File compressor)  
bzip2_32:  
bzip2_32: This package contains programs for compressing and decompressing files 
bzip2_32: using BWT compression method. Compressing text files with bzip2 yields 
bzip2_32: a much better compression percentage than with the traditional gzip.  
bzip2_32: 
bzip2_32: This package contains the 32-bit library.
bzip2_32: 
bzip2_32: 
bzip2_32: 
bzip2_32:
"


### 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/bzip2*
	
	# CLFS 3.0.0 relative symlink
	sed -i -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' Makefile &&
	sed -i 's@X)/man@X)/share/man@g' ./Makefile && # manpage location patch

	make -f Makefile-libbz2_so CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" &&
	make clean &&
	make CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" libbz2.a &&

	cp -v libbz2.a /usr/lib &&
	cp -av libbz2.so* /lib &&
	ln -sfv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so &&
	ln -sfv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so.1 &&
	
	pkg_build_slackdesc
}
