From eef28da33940d0b3e432a041a7b0614239f3fac4 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 19 Feb 2020 13:58:09 +0000 Subject: [PATCH] build: Add post-install script to update caches Update the desktop, schema and icon caches. Signed-off-by: Philip Withnall Helps: #9 --- build-aux/meson_post_install.py | 20 ++++++++++++++++++++ meson.build | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 build-aux/meson_post_install.py diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py new file mode 100644 index 0000000..bfdbebe --- /dev/null +++ b/build-aux/meson_post_install.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import os +import subprocess + +install_prefix = os.environ['MESON_INSTALL_PREFIX'] +schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas') + +if not os.environ.get('DESTDIR'): + print('Compiling gsettings schemas…') + subprocess.call(['glib-compile-schemas', schemadir]) + + print('Updating icon cache…') + icon_cache_dir = os.path.join(install_prefix, 'share', 'icons', 'hicolor') + subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) + + print('Updating desktop database…') + desktop_database_dir = os.path.join(install_prefix, 'share', 'applications') + subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) diff --git a/meson.build b/meson.build index 301a10b..7aa9e3b 100644 --- a/meson.build +++ b/meson.build @@ -133,3 +133,5 @@ subdir('malcontent-client') subdir('malcontent-control') subdir('pam') subdir('po') + +meson.add_install_script('build-aux/meson_post_install.py')