From f0bd1dd5f4ef51c40dd8fa480e68d9de26ae18bb Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Wed, 10 Mar 2021 23:28:52 +0100 Subject: [PATCH] build: make gschema/icon cache generation optional on DESTDIR existence This is what other meson/GNOME apps do as well and if users have DESTDIR set they're probably distros which don't want us to call these. --- data/meson.build | 16 ---------------- meson.build | 2 ++ meson_options.txt | 2 -- meson_post_install.sh | 13 +++++++++++++ 4 files changed, 15 insertions(+), 18 deletions(-) delete mode 100644 meson_options.txt create mode 100755 meson_post_install.sh diff --git a/data/meson.build b/data/meson.build index 8325c1b..39bccef 100644 --- a/data/meson.build +++ b/data/meson.build @@ -63,22 +63,6 @@ install_man ('gnome-mahjongg.6') resources = gnome.compile_resources ('resources', 'org.gnome.Mahjongg.gresource.xml', source_dir: '.', c_name: 'resources') - -# Compile GSettings schemas - -if get_option('compile-schemas').enabled() - compileschemas = gio_dep.get_pkgconfig_variable('glib_compile_schemas') - meson.add_install_script(compileschemas, get_option('prefix') / schemasdir) -endif - -# Rebuild icon cache - -if get_option('update-icon-cache').enabled() - updateiconcache = find_program('gtk-update-icon-cache') - meson.add_install_script(updateiconcache.path(), '-t', '-f', get_option('prefix') / hicolordir / 'scalable') - meson.add_install_script(updateiconcache.path(), '-t', '-f', get_option('prefix') / hicolordir / 'symbolic') -endif - # Make D-Bus activatable service_conf = configuration_data() service_conf.set('bindir', bindir) diff --git a/meson.build b/meson.build index 6b3dca9..ab8a418 100644 --- a/meson.build +++ b/meson.build @@ -27,3 +27,5 @@ subdir ('po') subdir ('data') subdir ('help') subdir ('src') + +meson.add_install_script('meson_post_install.sh', get_option('prefix') / schemasdir) diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100644 index e9f7a85..0000000 --- a/meson_options.txt +++ /dev/null @@ -1,2 +0,0 @@ -option('compile-schemas', type: 'feature', value : 'enabled', description : 'Compile GSettings schemas on install') -option('update-icon-cache', type: 'feature', value : 'enabled', description : 'Update icon cache') diff --git a/meson_post_install.sh b/meson_post_install.sh new file mode 100755 index 0000000..90fca8b --- /dev/null +++ b/meson_post_install.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Package managers set this so we don't need to run +if [ -z "$DESTDIR" ]; then + schemadir="$1" + icondir="$MESON_INSTALL_PREFIX/share/icons/hicolor" + + printf "%s\\n" "Compiling GSettings schemas in dir $schemadir" + glib-compile-schemas $schemadir + + printf "%s\\n" "Updating GTK icon cache in dir $icondir" + gtk-update-icon-cache -qft $icondir +fi -- GitLab