summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-02-27 13:45:57 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2019-02-27 13:45:57 +0000
commit9ecadf36bbaaaf2411cfe43397da631558f7caa4 (patch)
tree741ad2712e97fc48014bbbfc068d10f9f292bce2
parentf1b006dd092d5e4323f887f9dc1a1c3a40b5ba2d (diff)
downloadnetwork-manager-applet-meson-gettext-fixes.tar.gz
build: Use the i18n modulemeson-gettext-fixes
Meson provides a module for calling the various gettext tools with the right environment variables and commands. Let's use that, instead of custom targets. We should also test the result using the appropriate tools, if they are available, to avoid regressions introduced by translators and build systems.
-rw-r--r--meson.build68
1 files changed, 38 insertions, 30 deletions
diff --git a/meson.build b/meson.build
index 80b21abb..5575ffdb 100644
--- a/meson.build
+++ b/meson.build
@@ -359,10 +359,6 @@ pkg = import('pkgconfig')
po_dir = join_paths(meson.source_root(), 'po')
-msgfmt = find_program('msgfmt')
-msgfmt_desktop_cmd = [msgfmt, '--desktop', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@']
-msgfmt_xml_cmd = [msgfmt, '--xml', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@']
-
top_inc = include_directories('.')
subdir('po')
@@ -371,46 +367,58 @@ subdir('shared')
subdir('src')
subdir('man')
-desktop = 'nm-applet.desktop'
+i18n = import('i18n')
# FIXME: The same target can not be copied into two directories.
# There is a workaround in meson_post_install.py until proper solution arises:
# https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
-custom_target(
- desktop,
- input: desktop + '.in',
- output: desktop,
- command: msgfmt_desktop_cmd,
- install: true,
- install_dir: nma_appdir
- #install_dir: [
- # nma_appdir,
- # nma_autostartdir
- #]
-)
+desktop_files = [
+ 'nm-applet',
+ 'nm-connection-editor',
+]
-desktop = 'nm-connection-editor.desktop'
+desktop_file_validate = find_program('desktop-file-validate', required: false)
-custom_target(
- desktop,
- input: desktop + '.in',
- output: desktop,
- command: msgfmt_desktop_cmd,
- install: true,
- install_dir: nma_appdir
-)
+foreach desktop: desktop_files
+ i18n.merge_file(
+ desktop + '-desktop',
+ input: desktop + '.desktop.in',
+ output: desktop + '.desktop',
+ install: true,
+ install_dir: nma_appdir,
+ po_dir: po_dir,
+ type: 'desktop',
+ )
+
+ if desktop_file_validate.found()
+ test('validate-' + desktop + '-desktop',
+ desktop_file_validate,
+ args: desktop + '.desktop',
+ workdir: meson.current_build_dir(),
+ )
+ endif
+endforeach
appdata = 'nm-connection-editor.appdata.xml'
-custom_target(
- appdata,
+i18n.merge_file(
+ 'desktop',
input: appdata + '.in',
output: appdata,
- command: msgfmt_xml_cmd,
install: true,
- install_dir: join_paths(nma_datadir, 'metainfo')
+ install_dir: join_paths(nma_datadir, 'metainfo'),
+ po_dir: po_dir,
)
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+ test('validate-appdata',
+ appstream_util,
+ args: ['validate', '--nonet', appdata],
+ workdir: meson.current_build_dir(),
+ )
+endif
+
schema_conf = configuration_data()
schema_conf.set('GETTEXT_PACKAGE', nma_name)