commit:     89dbc7aa060fd1480f0160c87f74ca154b13b582
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 07:36:54 2022 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 07:36:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89dbc7aa

media-gfx/shotwell: make wayland optional

Bug: https://bugs.gentoo.org/836831
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../shotwell/files/0.30.16-optional-wayland.patch  | 59 ++++++++++++++++++++++
 media-gfx/shotwell/shotwell-0.30.16.ebuild         |  7 ++-
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/media-gfx/shotwell/files/0.30.16-optional-wayland.patch 
b/media-gfx/shotwell/files/0.30.16-optional-wayland.patch
new file mode 100644
index 000000000000..5cc82e67dc7d
--- /dev/null
+++ b/media-gfx/shotwell/files/0.30.16-optional-wayland.patch
@@ -0,0 +1,59 @@
+Make wayland backend optional
+
+* Unfortunately, upstream is hostile to making wayland optional:
+  https://gitlab.gnome.org/GNOME/shotwell/-/merge_requests/57#note_1500284
+
+See: https://bugs.gentoo.org/836831
+
+--- a/meson.build
++++ b/meson.build
+@@ -64,7 +64,14 @@
+ libraw = dependency('libraw', version : '>= 0.13.2')
+ libexif = dependency('libexif', version : '>= 0.6.16')
+ unity = dependency('unity', required : false)
+-gdk = [ dependency('gdk-x11-3.0'), dependency('gdk-wayland-3.0') ]
++gdk = [ dependency('gdk-x11-3.0') ]
++add_global_arguments(['--define=HAVE_X11_BACKEND'],
++                     language : 'vala')
++if get_option('wayland')
++  gdk += [dependency('gdk-wayland-3.0')]
++  add_global_arguments(['--define=HAVE_WAYLAND_BACKEND'],
++                       language : 'vala')
++endif
+ 
+ unity_available = false
+ if unity.found() and get_option('unity-support')
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -8,3 +8,4 @@
+ option('install-apport-hook', type : 'boolean', value : 'true', description: 
'Enable Ubuntu apport hook')
+ option('face-detection', type:'boolean', value:false, description: 'Enable 
face detection and recognition features')
+ option('fatal_warnings', type:'boolean', value:false)
++option('wayland', type: 'boolean', value: true, description: 'Enable Wayland 
support')
+--- a/src/Portal.vala
++++ b/src/Portal.vala
+@@ -53,6 +53,7 @@
+     private static async string get_parent_window () {
+         var window = AppWindow.get_instance().get_window ();
+ 
++#if HAVE_WAYLAND_BACKEND
+         if (window is Gdk.Wayland.Window) {
+             var handle = "wayland:";
+             ((Gdk.Wayland.Window) window).export_handle ((w, h) => {
+@@ -61,9 +62,14 @@
+             });
+             yield;
+             return handle;
+-        } else if (window is Gdk.X11.Window) {
++        } else
++#endif
++#if HAVE_X11_BACKEND
++        if (window is Gdk.X11.Window) {
+             return "x11:%x".printf ((uint) ((Gdk.X11.Window) window).get_xid 
());
+-        } else {
++        } else
++#endif
++        {
+             warning ("Could not get parent window");
+             return "";
+         }

diff --git a/media-gfx/shotwell/shotwell-0.30.16.ebuild 
b/media-gfx/shotwell/shotwell-0.30.16.ebuild
index cd09860b7b42..e5ed861303a2 100644
--- a/media-gfx/shotwell/shotwell-0.30.16.ebuild
+++ b/media-gfx/shotwell/shotwell-0.30.16.ebuild
@@ -13,10 +13,10 @@ HOMEPAGE="https://wiki.gnome.org/Apps/Shotwell";
 LICENSE="LGPL-2.1"
 SLOT="0"
 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~sparc ~x86"
-IUSE="opencv udev"
+IUSE="opencv udev wayland"
 
 DEPEND="
-       >=x11-libs/gtk+-3.22.0:3
+       >=x11-libs/gtk+-3.22.0:3[wayland?]
        >=dev-libs/glib-2.40.0:2
        >=dev-libs/libgee-0.8.5:0.8
        >=net-libs/webkit-gtk-2.26:4
@@ -52,6 +52,8 @@ BDEPEND="
        app-crypt/gcr[vala]
 "
 
+PATCHES=( "${FILESDIR}"/0.30.16-optional-wayland.patch )
+
 src_prepare() {
        default
        vala_setup
@@ -70,6 +72,7 @@ src_configure() {
                -Dinstall-apport-hook=false
                $(meson_use opencv face-detection)
                -Dfatal_warnings=false
+               $(meson_use wayland)
        )
        meson_src_configure
 }

Reply via email to