# Template file for 'webkitgtk'
pkgname=webkitgtk
version=2.4.2
revision=2
build_style=gnu-configure
configure_args="--with-gtk=3.0"
short_desc="GTK+3 port of the WebKit browser engine"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://webkitgtk.org/"
license="LGPL-2.1, Simplified BSD (2 clause)"
distfiles="${homepage}/releases/${pkgname}-${version}.tar.xz"
checksum=cac8385c3b8a956793eb6b67712c23297a39e5f8b429523f32bbdcdf9c21d00a

hostmakedepends="libtool perl python pkg-config intltool which gperf flex
 ruby glib-devel"
makedepends="
 at-spi2-core-devel libjpeg-turbo-devel libpng-devel>=1.6 sqlite-devel harfbuzz-devel>=0.9.19
 gst-plugins-base1-devel libsoup-devel libxslt-devel icu-devel>=49
 enchant-devel dbus-glib-devel geoclue-devel libwebp-devel>=0.4.0 libsecret-devel
 gtk+-devel gtk+3-devel libgudev-devel libXt-devel MesaLib-devel"

# Package build options
build_options="gir"
desc_option_gir="Enable support for building gobject introspection data"

# Disable gir for cross builds.
if [ -z "$CROSS_BUILD" ]; then
	build_options_default="gir"
fi

if [ "$build_option_gir" ]; then
	configure_args+=" --enable-introspection"
	hostmakedepends+=" gobject-introspection"
else
	configure_args+=" --disable-introspection"
fi

# Use linker flags to reduce memory consumption
LDFLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads"

pre_configure() {
	libtoolize -f
}

webkitgtk-devel_package() {
	depends="gtk+3-devel libsoup-devel ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
		fi
		vmove usr/share/gtk-doc
		vmove "usr/lib/*.so"
	}
}
