### this file is sourced not run
PKGVER=1.2.11
PKGBUILD=1

TARBALL=zlib-$PKGVER.tar.xz
MD5SUM=85adef240c5f370b308da8c938951a68
BUNDLE=fatdog-base-8.2.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$BUNDLE

SLACKREQ=
SLACKDESC="zlib: zlib $PKGVER (Generic LZ77 compression library)  
zlib:  
zlib: The Zlib package contains compression and decompression routines used by 
zlib: many programs including core system programs and libraries.  
zlib: 
zlib: 
zlib: 
zlib: 
zlib: 
zlib: 
zlib:
"


### 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
### default pkg_package
### build
pkg_build() {
	cd /tmp/zlib*

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

	# install docs
	mkdir -pv /usr/share/doc/zlib-1.2.8 &&
	cp -rv doc/* examples /usr/share/doc/zlib-1.2.8	&&
	
	pkg_build_slackdesc &&
	rm -f /etc/ld.so.cache /var/cache/ldconfig/aux-cache  
} 
