[eog: 11/21] build: Retrieve gio schemas path from pkg-config file



commit aef29b202b24d200aec839754c864b20c9888eb8
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Jun 27 23:58:06 2019 +0200

    build: Retrieve gio schemas path from pkg-config file
    
    gio's schema's path is hardcoded. However, this directory can be
    retrieved by checking this information from its pkgconfig files.
    
    This has been changed to retrieve the path for its correspondant
    pkgconfig file and uses this path as installation directory.

 data/meson.build      |  4 ++--
 meson.build           | 11 +++++++++--
 meson_post_install.py |  3 +--
 src/meson.build       |  2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 92b5e336..482e4a92 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -54,9 +54,9 @@ schema = 'org.gnome.eog.gschema.xml'
 configure_file(
   input: schema + '.in',
   output: schema,
-  install: true,
-  install_dir: eog_schemadir,
   configuration: schema_conf,
+  install: true,
+  install_dir: gio_schemasdir,
 )
 
 install_data(
diff --git a/meson.build b/meson.build
index 3f7a143d..94181bc1 100644
--- a/meson.build
+++ b/meson.build
@@ -26,7 +26,6 @@ eog_pkglibdir = eog_libdir / meson.project_name()
 eog_pkglibexecdir = get_option('libexecdir') / meson.project_name()
 
 eog_pluginsdir = eog_pkglibdir / 'plugins'
-eog_schemadir = eog_datadir / 'glib-2.0/schemas'
 
 cc = meson.get_compiler('c')
 
@@ -84,6 +83,7 @@ add_project_arguments(common_flags + compiler_flags, language: 'c')
 glib_req_version = '>= 2.53.4'
 peas_req_version = '>= 0.7.4'
 
+gio_dep = dependency('gio-2.0', version: glib_req_version)
 gio_unix_dep = dependency('gio-unix-2.0', version: glib_req_version)
 gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 2.91.2')
 libpeas_gtk_dep = dependency('libpeas-gtk-1.0', version: peas_req_version)
@@ -93,13 +93,19 @@ dependency('gsettings-desktop-schemas', version: '>= 2.91.92')
 dependency('shared-mime-info', version: '>= 0.20')
 
 common_deps = [
+  gio_dep,
   dependency('gdk-pixbuf-2.0', version: '>= 2.36.5'),
-  dependency('gio-2.0', version: glib_req_version),
   dependency('glib-2.0', version: glib_req_version),
   dependency('gtk+-3.0', version: '>= 3.22.0'),
   dependency('libpeas-1.0', version: peas_req_version),
 ]
 
+gio_schemasdir = gio_dep.get_pkgconfig_variable(
+  'schemasdir',
+  define_variable: ['datadir', eog_prefix / eog_datadir],
+  default: eog_prefix / eog_datadir / 'glib-2.0/schemas',
+)
+
 # ZLIB support (required)
 if not cc.has_header('zlib.h') or not (cc.has_function('inflate') and cc.has_function('crc32'))
   zlib_dep = cc.find_library('z', required: false)
@@ -215,6 +221,7 @@ configure_file(
 meson.add_install_script(
   'meson_post_install.py',
   eog_datadir,
+  gio_schemasdir,
 )
 
 output = 'Configure summary:\n\n'
diff --git a/meson_post_install.py b/meson_post_install.py
index 46d7d58c..7e554684 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -11,6 +11,5 @@ if not os.environ.get('DESTDIR'):
   print('Update icon cache...')
   subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
 
-  schemadir = os.path.join(prefix, sys.argv[1], 'glib-2.0', 'schemas')
   print('Compiling gsettings schemas...')
-  subprocess.call(['glib-compile-schemas', schemadir])
+  subprocess.call(['glib-compile-schemas', sys.argv[2]])
diff --git a/src/meson.build b/src/meson.build
index a0b05a05..accf63fb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,7 +15,7 @@ gnome.mkenums(
   vtail: '  </@type@>',
   ftail: '</schemalist>',
   install_header: true,
-  install_dir: eog_schemadir,
+  install_dir: gio_schemasdir,
 )
 
 headers = enum_headers + files(


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