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

TARBALL=zlib-1.2.8.tar.xz
MD5SUM=28f1205d8dd2001f26fec1e8c2cebe37
SRC_URL=http://distro.ibiblio.org/fatdog/source/710/clfs-packages-3.0.0.tar
BUNDLE=clfs-packages-3.0.0.tar

SLACKREQ=
SLACKDESC='zlib32: zlib32 1.2.8 (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 &&
	
	# relocalte 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  
} 
