#Packager: Dimitris Tzemos <dijemos~at~gmail~dot~com>

pkgname=wvstreams
pkgver=4.6.1
pkgrel=1dj
source=(https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/wvstreams/wvstreams-$pkgver.tar.gz
        wvstreams-4.6.1-glibc212.patch
        wvstreams-4.6.1-gcc47.patch
        openssl-buildfix.patch
        gcc-6.patch)
docs=("ChangeLog" "LICENSE" "README*")
url="https://web.archive.org/web/20110504183753/http://alumnit.ca:80/wiki/index.php?page=WvDial"

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"wvstreams (networking library in C++)"
"It aims to be an efficient, secure, easy-to-use,"
"and OS-independent library for doing network"
"applications development."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	patch -p0 -i "$SRC/wvstreams-4.6.1-glibc212.patch"
	patch -p0 -i "$SRC/wvstreams-4.6.1-gcc47.patch"
	patch -p1 -i "$SRC/openssl-buildfix.patch"
	patch -p1 -i "$SRC/gcc-6.patch"

	CPPFLAGS=-I/usr/include/openssl-1.0 \
	LDFLAGS=-L/usr/lib${LIBDIRSUFFIX}/openssl-1.0 \
  ./configure --prefix=/usr \
     --sbin=/usr/bin \
     --sysconfdir=/etc \
     --localstatedir=/var \
     --libdir=/usr/lib${LIBDIRSUFFIX} \
     --without-dbus \
     --with-pam \
     --with-openssl \
     --without-tcl \
     --without-qt \
     --build=$arch-slackware-linux
     
	make COPTS="$CFLAGS -fPIC" CXXOPTS="$CXXFLAGS -fPIC -fpermissive -fno-tree-dce -fno-optimize-sibling-calls" VERBOSE=1 || return 1

	make install DESTDIR=$startdir/pkg
	
	# FS#15974
	# --without-dbus still installs the pkg-config file
	rm "${PKG}/usr/lib${LIBDIRSUFFIX}/pkgconfig/libwvdbus.pc" || return 1
	# --without-qt still installs the pkg-config file
	rm "${PKG}/usr/lib${LIBDIRSUFFIX}/pkgconfig/libwvqt.pc" || return 1
} 
