From 6efcbf4634396abb0e7798233300ea8ab02d9900 Mon Sep 17 00:00:00 2001
From: muradm <muradm>
Date: Thu, 16 Sep 2021 19:40:56 +0300
Subject: [PATCH] Do not require wayland-protocols as dependency in the .pc
 file

Basically, I was building some packages on Guix. I figured out that
wayland-protocols was listed among propagated-inputs for gtk+ package
(gtk-3-24). propagated-inputs holds a list of runtime dependencies,
that should be available to any other package that depends on gtk+.
While discussing we clarified that wayland-protocols is not runtime
dependency. So I moved it to native-inputs of gtk+ package, which
means that, this dependency will be available only to gtk+ package and
only at build time. 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.
---
 configure.ac | 5 +++--
 meson.build  | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 547fdd5536..e3fadf9d2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -439,7 +439,8 @@ fi
 
 PKG_PROG_PKG_CONFIG
 
-WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version wayland-protocols >= wayland_protocols_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version wayland-egl"
+WAYLAND_RUNTIME_DEPENDENCIES="wayland-client >= wayland_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version wayland-egl"
+WAYLAND_DEPENDENCIES="wayland-protocols >= wayland_protocols_required_version $WAYLAND_RUNTIME_DEPENDENCIES"
 if test "$enable_wayland_backend" = "maybe" ; then
   AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
   PKG_CHECK_EXISTS($WAYLAND_DEPENDENCIES, [have_wayland_deps=yes], [have_wayland_deps=no])
@@ -460,7 +461,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"
   AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
   AS_IF([test "x$WAYLAND_SCANNER" = "xno"],
     [AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols])])
diff --git a/meson.build b/meson.build
index a8860810c7..82123e7a61 100644
--- a/meson.build
+++ b/meson.build
@@ -557,7 +557,6 @@ if wayland_enabled
 
   wayland_pkgs = [
     'wayland-client', wayland_req,
-    'wayland-protocols', wayland_proto_req,
     'xkbcommon', xkbcommon_req,
     'wayland-cursor', wayland_req,
     'wayland-egl',