From e666459482b2583eb0d6aa6cd886e4e7ba35012b Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 31 Jul 2019 16:34:07 -0700 Subject: LinGui: make selection of gtk3/gtk4 configure-able --- gtk/configure.ac | 22 +++++++++++++++------- gtk/module.defs | 4 ++++ gtk/src/Makefile.am | 10 ---------- make/configure.py | 5 +++++ 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/gtk/configure.ac b/gtk/configure.ac index 1c2119585..e282b1d56 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -89,6 +89,10 @@ AC_ARG_ENABLE(update-checks, AS_HELP_STRING([--disable-update-checks], [disable update checks]), update_checks=no, update_checks=yes) +AC_ARG_ENABLE(gtk4, + AS_HELP_STRING([--enable-gtk4], [enable building with gtk4]), + use_gtk4=yes, use_gtk4=no) + # overwrite global variable (used for Makefile generation) AC_SUBST(GLOBALCXXFLAGS, $CXXFLAGS ) AC_SUBST(GLOBALLDFLAGS, $LDFLAGS ) @@ -125,12 +129,18 @@ esac PKG_PROG_PKG_CONFIG -PKG_CHECK_MODULES([GHB_GTK_4_0], [gtk4 >= 3.92], [HAVE_GTK_400=1], [HAVE_GTK_400=0]) -# GTK4 disabled until stable release HAVE_GTK_400=0 -PKG_CHECK_MODULES([GHB_GTK_3_16], [gtk+-3.0 >= 3.16], [HAVE_GTK_316=1], [HAVE_GTK_316=0]) -PKG_CHECK_MODULES([GHB_GTK_3_14], [gtk+-3.0 >= 3.14], [HAVE_GTK_314=1], [HAVE_GTK_314=0]) -PKG_CHECK_MODULES([GHB_GTK_3_12], [gtk+-3.0 >= 3.12], [HAVE_GTK_312=1], [HAVE_GTK_312=0]) +HAVE_GTK_316=0 +if test "x$use_gtk4" = "xyes" ; then + PKG_CHECK_MODULES([GHB_GTK_4_0], [gtk4 >= 3.92], [HAVE_GTK_400=1], [HAVE_GTK_400=0]) +else + PKG_CHECK_MODULES([GHB_GTK_3_16], [gtk+-3.0 >= 3.16], [HAVE_GTK_316=1], [HAVE_GTK_316=0]) +fi + +if test "$HAVE_GTK_316" -eq 0 -a "$HAVE_GTK_400" -eq 0 ; then + AC_MSG_ERROR("GTK 3.16 or above is required) +fi + if test "$HAVE_GTK_400" -eq 1 ; then GHB_PACKAGES="gtk4 $GHB_PACKAGES" else @@ -175,8 +185,6 @@ fi AM_CONDITIONAL([GHB_GTK_4_00], [test "$HAVE_GTK_400" -eq 1]) AM_CONDITIONAL([GHB_GTK_3_16], [test "$HAVE_GTK_316" -eq 1]) -AM_CONDITIONAL([GHB_GTK_3_14], [test "$HAVE_GTK_314" -eq 1]) -AM_CONDITIONAL([GHB_GTK_3_12], [test "$HAVE_GTK_312" -eq 1]) AM_CONDITIONAL([MINGW], [test "x$mingw_flag" = "xyes"]) diff --git a/gtk/module.defs b/gtk/module.defs index ec3f697f5..837a3c4fb 100644 --- a/gtk/module.defs +++ b/gtk/module.defs @@ -51,4 +51,8 @@ ifeq (1,$(FEATURE.flatpak)) GTK.CONFIGURE.extra += --enable-flatpak endif +ifeq (1,$(FEATURE.gtk4)) + GTK.CONFIGURE.extra += --enable-gtk4 +endif + export HB.version HB.repo.date diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am index 617e71012..d968c1812 100644 --- a/gtk/src/Makefile.am +++ b/gtk/src/Makefile.am @@ -151,20 +151,10 @@ if GHB_GTK_3_16 UI=316 UI_FILE=ghb3.ui else -if GHB_GTK_3_14 -UI=314 -UI_FILE=ghb3.ui -else -if GHB_GTK_3_12 -UI=312 -UI_FILE=ghb3.ui -else UI=300 UI_FILE=ghb3.ui endif endif -endif -endif ui_res.c : ui_res.gresource.xml ui_res.h $(srcdir)/$(UI_FILE) glib-compile-resources --generate --target=$@ --c-name ghb_ui --manual-register $< diff --git a/make/configure.py b/make/configure.py index eeb97a71e..9e1c70d09 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1328,6 +1328,9 @@ def createCLI( cross = None ): h = 'enable GTK GUI for Windows' if (cross is not None and 'mingw' in cross) else argparse.SUPPRESS grp.add_argument( '--enable-gtk-mingw', default=False, action='store_true', help=h ) + h = IfHost( 'Build GUI with GTK4', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value + grp.add_argument( '--enable-gtk4', default=False, action='store_true', help=h ) + h = IfHost( 'disable GStreamer (live preview)', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value grp.add_argument( '--disable-gst', default=False, action='store_true', help=h ) @@ -1412,6 +1415,7 @@ def createCLI( cross = None ): h = IfHost( 'Build extra contribs for flatpak packaging', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value grp.add_argument( '--flatpak', default=False, action='store_true', help=h ) + cli.add_argument_group( grp ) return cli @@ -1947,6 +1951,7 @@ int main() doc.add( 'FEATURE.fdk_aac', int( options.enable_fdk_aac )) doc.add( 'FEATURE.ffmpeg_aac', int( options.enable_ffmpeg_aac )) doc.add( 'FEATURE.flatpak', int( options.flatpak )) + doc.add( 'FEATURE.gtk4', int( options.enable_gtk4 )) doc.add( 'FEATURE.gtk', int( not options.disable_gtk )) doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) doc.add( 'FEATURE.gtk.update.checks', int( not options.disable_gtk_update_checks )) -- cgit v1.2.3