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.
This commit is contained in:
Emmanuele Bassi 2017-04-26 15:59:43 +01:00
parent 561f41d112
commit c1965150c7
2 changed files with 31 additions and 0 deletions

21
build-aux/meson/post-install.sh Executable file
View File

@ -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

View File

@ -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)