summary refs log tree commit diff stats
path: root/data/misc/meson.build
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2017-06-15 00:10:55 -0400
committerPatrick Griffis <tingping@tingping.se>2017-06-15 00:10:55 -0400
commitf8467473ddae4060eea0f024be1d4ee07904bee2 (patch)
tree0d501bd7e0af316497e66024e774b247851a87b4 /data/misc/meson.build
parent2dfe5357a99736fc848255d7078c4b1d8cfe6884 (diff)
build: Validate desktop/appstream files
Diffstat (limited to 'data/misc/meson.build')
-rw-r--r--data/misc/meson.build26
1 files changed, 23 insertions, 3 deletions
diff --git a/data/misc/meson.build b/data/misc/meson.build
index ec79b757..b5532d63 100644
--- a/data/misc/meson.build
+++ b/data/misc/meson.build
@@ -1,7 +1,8 @@
 appdir = join_paths(get_option('datadir'), 'applications')
+desktop_utils = find_program('desktop-file-validate', required: false)
 
 if get_option('with-gtk')
-  i18n.merge_file(
+  hexchat_appdata = i18n.merge_file(
     input: 'hexchat.appdata.xml.in',
     output: 'hexchat.appdata.xml',
     po_dir: '../../po',
@@ -9,6 +10,13 @@ if get_option('with-gtk')
     install_dir: join_paths(get_option('datadir'), 'appdata')
   )
 
+  appstream_util = find_program('appstream-util', required: false)
+  if appstream_util.found()
+    test('Validate hexchat.appdata.xml', appstream_util,
+      args: ['validate', hexchat_appdata]
+    )
+  endif
+
   desktop_conf = configuration_data()
   if get_option('with-dbus')
     desktop_conf.set('exec_command', 'hexchat --existing %U')
@@ -22,7 +30,7 @@ if get_option('with-gtk')
     configuration: desktop_conf
   )
 
-  i18n.merge_file(
+  hexchat_desktop = i18n.merge_file(
     input: desktop_file,
     output: 'hexchat.desktop',
     po_dir: '../../po',
@@ -30,10 +38,16 @@ if get_option('with-gtk')
     install: true,
     install_dir: appdir
   )
+
+  if desktop_utils.found()
+    test('Validate hexchat.desktop', desktop_utils,
+      args: [hexchat_desktop]
+    )
+  endif
 endif
 
 if get_option('with-theme-manager')
-  i18n.merge_file(
+  htm_desktop = i18n.merge_file(
     input: 'htm.desktop.in',
     output: 'htm.desktop',
     po_dir: '../../po',
@@ -42,6 +56,12 @@ if get_option('with-theme-manager')
     install_dir: appdir
   )
 
+  if desktop_utils.found()
+    test('Validate htm.desktop', desktop_utils,
+      args: [htm_desktop]
+    )
+  endif
+
   install_data('htm-mime.xml',
     install_dir: join_paths(get_option('datadir'), 'mime/packages')
   )