Backport upstream patch to fix .pc file requires

This replaces earlier downstream revert
0001-Revert-Meson-Simplify-pkgconfig-file-generator.patch
This commit is contained in:
Kalev Lember 2023-08-17 23:21:07 +02:00
parent 9ea019b6ad
commit cf2971f84b
3 changed files with 103 additions and 124 deletions

View File

@ -1,120 +0,0 @@
From 5f5fd77f096174c45f8335afe6efd6745796d9a5 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Mon, 25 Jul 2022 16:21:50 +0200
Subject: [PATCH] Revert "Meson: Simplify pkgconfig file generator"
Temporarily revert this until we figure out how to best restore
private requires that are needed for rpm automatic dep extraction.
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4756
This reverts commit 802bf4199911c811938b0454a876089bafa97dba.
---
meson.build | 47 +++++++++++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/meson.build b/meson.build
index 1b8f2d0248..4fc808dbd4 100644
--- a/meson.build
+++ b/meson.build
@@ -471,6 +471,9 @@ if not os_win32
endif
endif
+
+pc_gdk_extra_libs = []
+
cairo_backends = []
foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
['cairo-win32', cairo_req, win32_enabled],
@@ -601,14 +604,26 @@ if x11_enabled
cdata.set('HAVE_RANDR15', xrandr15_dep.found())
endif
+if broadway_enabled
+ pc_gdk_extra_libs += ['-lz']
+endif
+
+if macos_enabled
+ pc_gdk_extra_libs += ['-framework Cocoa', '-framework Carbon']
+endif
+
extra_demo_ldflags = []
if win32_enabled
+ pc_gdk_extra_libs += ['-lgdi32', '-limm32', '-lshell32', '-lole32']
if cc.get_id() == 'msvc'
# Since the demo programs are now built as pure GUI programs, we
# need to pass in /entry:mainCRTStartup so that they will properly
# link on Visual Studio builds
extra_demo_ldflags = ['/entry:mainCRTStartup']
+ else
+ pc_gdk_extra_libs += ['-Wl,-luuid']
endif
+ pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32', '-lhid']
# Check whether libepoxy is built with EGL support on Windows
endif
@@ -826,7 +841,16 @@ gsk_private_packages = [] # all already in gdk_private_packages
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
gtk_private_packages = pangoft2_pkgs
-pkgs = []
+gdk_extra_libs = pc_gdk_extra_libs
+gsk_extra_libs = []
+gtk_extra_libs = []
+
+gdk_extra_cflags = []
+gsk_extra_cflags = []
+gtk_extra_cflags = []
+
+pkgs = [ 'gtk4' ]
+
pkg_targets = []
display_backends = []
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
@@ -843,23 +867,18 @@ common_pc_variables = [
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
]
-pkg_config.generate(libgtk,
- filebase: 'gtk4',
- unescaped_variables: common_pc_variables,
- name: 'GTK',
- description: 'GTK Graphical UI Library',
- requires: gdk_packages + gsk_packages + gtk_packages,
- subdirs: ['gtk-@0@'.format(gtk_api_version)],
-)
-meson.override_dependency('gtk4', libgtk_dep)
-
foreach pkg: pkgs
pkg_config.generate(
filebase: pkg,
unescaped_variables: common_pc_variables,
name: 'GTK',
description: 'GTK Graphical UI Library',
- requires: 'gtk4',
+ requires: gdk_packages + gsk_packages + gtk_packages,
+ requires_private: gdk_private_packages + gsk_private_packages + gtk_private_packages,
+ libraries: ['-L${libdir}', '-lgtk-4'],
+ libraries_private: gdk_extra_libs + gsk_extra_libs + gtk_extra_libs,
+ subdirs: ['gtk-@0@'.format(gtk_api_version)],
+ extra_cflags: gdk_extra_cflags + gsk_extra_cflags + gtk_extra_cflags,
)
meson.override_dependency(pkg, libgtk_dep)
endforeach
@@ -870,10 +889,10 @@ if os_unix
unescaped_variables: common_pc_variables,
name: 'GTK',
description: 'GTK Unix print support',
- requires: 'gtk4',
+ requires: ['gtk4'] + gtk_packages,
+ libraries: [],
subdirs: ['gtk-@0@/unix-print'.format(gtk_api_version)],
)
- meson.override_dependency('gtk4-unix-print', libgtk_dep)
endif
subdir('po')
--
2.37.1

100
6293.patch Normal file
View File

@ -0,0 +1,100 @@
From 090e01b3832c37bb3fd0af070650e942e287a3fc Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.com>
Date: Tue, 15 Aug 2023 13:35:46 -0400
Subject: [PATCH 1/2] meson: Add wayland-client to gtk4-wayland requires
---
gdk/wayland/meson.build | 3 +++
meson.build | 17 +++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/gdk/wayland/meson.build b/gdk/wayland/meson.build
index d325b4edea2..c6e6236ca8e 100644
--- a/gdk/wayland/meson.build
+++ b/gdk/wayland/meson.build
@@ -127,3 +127,6 @@ libgdk_wayland = static_library('gdk-wayland',
link_with: [ libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps ],
)
+
+# Used to generate pkg-config Requires
+wayland_public_deps = [wlclientdep]
diff --git a/meson.build b/meson.build
index 004333141c5..2217b947add 100644
--- a/meson.build
+++ b/meson.build
@@ -826,19 +826,15 @@ gsk_private_packages = [] # all already in gdk_private_packages
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
gtk_private_packages = pangoft2_pkgs
-pkgs = []
-pkg_targets = []
-display_backends = []
+enabled_backends = []
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
- pkgs += ['gtk4-@0@'.format(backend)]
- pkg_targets += backend
- display_backends += [ backend ]
+ enabled_backends += backend
endif
endforeach
common_pc_variables = [
- 'targets=@0@'.format(' '.join(pkg_targets)),
+ 'targets=@0@'.format(' '.join(enabled_backends)),
'gtk_binary_version=@0@'.format(gtk_binary_version),
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
]
@@ -853,13 +849,14 @@ pkg_config.generate(libgtk,
)
meson.override_dependency('gtk4', libgtk_dep)
-foreach pkg: pkgs
+foreach backend: enabled_backends
+ pkg = 'gtk4-@0@'.format(backend)
pkg_config.generate(
filebase: pkg,
unescaped_variables: common_pc_variables,
name: 'GTK',
description: 'GTK Graphical UI Library',
- requires: 'gtk4',
+ requires: ['gtk4', get_variable('@0@_public_deps'.format(backend), [])],
)
meson.override_dependency(pkg, libgtk_dep)
endforeach
@@ -904,7 +901,7 @@ endif
#### Summary ####
-summary('Display backends', display_backends, section: 'Components')
+summary('Display backends', enabled_backends, section: 'Components')
summary('Print backends', print_backends, section: 'Components')
summary('Media backends', media_backends, section: 'Components')
--
GitLab
From d6a07cd61763d2e0fa4e111dad34f0762738ce6f Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.com>
Date: Tue, 15 Aug 2023 21:17:23 -0400
Subject: [PATCH 2/2] meson: Add x11_dep to gtk4-x11 requires
---
gdk/x11/meson.build | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build
index 58d12bb8a1c..013d8b1d00c 100644
--- a/gdk/x11/meson.build
+++ b/gdk/x11/meson.build
@@ -86,3 +86,5 @@ libgdk_x11 = static_library('gdk-x11',
] + common_cflags,
dependencies: [ gdk_deps, gdk_x11_deps, ],
)
+
+x11_public_deps = [x11_dep]
--
GitLab

View File

@ -23,10 +23,9 @@ Summary: GTK graphical user interface library
License: LGPL-2.0-or-later
URL: https://www.gtk.org
Source0: https://download.gnome.org/sources/gtk/4.12/gtk-%{version}.tar.xz
# Temporarily revert this until we figure out how to best restore
# private requires that are needed for rpm automatic dep extraction.
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4756
Patch0: 0001-Revert-Meson-Simplify-pkgconfig-file-generator.patch
# Backported upstream MR
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6293
Patch0: 6293.patch
# Backported upstream MR
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6250
Patch1: 6250.patch