summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gtk+
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gtk+')
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3.inc90
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3/0001-Hardcoded-libtool.patch47
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch57
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch872
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch19
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3/opengl.patch738
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3_3.24.41.bb (renamed from meta/recipes-gnome/gtk+/gtk+3_3.24.24.bb)9
-rw-r--r--meta/recipes-gnome/gtk+/gtk4_4.14.2.bb130
8 files changed, 909 insertions, 1053 deletions
diff --git a/meta/recipes-gnome/gtk+/gtk+3.inc b/meta/recipes-gnome/gtk+/gtk+3.inc
index 8d5edb7ee8..e1603b43fc 100644
--- a/meta/recipes-gnome/gtk+/gtk+3.inc
+++ b/meta/recipes-gnome/gtk+/gtk+3.inc
@@ -6,65 +6,48 @@ HOMEPAGE = "http://www.gtk.org"
6BUGTRACKER = "https://bugzilla.gnome.org/" 6BUGTRACKER = "https://bugzilla.gnome.org/"
7SECTION = "libs" 7SECTION = "libs"
8 8
9DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf \ 9DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf gdk-pixbuf-native"
10 gdk-pixbuf-native"
11 10
12LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+" 11LICENSE = "LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-or-later"
13 12
14inherit autotools gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings features_check gobject-introspection 13inherit meson gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings features_check gobject-introspection
15 14
16BBCLASSEXTEND = "native nativesdk" 15BBCLASSEXTEND = "native nativesdk"
17 16
18GSETTINGS_PACKAGE_class-native = "" 17GSETTINGS_PACKAGE:class-native = ""
19 18
20# versions >= 3.90 are development versions, otherwise like upstream-version-is-even 19# versions >= 3.90 are development versions, otherwise like upstream-version-is-even
21UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>3\.([1-8]?[02468])+(\.\d+)+)\.tar" 20UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>3\.([1-8]?[02468])+(\.\d+)+)\.tar"
22 21
23ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" 22ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
24 23
25# This should be in autotools.bbclass, but until something elses uses it putting 24do_configure:prepend() {
26# it here avoids rebuilding everything.
27export PKG_CONFIG_FOR_BUILD = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
28
29do_configure_prepend() {
30 # Do this because the configure script is running ./libtool directly
31 rm -f libtool
32 ln -s ${TARGET_PREFIX}libtool libtool
33 #delete a file that will get confused with generated one in ${B}
34 rm -f ${S}/gtk/gtktypefuncs.c
35
36 # These files are generated by wayland-scanner but will race over modification 25 # These files are generated by wayland-scanner but will race over modification
37 # time between the copies in the sysroot from wayland-protocols and the copy 26 # time between the copies in the sysroot from wayland-protocols and the copy
38 # in the source tree. Solve the race by deleting so they need to be regenerated. 27 # in the source tree. Solve the race by deleting so they need to be regenerated.
39 # 3.24.22 will not be shipping these files so this can be deleted then: 28 rm -f ${S}/modules/input/*-text-input-*.[ch]
40 # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2183
41 rm -f ${S}/modules/input/text-input-unstable-v3*.[ch]
42} 29}
43 30
44EXTRA_OECONF += " \ 31GTKDOC_MESON_OPTION = 'gtk_doc'
45 --disable-glibtest \
46 --disable-xinerama \
47 --enable-modules \
48 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "--disable-gtk-doc", d)} \
49 "
50 32
51do_compile_prepend() { 33EXTRA_OEMESON = "-Dxinerama=no -Dtests=false"
52 export GIR_EXTRA_LIBS_PATH="${B}/gdk/.libs" 34EXTRA_OEMESON:append:class-native = " -Ddemos=false -Dexamples=false"
53}
54 35
55PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl wayland x11', d)} \ 36PACKAGECONFIG ??= " \
56 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'glx', '', d)}" 37 ${@bb.utils.filter('DISTRO_FEATURES', 'opengl x11', d)} \
57PACKAGECONFIG_class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" 38 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl wayland', 'wayland', '', d)} \
58PACKAGECONFIG_class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" 39"
40PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
41PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
59 42
60PACKAGECONFIG[x11] = "--enable-x11-backend,--disable-x11-backend,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes" 43PACKAGECONFIG[x11] = "-Dx11_backend=true,-Dx11_backend=false,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes"
61# this is provided by oe-core patch that removes epoxy/gl dependency from a X11 build 44# this is provided by oe-core patch that removes epoxy/gl dependency from a X11 build
62PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,libepoxy" 45PACKAGECONFIG[opengl] = "-Dopengl=true,-Dopengl=false,libepoxy"
63PACKAGECONFIG[glx] = "--enable-glx,--disable-glx,,libgl" 46PACKAGECONFIG[wayland] = "-Dwayland_backend=true,-Dwayland_backend=false,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native"
64PACKAGECONFIG[wayland] = "--enable-wayland-backend,--disable-wayland-backend,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native" 47PACKAGECONFIG[cups] = ",,cups,cups gtk3-printbackend-cups"
65PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups" 48PACKAGECONFIG[colord] = "-Dcolord=yes,-Dcolord=no,colord"
66PACKAGECONFIG[cloudprint] = "--enable-cloudprint,--disable-cloudprint,rest json-glib" 49PACKAGECONFIG[cloudproviders] = "-Dcloudproviders=true,-Dcloudproviders=false,libcloudproviders"
67PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord" 50PACKAGECONFIG[tracker3] = "-Dtracker3=true,-Dtracker3=false,tracker,tracker-miners"
68 51
69prepare_gtk_scripts() { 52prepare_gtk_scripts() {
70 mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-3.0 53 mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-3.0
@@ -74,15 +57,15 @@ prepare_gtk_scripts() {
74 ln ${D}${bindir}/gtk-query-immodules-3.0 ${D}${libexecdir}/${MLPREFIX}gtk-query-immodules-3.0 57 ln ${D}${bindir}/gtk-query-immodules-3.0 ${D}${libexecdir}/${MLPREFIX}gtk-query-immodules-3.0
75} 58}
76 59
77do_install_append_class-target() { 60do_install:append:class-target() {
78 prepare_gtk_scripts 61 prepare_gtk_scripts
79} 62}
80 63
81do_install_append_class-nativesdk() { 64do_install:append:class-nativesdk() {
82 prepare_gtk_scripts 65 prepare_gtk_scripts
83} 66}
84 67
85do_install_append_class-native() { 68do_install:append:class-native() {
86 create_wrapper ${D}/${bindir}/gtk-update-icon-cache \ 69 create_wrapper ${D}/${bindir}/gtk-update-icon-cache \
87 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache 70 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache
88 create_wrapper ${D}/${bindir}/gtk-encode-symbolic-svg \ 71 create_wrapper ${D}/${bindir}/gtk-encode-symbolic-svg \
@@ -93,7 +76,7 @@ PROVIDES += "gtk-icon-utils"
93PACKAGES =+ "${PN}-demo" 76PACKAGES =+ "${PN}-demo"
94LIBV = "3.0.0" 77LIBV = "3.0.0"
95 78
96FILES_${PN}-demo = "${bindir}/gtk3-demo \ 79FILES:${PN}-demo = "${bindir}/gtk3-demo \
97 ${bindir}/gtk3-demo-application \ 80 ${bindir}/gtk3-demo-application \
98 ${bindir}/gtk3-icon-browser \ 81 ${bindir}/gtk3-icon-browser \
99 ${bindir}/gtk3-widget-factory \ 82 ${bindir}/gtk3-widget-factory \
@@ -104,14 +87,15 @@ FILES_${PN}-demo = "${bindir}/gtk3-demo \
104 ${datadir}/icons/hicolor/*/apps/gtk3-demo*.png \ 87 ${datadir}/icons/hicolor/*/apps/gtk3-demo*.png \
105 ${datadir}/icons/hicolor/*/apps/gtk3-widget-factory*.png" 88 ${datadir}/icons/hicolor/*/apps/gtk3-widget-factory*.png"
106 89
107FILES_${PN}_append = " ${bindir}/gtk-update-icon-cache-3.0 \ 90FILES:${PN}:append = " ${bindir}/gtk-update-icon-cache-3.0 \
108 ${bindir}/gtk-query-immodules-3.0 \ 91 ${bindir}/gtk-query-immodules-3.0 \
109 ${bindir}/gtk-launch \ 92 ${bindir}/gtk-launch \
110 ${datadir}/themes ${sysconfdir} ${datadir}/glib-2.0/schemas/ \ 93 ${datadir}/themes ${datadir}/gtk-3.0/emoji \
94 ${sysconfdir} ${datadir}/glib-2.0/schemas/ \
111 ${libdir}/gtk-3.0/${LIBV}/engines/libpixmap.so \ 95 ${libdir}/gtk-3.0/${LIBV}/engines/libpixmap.so \
112 ${libdir}/gtk-3.0/modules/*.so" 96 ${libdir}/gtk-3.0/modules/*.so"
113 97
114FILES_${PN}-dev += " \ 98FILES:${PN}-dev += " \
115 ${datadir}/gtk-3.0/gtkbuilder.rng \ 99 ${datadir}/gtk-3.0/gtkbuilder.rng \
116 ${datadir}/gtk-3.0/include \ 100 ${datadir}/gtk-3.0/include \
117 ${datadir}/gtk-3.0/valgrind \ 101 ${datadir}/gtk-3.0/valgrind \
@@ -137,22 +121,22 @@ GTKBASE_RRECOMMENDS ?= "liberation-fonts \
137 adwaita-icon-theme-symbolic \ 121 adwaita-icon-theme-symbolic \
138 " 122 "
139 123
140GTKBASE_RRECOMMENDS_class-native ?= "\ 124GTKBASE_RRECOMMENDS:class-native ?= "\
141 " 125 "
142 126
143GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1" 127GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
144 128
145RRECOMMENDS_${PN} = "${GTKBASE_RRECOMMENDS}" 129RRECOMMENDS:${PN} = "${GTKBASE_RRECOMMENDS}"
146RRECOMMENDS_${PN}_libc-glibc = "${GTKGLIBC_RRECOMMENDS}" 130RRECOMMENDS:${PN}:libc-glibc = "${GTKGLIBC_RRECOMMENDS}"
147RDEPENDS_${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}" 131RDEPENDS:${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}"
148 132
149PACKAGES_DYNAMIC += "^gtk3-immodule-.* ^gtk3-printbackend-.*" 133PACKAGES_DYNAMIC += "^gtk3-immodule-.* ^gtk3-printbackend-.*"
150 134
151ALTERNATIVE_${PN} = "gtk-update-icon-cache" 135ALTERNATIVE:${PN} = "gtk-update-icon-cache"
152ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-3.0" 136ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-3.0"
153ALTERNATIVE_PRIORITY = "30" 137ALTERNATIVE_PRIORITY = "30"
154 138
155python populate_packages_prepend () { 139python populate_packages:prepend () {
156 import os.path 140 import os.path
157 141
158 gtk_libdir = d.expand('${libdir}/gtk-3.0/${LIBV}') 142 gtk_libdir = d.expand('${libdir}/gtk-3.0/${LIBV}')
@@ -166,5 +150,5 @@ python populate_packages_prepend () {
166 do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s') 150 do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s')
167 151
168 if (d.getVar('DEBIAN_NAMES')): 152 if (d.getVar('DEBIAN_NAMES')):
169 d.setVar(d.expand('PKG_${PN}'), '${MLPREFIX}libgtk-3.0') 153 d.setVar(d.expand('PKG:${PN}'), '${MLPREFIX}libgtk-3.0')
170} 154}
diff --git a/meta/recipes-gnome/gtk+/gtk+3/0001-Hardcoded-libtool.patch b/meta/recipes-gnome/gtk+/gtk+3/0001-Hardcoded-libtool.patch
deleted file mode 100644
index c210bbc7d5..0000000000
--- a/meta/recipes-gnome/gtk+/gtk+3/0001-Hardcoded-libtool.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 0ecaa5bab162abf0cb2057d77beeb7b89d5873b4 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Tue, 21 Jun 2016 14:53:56 +0300
4Subject: [PATCH 1/4] Hardcoded libtool
5
6Upstream-Status: Inappropriate [embedded specific]
7
8Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
9Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
10---
11 configure.ac | 6 +++---
12 1 file changed, 3 insertions(+), 3 deletions(-)
13
14diff --git a/configure.ac b/configure.ac
15index 6628e21..f43ac09 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -617,7 +617,7 @@ AC_MSG_CHECKING([whether to write dependencies into .pc files])
19 case $enable_explicit_deps in
20 auto)
21 export SED
22- deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
23+ deplibs_check_method=`(./$host_alias-libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
24 if test "x$deplibs_check_method" != xpass_all || test "x$enable_static" = xyes ; then
25 enable_explicit_deps=yes
26 else
27@@ -895,7 +895,7 @@ else
28 dnl Now we check to see if our libtool supports shared lib deps
29 dnl (in a rather ugly way even)
30 if $dynworks; then
31- module_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
32+ module_libtool_config="${CONFIG_SHELL-/bin/sh} ./$host_alias-libtool --config"
33 module_deplibs_check=`$module_libtool_config | \
34 grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
35 sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
36@@ -1649,7 +1649,7 @@ AC_SUBST(GTK_PRINT_BACKENDS)
37 # We are using gmodule-no-export now, but I'm leaving the stripping
38 # code in place for now, since pango and atk still require gmodule.
39 export SED
40-export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
41+export_dynamic=`(./$host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
42 if test -n "$export_dynamic"; then
43 GDK_DEP_LIBS=`echo $GDK_DEP_LIBS | sed -e "s/$export_dynamic//"`
44 GTK_DEP_LIBS=`echo $GTK_DEP_LIBS | sed -e "s/$export_dynamic//"`
45--
462.12.0
47
diff --git a/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch b/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch
deleted file mode 100644
index 80dc2d7a05..0000000000
--- a/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 6575ab0f0e8c1bba033ad1616511e37a2ec995ff Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Fri, 16 Oct 2015 16:35:16 +0300
4Subject: [PATCH] Do not try to initialize GL without libGL
5
6_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys
7GLX api which will exit() if libGL.so.1 is not present. We do not
8want that to happen and we don't want every app to have to set
9"GDK_GL=disabled" environment variable: so use #ifdef set based on
10opengl distro feature.
11
12Upstream is not interested in the fix as it is: Either epoxy should be
13fixed (to not exit) or GTK+ possibly could do some additional probing
14before calling epoxy APIs.
15
16Upstream-Status: Denied
17Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
18
19---
20 configure.ac | 6 ++++++
21 gdk/x11/gdkvisual-x11.c | 5 +++++
22 2 files changed, 11 insertions(+)
23
24diff --git a/configure.ac b/configure.ac
25index e9f5583..bd651bb 100644
26--- a/configure.ac
27+++ b/configure.ac
28@@ -346,6 +346,12 @@ AC_ARG_ENABLE(cloudproviders,
29 [AS_HELP_STRING([--enable-cloudproviders],
30 [enable libcloudproviders integration])],
31 [cloudproviders_set=yes])
32+AC_ARG_ENABLE(glx,
33+ [AS_HELP_STRING([--enable-glx],
34+ [When enabled Gdk will try to initialize GLX])])
35+AS_IF([test "x$enable_glx" != "xno"], [
36+ AC_DEFINE([HAVE_GLX], [], [GLX will be available at runtime])
37+])
38
39 AC_ARG_ENABLE(profiler,
40 [AS_HELP_STRING([--enable-profiler],
41diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
42index 81479d8..3c8c5c0 100644
43--- a/gdk/x11/gdkvisual-x11.c
44+++ b/gdk/x11/gdkvisual-x11.c
45@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
46 /* If GL is available we want to pick better default/rgba visuals,
47 as we care about glx details such as alpha/depth/stencil depth,
48 stereo and double buffering */
49+ /* update_visuals_for_gl() will end up calling epoxy GLX api which
50+ will exit if libgl is not there: so only do this if we know GL
51+ is available */
52+#ifdef HAVE_GLX
53 _gdk_x11_screen_update_visuals_for_gl (screen);
54+#endif
55 }
56
57 gint
diff --git a/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch b/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch
deleted file mode 100644
index 398c9bc36a..0000000000
--- a/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch
+++ /dev/null
@@ -1,872 +0,0 @@
1From f83fcf1991afad6d9c15546b2ccd775dad4e314c Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Tue, 21 Jun 2016 15:11:39 +0300
4Subject: [PATCH] Add --disable-opengl configure option
5
6--disable-opengl will remove the dependency on libepoxy and on the
7OpenGL APIs. This is useful for those who want to keep using gtk+3
8without the "opengl" distro feature.
9
10GtkGLArea is still part of the API (it just doesn't work) even when
11OpenGL is disabled. GdkX11GLContext was removed from the Gtk API
12completely: that object exposes GL API elements so it had to be at
13the very least modified.
14
15The patch is _not_ great from a maintenance point of view and
16modifying the library API is also a fairly nasty thing to do.
17Next long term release (4.0) will require alternative solutions
18as it actually will depend on OpenGL.
19
20Upstream-Status: Inappropriate [Evil eye expected from upstream]
21Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
22
23---
24 configure.ac | 13 ++++-
25 demos/gtk-demo/glarea.c | 14 ++++++
26 docs/tools/Makefile.am | 9 +++-
27 docs/tools/widgets.c | 4 +-
28 gdk/Makefile.am | 8 ++-
29 gdk/gdkdisplay.c | 4 +-
30 gdk/gdkgl.c | 10 ++++
31 gdk/gdkglcontext.c | 6 +++
32 gdk/gdkwindow.c | 13 +++++
33 gdk/x11/Makefile.am | 30 +++++++++--
34 gdk/x11/gdkdisplay-x11.c | 6 ++-
35 gdk/x11/gdkscreen-x11.c | 5 ++
36 gdk/x11/gdkwindow-x11.c | 4 ++
37 gdk/x11/gdkx-autocleanups.h | 2 +
38 gdk/x11/{gdkx.h => gdkx-with-gl-context.h} | 1 -
39 gdk/x11/gdkx-without-gl-context.h | 58 ++++++++++++++++++++++
40 gtk/Makefile.am | 2 +-
41 gtk/gtkglarea.c | 20 +++++++-
42 gtk/inspector/general.c | 6 +++
43 tests/Makefile.am | 10 ++--
44 testsuite/gtk/objects-finalize.c | 2 +
45 21 files changed, 208 insertions(+), 19 deletions(-)
46 rename gdk/x11/{gdkx.h => gdkx-with-gl-context.h} (98%)
47 create mode 100644 gdk/x11/gdkx-without-gl-context.h
48
49diff --git a/configure.ac b/configure.ac
50index bd651bb..b4c061f 100644
51--- a/configure.ac
52+++ b/configure.ac
53@@ -346,6 +346,15 @@ AC_ARG_ENABLE(cloudproviders,
54 [AS_HELP_STRING([--enable-cloudproviders],
55 [enable libcloudproviders integration])],
56 [cloudproviders_set=yes])
57+AC_ARG_ENABLE(opengl,
58+ [AS_HELP_STRING([--enable-opengl],
59+ [When enabled, Gtk+ will use libepoxy and exposes GtkGLArea widget ])])
60+AS_IF([test "x$enable_opengl" != "xno"], [
61+ AC_DEFINE([HAVE_OPENGL], [1], [libepoxy and opengl APIs are available at buildtime])
62+ EPOXY_PACKAGES="epoxy >= epoxy_required_version"
63+])
64+AM_CONDITIONAL([HAVE_OPENGL],[test "x$enable_opengl" != "xno"])
65+
66 AC_ARG_ENABLE(glx,
67 [AS_HELP_STRING([--enable-glx],
68 [When enabled Gdk will try to initialize GLX])])
69@@ -1345,7 +1354,7 @@ CFLAGS="$saved_cflags"
70 LDFLAGS="$saved_ldflags"
71
72 GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version"
73-GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends epoxy >= epoxy_required_version $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version"
74+GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends $EPOXY_PACKAGES $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version"
75
76 PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES)
77 GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB"
78@@ -1379,7 +1388,7 @@ fi
79 PKG_CHECK_MODULES(ATK, $ATK_PACKAGES)
80
81 GTK_PACKAGES="atk >= atk_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version gdk-pixbuf-2.0 >= gdk_pixbuf_required_version gio-2.0 >= glib_required_version"
82-GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES epoxy >= epoxy_required_version fribidi >= fribidi_required_version"
83+GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $EPOXY_PACKAGES fribidi >= fribidi_required_version"
84 if test "x$enable_x11_backend" = xyes -o "x$enable_wayland_backend" = xyes; then
85 GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
86 fi
87diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c
88index b51e4ae..82409c7 100644
89--- a/demos/gtk-demo/glarea.c
90+++ b/demos/gtk-demo/glarea.c
91@@ -3,9 +3,12 @@
92 * GtkGLArea is a widget that allows custom drawing using OpenGL calls.
93 */
94
95+#include "config.h"
96 #include <math.h>
97 #include <gtk/gtk.h>
98+#if HAVE_OPENGL
99 #include <epoxy/gl.h>
100+#endif
101
102 static GtkWidget *demo_window = NULL;
103
104@@ -23,6 +26,8 @@ enum {
105 /* Rotation angles on each axis */
106 static float rotation_angles[N_AXIS] = { 0.0 };
107
108+#ifdef HAVE_OPENGL
109+
110 /* The object we are drawing */
111 static const GLfloat vertex_data[] = {
112 0.f, 0.5f, 0.f, 1.f,
113@@ -215,6 +220,7 @@ compute_mvp (float *res,
114 static GLuint position_buffer;
115 static GLuint program;
116 static GLuint mvp_location;
117+#endif
118
119 /* We need to set up our state when we realize the GtkGLArea widget */
120 static void
121@@ -241,8 +247,10 @@ realize (GtkWidget *widget)
122 fragment_path = "/glarea/glarea-gl.fs.glsl";
123 }
124
125+#ifdef HAVE_OPENGL
126 init_buffers (&position_buffer, NULL);
127 init_shaders (vertex_path, fragment_path, &program, &mvp_location);
128+#endif
129 }
130
131 /* We should tear down the state when unrealizing */
132@@ -254,10 +262,13 @@ unrealize (GtkWidget *widget)
133 if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
134 return;
135
136+#ifdef HAVE_OPENGL
137 glDeleteBuffers (1, &position_buffer);
138 glDeleteProgram (program);
139+#endif
140 }
141
142+#ifdef HAVE_OPENGL
143 static void
144 draw_triangle (void)
145 {
146@@ -290,6 +301,7 @@ draw_triangle (void)
147 glBindBuffer (GL_ARRAY_BUFFER, 0);
148 glUseProgram (0);
149 }
150+#endif
151
152 static gboolean
153 render (GtkGLArea *area,
154@@ -298,6 +310,7 @@ render (GtkGLArea *area,
155 if (gtk_gl_area_get_error (area) != NULL)
156 return FALSE;
157
158+#ifdef HAVE_OPENGL
159 /* Clear the viewport */
160 glClearColor (0.5, 0.5, 0.5, 1.0);
161 glClear (GL_COLOR_BUFFER_BIT);
162@@ -307,6 +320,7 @@ render (GtkGLArea *area,
163
164 /* Flush the contents of the pipeline */
165 glFlush ();
166+#endif
167
168 return TRUE;
169 }
170diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am
171index bec43e3..189e8fc 100644
172--- a/docs/tools/Makefile.am
173+++ b/docs/tools/Makefile.am
174@@ -9,13 +9,18 @@ AM_CPPFLAGS = \
175 $(GTK_DEBUG_FLAGS) \
176 $(GTK_DEP_CFLAGS)
177
178+if HAVE_OPENGL
179+GEARS_LDADD = $(top_builddir)/tests/gtkgears.o
180+endif
181+
182 DEPS = \
183- $(top_builddir)/gtk/libgtk-3.la
184+ $(top_builddir)/gtk/libgtk-3.la \
185+ $(GEARS_LDADD)
186
187 LDADDS = \
188 $(top_builddir)/gtk/libgtk-3.la \
189 $(top_builddir)/gdk/libgdk-3.la \
190- $(top_builddir)/tests/gtkgears.o \
191+ $(GEARS_LDADD) \
192 $(GTK_DEP_LIBS) \
193 $(GDK_DEP_LIBS) \
194 -lm
195diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
196index 932daf1..54239d6 100644
197--- a/docs/tools/widgets.c
198+++ b/docs/tools/widgets.c
199@@ -1526,9 +1526,11 @@ create_gl_area (void)
200 widget = gtk_frame_new (NULL);
201 gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
202
203+#ifdef HAVE_OPENGL
204 gears = gtk_gears_new ();
205 gtk_container_add (GTK_CONTAINER (widget), gears);
206-
207+#endif
208+
209 info = new_widget_info ("glarea", widget, MEDIUM);
210
211 return info;
212diff --git a/gdk/Makefile.am b/gdk/Makefile.am
213index 479d6a1..7edbee8 100644
214--- a/gdk/Makefile.am
215+++ b/gdk/Makefile.am
216@@ -274,7 +274,6 @@ x11_introspection_files = \
217 x11/gdkeventsource.c \
218 x11/gdkeventtranslator.c \
219 x11/gdkgeometry-x11.c \
220- x11/gdkglcontext-x11.c \
221 x11/gdkkeys-x11.c \
222 x11/gdkmain-x11.c \
223 x11/gdkmonitor-x11.c \
224@@ -300,7 +299,6 @@ x11_introspection_files = \
225 x11/gdkx11display.h \
226 x11/gdkx11displaymanager.h \
227 x11/gdkx11dnd.h \
228- x11/gdkx11glcontext.h \
229 x11/gdkx11keys.h \
230 x11/gdkx11monitor.h \
231 x11/gdkx11property.h \
232@@ -310,6 +308,12 @@ x11_introspection_files = \
233 x11/gdkx11visual.h \
234 x11/gdkx11window.h
235
236+if HAVE_OPENGL
237+x11_introspection_files += \
238+ x11/gdkglcontext-x11.c \
239+ x11/gdkx11glcontext.h
240+endif
241+
242 GdkX11-3.0.gir: libgdk-3.la Gdk-3.0.gir Makefile
243 GdkX11_3_0_gir_SCANNERFLAGS = \
244 --identifier-prefix=Gdk \
245diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
246index 240c99f..9eb49bf 100644
247--- a/gdk/gdkdisplay.c
248+++ b/gdk/gdkdisplay.c
249@@ -2419,7 +2419,9 @@ gboolean
250 gdk_display_make_gl_context_current (GdkDisplay *display,
251 GdkGLContext *context)
252 {
253- return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
254+ if (GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current)
255+ return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
256+ return FALSE;
257 }
258
259 GdkRenderingMode
260diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
261index 933e204..1767508 100644
262--- a/gdk/gdkgl.c
263+++ b/gdk/gdkgl.c
264@@ -26,7 +26,9 @@
265 # include "win32/gdkwin32.h"
266 #endif
267
268+#ifdef HAVE_OPENGL
269 #include <epoxy/gl.h>
270+#endif
271 #include <math.h>
272 #include <string.h>
273
274@@ -40,6 +42,7 @@ gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
275 g_object_ref (window), g_object_unref);
276 }
277
278+#ifdef HAVE_OPENGL
279 static const char *
280 get_vertex_type_name (int type)
281 {
282@@ -212,6 +215,7 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data)
283 glUseProgram (paint_data->current_program->program);
284 }
285 }
286+#endif
287
288 void
289 gdk_gl_texture_quads (GdkGLContext *paint_context,
290@@ -220,6 +224,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
291 GdkTexturedQuad *quads,
292 gboolean flip_colors)
293 {
294+#ifdef HAVE_OPENGL
295 GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context);
296 GdkGLContextProgram *program;
297 GdkWindow *window = gdk_gl_context_get_window (paint_context);
298@@ -293,6 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
299
300 glDisableVertexAttribArray (program->position_location);
301 glDisableVertexAttribArray (program->uv_location);
302+#endif
303 }
304
305 /* x,y,width,height describes a rectangle in the gl render buffer
306@@ -341,6 +347,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
307 int width,
308 int height)
309 {
310+#ifdef HAVE_OPENGL
311 GdkGLContext *paint_context;
312 cairo_surface_t *image;
313 cairo_matrix_t matrix;
314@@ -718,6 +725,7 @@ out:
315 if (clip_region)
316 cairo_region_destroy (clip_region);
317
318+#endif
319 }
320
321 /* This is always called with the paint context current */
322@@ -725,6 +733,7 @@ void
323 gdk_gl_texture_from_surface (cairo_surface_t *surface,
324 cairo_region_t *region)
325 {
326+#ifdef HAVE_OPENGL
327 GdkGLContext *paint_context;
328 cairo_surface_t *image;
329 double device_x_offset, device_y_offset;
330@@ -825,4 +834,5 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
331
332 glDisable (GL_SCISSOR_TEST);
333 glDeleteTextures (1, &texture_id);
334+#endif
335 }
336diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
337index dfbed63..556f0a3 100644
338--- a/gdk/gdkglcontext.c
339+++ b/gdk/gdkglcontext.c
340@@ -85,7 +85,9 @@
341 #include "gdkintl.h"
342 #include "gdk-private.h"
343
344+#ifdef HAVE_OPENGL
345 #include <epoxy/gl.h>
346+#endif
347
348 typedef struct {
349 GdkDisplay *display;
350@@ -243,6 +245,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
351 int height,
352 guint texture_target)
353 {
354+#ifdef HAVE_OPENGL
355 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
356
357 g_return_if_fail (GDK_IS_GL_CONTEXT (context));
358@@ -286,6 +289,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
359 glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride));
360 }
361 }
362+#endif
363 }
364
365 static gboolean
366@@ -774,6 +778,7 @@ gdk_gl_context_realize (GdkGLContext *context,
367 static void
368 gdk_gl_context_check_extensions (GdkGLContext *context)
369 {
370+#ifdef HAVE_OPENGL
371 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
372 gboolean has_npot, has_texture_rectangle;
373
374@@ -853,6 +858,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
375 priv->use_texture_rectangle ? "yes" : "no"));
376
377 priv->extensions_checked = TRUE;
378+#endif
379 }
380
381 /**
382diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
383index 6ae0f86..4e48a2a 100644
384--- a/gdk/gdkwindow.c
385+++ b/gdk/gdkwindow.c
386@@ -45,7 +45,9 @@
387
388 #include <math.h>
389
390+#ifdef HAVE_OPENGL
391 #include <epoxy/gl.h>
392+#endif
393
394 /* for the use of round() */
395 #include "fallback-c89.c"
396@@ -2844,6 +2846,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
397 {
398 GError *internal_error = NULL;
399
400+#ifndef HAVE_OPENGL
401+ g_set_error_literal (error, GDK_GL_ERROR,
402+ GDK_GL_ERROR_NOT_AVAILABLE,
403+ _("GL support disabled with --disable-opengl"));
404+ return NULL;
405+#endif
406+
407 if (_gdk_gl_flags & GDK_GL_DISABLE)
408 {
409 g_set_error_literal (error, GDK_GL_ERROR,
410@@ -2979,6 +2988,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
411 }
412 else
413 {
414+#ifdef HAVE_OPENGL
415 gdk_gl_context_make_current (context);
416 /* With gl we always need a surface to combine the gl
417 drawing with the native drawing. */
418@@ -2993,6 +3003,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
419 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
420
421 glViewport (0, 0, ww, wh);
422+#endif
423 }
424 }
425
426@@ -3056,6 +3067,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
427
428 gdk_gl_context_make_current (window->gl_paint_context);
429
430+#ifdef HAVE_OPENGL
431 if (!cairo_region_is_empty (opaque_region))
432 gdk_gl_texture_from_surface (window->current_paint.surface,
433 opaque_region);
434@@ -3066,6 +3078,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
435 window->current_paint.need_blend_region);
436 glDisable(GL_BLEND);
437 }
438+#endif
439
440 cairo_region_destroy (opaque_region);
441
442diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
443index 32b1f24..6352313 100644
444--- a/gdk/x11/Makefile.am
445+++ b/gdk/x11/Makefile.am
446@@ -40,8 +40,6 @@ libgdk_x11_la_SOURCES = \
447 gdkeventtranslator.c \
448 gdkeventtranslator.h \
449 gdkgeometry-x11.c \
450- gdkglcontext-x11.c \
451- gdkglcontext-x11.h \
452 gdkkeys-x11.c \
453 gdkmain-x11.c \
454 gdkmonitor-x11.c \
455@@ -56,14 +54,32 @@ libgdk_x11_la_SOURCES = \
456 gdkwindow-x11.h \
457 gdkxftdefaults.c \
458 gdkxid.c \
459- gdkx.h \
460 gdkprivate-x11.h \
461 xsettings-client.h \
462 xsettings-client.c
463
464+if HAVE_OPENGL
465+libgdk_x11_la_SOURCES += \
466+ gdkglcontext-x11.c \
467+ gdkglcontext-x11.h
468+endif
469+
470 libgdkinclude_HEADERS = \
471 gdkx.h
472
473+if HAVE_OPENGL
474+GDKX_HEADER = gdkx-with-gl-context.h
475+else
476+GDKX_HEADER = gdkx-without-gl-context.h
477+endif
478+
479+BUILT_SOURCES = gdkx.h
480+
481+.PHONY: gdkx.h
482+gdkx.h:
483+ $(AM_V_GEN) cd $(srcdir) \
484+ && (cmp -s $(GDKX_HEADER) gdkx.h || cp $(GDKX_HEADER) gdkx.h )
485+
486 libgdkx11include_HEADERS = \
487 gdkx-autocleanups.h \
488 gdkx11applaunchcontext.h \
489@@ -77,7 +93,6 @@ libgdkx11include_HEADERS = \
490 gdkx11display.h \
491 gdkx11displaymanager.h \
492 gdkx11dnd.h \
493- gdkx11glcontext.h \
494 gdkx11keys.h \
495 gdkx11monitor.h \
496 gdkx11property.h \
497@@ -87,10 +102,17 @@ libgdkx11include_HEADERS = \
498 gdkx11visual.h \
499 gdkx11window.h
500
501+if HAVE_OPENGL
502+libgdkx11include_HEADERS += gdkx11glcontext.h
503+endif
504+
505 # We need to include all these C files here since the conditionals
506 # don't seem to be correctly expanded for the dist files.
507 EXTRA_DIST += \
508+ gdkx.h \
509 gdksettings.c \
510 meson.build
511
512+MAINTAINERCLEANFILES = gdkx.h
513+
514 -include $(top_srcdir)/git.mk
515diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
516index 817944e..e7a2947 100644
517--- a/gdk/x11/gdkdisplay-x11.c
518+++ b/gdk/x11/gdkdisplay-x11.c
519@@ -37,7 +37,9 @@
520 #include "gdkdisplay-x11.h"
521 #include "gdkprivate-x11.h"
522 #include "gdkscreen-x11.h"
523+#ifdef HAVE_OPENGL
524 #include "gdkglcontext-x11.h"
525+#endif
526 #include "gdk-private.h"
527 #include "gdkprofilerprivate.h"
528
529@@ -3188,7 +3190,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
530 display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
531 display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
532
533- display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
534+#ifdef HAVE_OPENGL
535+ display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
536+#endif
537
538 display_class->get_default_seat = gdk_x11_display_get_default_seat;
539
540diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
541index 8939ae9..931bff9 100644
542--- a/gdk/x11/gdkscreen-x11.c
543+++ b/gdk/x11/gdkscreen-x11.c
544@@ -1723,3 +1723,8 @@ gdk_x11_screen_get_current_desktop (GdkScreen *screen)
545 {
546 return get_netwm_cardinal_property (screen, "_NET_CURRENT_DESKTOP");
547 }
548+
549+#ifndef HAVE_OPENGL
550+/* Function from in gdk/x11/gdkglcontext-x11.c */
551+void _gdk_x11_screen_update_visuals_for_gl (GdkScreen *screen) {}
552+#endif
553diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
554index 1fe7b90..d23a347 100644
555--- a/gdk/x11/gdkwindow-x11.c
556+++ b/gdk/x11/gdkwindow-x11.c
557@@ -36,7 +36,9 @@
558 #include "gdkasync.h"
559 #include "gdkeventsource.h"
560 #include "gdkdisplay-x11.h"
561+#ifdef HAVE_OPENGL
562 #include "gdkglcontext-x11.h"
563+#endif
564 #include "gdkprivate-x11.h"
565 #include "gdk-private.h"
566
567@@ -5861,7 +5863,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
568 impl_class->set_opaque_region = gdk_x11_window_set_opaque_region;
569 impl_class->set_shadow_width = gdk_x11_window_set_shadow_width;
570 impl_class->show_window_menu = gdk_x11_window_show_window_menu;
571+#ifdef HAVE_OPENGL
572 impl_class->create_gl_context = gdk_x11_window_create_gl_context;
573 impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame;
574+#endif
575 impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size;
576 }
577diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h
578index edb0ea7..a317d61 100644
579--- a/gdk/x11/gdkx-autocleanups.h
580+++ b/gdk/x11/gdkx-autocleanups.h
581@@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
582 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
583 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref)
584 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
585+#ifdef HAVE_OPENGL
586 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
587+#endif
588 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
589 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
590 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref)
591diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx-with-gl-context.h
592similarity index 98%
593rename from gdk/x11/gdkx.h
594rename to gdk/x11/gdkx-with-gl-context.h
595index 1f64bcc..ae05fa6 100644
596--- a/gdk/x11/gdkx.h
597+++ b/gdk/x11/gdkx-with-gl-context.h
598@@ -45,7 +45,6 @@
599 #include <gdk/x11/gdkx11dnd.h>
600 #include <gdk/x11/gdkx11glcontext.h>
601 #include <gdk/x11/gdkx11keys.h>
602-#include <gdk/x11/gdkx11monitor.h>
603 #include <gdk/x11/gdkx11property.h>
604 #include <gdk/x11/gdkx11screen.h>
605 #include <gdk/x11/gdkx11selection.h>
606diff --git a/gdk/x11/gdkx-without-gl-context.h b/gdk/x11/gdkx-without-gl-context.h
607new file mode 100644
608index 0000000..c9e2617
609--- /dev/null
610+++ b/gdk/x11/gdkx-without-gl-context.h
611@@ -0,0 +1,58 @@
612+/* GDK - The GIMP Drawing Kit
613+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
614+ *
615+ * This library is free software; you can redistribute it and/or
616+ * modify it under the terms of the GNU Lesser General Public
617+ * License as published by the Free Software Foundation; either
618+ * version 2 of the License, or (at your option) any later version.
619+ *
620+ * This library is distributed in the hope that it will be useful,
621+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
622+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
623+ * Lesser General Public License for more details.
624+ *
625+ * You should have received a copy of the GNU Lesser General Public
626+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
627+ */
628+
629+/*
630+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
631+ * file for a list of people on the GTK+ Team. See the ChangeLog
632+ * files for a list of changes. These files are distributed with
633+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
634+ */
635+
636+#ifndef __GDK_X_H__
637+#define __GDK_X_H__
638+
639+#include <gdk/gdk.h>
640+
641+#include <X11/Xlib.h>
642+#include <X11/Xutil.h>
643+
644+#define __GDKX_H_INSIDE__
645+
646+#include <gdk/x11/gdkx11applaunchcontext.h>
647+#include <gdk/x11/gdkx11cursor.h>
648+#include <gdk/x11/gdkx11device.h>
649+#include <gdk/x11/gdkx11device-core.h>
650+#include <gdk/x11/gdkx11device-xi2.h>
651+#include <gdk/x11/gdkx11devicemanager.h>
652+#include <gdk/x11/gdkx11devicemanager-core.h>
653+#include <gdk/x11/gdkx11devicemanager-xi2.h>
654+#include <gdk/x11/gdkx11display.h>
655+#include <gdk/x11/gdkx11displaymanager.h>
656+#include <gdk/x11/gdkx11dnd.h>
657+#include <gdk/x11/gdkx11keys.h>
658+#include <gdk/x11/gdkx11property.h>
659+#include <gdk/x11/gdkx11screen.h>
660+#include <gdk/x11/gdkx11selection.h>
661+#include <gdk/x11/gdkx11utils.h>
662+#include <gdk/x11/gdkx11visual.h>
663+#include <gdk/x11/gdkx11window.h>
664+
665+#include <gdk/x11/gdkx-autocleanups.h>
666+
667+#undef __GDKX_H_INSIDE__
668+
669+#endif /* __GDK_X_H__ */
670diff --git a/gtk/Makefile.am b/gtk/Makefile.am
671index eaca473..99352d1 100644
672--- a/gtk/Makefile.am
673+++ b/gtk/Makefile.am
674@@ -1449,7 +1449,7 @@ gtktypefuncs.inc: stamp-gtktypebuiltins.h stamp-gtkprivatetypebuiltins.h $(top_s
675 ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
676 $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
677 sort | uniq | \
678- $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; }' >> xgen-gtf \
679+ $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; s/^.*gdk_x11_gl.*$$/#ifdef HAVE_OPENGL\n&\n#endif/; }' >> xgen-gtf \
680 && cp xgen-gtf $@ && rm -f xgen-gtf
681 $(srcdir)/gtktestutils.c: gtktypefuncs.inc
682
683diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
684index 9a56443..7de0db2 100644
685--- a/gtk/gtkglarea.c
686+++ b/gtk/gtkglarea.c
687@@ -29,7 +29,9 @@
688 #include "gtkprivate.h"
689 #include "gtkrender.h"
690
691+#ifdef HAVE_OPENGL
692 #include <epoxy/gl.h>
693+#endif
694
695 /**
696 * SECTION:gtkglarea
697@@ -369,9 +371,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area)
698 static void
699 gtk_gl_area_resize (GtkGLArea *area, int width, int height)
700 {
701+#ifdef HAVE_OPENGL
702 glViewport (0, 0, width, height);
703+#endif
704 }
705
706+#ifdef HAVE_OPENGL
707 /*
708 * Creates all the buffer objects needed for rendering the scene
709 */
710@@ -483,6 +488,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
711
712 priv->needs_render = TRUE;
713 }
714+#endif
715
716 /**
717 * gtk_gl_area_attach_buffers:
718@@ -501,6 +507,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
719 void
720 gtk_gl_area_attach_buffers (GtkGLArea *area)
721 {
722+#ifdef HAVE_OPENGL
723 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
724
725 g_return_if_fail (GTK_IS_GL_AREA (area));
726@@ -533,11 +540,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
727 glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
728 GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
729 }
730+#endif
731 }
732
733 static void
734 gtk_gl_area_delete_buffers (GtkGLArea *area)
735 {
736+#ifdef HAVE_OPENGL
737 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
738
739 if (priv->context == NULL)
740@@ -569,6 +578,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
741 glDeleteFramebuffersEXT (1, &priv->frame_buffer);
742 priv->frame_buffer = 0;
743 }
744+#endif
745 }
746
747 static void
748@@ -679,6 +689,7 @@ gtk_gl_area_draw (GtkWidget *widget,
749 GtkGLArea *area = GTK_GL_AREA (widget);
750 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
751 gboolean unused;
752+#ifdef HAVE_OPENGL
753 int w, h, scale;
754 GLenum status;
755
756@@ -690,7 +701,6 @@ gtk_gl_area_draw (GtkWidget *widget,
757 gtk_widget_get_allocated_height (widget));
758 return FALSE;
759 }
760-
761 if (priv->context == NULL)
762 return FALSE;
763
764@@ -736,6 +746,14 @@ gtk_gl_area_draw (GtkWidget *widget,
765 }
766
767 return TRUE;
768+#else
769+ if (priv->error != NULL)
770+ gtk_gl_area_draw_error_screen (area,
771+ cr,
772+ gtk_widget_get_allocated_width (widget),
773+ gtk_widget_get_allocated_height (widget));
774+ return FALSE;
775+#endif
776 }
777
778 static gboolean
779diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
780index c241ec8..24576dd 100644
781--- a/gtk/inspector/general.c
782+++ b/gtk/inspector/general.c
783@@ -33,8 +33,10 @@
784
785 #ifdef GDK_WINDOWING_X11
786 #include "x11/gdkx.h"
787+#ifdef HAVE_OPENGL
788 #include <epoxy/glx.h>
789 #endif
790+#endif
791
792 #ifdef GDK_WINDOWING_WIN32
793 #include "win32/gdkwin32.h"
794@@ -196,6 +198,7 @@ add_label_row (GtkInspectorGeneral *gen,
795 gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label);
796 }
797
798+#ifdef HAVE_OPENGL
799 #ifdef GDK_WINDOWING_X11
800 static void
801 append_glx_extension_row (GtkInspectorGeneral *gen,
802@@ -205,6 +208,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
803 add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
804 }
805 #endif
806+#endif
807
808 #ifdef GDK_WINDOWING_WAYLAND
809 static void
810@@ -254,6 +258,7 @@ wayland_get_display (struct wl_display *wl_display)
811 static void
812 init_gl (GtkInspectorGeneral *gen)
813 {
814+#ifdef HAVE_OPENGL
815 #ifdef GDK_WINDOWING_X11
816 if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
817 {
818@@ -280,6 +285,7 @@ init_gl (GtkInspectorGeneral *gen)
819 }
820 else
821 #endif
822+#endif
823 #ifdef GDK_WINDOWING_WAYLAND
824 if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
825 {
826diff --git a/tests/Makefile.am b/tests/Makefile.am
827index ee1e8b5..e6c6502 100644
828--- a/tests/Makefile.am
829+++ b/tests/Makefile.am
830@@ -80,8 +80,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
831 testfullscreen \
832 testgeometry \
833 testgiconpixbuf \
834- testglarea \
835- testglblending \
836 testgrid \
837 testgtk \
838 testheaderbar \
839@@ -172,12 +170,18 @@ noinst_PROGRAMS = $(TEST_PROGS) \
840 testactionbar \
841 testwindowsize \
842 testpopover \
843- gdkgears \
844 listmodel \
845 testpopup \
846 testpopupat \
847 $(NULL)
848
849+if HAVE_OPENGL
850+noinst_PROGRAMS +=
851+ testglarea \
852+ testglblending \
853+ gdkgears
854+endif
855+
856 if USE_WAYLAND
857 noinst_PROGRAMS += testforeign
858 endif
859diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c
860index 24540e3..e0f863a 100644
861--- a/testsuite/gtk/objects-finalize.c
862+++ b/testsuite/gtk/objects-finalize.c
863@@ -116,7 +116,9 @@ main (int argc, char **argv)
864 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE &&
865 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 &&
866 all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER &&
867+#ifdef HAVE_OPENGL
868 all_types[i] != GDK_TYPE_X11_GL_CONTEXT &&
869+#endif
870 #endif
871 /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */
872 all_types[i] != GDK_TYPE_PIXBUF_LOADER &&
diff --git a/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch b/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch
deleted file mode 100644
index e4bbd799f1..0000000000
--- a/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch
+++ /dev/null
@@ -1,19 +0,0 @@
1Link with libfribidi, this is to avoid under linking where these functions are
2used but the library is not linked in, and they are marked undefined by BFD linker
3but gold linker refuses to link
4
5| ./.libs/libgdk-3.so: error: undefined reference to 'fribidi_get_bidi_type'
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8Upstream-Status: Pending
9
10--- a/gdk/Makefile.am
11+++ b/gdk/Makefile.am
12@@ -55,6 +55,7 @@ LDADD = \
13 -version-info $(LT_VERSION_INFO) \
14 -export-dynamic \
15 -rpath $(libdir) \
16+ -lfribidi \
17 $(no_undefined)
18
19 #
diff --git a/meta/recipes-gnome/gtk+/gtk+3/opengl.patch b/meta/recipes-gnome/gtk+/gtk+3/opengl.patch
new file mode 100644
index 0000000000..8f2feb0ee7
--- /dev/null
+++ b/meta/recipes-gnome/gtk+/gtk+3/opengl.patch
@@ -0,0 +1,738 @@
1From 4a0716f04fb25b51b08e994bd5a900b2e7f7fed5 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Fri, 16 Oct 2015 16:35:16 +0300
4Subject: [PATCH] Do not try to initialize GL without libGL
5
6_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys
7GLX api which will exit() if libGL.so.1 is not present. We do not
8want that to happen and we don't want every app to have to set
9"GDK_GL=disabled" environment variable: so use #ifdef set based on
10opengl distro feature.
11
12Upstream is not interested in the fix as it is: Either epoxy should be
13fixed (to not exit) or GTK+ possibly could do some additional probing
14before calling epoxy APIs.
15
16Upstream-Status: Denied
17Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
18---
19 demos/gtk-demo/meson.build | 5 ++++-
20 docs/tools/meson.build | 7 +++++--
21 docs/tools/widgets.c | 6 +++++-
22 gdk/gdkconfig.h.meson | 1 +
23 gdk/gdkdisplay.c | 4 ++++
24 gdk/gdkgl.c | 10 ++++++++++
25 gdk/gdkglcontext.c | 6 ++++++
26 gdk/gdkwindow.c | 13 +++++++++++++
27 gdk/meson.build | 8 +++++++-
28 gdk/x11/gdkdisplay-x11.c | 6 +++++-
29 gdk/x11/gdkvisual-x11.c | 5 +++++
30 gdk/x11/gdkwindow-x11.c | 4 ++++
31 gdk/x11/gdkx-autocleanups.h | 2 ++
32 gdk/x11/gdkx.h | 2 ++
33 gdk/x11/meson.build | 7 +++++--
34 gtk/gtkglarea.c | 19 +++++++++++++++++++
35 gtk/inspector/general.c | 6 ++++++
36 meson.build | 17 ++++++++++++++---
37 meson_options.txt | 2 ++
38 tests/meson.build | 9 +++++++--
39 testsuite/gtk/objects-finalize.c | 2 ++
40 21 files changed, 128 insertions(+), 13 deletions(-)
41
42diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
43index 252da16d05..4b57cff6ac 100644
44--- a/demos/gtk-demo/meson.build
45+++ b/demos/gtk-demo/meson.build
46@@ -28,7 +28,6 @@ demos = files([
47 'fishbowl.c',
48 'foreigndrawing.c',
49 'gestures.c',
50- 'glarea.c',
51 'headerbar.c',
52 'hypertext.c',
53 'iconview.c',
54@@ -87,6 +86,10 @@ elif harfbuzz_dep.found() and pangoft_dep.found()
55 gtkdemo_deps += [harfbuzz_dep, pangoft_dep]
56 endif
57
58+if opengl_enabled
59+ demos += files('glarea.c')
60+endif
61+
62 if os_unix
63 demos += files('pagesetup.c')
64 endif
65diff --git a/docs/tools/meson.build b/docs/tools/meson.build
66index 05621ee7ed..3d0a333b32 100644
67--- a/docs/tools/meson.build
68+++ b/docs/tools/meson.build
69@@ -2,10 +2,13 @@ if x11_enabled
70 doc_shooter_sources = [
71 'shadow.c',
72 'shooter.c',
73- 'widgets.c',
74- '../../tests/gtkgears.c',
75+ 'widgets.c'
76 ]
77
78+ if opengl_enabled
79+ doc_shooter_sources += ['../../tests/gtkgears.c']
80+ endif
81+
82 doc_shooter = executable('doc-shooter', doc_shooter_sources,
83 include_directories: [ confinc, gdkinc, gtkinc, testinc, ],
84 dependencies: libgtk_dep)
85diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
86index 932daf1746..348807e133 100644
87--- a/docs/tools/widgets.c
88+++ b/docs/tools/widgets.c
89@@ -8,7 +8,9 @@
90 #include <X11/Xatom.h>
91 #include <gdkx.h>
92 #include "widgets.h"
93+#ifdef HAVE_OPENGL
94 #include "gtkgears.h"
95+#endif
96
97 #define SMALL_WIDTH 240
98 #define SMALL_HEIGHT 75
99@@ -1526,9 +1528,11 @@ create_gl_area (void)
100 widget = gtk_frame_new (NULL);
101 gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
102
103+#ifdef HAVE_OPENGL
104 gears = gtk_gears_new ();
105 gtk_container_add (GTK_CONTAINER (widget), gears);
106-
107+#endif
108+
109 info = new_widget_info ("glarea", widget, MEDIUM);
110
111 return info;
112diff --git a/gdk/gdkconfig.h.meson b/gdk/gdkconfig.h.meson
113index 7db19e0470..088651bafa 100644
114--- a/gdk/gdkconfig.h.meson
115+++ b/gdk/gdkconfig.h.meson
116@@ -15,6 +15,7 @@ G_BEGIN_DECLS
117 #mesondefine GDK_WINDOWING_WAYLAND
118 #mesondefine GDK_WINDOWING_WIN32
119 #mesondefine GDK_WINDOWING_QUARTZ
120+#mesondefine GDK_WITH_OPENGL
121
122 G_END_DECLS
123
124diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
125index 748f54860c..04ef2c09d4 100644
126--- a/gdk/gdkdisplay.c
127+++ b/gdk/gdkdisplay.c
128@@ -2420,7 +2420,11 @@ gboolean
129 gdk_display_make_gl_context_current (GdkDisplay *display,
130 GdkGLContext *context)
131 {
132+#ifdef HAVE_OPENGL
133 return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
134+#else
135+ return FALSE;
136+#endif
137 }
138
139 GdkRenderingMode
140diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
141index 9690077cc2..55f85ef605 100644
142--- a/gdk/gdkgl.c
143+++ b/gdk/gdkgl.c
144@@ -21,8 +21,9 @@
145 #include "gdkglcontextprivate.h"
146
147 #include "gdkinternals.h"
148-
149+#ifdef HAVE_OPENGL
150 #include <epoxy/gl.h>
151+#endif
152 #include <math.h>
153 #include <string.h>
154
155@@ -36,6 +37,7 @@
156 g_object_ref (window), g_object_unref);
157 }
158
159+#ifdef HAVE_OPENGL
160 static const char *
161 get_vertex_type_name (int type)
162 {
163@@ -208,6 +210,7 @@
164 glUseProgram (paint_data->current_program->program);
165 }
166 }
167+#endif
168
169 void
170 gdk_gl_texture_quads (GdkGLContext *paint_context,
171@@ -216,6 +219,7 @@
172 GdkTexturedQuad *quads,
173 gboolean flip_colors)
174 {
175+#ifdef HAVE_OPENGL
176 GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context);
177 GdkGLContextProgram *program;
178 GdkWindow *window = gdk_gl_context_get_window (paint_context);
179@@ -289,6 +293,7 @@
180
181 glDisableVertexAttribArray (program->position_location);
182 glDisableVertexAttribArray (program->uv_location);
183+#endif
184 }
185
186 /* x,y,width,height describes a rectangle in the gl render buffer
187@@ -337,6 +342,7 @@
188 int width,
189 int height)
190 {
191+#ifdef HAVE_OPENGL
192 GdkGLContext *paint_context, *current_context;
193 cairo_surface_t *image;
194 cairo_matrix_t matrix;
195@@ -703,6 +709,7 @@
196 if (clip_region)
197 cairo_region_destroy (clip_region);
198
199+#endif
200 }
201
202 /* This is always called with the paint context current */
203@@ -710,6 +717,7 @@
204 gdk_gl_texture_from_surface (cairo_surface_t *surface,
205 cairo_region_t *region)
206 {
207+#ifdef HAVE_OPENGL
208 GdkGLContext *paint_context;
209 cairo_surface_t *image;
210 double device_x_offset, device_y_offset;
211@@ -810,4 +818,5 @@
212
213 glDisable (GL_SCISSOR_TEST);
214 glDeleteTextures (1, &texture_id);
215+#endif
216 }
217diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
218index 3b23639e1c..1f04f8e0b2 100644
219--- a/gdk/gdkglcontext.c
220+++ b/gdk/gdkglcontext.c
221@@ -85,7 +85,9 @@
222 #include "gdkintl.h"
223 #include "gdk-private.h"
224
225+#ifdef HAVE_OPENGL
226 #include <epoxy/gl.h>
227+#endif
228
229 typedef struct {
230 GdkDisplay *display;
231@@ -243,6 +245,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
232 int height,
233 guint texture_target)
234 {
235+#ifdef HAVE_OPENGL
236 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
237
238 g_return_if_fail (GDK_IS_GL_CONTEXT (context));
239@@ -286,6 +289,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
240 glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride));
241 }
242 }
243+#endif
244 }
245
246 static gboolean
247@@ -774,6 +778,7 @@ gdk_gl_context_realize (GdkGLContext *context,
248 static void
249 gdk_gl_context_check_extensions (GdkGLContext *context)
250 {
251+#ifdef HAVE_OPENGL
252 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
253 gboolean has_npot, has_texture_rectangle;
254
255@@ -853,6 +858,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
256 priv->use_texture_rectangle ? "yes" : "no"));
257
258 priv->extensions_checked = TRUE;
259+#endif
260 }
261
262 /**
263diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
264index 727b0cf1f4..d4d91b0d16 100644
265--- a/gdk/gdkwindow.c
266+++ b/gdk/gdkwindow.c
267@@ -45,7 +45,9 @@
268
269 #include <math.h>
270
271+#ifdef HAVE_OPENGL
272 #include <epoxy/gl.h>
273+#endif
274
275 /* for the use of round() */
276 #include "fallback-c89.c"
277@@ -2844,6 +2846,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
278 {
279 GError *internal_error = NULL;
280
281+#ifndef HAVE_OPENGL
282+ g_set_error_literal (error, GDK_GL_ERROR,
283+ GDK_GL_ERROR_NOT_AVAILABLE,
284+ _("GL support disabled with --disable-opengl"));
285+ return NULL;
286+#endif
287+
288 if (_gdk_gl_flags & GDK_GL_DISABLE)
289 {
290 g_set_error_literal (error, GDK_GL_ERROR,
291@@ -2979,6 +2988,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
292 }
293 else
294 {
295+#ifdef HAVE_OPENGL
296 gdk_gl_context_make_current (context);
297 /* With gl we always need a surface to combine the gl
298 drawing with the native drawing. */
299@@ -2993,6 +3003,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
300 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
301
302 glViewport (0, 0, ww, wh);
303+#endif
304 }
305 }
306
307@@ -3056,6 +3067,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
308
309 gdk_gl_context_make_current (window->gl_paint_context);
310
311+#ifdef HAVE_OPENGL
312 if (!cairo_region_is_empty (opaque_region))
313 gdk_gl_texture_from_surface (window->current_paint.surface,
314 opaque_region);
315@@ -3066,6 +3078,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
316 window->current_paint.need_blend_region);
317 glDisable(GL_BLEND);
318 }
319+#endif
320
321 cairo_region_destroy (opaque_region);
322
323diff --git a/gdk/meson.build b/gdk/meson.build
324index 4bb1bf2b6c..64172b8d3e 100644
325--- a/gdk/meson.build
326+++ b/gdk/meson.build
327@@ -56,7 +56,6 @@ gdk_gir_public_headers = files(
328 'gdkdrawingcontext.h',
329 'gdkevents.h',
330 'gdkframetimings.h',
331- 'gdkglcontext.h',
332 'gdkkeys.h',
333 'gdkkeysyms.h',
334 'gdkmain.h',
335@@ -78,6 +77,12 @@ gdk_gir_public_headers = files(
336 'gdkwindow.h',
337 )
338 gdk_nogir_public_headers = [files('gdkkeysyms-compat.h')]
339+if opengl_enabled
340+gdk_gir_public_headers += files('gdkglcontext.h')
341+else
342+gdk_nogir_public_headers += files('gdkglcontext.h')
343+endif
344+
345 gdk_public_headers = gdk_gir_public_headers + gdk_nogir_public_headers
346 install_headers(gdk_public_headers, subdir : 'gtk-3.0/gdk')
347
348@@ -166,6 +171,7 @@ gdkconfig_cdata.set('GDK_WINDOWING_WAYLAND', wayland_enabled)
349 gdkconfig_cdata.set('GDK_WINDOWING_WIN32', win32_enabled)
350 gdkconfig_cdata.set('GDK_WINDOWING_BROADWAY', broadway_enabled)
351 gdkconfig_cdata.set('GDK_WINDOWING_QUARTZ', quartz_enabled)
352+gdkconfig_cdata.set('GDK_WITH_OPENGL', opengl_enabled)
353
354 gdkconfig = configure_file(
355 input : 'gdkconfig.h.meson',
356diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
357index 7e08f472cc..30fd7b6089 100644
358--- a/gdk/x11/gdkdisplay-x11.c
359+++ b/gdk/x11/gdkdisplay-x11.c
360@@ -37,7 +37,9 @@
361 #include "gdkdisplay-x11.h"
362 #include "gdkprivate-x11.h"
363 #include "gdkscreen-x11.h"
364+#ifdef HAVE_OPENGL
365 #include "gdkglcontext-x11.h"
366+#endif
367 #include "gdk-private.h"
368 #include "gdkprofilerprivate.h"
369
370@@ -3191,7 +3193,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
371 display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
372 display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
373
374- display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
375+#ifdef HAVE_OPENGL
376+ display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
377+#endif
378
379 display_class->get_default_seat = gdk_x11_display_get_default_seat;
380
381diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
382index 81479d81f4..3c8c5c02ff 100644
383--- a/gdk/x11/gdkvisual-x11.c
384+++ b/gdk/x11/gdkvisual-x11.c
385@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
386 /* If GL is available we want to pick better default/rgba visuals,
387 as we care about glx details such as alpha/depth/stencil depth,
388 stereo and double buffering */
389+ /* update_visuals_for_gl() will end up calling epoxy GLX api which
390+ will exit if libgl is not there: so only do this if we know GL
391+ is available */
392+#ifdef HAVE_GLX
393 _gdk_x11_screen_update_visuals_for_gl (screen);
394+#endif
395 }
396
397 gint
398diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
399index 194bc82e29..0302bb68d4 100644
400--- a/gdk/x11/gdkwindow-x11.c
401+++ b/gdk/x11/gdkwindow-x11.c
402@@ -36,7 +36,9 @@
403 #include "gdkasync.h"
404 #include "gdkeventsource.h"
405 #include "gdkdisplay-x11.h"
406+#ifdef HAVE_OPENGL
407 #include "gdkglcontext-x11.h"
408+#endif
409 #include "gdkprivate-x11.h"
410 #include "gdk-private.h"
411
412@@ -5888,7 +5890,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
413 impl_class->set_opaque_region = gdk_x11_window_set_opaque_region;
414 impl_class->set_shadow_width = gdk_x11_window_set_shadow_width;
415 impl_class->show_window_menu = gdk_x11_window_show_window_menu;
416+#ifdef HAVE_OPENGL
417 impl_class->create_gl_context = gdk_x11_window_create_gl_context;
418 impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame;
419+#endif
420 impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size;
421 }
422diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h
423index edb0ea7dbf..a317d61cca 100644
424--- a/gdk/x11/gdkx-autocleanups.h
425+++ b/gdk/x11/gdkx-autocleanups.h
426@@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
427 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
428 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref)
429 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
430+#ifdef HAVE_OPENGL
431 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
432+#endif
433 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
434 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
435 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref)
436diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
437index 1f64bccb6d..4db6c18351 100644
438--- a/gdk/x11/gdkx.h
439+++ b/gdk/x11/gdkx.h
440@@ -43,7 +43,9 @@
441 #include <gdk/x11/gdkx11display.h>
442 #include <gdk/x11/gdkx11displaymanager.h>
443 #include <gdk/x11/gdkx11dnd.h>
444+#ifdef GDK_WITH_OPENGL
445 #include <gdk/x11/gdkx11glcontext.h>
446+#endif
447 #include <gdk/x11/gdkx11keys.h>
448 #include <gdk/x11/gdkx11monitor.h>
449 #include <gdk/x11/gdkx11property.h>
450diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build
451index 754ae0a615..0318c83877 100644
452--- a/gdk/x11/meson.build
453+++ b/gdk/x11/meson.build
454@@ -14,7 +14,6 @@ gdk_x11_sources = files(
455 'gdkeventsource.c',
456 'gdkeventtranslator.c',
457 'gdkgeometry-x11.c',
458- 'gdkglcontext-x11.c',
459 'gdkkeys-x11.c',
460 'gdkmain-x11.c',
461 'gdkproperty-x11.c',
462@@ -42,7 +41,6 @@ gdk_x11_public_headers = files(
463 'gdkx11display.h',
464 'gdkx11displaymanager.h',
465 'gdkx11dnd.h',
466- 'gdkx11glcontext.h',
467 'gdkx11keys.h',
468 'gdkx11monitor.h',
469 'gdkx11property.h',
470@@ -53,6 +51,11 @@ gdk_x11_public_headers = files(
471 'gdkx11window.h',
472 )
473
474+if opengl_enabled
475+ gdk_x11_sources += files('gdkglcontext-x11.c')
476+ gdk_x11_public_headers += files('gdkx11glcontext.h')
477+endif
478+
479 install_headers(gdk_x11_public_headers, subdir: 'gtk-3.0/gdk/x11/')
480 install_headers('gdkx.h', subdir: 'gtk-3.0/gdk/')
481
482diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
483index 802303ea9f..6439d7745d 100644
484--- a/gtk/gtkglarea.c
485+++ b/gtk/gtkglarea.c
486@@ -29,7 +29,9 @@
487 #include "gtkprivate.h"
488 #include "gtkrender.h"
489
490+#ifdef HAVE_OPENGL
491 #include <epoxy/gl.h>
492+#endif
493
494 /**
495 * SECTION:gtkglarea
496@@ -369,9 +371,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area)
497 static void
498 gtk_gl_area_resize (GtkGLArea *area, int width, int height)
499 {
500+#ifdef HAVE_OPENGL
501 glViewport (0, 0, width, height);
502+#endif
503 }
504
505+#ifdef HAVE_OPENGL
506 /*
507 * Creates all the buffer objects needed for rendering the scene
508 */
509@@ -483,6 +488,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
510
511 priv->needs_render = TRUE;
512 }
513+#endif
514
515 /**
516 * gtk_gl_area_attach_buffers:
517@@ -501,6 +507,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
518 void
519 gtk_gl_area_attach_buffers (GtkGLArea *area)
520 {
521+#ifdef HAVE_OPENGL
522 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
523
524 g_return_if_fail (GTK_IS_GL_AREA (area));
525@@ -533,11 +540,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
526 glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
527 GL_RENDERBUFFER, priv->depth_stencil_buffer);
528 }
529+#endif
530 }
531
532 static void
533 gtk_gl_area_delete_buffers (GtkGLArea *area)
534 {
535+#ifdef HAVE_OPENGL
536 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
537
538 if (priv->context == NULL)
539@@ -569,6 +578,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
540 glDeleteFramebuffers (1, &priv->frame_buffer);
541 priv->frame_buffer = 0;
542 }
543+#endif
544 }
545
546 static void
547@@ -679,6 +689,7 @@ gtk_gl_area_draw (GtkWidget *widget,
548 GtkGLArea *area = GTK_GL_AREA (widget);
549 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
550 gboolean unused;
551+#ifdef HAVE_OPENGL
552 int w, h, scale;
553 GLenum status;
554
555@@ -736,6 +747,14 @@ gtk_gl_area_draw (GtkWidget *widget,
556 }
557
558 return TRUE;
559+#else
560+ if (priv->error != NULL)
561+ gtk_gl_area_draw_error_screen (area,
562+ cr,
563+ gtk_widget_get_allocated_width (widget),
564+ gtk_widget_get_allocated_height (widget));
565+ return FALSE;
566+#endif
567 }
568
569 static gboolean
570diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
571index 4fd0c3039c..a8e59ed077 100644
572--- a/gtk/inspector/general.c
573+++ b/gtk/inspector/general.c
574@@ -33,8 +33,10 @@
575
576 #ifdef GDK_WINDOWING_X11
577 #include "x11/gdkx.h"
578+#ifdef HAVE_OPENGL
579 #include <epoxy/glx.h>
580 #endif
581+#endif
582
583 #ifdef GDK_WINDOWING_WIN32
584 #include "win32/gdkwin32.h"
585@@ -217,6 +219,7 @@ add_label_row (GtkInspectorGeneral *gen,
586 gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label);
587 }
588
589+#ifdef HAVE_OPENGL
590 #ifdef GDK_WINDOWING_X11
591 static void
592 append_glx_extension_row (GtkInspectorGeneral *gen,
593@@ -226,6 +229,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
594 add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
595 }
596 #endif
597+#endif
598
599 #ifdef GDK_WINDOWING_WAYLAND
600 static void
601@@ -275,6 +279,7 @@ wayland_get_display (struct wl_display *wl_display)
602 static void
603 init_gl (GtkInspectorGeneral *gen)
604 {
605+#ifdef HAVE_OPENGL
606 #ifdef GDK_WINDOWING_X11
607 if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
608 {
609@@ -301,6 +306,7 @@ init_gl (GtkInspectorGeneral *gen)
610 }
611 else
612 #endif
613+#endif
614 #ifdef GDK_WINDOWING_WAYLAND
615 if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
616 {
617diff --git a/meson.build b/meson.build
618index aed48fc3f6..bfc33af0f6 100644
619--- a/meson.build
620+++ b/meson.build
621@@ -137,6 +137,7 @@ wayland_enabled = get_option('wayland_backend')
622 broadway_enabled = get_option('broadway_backend')
623 quartz_enabled = get_option('quartz_backend')
624 win32_enabled = get_option('win32_backend')
625+opengl_enabled = get_option('opengl')
626
627 os_unix = false
628 os_linux = false
629@@ -430,7 +431,7 @@ pangocairo_dep = dependency('pangocairo', version: cairo_req,
630 fallback : ['pango', 'libpangocairo_dep'])
631 pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
632 fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'])
633-epoxy_dep = dependency('epoxy', version: epoxy_req,
634+epoxy_dep = dependency('epoxy', version: epoxy_req, required: opengl_enabled,
635 fallback: ['libepoxy', 'libepoxy_dep'])
636 atk_dep = dependency('atk', version: atk_req,
637 fallback : ['atk', 'libatk_dep'])
638@@ -476,6 +477,10 @@ if tracker3_enabled
639 endif
640 endif
641
642+if opengl_enabled
643+ cdata.set('HAVE_OPENGL', 1)
644+endif
645+
646 if iso_codes_dep.found()
647 cdata.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_variable(pkgconfig: 'prefix'))
648 else
649@@ -912,9 +917,15 @@ else
650 gio_packages = ['gio-2.0', glib_req]
651 endif
652
653+if opengl_enabled
654+ epoxy_packages = ['epoxy', epoxy_req]
655+else
656+ epoxy_packages = []
657+endif
658+
659 pkgconf.set('GDK_PRIVATE_PACKAGES',
660 ' '.join(gio_packages + x11_pkgs + wayland_pkgs + cairo_backends +
661- ['epoxy', epoxy_req] + cloudproviders_packages +
662+ epoxy_packages + cloudproviders_packages +
663 ['fribidi', fribidi_req]))
664
665 gtk_packages = ' '.join([
666@@ -928,7 +939,7 @@ pkgconf.set('GTK_PACKAGES', gtk_packages)
667 # Requires.private
668 pc_gdk_extra_libs += cairo_libs
669
670-gtk_private_packages = atk_pkgs + wayland_pkgs + ['epoxy', epoxy_req, 'fribidi', fribidi_req]
671+gtk_private_packages = atk_pkgs + wayland_pkgs + epoxy_packages + ['fribidi', fribidi_req]
672 if wayland_enabled or x11_enabled
673 gtk_private_packages += ['pangoft2']
674 endif
675diff --git a/meson_options.txt b/meson_options.txt
676index 94099aa01e..8bd096896d 100644
677--- a/meson_options.txt
678+++ b/meson_options.txt
679@@ -19,6 +19,8 @@ option('profiler', type: 'boolean', value: false,
680 description : 'Enable profiler support')
681 option('tracker3', type: 'boolean', value: false,
682 description : 'Enable Tracker3 filechooser search')
683+option('opengl', type: 'boolean', value: true,
684+ description : 'Enable use of GL')
685
686 # Print backends
687 option('print_backends', type : 'string', value : 'auto',
688diff --git a/tests/meson.build b/tests/meson.build
689index 586fe2f45e..6ecf317dde 100644
690--- a/tests/meson.build
691+++ b/tests/meson.build
692@@ -5,7 +5,6 @@ gtk_tests = [
693 ['scrolling-performance', ['frame-stats.c', 'variable.c']],
694 ['blur-performance', ['../gtk/gtkcairoblur.c']],
695 ['flicker'],
696- ['gdkgears', ['gtkgears.c']],
697 ['listmodel'],
698 ['motion-compression'],
699 ['styleexamples'],
700@@ -54,7 +53,6 @@ gtk_tests = [
701 ['testfullscreen'],
702 ['testgeometry'],
703 ['testgiconpixbuf'],
704- ['testglblending', ['gtkgears.c']],
705 ['testgmenu'],
706 ['testgrid'],
707 ['testgrouping'],
708@@ -137,6 +135,13 @@ if x11_enabled
709 ]
710 endif
711
712+if opengl_enabled
713+ gtk_tests += [
714+ ['gdkgears', ['gtkgears.c']],
715+ ['testglblending', ['gtkgears.c']],
716+ ]
717+endif
718+
719 if os_linux
720 gtk_tests += [['testfontchooserdialog']]
721 endif
722diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c
723index 24540e313f..e0f863ab6a 100644
724--- a/testsuite/gtk/objects-finalize.c
725+++ b/testsuite/gtk/objects-finalize.c
726@@ -116,7 +116,9 @@ main (int argc, char **argv)
727 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE &&
728 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 &&
729 all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER &&
730+#ifdef HAVE_OPENGL
731 all_types[i] != GDK_TYPE_X11_GL_CONTEXT &&
732+#endif
733 #endif
734 /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */
735 all_types[i] != GDK_TYPE_PIXBUF_LOADER &&
736--
7372.30.2
738
diff --git a/meta/recipes-gnome/gtk+/gtk+3_3.24.24.bb b/meta/recipes-gnome/gtk+/gtk+3_3.24.41.bb
index 01a2a94ce3..17e90c59f0 100644
--- a/meta/recipes-gnome/gtk+/gtk+3_3.24.24.bb
+++ b/meta/recipes-gnome/gtk+/gtk+3_3.24.41.bb
@@ -3,12 +3,9 @@ require gtk+3.inc
3MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" 3MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
4 4
5SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk+/${MAJ_VER}/gtk+-${PV}.tar.xz \ 5SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk+/${MAJ_VER}/gtk+-${PV}.tar.xz \
6 file://0001-Hardcoded-libtool.patch \ 6 file://opengl.patch \
7 file://0002-Do-not-try-to-initialize-GL-without-libGL.patch \
8 file://0003-Add-disable-opengl-configure-option.patch \
9 file://link_fribidi.patch \
10 " 7 "
11SRC_URI[sha256sum] = "cc9d4367c55b724832f6b09ab85481738ea456871f0381768a6a99335a98378a" 8SRC_URI[sha256sum] = "47da61487af3087a94bc49296fd025ca0bc02f96ef06c556e7c8988bd651b6fa"
12 9
13S = "${WORKDIR}/gtk+-${PV}" 10S = "${WORKDIR}/gtk+-${PV}"
14 11
@@ -16,3 +13,5 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
16 file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \ 13 file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \
17 file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \ 14 file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \
18 file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1" 15 file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1"
16
17CVE_PRODUCT = "gnome:gtk"
diff --git a/meta/recipes-gnome/gtk+/gtk4_4.14.2.bb b/meta/recipes-gnome/gtk+/gtk4_4.14.2.bb
new file mode 100644
index 0000000000..282e81f048
--- /dev/null
+++ b/meta/recipes-gnome/gtk+/gtk4_4.14.2.bb
@@ -0,0 +1,130 @@
1SUMMARY = "Multi-platform toolkit for creating GUIs"
2DESCRIPTION = "GTK is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \
3set of widgets, GTK is suitable for projects ranging from small one-off projects to complete application suites."
4HOMEPAGE = "http://www.gtk.org"
5BUGTRACKER = "https://bugzilla.gnome.org/"
6SECTION = "libs"
7
8DEPENDS = " \
9 atk \
10 cairo \
11 fribidi \
12 gdk-pixbuf \
13 gdk-pixbuf-native \
14 gi-docgen \
15 glib-2.0 \
16 graphene \
17 harfbuzz \
18 jpeg \
19 libepoxy \
20 libpng \
21 librsvg \
22 libxkbcommon \
23 pango \
24 tiff \
25"
26
27LICENSE = "LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-or-later"
28LIC_FILES_CHKSUM = " \
29 file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
30 file://gtk/gtk.h;endline=25;md5=61900d77e8d5bc67cf15ad93de9a3490 \
31 file://gdk/gdk.h;endline=25;md5=a0fb26c1f6b94e66d148279e192c333f \
32 file://tests/testgtk.c;endline=25;md5=49d06770681b8322466b52ed19d29fb2 \
33"
34
35MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
36
37UPSTREAM_CHECK_REGEX = "gtk-(?P<pver>\d+\.(\d*[02468])+(\.\d+)+)\.tar.xz"
38
39SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk/${MAJ_VER}/gtk-${PV}.tar.xz"
40SRC_URI[sha256sum] = "22604cef2898a79e5f2143bb7aee2b7d1fa2eb946989a9d1338ecf9c8ae0e072"
41
42S = "${WORKDIR}/gtk-${PV}"
43
44CVE_PRODUCT = "gnome:gtk"
45
46inherit meson gettext pkgconfig gi-docgen update-alternatives gsettings features_check gobject-introspection
47
48# TBD: nativesdk
49# gobject-introspection.bbclass pins introspection off for nativesk. As long as
50# we do not remove this wisdom or hack gtk4, it is not possible to build
51# nativesdk-gtk4
52BBCLASSEXTEND = "native"
53
54GSETTINGS_PACKAGE:class-native = ""
55
56ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
57REQUIRED_DISTRO_FEATURES = "opengl"
58GTKDOC_MESON_OPTION = "documentation"
59GIR_MESON_ENABLE_FLAG = 'enabled'
60GIR_MESON_DISABLE_FLAG = 'disabled'
61
62EXTRA_OEMESON = " -Dbuild-tests=false -Dbuild-testsuite=false -Dbuild-demos=false"
63
64PACKAGECONFIG ??= "gstreamer ${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11 vulkan', d)}"
65PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
66PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
67
68PACKAGECONFIG[x11] = "-Dx11-backend=true,-Dx11-backend=false,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes xinerama"
69PACKAGECONFIG[wayland] = "-Dwayland-backend=true,-Dwayland-backend=false,wayland wayland-protocols virtual/egl virtual/libgles2 wayland-native"
70PACKAGECONFIG[cloudproviders] = "-Dcloudproviders=enabled,-Dcloudproviders=disabled,libcloudproviders"
71PACKAGECONFIG[cups] = "-Dprint-cups=enabled,-Dprint-cups=disabled,cups,cups gtk4-printbackend-cups"
72PACKAGECONFIG[colord] = "-Dcolord=enabled,-Dcolord=disabled,colord"
73PACKAGECONFIG[iso-codes] = ",,iso-codes,iso-codes"
74# gtk4 wants gstreamer-player-1.0 -> gstreamer1.0-plugins-bad
75PACKAGECONFIG[gstreamer] = "-Dmedia-gstreamer=enabled,-Dmedia-gstreamer=disabled,gstreamer1.0-plugins-bad"
76PACKAGECONFIG[tracker] = "-Dtracker=enabled,-Dtracker=disabled,tracker,tracker-miners"
77PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled, vulkan-loader vulkan-headers shaderc-native"
78
79LIBV = "4.0.0"
80
81FILES:${PN}:append = " \
82 ${datadir}/glib-2.0/schemas/ \
83 ${datadir}/gtk-4.0/emoji/ \
84 ${datadir}/metainfo/ \
85 ${datadir}/icons/hicolor/*/apps/org.gtk.PrintEditor4*.* \
86 ${libdir}/gtk-4.0/${LIBV}/media \
87 ${bindir}/gtk4-update-icon-cache \
88 ${bindir}/gtk4-launch \
89"
90
91FILES:${PN}-dev += " \
92 ${datadir}/gtk-4.0/gtk4builder.rng \
93 ${datadir}/gtk-4.0/include \
94 ${datadir}/gtk-4.0/valgrind \
95 ${datadir}/gettext/its \
96 ${bindir}/gtk4-builder-tool \
97 ${bindir}/gtk4-encode-symbolic-svg \
98 ${bindir}/gtk4-query-settings \
99"
100
101GTKBASE_RRECOMMENDS ?= " \
102 liberation-fonts \
103 gdk-pixbuf-loader-png \
104 gdk-pixbuf-loader-jpeg \
105 gdk-pixbuf-loader-gif \
106 gdk-pixbuf-loader-xpm \
107 shared-mime-info \
108 adwaita-icon-theme-symbolic \
109"
110
111GTKBASE_RRECOMMENDS:class-native ?= ""
112
113GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
114
115RRECOMMENDS:${PN} = "${GTKBASE_RRECOMMENDS}"
116RRECOMMENDS:${PN}:libc-glibc = "${GTKGLIBC_RRECOMMENDS}"
117RDEPENDS:${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}"
118
119PACKAGES_DYNAMIC += "^gtk4-printbackend-.*"
120python populate_packages:prepend () {
121 import os.path
122
123 gtk_libdir = d.expand('${libdir}/gtk-4.0/${LIBV}')
124 printmodules_root = os.path.join(gtk_libdir, 'printbackends');
125
126 do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk4-printbackend-%s', 'GTK printbackend module for %s')
127
128 if (d.getVar('DEBIAN_NAMES')):
129 d.setVar(d.expand('PKG:${PN}'), '${MLPREFIX}libgtk-4.0')
130}