media-gfx/gimp: allow build without en_US.UTF-8

Closes: https://bugs.gentoo.org/969468
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45601
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Alfred Wingate
2026-02-07 17:44:37 +00:00
committed by Sam James
parent 1d5b2bddde
commit 73412ee2b8
3 changed files with 78 additions and 2 deletions
@@ -0,0 +1,39 @@
https://bugs.gentoo.org/969468
https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/2610
https://gitlab.gnome.org/GNOME/gimp/-/commit/cae3be98df77b27ebaa6b9a07a5d64f375f18e28
From cae3be98df77b27ebaa6b9a07a5d64f375f18e28 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Sat, 31 Jan 2026 20:21:27 +0200
Subject: [PATCH] tools/gen-languages: query user locale before falling back to
en_US
setlocale(LC_ALL, "") queries the user locale.
setlocale(LC_ALL, NULL) also queries the locale, but not the user
locale. It actually queries the programs locale, which by default is C.
Otherwise the user would need to have en_US.UTF-8 available no matter
what.
Check that derivates UTF8 of C locale aren't used as well.
Bug: https://bugs.gentoo.org/969468
Fixes: 88261f8b4cab65350cd858e9221a91da4c7f86db
Signed-off-by: Alfred Wingate <parona@protonmail.com>
--- a/tools/gen-languages.c
+++ b/tools/gen-languages.c
@@ -280,8 +280,8 @@ gimp_language_store_parser_init (GError **error)
goto cleanup;
}
- locale = setlocale (LC_ALL, NULL);
- if (g_strcmp0 (locale, "C") == 0 || g_strcmp0 (locale, "POSIX") == 0)
+ locale = setlocale (LC_ALL, "");
+ if (g_strcmp0 (locale, "C") == 0 || g_strcmp0 (locale, "POSIX") == 0 || g_str_has_prefix (locale, "C."))
{
/* Note: we do not care about what we set, except not C or POSIX.
* It may be any valid locale. This needs to be set so that this
--
GitLab
+21 -1
View File
@@ -26,6 +26,8 @@ REQUIRED_USE="
RESTRICT="!test? ( test )"
# TODO: next revbump add iso-codes as a build time dependency. It affects the end result whether its available
# See libgimp_deps_table in libgimp/meson.build for introspection dependencies, bug #969449
COMMON_DEPEND="
${PYTHON_DEPS}
@@ -126,6 +128,7 @@ DOCS=( "AUTHORS" "NEWS" "README" "README.i18n" )
PATCHES=(
"${FILESDIR}"/gimp-3.0.6-respect-NM.patch
"${FILESDIR}"/gimp-3.0.8-no-libunwind.patch
"${FILESDIR}"/gimp-3.0.8-allow-user-locale.patch
)
pkg_pretend() {
@@ -133,7 +136,24 @@ pkg_pretend() {
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
if [[ ${MERGE_TYPE} != binary ]]; then
use openmp && tc-check-openmp
# bug #969468
local locales="$(locale -a)"
if ! has "en_US.utf8" ${locales} && ! has "en_US.UTF-8" ${locales}; then
# portage splits and unset LC_ALL. Cannot rely on that
if [[ ${LANG} != C ]] && [[ ${LANG} != POSIX ]] && ! [[ ${LANG} =~ C. ]]; then
# Set LC_ALL to avoid locales breaking due to the profile setting LC_MESSAGES=C and portage itself setting LC_COLLATE=C
einfo "Setting LC_ALL=${LANG} based on LANG because en_US.UTF-8 isn't available, bug #968468"
export LC_ALL="${LANG}"
else
eerror "Cannot use LANG=${LANG} as it cannot be C or POSIX"
die "en_US.UTF-8 isn't available and cannot fallback to user locale, bug #969468"
fi
fi
fi
python-single-r1_pkg_setup
use lua && lua-single_pkg_setup
}
+18 -1
View File
@@ -161,7 +161,24 @@ pkg_pretend() {
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
if [[ ${MERGE_TYPE} != binary ]]; then
use openmp && tc-check-openmp
# bug #969468
local locales="$(locale -a)"
if ! has "en_US.utf8" ${locales} && ! has "en_US.UTF-8" ${locales}; then
# portage splits and unset LC_ALL. Cannot rely on that
if [[ ${LANG} != C ]] && [[ ${LANG} != POSIX ]] && ! [[ ${LANG} =~ C. ]]; then
# Set LC_ALL to avoid locales breaking due to the profile setting LC_MESSAGES=C and portage itself setting LC_COLLATE=C
einfo "Setting LC_ALL=${LANG} based on LANG because en_US.UTF-8 isn't available, bug #968468"
export LC_ALL="${LANG}"
else
eerror "Cannot use LANG=${LANG} as it cannot be C or POSIX"
die "en_US.UTF-8 isn't available and cannot fallback to user locale, bug #969468"
fi
fi
fi
python-single-r1_pkg_setup
use lua && lua-single_pkg_setup