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

TARBALL=zlib-$PKGVER.tar.xz
MD5SUM=7d9fc1d78ae2fa3e84fe98b77d006c63
BUNDLE=fatdog-base-11.3.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/900/$BUNDLE

SLACKREQ=
SLACKDESC="zlib32: zlib32 $PKGVER (Generic LZ77 compression library)  
zlib32:  
zlib32: The Zlib package contains compression and decompression routines used by 
zlib32: many programs including core system programs and libraries.  
zlib32: 
zlib32: This is the 32-bit version of zlib (also know as libz) library.
zlib32: 
zlib32: 
zlib32: 
zlib32: 
zlib32:
"


### override download for LFS sources
# $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

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

### build
pkg_build() {
	cd /tmp/zlib*
	
	CC="gcc -isystem /usr/include ${BUILD32}" \
	CXX="g++ -isystem /usr/include ${BUILD32}" \
	LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib ${BUILD32}" \
	  ./configure --prefix=/usr &&
	make $MAKEFLAGS && make install &&
	
	# relocate the libs
	mv -v /usr/lib/libz.so.* /lib &&
	ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so &&

	pkg_build_slackdesc &&
	rm -f /etc/ld.so.cache /var/cache/ldconfig/aux-cache  
} 
