[gnome-disk-utility] build: Retrieve gio schemas path from pkg-config file



commit 215b96c58d779b1ef4ce0e65d29f7a1598f8871a
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Jul 3 23:23:23 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      | 2 +-
 meson.build           | 7 +++++++
 meson_post_install.py | 3 +--
 3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index d91ecc17..702fbc32 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -33,7 +33,7 @@ configure_file(
 
 install_data(
   'org.gnome.Disks.gschema.xml',
-  install_dir: gdu_datadir / 'glib-2.0/schemas',
+  install_dir: gio_schemasdir,
 )
 
 info = 'org.gnome.DiskUtility.appdata.xml'
diff --git a/meson.build b/meson.build
index f12d2a48..db2e13fc 100644
--- a/meson.build
+++ b/meson.build
@@ -75,6 +75,12 @@ libnotify_dep = dependency('libnotify', version: '>= 0.7')
 liblzma_dep = dependency('liblzma', version: '>= 5.0.5')
 m_dep = cc.find_library('m')
 
+gio_schemasdir = dependency('gio-2.0').get_pkgconfig_variable(
+  'schemasdir',
+  define_variable: ['datadir', gdu_prefix / gdu_datadir],
+  default: gdu_prefix / gdu_datadir / 'glib-2.0/schemas',
+)
+
 # *** Check for logind ***
 if get_option('logind') == 'libsystemd'
   logind_dep = dependency('libsystemd', version: '>= 209')
@@ -115,6 +121,7 @@ configure_file(
 meson.add_install_script(
   'meson_post_install.py',
   gdu_datadir,
+  gio_schemasdir,
 )
 
 output = '\n        gnome-disk-utility ' + gdu_version + '\n'
diff --git a/meson_post_install.py b/meson_post_install.py
index c8c8ce8b..6381fccf 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('Compile gsettings schemas...')
-  subprocess.call(['glib-compile-schemas', schemadir])
+  subprocess.call(['glib-compile-schemas', sys.argv[2]])


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