Blame SOURCES/0003-migrate-from-custom-itstool-to-builtin-msgfmt-for-cr.patch

d0071d
From 5a406b06792e26a83c7346b3c2443c0bd8d4cdb2 Mon Sep 17 00:00:00 2001
d0071d
From: Eli Schwartz <eschwartz@archlinux.org>
d0071d
Date: Mon, 8 Nov 2021 18:22:47 -0500
d0071d
Subject: [PATCH] migrate from custom itstool to builtin msgfmt for creating
d0071d
 translated XML
d0071d
d0071d
gettext upstream has supported this for a very long time (since 0.19.7
d0071d
via commit b3c2a5a242c36fbbaa0c5b17f975d6c638598a23, released in 2015),
d0071d
and itstool is (mostly) a legacy of the time before gettext had proper
d0071d
support for these sorts of use cases.
d0071d
d0071d
This is similar to the state of intltool, which is described at
d0071d
https://wiki.gnome.org/MigratingFromIntltoolToGettext
d0071d
d0071d
During the port from autotools to meson, the legacy use of itstool was
d0071d
faithfully translated to meson in the only way possible: by jumping
d0071d
through hoops to run ninja inside ninja in order to generate the .mo
d0071d
files for itstool, because meson's i18n module used a flawed design and
d0071d
there was no "real" target to create those files, only a .PHONY
d0071d
run_target which other rules cannot depend on.
d0071d
d0071d
Although meson 0.60.0 added support for real targets for the built .mo
d0071d
files, this changed the rules for output filenames, breaking the script.
d0071d
d0071d
But msgfmt does not care, and anyways comes with builtin meson functions
d0071d
for convenient use with XML files. So let's take this opportunity to
d0071d
drop legacy dependencies and use the modern, builtin tooling, which
d0071d
fixes this bug as a side effect.
d0071d
d0071d
Fixes #170
d0071d
---
d0071d
 README.md                    |  2 +-
d0071d
 data/freedesktop_generate.sh | 12 ------------
d0071d
 data/meson.build             | 16 +++++-----------
d0071d
 meson.build                  |  1 -
d0071d
 5 files changed, 6 insertions(+), 27 deletions(-)
d0071d
 delete mode 100755 data/freedesktop_generate.sh
d0071d
d0071d
diff --git a/README.md b/README.md
d0071d
index c23d9d5..b2fb0ac 100644
d0071d
--- a/README.md
d0071d
+++ b/README.md
d0071d
@@ -19,7 +19,7 @@ $ ninja -v -C _build install
d0071d
 ```
d0071d
 
d0071d
 It requires the glib development package to be installed as well as
d0071d
-gettext and itstool.
d0071d
+gettext.
d0071d
 This database is translated at Transifex.
d0071d
 
d0071d
 
d0071d
diff --git a/data/freedesktop_generate.sh b/data/freedesktop_generate.sh
d0071d
deleted file mode 100755
d0071d
index 62ccffa..0000000
d0071d
--- a/data/freedesktop_generate.sh
d0071d
+++ /dev/null
d0071d
@@ -1,12 +0,0 @@
d0071d
-#!/bin/sh -e
d0071d
-
d0071d
-src_root="$1"
d0071d
-build_root="$2"
d0071d
-
d0071d
-${NINJA:-ninja} -C "${build_root}" shared-mime-info-gmo
d0071d
-
d0071d
-itstool \
d0071d
-    --its "${src_root}/data/its/shared-mime-info.its" \
d0071d
-    --join "${src_root}/data/freedesktop.org.xml.in" \
d0071d
-    -o "${build_root}/data/freedesktop.org.xml" \
d0071d
-    "${build_root}/po/"*".gmo"
d0071d
diff --git a/data/meson.build b/data/meson.build
d0071d
index 24361c9..09ed7a9 100644
d0071d
--- a/data/meson.build
d0071d
+++ b/data/meson.build
d0071d
@@ -1,18 +1,12 @@
d0071d
 
d0071d
 install_man('update-mime-database.1')
d0071d
 
d0071d
-freedesktop_org_xml = custom_target('freedesktop.org.xml',
d0071d
-    input : files(
d0071d
-        'freedesktop.org.xml.in',
d0071d
-        'its/shared-mime-info.its',
d0071d
-        'its/shared-mime-info.loc',
d0071d
-    ),
d0071d
+freedesktop_org_xml = i18n.merge_file(
d0071d
+    input: 'freedesktop.org.xml.in',
d0071d
     output: 'freedesktop.org.xml',
d0071d
-    command: [
d0071d
-        find_program('freedesktop_generate.sh'),
d0071d
-        meson.source_root(),
d0071d
-        meson.build_root()
d0071d
-    ],
d0071d
+    data_dirs: '.',
d0071d
+    po_dir: '../po',
d0071d
+    type: 'xml',
d0071d
     install: true,
d0071d
     install_dir: get_option('datadir') / 'mime' / 'packages',
d0071d
 )
d0071d
diff --git a/meson.build b/meson.build
d0071d
index 0d08c8a..60f17ae 100644
d0071d
--- a/meson.build
d0071d
+++ b/meson.build
d0071d
@@ -20,7 +20,6 @@ config.set_quoted('VERSION', meson.project_version())
d0071d
 ###############################################################################
d0071d
 # Find tools
d0071d
 
d0071d
-itstool = find_program('itstool')
d0071d
 xmllint = find_program('xmllint')
d0071d
 xmlto   = find_program('xmlto', required: false)
d0071d
 
d0071d
-- 
d0071d
2.37.3
d0071d