### this file is sourced not run
PKGVER=4.6.1debian5
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 6.1 updated to wvstreams 4.6.1 with debian + arch patches
TARBALL=wvstreams_4.6.1.orig.tar.gz
MD5SUM=2760dac31a43d452a19a3147bfde571c
SRC_URL=http://ftp.de.debian.org/debian/pool/main/w/wvstreams/$TARBALL
BUNDLE=

SLACKREQ='openssl libreadline'
SLACKDESC='libwvstreams: libwvstreams 4.6.1debian5 (Networking library)  
libwvstreams:  
libwvstreams: WvStreams is a library suite containing platform-independent C++ 
libwvstreams: networking and utilities libraries for rapid application 
libwvstreams: development.  
libwvstreams: 
libwvstreams: 
libwvstreams: 
libwvstreams: 
libwvstreams: 
libwvstreams:
'

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/wvstreams* &&
	tar -xf $CHROOT_DIR/tmp/pkg/wvstreams_4.6.1-5.debian.tar.gz &&
	
	#for p in $(cat debian/patches/series); do
	#	patch -Np1 -i debian/patches/$p || return 1
	#done &&
	#patch -Np1 -i $CHROOT_DIR/tmp/pkg/wvstreams-07_magic_number.diff
	
	# use debian patch up to 4 (these are doc patches)
	for p in $(cat debian/patches/series); do
		case $p in
			01*|02*|03*|04*) patch -Np1 -i debian/patches/$p || return 1 ;;
		esac
	done &&
	
	# and then use arch patches (FTFBS and segfaults patches)
	patch -Np0 -i $CHROOT_DIR/tmp/pkg/wvstreams-4.6.1-glibc212.patch &&
	patch -Np0 -i $CHROOT_DIR/tmp/pkg/wvstreams-4.6.1-gcc47.patch &&
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/wvstreams-openssl.patch
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/wvstreams*
	
	./configure $CONFFLAGS \
	    --with-openssl --without-dbus --without-tcl --without-qt &&

	make COPTS="$CFLAGS -fPIC" \
	     CXXOPTS="$CXXFLAGS -fPIC -fpermissive -fno-tree-dce -fno-optimize-sibling-calls" \
	     VERBOSE=1 all install && # note: no parallel build.
	
	pkg_build_slackdesc &&
	rm -f /usr/lib/libwvstatic.a # don't want this huge static lib &&
	
	# according to arch, these files still get installed, so remove them
	rm -f /usr/$LIBDIR/pkgconfig/libwvdbus.pc && # dbus support which we don't build
	rm -f /usr/$LIBDIR/pkgconfig/libwvqt.pc	   # qt support which we don't build too
}


