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