commit:     5e15044f3d1627587e6fc40696ccdc4054a31355
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 28 03:32:37 2025 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Sun Dec 28 04:28:40 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e15044f

app-arch/brotli: add upstream patch to fix loong build for 1.2.0

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/45183
Closes: https://github.com/gentoo/gentoo/pull/45183
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 app-arch/brotli/brotli-1.2.0.ebuild               |  2 ++
 app-arch/brotli/files/1.2.0-fix-loong-build.patch | 36 +++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/app-arch/brotli/brotli-1.2.0.ebuild 
b/app-arch/brotli/brotli-1.2.0.ebuild
index 50469a1dd9d1..5a25040e1780 100644
--- a/app-arch/brotli/brotli-1.2.0.ebuild
+++ b/app-arch/brotli/brotli-1.2.0.ebuild
@@ -44,6 +44,8 @@ BDEPEND="
 
 DOCS=( README.md CONTRIBUTING.md )
 
+PATCHES=( "${FILESDIR}/${PV}-fix-loong-build.patch" )
+
 src_prepare() {
        cmake_src_prepare
        use python && distutils-r1_src_prepare

diff --git a/app-arch/brotli/files/1.2.0-fix-loong-build.patch 
b/app-arch/brotli/files/1.2.0-fix-loong-build.patch
new file mode 100644
index 000000000000..405f81772fdf
--- /dev/null
+++ b/app-arch/brotli/files/1.2.0-fix-loong-build.patch
@@ -0,0 +1,36 @@
+https://github.com/google/brotli/commit/e230f474b87134e8c6c85b630084c612057f253e
+From: Evgenii Kliuchnikov <[email protected]>
+Date: Mon, 3 Nov 2025 07:20:19 -0800
+Subject: [PATCH] disable BROTLI_MODEL macro for some targets
+
+PiperOrigin-RevId: 827486322
+--- a/c/common/platform.h
++++ b/c/common/platform.h
+@@ -213,6 +213,10 @@ To apply compiler hint, enclose the branching condition 
into macros, like this:
+ #define BROTLI_TARGET_MIPS64
+ #endif
+ 
++#if defined(__ia64__) || defined(_M_IA64)
++#define BROTLI_TARGET_IA64
++#endif
++
+ #if defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
+     defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \
+     defined(BROTLI_TARGET_LOONGARCH64) || defined(BROTLI_TARGET_MIPS64)
+@@ -665,13 +669,14 @@ BROTLI_UNUSED_FUNCTION void 
BrotliSuppressUnusedFunctions(void) {
+ #undef BROTLI_TEST
+ #endif
+ 
+-#if BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3)
++#if !defined(BROTLI_MODEL) && BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3) && \
++    !defined(BROTLI_TARGET_IA64) && !defined(BROTLI_TARGET_LOONGARCH64)
+ #define BROTLI_MODEL(M) __attribute__((model(M)))
+ #else
+ #define BROTLI_MODEL(M) /* M */
+ #endif
+ 
+-#if BROTLI_GNUC_HAS_ATTRIBUTE(cold, 4, 3, 0)
++#if !defined(BROTLI_COLD) && BROTLI_GNUC_HAS_ATTRIBUTE(cold, 4, 3, 0)
+ #define BROTLI_COLD __attribute__((cold))
+ #else
+ #define BROTLI_COLD /* cold */

Reply via email to