aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-01-06 11:28:56 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-01-06 11:44:01 +0100
commit077747f428998150f366a558b685b0393f5237fd (patch)
tree0defaca5deacc901d4c9d74df255d3c0a55a118d
parent3ae22e49ee3538780c9c26152f85bc5af1b2e596 (diff)
downloadfiv-077747f428998150f366a558b685b0393f5237fd.tar.gz
fiv-077747f428998150f366a558b685b0393f5237fd.tar.xz
fiv-077747f428998150f366a558b685b0393f5237fd.zip
Improve desktop file regeneration
-rw-r--r--meson.build31
1 files changed, 18 insertions, 13 deletions
diff --git a/meson.build b/meson.build
index 7b0762c..c3d5a86 100644
--- a/meson.build
+++ b/meson.build
@@ -83,20 +83,25 @@ if gdkpixbuf.found()
dependencies : [dependencies, gdkpixbuf])
endif
-install_data('fiv.desktop',
- install_dir : get_option('datadir') + '/applications')
+# XXX: With gdk-pixbuf, this even dependens on currently installed modules.
+if meson.is_cross_build()
+ install_data('fiv.desktop',
+ install_dir : get_option('datadir') + '/applications')
+else
+ # XXX: The exe path may not contain spaces--quoting is a bitch in Meson.
+ desktop = custom_target('desktop',
+ output : 'fiv.desktop',
+ input : 'fiv.desktop',
+ command : ['sh', '-c', '''awk '/^MimeType=/ { $0 = "MimeType=";
+ while ((exe " --list-supported-media-types" | getline type) > 0)
+ $0 = $0 type ";" } 1' "exe=$1" "$2"''', 'sh', exe, '@INPUT@'],
+ capture : true,
+ install : true,
+ install_dir : get_option('datadir') + '/applications',
+ )
+endif
+
install_data('fiv-browse.desktop',
install_dir : get_option('datadir') + '/applications')
install_data('fiv.svg',
install_dir : get_option('datadir') + '/icons/hicolor/scalable/apps')
-
-# TODO(p): Replace this with custom_target().
-if not meson.is_cross_build()
- meson.add_install_script(
- 'sh', '-c', '''sed -i "/^MimeType=/{c \\
-MimeType=$($1 --list-supported-media-types | tr "\\012" ";")
-}" "$MESON_INSTALL_DESTDIR_PREFIX/$2"''',
- 'sh',
- exe.full_path(),
- get_option('datadir') + '/applications/fiv.desktop')
-endif