Subject: [bug#50627] [PATCH 1/2] gnu: gtk: Move wayland-protocols to native-inputs.

From: muradm <[email-masked]>
Date: Thu, 16 Sep 2021 22:26:45 +0300

I was building some packages on Guix. I figured out that
wayland-protocols was listed among propagated-inputs for gtk+ package.

wayland-protocols is not runtime dependency, so I moved it to
native-inputs of gtk+ package, once moved, building of other
applications that depening on gtk+ started to fail.

Investigation showed that, all .pc (pkg-config) files prepared by gtk+
package, was including:

Requires.private: ... wayland-protocols ...

Since it becomes requirement, other applications was failing with
missing dependency wayland-protocols of dependency gtk+, for instance:

-- Checking for module 'gtk+-3.0'
--   Package 'wayland-protocols', required by 'gdk-3.0', not found

While actually wayland-protocols is not even a build time dependency
of application that depends on gtk+. Advertisement of such
requirement, is a bit misleading, because one does not need it at
runtime, especially applications based on gtk.

Same change also merged upstream for both master and gtk-3-24 branch.

* gnu/packages/patches/gtk3-wayland-protocols-dependency.patch:
Upstream change
* gnu/packages/gtk.scm (gtk+): move wayland-protocols to native-inputs
---
 gnu/packages/gtk.scm                          |  7 +++---
 .../gtk3-wayland-protocols-dependency.patch   | 23 +++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/gtk3-wayland-protocols-dependency.patch

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 24c24d5653..2dbfcde6e5 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -948,7 +948,8 @@ application suites.")
         (base32
          "1a9vg840fjq1mmm403b67k624qrkxh9shaz9pv7z9l8a6bzvyxds"))
        (patches (search-patches "gtk3-respect-GUIX_GTK3_PATH.patch"
-                                "gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch"))))
+                                "gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch"
+                                "gtk3-wayland-protocols-dependency.patch"))))
     (propagated-inputs
      `(("atk" ,atk)
        ("at-spi2-atk" ,at-spi2-atk)
@@ -978,8 +979,7 @@ application suites.")
        ("libxrender" ,libxrender)
        ("mesa" ,mesa)
        ("pango" ,pango)
-       ("wayland" ,wayland)
-       ("wayland-protocols" ,wayland-protocols)))
+       ("wayland" ,wayland)))
     (inputs
      `(("colord" ,colord)
        ("cups" ,cups)
@@ -999,6 +999,7 @@ application suites.")
        ("pkg-config" ,pkg-config)
        ("python-wrapper" ,python-wrapper)
        ("sassc" ,sassc)
+       ("wayland-protocols" ,wayland-protocols)
        ;; By using a special xorg-server for GTK+'s tests, we reduce the impact
        ;; of updating xorg-server directly on the master branch.
        ("xorg-server" ,xorg-server-for-tests)
diff --git a/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch b/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch
new file mode 100644
index 0000000000..03196713bc
--- /dev/null
+++ b/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch
@@ -0,0 +1,23 @@
+diff --git a/configure b/configure
+index edd41ad..cb36877 100755
+--- a/configure
++++ b/configure
+@@ -23247,7 +23247,8 @@ $as_echo "no" >&6; }
+ 	fi
+ fi
+ 
+-WAYLAND_DEPENDENCIES="wayland-client >= 1.14.91 wayland-protocols >= 1.17 xkbcommon >= 0.2.0 wayland-cursor >= 1.14.91 wayland-egl"
++WAYLAND_RUNTIME_DEPENDENCIES="wayland-client >= 1.14.91 xkbcommon >= 0.2.0 wayland-cursor >= 1.14.91 wayland-egl"
++WAYLAND_DEPENDENCIES="wayland-protocols >= 1.17 $WAYLAND_RUNTIME_DEPENDENCIES"
+ if test "$enable_wayland_backend" = "maybe" ; then
+   # Extract the first word of "wayland-scanner", so it can be a program name with args.
+ set dummy wayland-scanner; ac_word=$2
+@@ -23320,7 +23321,7 @@ if test "$enable_wayland_backend" = "yes"; then
+   GDK_WINDOWING="$GDK_WINDOWING
+ #define GDK_WINDOWING_WAYLAND"
+   backend_immodules="$backend_immodules,wayland"
+-  WAYLAND_PACKAGES="$WAYLAND_DEPENDENCIES"
++  WAYLAND_PACKAGES="$WAYLAND_RUNTIME_DEPENDENCIES"
+   # Extract the first word of "wayland-scanner", so it can be a program name with args.
+ set dummy wayland-scanner; ac_word=$2
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-- 
2.33.0