#!/bin/bash
#
# Copyright 2004 Dagmar d'Surreal <rivyqntzne@tznvy.pbz>
# Copyright 2006 Scott Harmon
# Copyright 2013-2026 Sasa Ostrouska <saxa@droplinegnome.org>
# Copyright 2014 John Truex <apolluwn@gmail.com>
# Available under the terms of the GNU GPL.
#
# - this is webkit 2.5.3.  They call it webkit 4
# - 2.4.x was webkit 3.  They call the 2.5.x package webkit.
# - 2.4.x is webkit1.  This makes no sense at all.
######################
# BUILD AGAINST GTK3 #
######################

NAME="webkitgtk"
VERSION="2.52.5"
REVISION="1"

PKG_SOURCEURL='http://webkitgtk.org/releases/${NAME}-${VERSION}.tar.xz'

. $DLG_ROOT/etc/config
. $DLG_ROOT/lib/dl-base

cflags
cxxflags
prepare

analyzesource
# Configure now should be able to determine which 
# kind of build system the source use and add the 
# correct configure options. I will leave that options
# for now here in case we need them later.
configure -DCMAKE_BUILD_TYPE=Release \
	-DPORT=GTK \
	-DENABLE_BUBBLEWRAP_SANDBOX=OFF \
	-DENABLE_JOURNALD_LOG=OFF \
	-DUSE_LIBBACKTRACE=OFF \
	-DENABLE_DOCUMENTATION=OFF \
	-DENABLE_SPEECH_SYNTHESIS=OFF \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DLIB_INSTALL_DIR=${PKG_LIBDIR}${LIBSUFFIX} \
	-DUSE_AVIF=OFF \
	-DUSE_GTK4=OFF \
	-DUSE_JPEGXL=ON \
	-DUSE_SYSPROF_CAPTURE=OFF \
	-G Ninja 
#make
spewdo "cd $PKG_BUILDROOT/builddir; ninja"
#makeinstall 
spewdo "cd $PKG_BUILDROOT/builddir; $PKG_DESTDIRVAR=$PKG_STAGEROOT ninja install"
tidydocumentation
analyzebinaries
finalizepackage
packagize
cleanup
