[planner: 32/40] build: Implement mime-info installation and post-install calls




commit ffdf436737ee088d4dd7ac908df737a999266c5e
Author: Mart Raudsepp <leio gentoo org>
Date:   Wed Mar 4 19:52:57 2020 +0200

    build: Implement mime-info installation and post-install calls

 data/meson.build      |  3 +++
 data/mime/meson.build | 12 ++++++++++++
 meson.build           |  2 ++
 meson_post_install.sh | 13 +++++++++++++
 4 files changed, 30 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
index 7e5ce63f..1476d0bb 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -18,6 +18,7 @@ i18n.merge_file(
 intltool_merge = find_program('intltool-merge')
 intltool_cache = po_dir / '.intltool-merge-cache'
 intltool_schema_cmd = [intltool_merge, '-s', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
 
 gconfschemadir = planner_sysconfdir / 'gconf' / 'schemas'
 schema_file = 'planner.schemas'
@@ -36,3 +37,5 @@ meson.add_install_script(
   gconfschemadir,
   schema_file,
 )
+
+subdir('mime') # relies on intltool variables from above
diff --git a/data/mime/meson.build b/data/mime/meson.build
new file mode 100644
index 00000000..01982efd
--- /dev/null
+++ b/data/mime/meson.build
@@ -0,0 +1,12 @@
+mime_xml_file = 'planner.xml'
+
+planner_mimedir = planner_datadir / 'mime' / 'packages'
+
+custom_target(
+  mime_xml_file,
+  input: mime_xml_file + '.in',
+  output: mime_xml_file,
+  command: intltool_xml_cmd,
+  install: true,
+  install_dir: planner_mimedir,
+)
diff --git a/meson.build b/meson.build
index 9726c0c0..4981be3d 100644
--- a/meson.build
+++ b/meson.build
@@ -78,3 +78,5 @@ if python_dep.found() and pygobject_codegen.found()
   subdir('python')
 endif
 subdir('docs')
+
+meson.add_install_script('meson_post_install.sh')
diff --git a/meson_post_install.sh b/meson_post_install.sh
new file mode 100755
index 00000000..48646fd9
--- /dev/null
+++ b/meson_post_install.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -z $MESON_INSTALL_PREFIX ]; then
+    echo 'This is meant to be ran from Meson only!'
+    exit 1
+fi
+
+if [ -z $DESTDIR ]; then
+    echo 'Updating mime database'
+    update-mime-database "$MESON_INSTALL_PREFIX/share/mime"
+    echo 'Updating desktop database'
+    update-desktop-database -q "$MESON_INSTALL_PREFIX/share/applications"
+fi


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