# Template file for 'qt5-webkit'
pkgname=qt5-webkit
version=5.7.1
revision=1
build_style=qmake
wrksrc=qtwebkit-opensource-src-${version}
hostmakedepends="bison flex gperf perl python ruby pkg-config
 qt5-host-tools qt5-declarative-devel"
makedepends="libwebp-devel libxslt-devel libXcomposite-devel sqlite-devel
 gst-plugins-base1-devel qt5-declarative-devel qt5-location-devel
 qt5-sensors-devel qt5-webchannel-devel"
short_desc="A cross-platform application and UI framework (Qt5) - WebKit2 component"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-3, LGPL-2.1"
homepage="https://www.qt.io/"
distfiles="https://download.qt.io/community_releases/${version%.*}/${version}/qtwebkit-opensource-src-${version}.tar.xz"
checksum=a46cf7c89339645f94a5777e8ae5baccf75c5fc87ab52c9dafc25da3327b5f03

if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then
	CXXFLAGS="-fno-delete-null-pointer-checks"
fi
if [ -n "$CROSS_BUILD" ]; then
	# Can't use gold linker when cross compiling
	configure_args+=" QMAKE_LFLAGS_USE_GOLD="
fi

pre_configure() {
	# Generate headers
	syncqt.pl-qt5 -version ${version} Source/sync.profile
}
post_install() {
	# QMAKE_PRL_BUILD_DIR contains a reference the build dir; drop it
	find ${DESTDIR}/usr/lib -type f -name '*.prl' -exec \
		sed -i "{}" -e "/^QMAKE_PRL_BUILD_DIR/d" \;
}

qt5-webkit-devel_package() {
	short_desc+=" (development)"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.so
		vmove usr/lib/*.prl
		vmove usr/lib/pkgconfig
	}
}
