#!/bin/bash
#
# Copyright 2023-2026 Sasa Ostrouska <saxa@droplinegnome.org>
# Available under the terms of the GNU GPL.
#

##################################
# THIS IS COMPILLED AGAInST GTK4 #
# ################################

NAME="webkitgtk4"
VERSION="2.52.5"
REVISION="1"

PKG_SOURCEURL='http://webkitgtk.org/releases/webkitgtk-${VERSION}.tar.xz'
#PKG_PATCH[0]='20741.patch'

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

cflags
cxxflags
prepare

#applypatch 0 1

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 \
	-DUSE_GTK4=ON \
	-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_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
