From 8ccd12d6ec3330e9646ae9db6fd491226d516dc3 Mon Sep 17 00:00:00 2001
From: Markus Volk <f_l_k@t-online.de>
Date: Fri, 28 Mar 2025 01:33:00 +0100
Subject: [PATCH] meson.build: use relative path for ISO_CODES_LOCATION

If the host system does not provide iso-codes, the build fails with the following message:
FAILED: app/widgets/gimplanguagestore-data.h
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/gimp/3.0.2/build/tools/gen-languages
gimp_language_store_parser_init: 0.006277 seconds
ERROR: parse_iso_codes: Error parsing ‘/usr/share/xml/iso-codes/iso_639_3.xml’: No such file or directory

So far, we have worked around the problem by using the “iso-codes-native” dependency, but the path
for 'isocodes_prefix' is then generated from the native pkgconfig entry, resulting in a hard-coded path to
${STAGING_DATADIR_NATIVE}, which then leaks into the binaries of gimp and gimp-console.

Instead, use iso-codes for the target and adjust the path stored in ISO_CODES_LOCATION
(which is used in tools/gen-languages.c) to a relative path so that the build system can find it.

This allows us to depend on iso-codes for the target system, while still working on host systems that
do not provide iso-codes.

It also fixes a reproducibility issue:
ERROR: gimp-3.2.0-r0 do_package_qa: QA Issue: File /usr/bin/gimp-console-3.2 in package gimp contains reference to TMPDIR [buildpaths]
ERROR: gimp-3.2.0-r0 do_package_qa: QA Issue: File /usr/bin/gimp-3.2 in package gimp contains reference to TMPDIR [buildpaths]
ERROR: gimp-3.2.0-r0 do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /home/flk/bitbake-builds/poky/build/tmp/work/corei7-64-oe-linux/gimp/3.2.0/temp/log.do_package_qa.597065
ERROR: Task (/home/flk/bitbake-builds/poky/layers/meta-openembedded/meta-gnome/recipes-gimp/gimp/gimp_3.2.0.bb:do_package_qa) failed with exit code '1'

Upstream-Status: Inappropriate [oe-specific]

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index efbc2d8175..fd050f4d3c 100644
--- a/meson.build
+++ b/meson.build
@@ -1184,7 +1184,7 @@
   isocodes_prefix = isocodes.get_variable(pkgconfig: 'prefix')
   isocodes_location = isocodes_prefix / 'share' / 'xml' / 'iso-codes'
   isocodes_localedir= isocodes_prefix / 'share' / 'locale'
-  conf.set_quoted('ISO_CODES_LOCATION',  isocodes_location)
+  conf.set_quoted('ISO_CODES_LOCATION',  '..' / 'recipe-sysroot' / 'usr' / 'share' / 'xml' / 'iso-codes')
   conf.set_quoted('ISO_CODES_LOCALEDIR', isocodes_localedir)
 endif
 conf.set('HAVE_ISO_CODES', isocodes.found())
-- 
2.49.0

