commit:     73412ee2b83589fc6bccf63c320cbbe4cd20e50e
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Mon Feb  2 17:45:08 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Feb  7 17:44:37 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73412ee2

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

Closes: https://bugs.gentoo.org/969468
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45601
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gimp/files/gimp-3.0.8-allow-user-locale.patch  | 39 ++++++++++++++++++++++
 media-gfx/gimp/gimp-3.0.8-r1.ebuild                | 22 +++++++++++-
 media-gfx/gimp/gimp-9999.ebuild                    | 19 ++++++++++-
 3 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/media-gfx/gimp/files/gimp-3.0.8-allow-user-locale.patch 
b/media-gfx/gimp/files/gimp-3.0.8-allow-user-locale.patch
new file mode 100644
index 000000000000..734b49d3996c
--- /dev/null
+++ b/media-gfx/gimp/files/gimp-3.0.8-allow-user-locale.patch
@@ -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 <[email protected]>
+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 <[email protected]>
+--- 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
+

diff --git a/media-gfx/gimp/gimp-3.0.8-r1.ebuild 
b/media-gfx/gimp/gimp-3.0.8-r1.ebuild
index 8d51913e2c9e..0795b4c13e07 100644
--- a/media-gfx/gimp/gimp-3.0.8-r1.ebuild
+++ b/media-gfx/gimp/gimp-3.0.8-r1.ebuild
@@ -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
 }

diff --git a/media-gfx/gimp/gimp-9999.ebuild b/media-gfx/gimp/gimp-9999.ebuild
index 0447c217ca37..39e63c1f05a2 100644
--- a/media-gfx/gimp/gimp-9999.ebuild
+++ b/media-gfx/gimp/gimp-9999.ebuild
@@ -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
 

Reply via email to