[gtk+] build: Add post-install script



commit c1965150c72cc11d51febd4fec0e4334601f947c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 26 15:59:43 2017 +0100

    build: Add post-install script
    
    When building GTK+ straight from the repository without any assistance
    from packaging tools, we need to trigger system-wide updates, like the
    icon theme cache update, or the schema compilation.

 build-aux/meson/post-install.sh |   21 +++++++++++++++++++++
 meson.build                     |   10 ++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/build-aux/meson/post-install.sh b/build-aux/meson/post-install.sh
new file mode 100755
index 0000000..a59d7d5
--- /dev/null
+++ b/build-aux/meson/post-install.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+gtk_version=$1
+gtk_abi_version=$2
+gtk_libdir=$3
+gtk_datadir=$4
+
+# Package managers set this so we don't need to run
+if [ -z "$DESTDIR" ]; then
+  echo Compiling GSettings schemas...
+  glib-compile-schemas ${gtk_datadir}/glib-2.0/schemas
+
+  echo Updating desktop database...
+  update-desktop-database -q ${gtk_datadir}/applications
+
+  echo Updating icon cache...
+  gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
+
+  echo Updating input method modules cache...
+  gtk4-query-immodules > ${gtk_libdir}/gtk-${version}/${gtk_abi_version}/immodules.cache
+fi
diff --git a/meson.build b/meson.build
index 4dcc641..58cbee1 100644
--- a/meson.build
+++ b/meson.build
@@ -95,10 +95,13 @@ endif
 os_unix = not os_win32
 
 gtk_prefix = get_option('prefix')
+gtk_includedir = join_paths(gtk_prefix, get_option('includedir'))
 gtk_libdir = join_paths(gtk_prefix, get_option('libdir'))
 gtk_datadir = join_paths(gtk_prefix, get_option('datadir'))
 gtk_localedir = join_paths(gtk_prefix, get_option('localedir'))
 gtk_sysconfdir = join_paths(gtk_prefix, get_option('sysconfdir'))
+gtk_applicationsdir = join_paths(gtk_datadir, 'applications')
+gtk_schemasdir = join_paths(gtk_datadir, 'glib-2.0/schemas')
 
 cc = meson.get_compiler('c')
 
@@ -584,3 +587,10 @@ if get_option('enable-documentation')
   subdir('docs/tools')
   subdir('docs/reference')
 endif
+
+# Keep this in sync with post-install.sh expected arguments
+meson.add_install_script('build-aux/meson/post-install.sh',
+                         gtk_version,
+                         gtk_binary_version,
+                         gtk_libdir,
+                         gtk_datadir)


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