[gtk/gtk-3-24: 1/2] Meson: Use gnome.post_install




commit b5d0c44a87443bc4aadcb35009ecb5e2674432df
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Fri Jan 14 16:46:22 2022 +0100

    Meson: Use gnome.post_install
    
    Only available on Meson 0.57.0 and later

 gtk/meson.build                   | 16 +++++++++++++++-
 meson.build                       | 26 +++++++++++++++++++-------
 modules/input/meson.build         |  5 ++++-
 modules/meson.build               |  2 ++
 modules/printbackends/meson.build |  2 ++
 5 files changed, 42 insertions(+), 9 deletions(-)
---
diff --git a/gtk/meson.build b/gtk/meson.build
index 12aa7db5c3..79f4f0d234 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1067,6 +1067,8 @@ install_data('gtkbuilder.loc', 'gtkbuilder.its',
              install_dir: join_paths(gtk_datadir, 'gettext/its'))
 
 ####### Utils ######
+gtk_tools = []
+
 gtk_query_settings = executable(
   'gtk-query-settings',
   'gtk-query-settings.c',
@@ -1074,6 +1076,7 @@ gtk_query_settings = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_query_settings
 
 gtk_builder_tool = executable(
   'gtk-builder-tool',
@@ -1082,6 +1085,7 @@ gtk_builder_tool = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_builder_tool
 
 extra_update_icon_cache_objs = []
 if win32_enabled
@@ -1113,8 +1117,9 @@ gtk_update_icon_cache = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_update_icon_cache
 
- gtk_query_immodules = executable(
+gtk_query_immodules = executable(
   'gtk-query-immodules-3.0',
   'queryimmodules.c',
   'gtkutils.c',
@@ -1122,6 +1127,7 @@ gtk_update_icon_cache = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_query_immodules
 
 gtk_encode_symbolic_svg = executable(
   'gtk-encode-symbolic-svg',
@@ -1130,6 +1136,7 @@ gtk_encode_symbolic_svg = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_encode_symbolic_svg
 
 gtk_launch = executable(
   'gtk-launch',
@@ -1138,3 +1145,10 @@ gtk_launch = executable(
   dependencies: libgtk_dep,
   install: true
 )
+gtk_tools += gtk_launch
+
+if meson.version().version_compare('>=0.54.0')
+  foreach tool: gtk_tools
+    meson.override_find_program(tool.name(), tool)
+  endforeach
+endif
diff --git a/meson.build b/meson.build
index 0950827a73..4f24ff025b 100644
--- a/meson.build
+++ b/meson.build
@@ -1008,13 +1008,25 @@ subdir('docs/reference')
 
 install_data('m4macros/gtk-3.0.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
 
-# Keep this in sync with post-install.py expected arguments
-meson.add_install_script('build-aux/meson/post-install.py',
-                         gtk_api_version,
-                         gtk_binary_version,
-                         join_paths(gtk_prefix, get_option('bindir')),
-                         gtk_libdir,
-                         gtk_datadir)
+if not meson.is_cross_build()
+  if meson.version().version_compare('>=0.57.0')
+    gnome.post_install(
+      glib_compile_schemas: true,
+      gio_querymodules: gio_module_dirs,
+      gtk_update_icon_cache: get_option('demos'),
+    )
+  else
+    # Keep this in sync with post-install.py expected arguments
+    meson.add_install_script('build-aux/meson/post-install.py',
+                             gtk_api_version,
+                             gtk_binary_version,
+                             join_paths(gtk_prefix, get_option('bindir')),
+                             gtk_libdir,
+                             gtk_datadir)
+  endif
+else
+  message('Not executing post-install steps automatically when cross compiling')
+endif
 
 if host_machine.system() != 'windows'
   # Install Valgrind suppression files (except on Windows,
diff --git a/modules/input/meson.build b/modules/input/meson.build
index 95534b05ec..cac6fcd7b8 100644
--- a/modules/input/meson.build
+++ b/modules/input/meson.build
@@ -1,6 +1,9 @@
 
 # Note: the list of immodules is in $(srcroot)/meson.build!
 
+immodules_install_dir = '@0@/gtk-@1@/@2@/immodules/'.format(gtk_libdir, gtk_api_version, gtk_binary_version)
+gio_module_dirs += immodules_install_dir
+
 foreach l: immodules
   name = l[0]
   immod_sources = l[1]
@@ -12,7 +15,7 @@ foreach l: immodules
                   immod_sources,
                   c_args: common_cflags + cflags,
                   dependencies: [ libgtk_dep ],
-                  install_dir: '@0@/gtk-@1@/@2@/immodules/'.format(gtk_libdir, gtk_api_version, 
gtk_binary_version),
+                  install_dir: immodules_install_dir,
                   include_directories: [confinc, gtkinc],
                   install : true,
                   name_suffix: module_suffix,
diff --git a/modules/meson.build b/modules/meson.build
index 1ae93fdaf7..c6d82425a1 100644
--- a/modules/meson.build
+++ b/modules/meson.build
@@ -1,2 +1,4 @@
+gio_module_dirs = []
+
 subdir('input')
 subdir('printbackends')
diff --git a/modules/printbackends/meson.build b/modules/printbackends/meson.build
index 0964fccd12..f03496313b 100644
--- a/modules/printbackends/meson.build
+++ b/modules/printbackends/meson.build
@@ -95,6 +95,8 @@ printbackends_args = [
 printbackends_subdir = 'gtk-3.0/@0@/printbackends'.format(gtk_binary_version)
 printbackends_install_dir = join_paths(get_option('libdir'), printbackends_subdir)
 
+gio_module_dirs += printbackends_install_dir
+
 if print_backends.contains('file')
   shared_module('printbackend-file',
                 'file/gtkprintbackendfile.c',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]