[tracker/sam/build-fixes: 2/2] build: Compile GSettings schemas after install



commit aef285b4a801ba7e9d8c166c668b27713e241130
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Jul 10 15:07:48 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 4c6b5c902..16e70d339 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -33,7 +33,7 @@ tracker_store_settings_enums = custom_target('tracker-store-settings-enums',
 #
 custom_target('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: tracker_store_settings_enums)
 
diff --git a/meson.build b/meson.build
index 92da1240b..7bfa10ec2 100644
--- a/meson.build
+++ b/meson.build
@@ -330,6 +330,7 @@ tracker_ontologies_dir = join_paths(get_option('prefix'), get_option('datadir'),
 
 vapi_dir = join_paths(get_option('prefix'), get_option('datadir'), 'vala', 'vapi')
 
+glib_compile_schemas = find_program('glib-compile-schemas')
 glib_mkenums = find_program('glib-mkenums')
 g_ir_compiler = find_program('g-ir-compiler', gobject_introspection.get_pkgconfig_variable('g_ir_compiler'))
 g_ir_merge = find_program('g-ir-merge', join_paths(meson.current_source_dir(), 'utils', 'g-ir-merge', 
'g-ir-merge'))
@@ -374,6 +375,8 @@ elif sqlite.version().version_compare('3.8.4.2')
   sqlite_safe = false
 endif
 
+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]