# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=wt
pkgver=4.0.2
pkgrel=0
pkgdesc="A C++ library and application server for developing and deploying web applications"
url="http://www.webtoolkit.eu"
arch="all"
license="GPL"
depends=""
depends_dev="zlib-dev boost-dev sqlite-dev mesa-dev glu-dev graphicsmagick-dev
	libressl-dev pango-dev sqlite-dev fcgi-dev postgresql-dev qt-dev libharu-dev"
makedepends="$depends_dev cmake boost"
pkggroups="wt"
pkgusers="wt"
options="!check"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/kdeforche/$pkgname/archive/$pkgver.tar.gz
	960e8d017b264710e344c63f9feb6ea1fa593eeb.patch
	"
builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	mkdir -p build && cd build
	CXXFLAGS="-fpermissive" \
	cmake \
	      -DCONNECTOR_HTTP=ON \
	      -DWT_CPP_11_MODE=-std=c++11 \
	      -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick \
	      -DCMAKE_INSTALL_PREFIX=/usr \
	      -DWEBUSER=$pkgusers \
	      -DWEBGROUP=$pkggroups \
	      -DRUNDIR="$pkgdir"/var/run/wt \
	      -DUSE_SYSTEM_SQLITE3=ON \
	      -DINSTALL_EXAMPLES=ON \
	      -DBUILD_EXAMPLES=OFF \
	      -DINSTALL_FINDWT_CMAKE_FILE=ON \
	..
	make
}

package() {
	cd "$builddir"/build
	make DESTDIR=$pkgdir install
	rm -rf $pkgdir/usr/cmake
	rm -rf $pkgdir/var/run
}

sha512sums="85e35374bec662c314b20d0699656895364386ee2e51ca99d131702f02ea5a4defeb357fdda3cf068049f077daaa7a3af1dc3d239fb73b3cf13b574778e5609c  wt-4.0.2.tar.gz
b827b7bb0c29874bcd75925b61e9ffa8ee466e340bbed68914979058eab526371a671f183e16778a6efef6bde31af8773d59528af9eaba3895a57da1eba21aaf  960e8d017b264710e344c63f9feb6ea1fa593eeb.patch"
