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