You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.7 KiB

  1. From 5a406b06792e26a83c7346b3c2443c0bd8d4cdb2 Mon Sep 17 00:00:00 2001
  2. From: Eli Schwartz <eschwartz@archlinux.org>
  3. Date: Mon, 8 Nov 2021 18:22:47 -0500
  4. Subject: [PATCH] migrate from custom itstool to builtin msgfmt for creating
  5. translated XML
  6. gettext upstream has supported this for a very long time (since 0.19.7
  7. via commit b3c2a5a242c36fbbaa0c5b17f975d6c638598a23, released in 2015),
  8. and itstool is (mostly) a legacy of the time before gettext had proper
  9. support for these sorts of use cases.
  10. This is similar to the state of intltool, which is described at
  11. https://wiki.gnome.org/MigratingFromIntltoolToGettext
  12. During the port from autotools to meson, the legacy use of itstool was
  13. faithfully translated to meson in the only way possible: by jumping
  14. through hoops to run ninja inside ninja in order to generate the .mo
  15. files for itstool, because meson's i18n module used a flawed design and
  16. there was no "real" target to create those files, only a .PHONY
  17. run_target which other rules cannot depend on.
  18. Although meson 0.60.0 added support for real targets for the built .mo
  19. files, this changed the rules for output filenames, breaking the script.
  20. But msgfmt does not care, and anyways comes with builtin meson functions
  21. for convenient use with XML files. So let's take this opportunity to
  22. drop legacy dependencies and use the modern, builtin tooling, which
  23. fixes this bug as a side effect.
  24. Fixes #170
  25. ---
  26. .gitlab-ci.yml | 2 --
  27. README.md | 2 +-
  28. data/freedesktop_generate.sh | 12 ------------
  29. data/meson.build | 16 +++++-----------
  30. meson.build | 1 -
  31. 5 files changed, 6 insertions(+), 27 deletions(-)
  32. delete mode 100755 data/freedesktop_generate.sh
  33. --- a/data/meson.build
  34. +++ b/data/meson.build
  35. @@ -1,18 +1,12 @@
  36. install_man('update-mime-database.1')
  37. -freedesktop_org_xml = custom_target('freedesktop.org.xml',
  38. - input : files(
  39. - 'freedesktop.org.xml.in',
  40. - 'its/shared-mime-info.its',
  41. - 'its/shared-mime-info.loc',
  42. - ),
  43. +freedesktop_org_xml = i18n.merge_file(
  44. + input: 'freedesktop.org.xml.in',
  45. output: 'freedesktop.org.xml',
  46. - command: [
  47. - find_program('freedesktop_generate.sh'),
  48. - meson.source_root(),
  49. - meson.build_root()
  50. - ],
  51. + data_dirs: '.',
  52. + po_dir: '../po',
  53. + type: 'xml',
  54. install: true,
  55. install_dir: get_option('datadir') / 'mime' / 'packages',
  56. )
  57. --- a/meson.build
  58. +++ b/meson.build
  59. @@ -20,7 +20,6 @@ config.set_quoted('VERSION', meson.proje
  60. ###############################################################################
  61. # Find tools
  62. -itstool = find_program('itstool')
  63. xmllint = find_program('xmllint')
  64. xmlto = find_program('xmlto')