summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-01-19 04:04:34 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-01-19 04:04:34 +0000
commit1edbc1f1f9c2470a8a9197c57d09fac831cbf9b5 (patch)
tree0dd857354a9c471d9ff571c77ae388c6cdee28f7
parent146b4c93bafa6ddfcec9d5ebb3d210a0a2885e70 (diff)
parent2c9f2325e28d53a72345de41075c8acb851dd7a5 (diff)
downloadgtk+-1edbc1f1f9c2470a8a9197c57d09fac831cbf9b5.tar.gz
Merge branch 'wip/jtojnar/fix-pc-vulcan' into 'master'
build: Use Meson’s module for building .pc files Closes #3517 See merge request GNOME/gtk!3005
-rw-r--r--gtk4-unix-print.pc.in14
-rw-r--r--gtk4.pc.in17
-rw-r--r--meson.build107
3 files changed, 56 insertions, 82 deletions
diff --git a/gtk4-unix-print.pc.in b/gtk4-unix-print.pc.in
deleted file mode 100644
index a15f064811..0000000000
--- a/gtk4-unix-print.pc.in
+++ /dev/null
@@ -1,14 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-targets=@GDK_BACKENDS@
-
-gtk_binary_version=@GTK_BINARY_VERSION@
-gtk_host=@host@
-
-Name: GTK
-Description: GTK Unix print support
-Version: @VERSION@
-Requires: gtk4 @GTK_PACKAGES@
-Cflags: -I${includedir}/gtk-@GTK_API_VERSION@/unix-print
diff --git a/gtk4.pc.in b/gtk4.pc.in
deleted file mode 100644
index b6822bdd95..0000000000
--- a/gtk4.pc.in
+++ /dev/null
@@ -1,17 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-targets=@GDK_BACKENDS@
-
-gtk_binary_version=@GTK_BINARY_VERSION@
-gtk_host=@host@
-
-Name: GTK
-Description: GTK Graphical UI Library
-Version: @VERSION@
-Requires: @GDK_PACKAGES@ @GSK_PACKAGES@ @GTK_PACKAGES@
-Requires.private: @GDK_PRIVATE_PACKAGES@ @GSK_PRIVATE_PACKAGES@ @GTK_PRIVATE_PACKAGES@
-Libs: -L${libdir} -lgtk-4
-Libs.private: @GDK_EXTRA_LIBS@ @GSK_EXTRA_LIBS@ @GTK_EXTRA_LIBS@
-Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GDK_EXTRA_CFLAGS@ @GSK_EXTRA_CFLAGS@ @GTK_EXTRA_CFLAGS@
diff --git a/meson.build b/meson.build
index d546c00b91..a1c58c7abf 100644
--- a/meson.build
+++ b/meson.build
@@ -25,6 +25,7 @@ xkbcommon_req = '>= 0.2.0'
sysprof_req = '>= 3.38.0'
gnome = import('gnome')
+pkg_config = import('pkgconfig')
add_project_arguments('-DG_LOG_USE_STRUCTURED=1', language: 'c')
add_project_arguments('-DGLIB_DISABLE_DEPRECATION_WARNINGS', language: 'c')
@@ -469,9 +470,9 @@ if wayland_enabled
endif
wayland_pkgs = [
- 'wayland-client', wayland_req,
- 'wayland-protocols', wayland_proto_req,
- 'xkbcommon', xkbcommon_req,
+ 'wayland-client @0@'.format(wayland_req),
+ 'wayland-protocols @0@'.format(wayland_proto_req),
+ 'xkbcommon @0@'.format(xkbcommon_req),
'wayland-egl',
]
endif
@@ -705,84 +706,88 @@ configure_file(input: 'config.h.meson',
output: 'config.h',
configuration: cdata)
-# pkg-config files - bit of a mess all of this
-pkgconf = configuration_data()
-
-pkgconf.set('prefix', get_option('prefix'))
-pkgconf.set('exec_prefix', '${prefix}')
-pkgconf.set('libdir', '${prefix}' / get_option('libdir'))
-pkgconf.set('includedir', '${prefix}' / get_option('includedir'))
-pkgconf.set('GTK_API_VERSION', gtk_api_version)
-pkgconf.set('VERSION', meson.project_version())
-pkgconf.set('GTK_BINARY_VERSION', gtk_binary_version)
-pkgconf.set('host', '@0@-@1@'.format(host_machine.cpu_family(), host_machine.system())) # FIXME
-
# Requires
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
-gdk_packages = ' '.join([ pango_pkgname, pango_req,
- 'pangocairo', pango_req,
- 'gdk-pixbuf-2.0', gdk_pixbuf_req ])
+gdk_packages = [
+ '@0@ @1@'.format(pango_pkgname, pango_req),
+ 'pangocairo @0@'.format(pango_req),
+ 'gdk-pixbuf-2.0 @0@'.format(gdk_pixbuf_req),
+]
if cairo_pkg_found
- gdk_packages += ' '.join([ ' cairo', cairo_req ])
+ gdk_packages += 'cairo @0@'.format(cairo_req)
endif
if cairogobj_pkg_found
- gdk_packages += ' '.join([ ' cairo-gobject', cairo_req ])
+ gdk_packages += 'cairo-gobject @0@'.format(cairo_req)
endif
if vulkan_pkg_found
gdk_packages += ' vulkan'
endif
-pkgconf.set('GDK_PACKAGES', gdk_packages)
-pkgconf.set('GSK_PACKAGES',
- ' '.join([ 'graphene-gobject-1.0', graphene_req ]))
-pkgconf.set('GTK_PACKAGES',
- ' '.join([ 'gio-2.0', glib_req ]))
+gsk_packages = [ 'graphene-gobject-1.0 @0@'.format(graphene_req) ]
+gtk_packages = [ 'gio-2.0 @0@'.format(glib_req) ]
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
-pkgconf.set('GDK_PRIVATE_PACKAGES',
- ' '.join([ gio_pkgname, glib_req,
- 'epoxy', epoxy_req ] + x11_pkgs + wayland_pkgs + cairo_backends))
-pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES
+gdk_private_packages = [
+ '@0@ @1@'.format(gio_pkgname, glib_req),
+ 'epoxy @0@'.format(epoxy_req),
+] + x11_pkgs + wayland_pkgs + cairo_backends
+gsk_private_packages = [] # all already in gdk_private_packages
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
-pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(pangoft2_pkgs))
-
-pkgconf.set('GDK_EXTRA_LIBS', ' '.join(pc_gdk_extra_libs))
-pkgconf.set('GSK_EXTRA_LIBS', '')
-pkgconf.set('GTK_EXTRA_LIBS', '')
+gtk_private_packages = pangoft2_pkgs
-pkgconf.set('GDK_EXTRA_CFLAGS', '')
-pkgconf.set('GSK_EXTRA_CFLAGS', '')
-pkgconf.set('GTK_EXTRA_CFLAGS', '')
+gdk_extra_libs = pc_gdk_extra_libs
+gsk_extra_libs = []
+gtk_extra_libs = []
-pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
+gdk_extra_cflags = []
+gsk_extra_cflags = []
+gtk_extra_cflags = []
-pkgs = [ 'gtk4.pc' ]
+pkgs = [ 'gtk4' ]
-pkg_targets = ''
+pkg_targets = []
display_backends = []
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
- pkgs += ['gtk4-@0@.pc'.format(backend)]
- pkg_targets += ' ' + backend
+ pkgs += ['gtk4-@0@'.format(backend)]
+ pkg_targets += backend
display_backends += [ backend ]
endif
endforeach
-pkgconf.set('GDK_BACKENDS', pkg_targets.strip())
+
+common_pc_variables = [
+ 'targets=@0@'.format(' '.join(pkg_targets)),
+ 'gtk_binary_version=@0@'.format(gtk_binary_version),
+ 'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
+]
foreach pkg: pkgs
- configure_file(input: 'gtk4.pc.in',
- output: pkg,
- configuration: pkgconf,
- install_dir: pkg_install_dir)
+ pkg_config.generate(
+ filebase: pkg,
+ variables: common_pc_variables,
+ name: 'GTK',
+ description: 'GTK Graphical UI Library',
+ 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,
+ )
endforeach
if os_unix
- configure_file(input: 'gtk4-unix-print.pc.in',
- output: 'gtk4-unix-print.pc',
- configuration: pkgconf,
- install_dir: pkg_install_dir)
+ pkg_config.generate(
+ filebase: 'gtk4-unix-print',
+ variables: common_pc_variables,
+ name: 'GTK',
+ description: 'GTK Unix print support',
+ requires: ['gtk4'] + gtk_packages,
+ libraries: [],
+ subdirs: ['gtk-@0@/unix-print'.format(gtk_api_version)],
+ )
endif
subdir('po')