# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=wkhtmltopdf
pkgver=0.12.4
pkgrel=0
pkgdesc="Simple shell utility to convert html to pdf"
url="http://wkhtmltopdf.org/"
arch="all"
license="GPL-3.0-or-later"
depends=""
depends_dev=""
makedepends="$depends_dev qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev
	qt5-qtxmlpatterns-dev"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/wkhtmltopdf/wkhtmltopdf/archive/$pkgver.tar.gz
	wkhtmltopdf-missing-setDevicePixelRatio.patch
	"

_builddir="$srcdir"/wkhtmltopdf-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	qmake-qt5 -makefile && make  || return 1
}

package() {
	cd "$_builddir"
	make install INSTALL_ROOT="$pkgdir"/usr || return 1
}

sha512sums="6ec27453efdf32b97f6434a3eb5dd3d3470bbdccdbb4f997ff4234441c79960932e51d963e5d0d2d98bbf8b4f7ab2ed8835dbc1a35407a63815691b59217caa2  wkhtmltopdf-0.12.4.tar.gz
05285d9f7aede92941edcc4513b61cc328ade39639b01e72e2f9857d44e8ea2240b67c02a40804022e7c3888de6de8338339cdd6f28b5c681f5be8585ce00983  wkhtmltopdf-missing-setDevicePixelRatio.patch"
