extensions: fix builds after MR !653 (migrating to gettext).

(1) On recent meson versions, it fixes this error:

> extensions/goat-exercises/meson.build:108:0: ERROR: i18n.merge_file keyword argument 'output' was of type array[str] but should have been str

As docs explains, 'output' only accepts one item in i18n.merge_file().

This bug also happens on older meson (but there the reported error is a
lot less useful as it doesn't mention local meson build code).

(2) `setup.isl.xml` is a temporary intermediary file used to create the
    Windows installer. It must not be installed.

(3) `gimp30-windows-installer.mo` itself is only used to create
    `setup.isl.xml`. It must not be installed as well.

(4) gimp-tips.(its|loc) files (same for gimp-tags ones) should not be
    installed. They are only temporary data.

(5) Fix environment variable: s/GETTEXT_DATA_DIRS/GETTEXTDATADIRS/

Fixes:

> /usr/bin/msgfmt: cannot locate ITS rules for ../../../data/tips/gimp-tips.xml.in

(6) Fix various bugs in the *.setup.isl files creation in autotools
    build (typo, wrong files used, order of options in `xsltproc`
    apparently meaningful, and so on. I guess the autotools build was
    not as well tested as the meson one :P).

(7) Fixing the unit test verifying language lists consistency.

(8) `setup.isl.xml.in` must be added to the distribution.
This commit is contained in:
Jehan 2022-06-24 22:43:13 +02:00
parent f663d26ab5
commit 8122e8cf36
9 changed files with 14 additions and 27 deletions

View file

@ -5,10 +5,11 @@ stamp_files = \
stamp-isl
CLEANFILES = $(isl_xml_files) $(stamp_files)
EXTRA_DIST = $(isl_xml_files)
# First we use the XML file to be able to do gettext translation
$(isl_xml_files): $(is_xml_in_files) $(wildcard $(top_srcdir)/po-windows-installer/*.po) Makefile.am
$(AM_V_GEN) GETTEXT_DATA_DIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-windows-installer -o $@
$(isl_xml_files): $(isl_xml_in_files) $(wildcard $(top_srcdir)/po-windows-installer/*.po) Makefile.am
$(AM_V_GEN) GETTEXTDATADIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-windows-installer -o $@
# Then, we generate the .isl file for each language using some xsltproc magic
languages = \
@ -53,17 +54,18 @@ languages = \
zh_CN:zh_CN \
zh_TW:zh_TW
stamp-isl: setup.isl gimp-ms-installer-config.xsl.in Makefile.am
stamp-isl: setup.isl.xml gimp-ms-installer-config.xsl.in Makefile.am
@ \
for lang in $(languages); do \
code=`echo $$lang | cut -d: -f1`; \
prefix=`echo $$lang | cut -d: -f2`; \
lang_check=`[ "$$prefix" ] && echo "value[lang('$$code')]" || echo "value"`; \
xslin="$(srcdir)/gimp-ms-installer-config.xsl.in"; \
xsl="$(builddir)/gimp-ms-installer-config.xsl"; \
isl="$(builddir)/$$code.setup.isl"; \
echo " GEN $$isl"; \
sed 's/@LANG_CHECK@/$$lang_check/' "$$xsl" > "$$xsl.in"; \
$(XSLTPROC) --xinclude "$$xsl" $< --output "$$isl" || rm -f "$$isl"; \
sed "s/@LANG_CHECK@/$$lang_check/" "$$xslin" > "$$xsl"; \
$(XSLTPROC) --xinclude --output "$$isl" "$$xsl" $< || rm -f "$$isl"; \
done && \
echo timestamp > stamp-isl

View file

@ -4,8 +4,7 @@ ms_installer_config_xml = i18n.merge_file(
output: '@BASENAME@',
data_dirs: meson.current_source_dir(),
po_dir: po_windows_installer_dir,
install: true,
install_dir: gimpdatadir / 'tags',
install: false,
)
languages = [

View file

@ -24,7 +24,7 @@ if [ "$PO_LANGS" != "$INSTALLER_LANGS" ]; then
exit 1
fi
AUTOTOOLS_LANGS=`grep '[a-zA-Z_]*:\[[a-zA-Z_]*\]' ${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/lang/Makefile.am | \
AUTOTOOLS_LANGS=`grep '^\s*[a-zA-Z_]*:[a-zA-Z_]*\s*\\\\\?' ${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/lang/Makefile.am | \
sed 's/^\t*\([a-zA-Z_]*\):.*$/\1/' |sort`
AUTOTOOLS_LANGS=`echo "$AUTOTOOLS_LANGS" | tr '\n\r' ' ' | sed 's/\<en\> //'`

View file

@ -22,7 +22,7 @@ EXTRA_DIST += $(its_DATA)
gimp-tags-default.xml: gimp-tags-default.xml.in $(wildcard $(top_srcdir)/po-tags/*.po)
$(AM_V_GEN) GETTEXT_DATA_DIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-tags -o $@
$(AM_V_GEN) GETTEXTDATADIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-tags -o $@
validate: gimp-tags-default.xml

View file

@ -1,10 +1,3 @@
install_data([
'its/gimp-tags.its',
'its/gimp-tags.loc',
],
install_dir: get_option('datadir') / 'gettext' / 'its',
)
gimp_tags_default = i18n.merge_file(
input : 'gimp-tags-default.xml.in',
output: '@BASENAME@',

View file

@ -23,7 +23,7 @@ EXTRA_DIST += $(its_DATA)
gimp-tips.xml: gimp-tips.xml.in $(wildcard $(top_srcdir)/po-tips/*.po)
$(AM_V_GEN) GETTEXT_DATA_DIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-tips -o $@
$(AM_V_GEN) GETTEXTDATADIRS=$(abs_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po-tips -o $@
validate: gimp-tips.xml

View file

@ -1,10 +1,3 @@
install_data([
'its/gimp-tips.its',
'its/gimp-tips.loc',
],
install_dir: get_option('datadir') / 'gettext' / 'its',
)
gimp_tips = i18n.merge_file(
input : 'gimp-tips.xml.in',
output: '@BASENAME@',

View file

@ -107,7 +107,7 @@ appdatafilein = configure_file(
appdatafile = i18n.merge_file(
input : [ appdatafilein, ],
output: [ appdatafilename, ],
output: appdatafilename,
po_dir: po_plug_ins_dir,
install: true,
install_dir: gimpplugindir / 'extensions' / extension_name,

View file

@ -1,2 +1,2 @@
po_windows_installer_dir = meson.current_source_dir()
i18n.gettext(gettext_package + '-windows-installer', preset: 'glib')
i18n.gettext(gettext_package + '-windows-installer', preset: 'glib', install: false)