[tracker-miners/tracker-miners-2.2: 23/47] build: Compile GSettings schemas after install



commit b791b81ee40865c4ed36a64cc0a648d92145af2f
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Jul 10 15:01:11 2019 +0100

    build: Compile GSettings schemas after install
    
    This isn't needed in the common case of distro package builds, as the
    distro package will already provide a hook. However, our README.md
    tells developers to install into a prefix like ~/opt/tracker, and
    that is broken by default because GLib will complain that none of the
    settings schemas are installed.

 data/meson.build              |  2 +-
 meson.build                   |  3 +++
 meson_integration_commands.sh | 15 +++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/data/meson.build b/data/meson.build
index ac103d0f3..66659013b 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -62,7 +62,7 @@ endif
 
 custom_target('tracker-miners-compile-schemas',
   output: 'gschemas.compiled',
-  command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
+  command: [glib_compile_schemas, meson.current_build_dir()],
   build_by_default: true,
   depends: compile_schemas_deps)
 
diff --git a/meson.build b/meson.build
index 0e811f0d8..8fba6662c 100644
--- a/meson.build
+++ b/meson.build
@@ -399,6 +399,7 @@ tracker_uninstalled_writeback_modules_dir = join_paths(meson.current_build_dir()
 
 gsettings_schema_dir = join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')
 
+glib_compile_schemas = find_program('glib-compile-schemas')
 glib_mkenums = find_program('glib-mkenums')
 
 subdir('src')
@@ -417,6 +418,8 @@ subdir('tests')
 
 subdir('po')
 
+meson.add_install_script('meson_integration_commands.sh', glib_compile_schemas.path(), gsettings_schema_dir)
+
 summary = [
   '\nBuild Configuration:',
   '    Prefix:                                 ' + get_option('prefix'),
diff --git a/meson_integration_commands.sh b/meson_integration_commands.sh
new file mode 100644
index 000000000..34a526f1c
--- /dev/null
+++ b/meson_integration_commands.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Post install triggers.
+#
+# These are needed when following the developer workflow that we suggest in
+# README.md, of installing into an isolated prefix like ~/opt/tracker.
+
+set -e
+
+GLIB_COMPILE_SCHEMAS=$1
+GSETTINGS_SCHEMAS_DIR=$2
+
+if [ -z "$DESTDIR" ]; then
+    $GLIB_COMPILE_SCHEMAS $GSETTINGS_SCHEMAS_DIR
+fi


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