Update build system to use GTK4 instead of GTK3

Co-authored-by: speed47 <218502+speed47@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-16 14:47:04 +00:00
parent c87d85ffa5
commit 53ad97fe5a
2 changed files with 16 additions and 17 deletions

2
configure vendored
View File

@@ -87,7 +87,7 @@ REQUIRE_GLIB2 2 32 0
echo
if test "$cfg_with_gui" == "yes"; then
REQUIRE_GTK3 3 4 0 WITH_THREADS
REQUIRE_GTK4 4 0 0 WITH_THREADS
fi
if ! CHECK_INCLUDE locale.h locale || ! CHECK_INCLUDE libintl.h intl ; then

View File

@@ -1483,7 +1483,7 @@ EOF
# It seems that people have more trouble with getting GTK+ to work
# than with other toolkits, so we try a bit harder to diagnose them here.
function REQUIRE_GTK3()
function REQUIRE_GTK4()
{ local want_major="$1"
local want_minor="$2"
local want_micro="$3"
@@ -1496,14 +1496,14 @@ function REQUIRE_GTK3()
if test "$want_threads" == "WITH_THREADS"; then threads="--libs gthread-2.0"; fi
echo -e "\n/* *** REQUIRE_GTK3 */\n" >>$LOGFILE
echo -e "\n/* *** REQUIRE_GTK4 */\n" >>$LOGFILE
echo "Gtk+ ${want_major}.${want_minor}.${want_micro} is required..."
# See if pkgconfig returns something
echo -n " pkg-config... "
if pkg-config --cflags gtk+-3.0 >>config.tmp 2>&1 && pkg-config $threads --libs gtk+-3.0 >>config.tmp 2>&1 ; then
if pkg-config --cflags gtk4 >>config.tmp 2>&1 && pkg-config $threads --libs gtk4 >>config.tmp 2>&1 ; then
echo "works"
rm config.tmp
else
@@ -1517,12 +1517,11 @@ Make sure you have the following packages installed:
- pkg-config (sometimes, the obvious is overlooked ;-)
- glib2
- pango
- atk
- gtk3
- gtk4
Some GNU/Linux distributions (e.g. SuSE) distinguish between
end-user packages of the libraries (e.g. 'gtk3') and
versions suitable for building programs (e.g. 'gtk3-devel').
end-user packages of the libraries (e.g. 'gtk4') and
versions suitable for building programs (e.g. 'gtk4-devel').
You might have to install the development versions explicitly
even if you have already GTK+ or Gnome applications running
on your system.
@@ -1533,14 +1532,14 @@ EOF
# Do a test compile to make sure they did not return some junk
CFG_GTK3_CFLAGS=`pkg-config --cflags gtk+-3.0`
CFG_GTK3_LIBS=`pkg-config $threads --libs gtk+-3.0`
CFG_GTK4_CFLAGS=`pkg-config --cflags gtk4`
CFG_GTK4_LIBS=`pkg-config $threads --libs gtk4`
CFG_GTK3_BINDIR=`which pkg-config`
CFG_GTK3_BINDIR=`echo $CFG_GTK3_BINDIR | sed -e 's/.exe//' | sed -e 's/\/pkg-config//'`
CFG_GTK4_BINDIR=`which pkg-config`
CFG_GTK4_BINDIR=`echo $CFG_GTK4_BINDIR | sed -e 's/.exe//' | sed -e 's/\/pkg-config//'`
CFG_CFLAGS="$CFG_CFLAGS $CFG_GTK3_CFLAGS"
CFG_LIBS="$CFG_LIBS $CFG_GTK3_LIBS"
CFG_CFLAGS="$CFG_CFLAGS $CFG_GTK4_CFLAGS"
CFG_LIBS="$CFG_LIBS $CFG_GTK4_LIBS"
cat >conftest.c <<EOF
#include <gtk/gtk.h>
@@ -1568,9 +1567,9 @@ EOF
# Successfully finished
echo "CFG_GTK3_CFLAGS = $CFG_GTK3_CFLAGS" >> Makefile.config
echo "CFG_GTK3_LIBS = $CFG_GTK3_LIBS" >> Makefile.config
echo "CFG_GTK3_BINDIR = $CFG_GTK3_BINDIR" >> Makefile.config
echo "CFG_GTK4_CFLAGS = $CFG_GTK4_CFLAGS" >> Makefile.config
echo "CFG_GTK4_LIBS = $CFG_GTK4_LIBS" >> Makefile.config
echo "CFG_GTK4_BINDIR = $CFG_GTK4_BINDIR" >> Makefile.config
return 1
}