From ac82f85706b84e110df0b853b0dcbaacaebafc7c Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 7 Sep 2025 05:41:15 +0100 Subject: [PATCH] app-text/libexttextcat: fix LTO * Use elibtoolize so -Werror=x gets passed down to the linker, not filtered by libtool * Fix resulting -Werror=lto-type-mismatch Signed-off-by: Sam James --- .../files/libexttextcat-3.4.7-lto.patch | 36 +++++++++++++++++++ .../libexttextcat-3.4.7-r1.ebuild | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 app-text/libexttextcat/files/libexttextcat-3.4.7-lto.patch create mode 100644 app-text/libexttextcat/libexttextcat-3.4.7-r1.ebuild diff --git a/app-text/libexttextcat/files/libexttextcat-3.4.7-lto.patch b/app-text/libexttextcat/files/libexttextcat-3.4.7-lto.patch new file mode 100644 index 000000000000..7b5e351b5491 --- /dev/null +++ b/app-text/libexttextcat/files/libexttextcat-3.4.7-lto.patch @@ -0,0 +1,36 @@ +https://github.com/LibreOffice/libexttextcat/pull/5 + +From 96abcf3a68c7b3b089c256eb749e689879a61b10 Mon Sep 17 00:00:00 2001 +From: Alessandro Astone +Date: Fri, 28 Mar 2025 14:46:28 +0100 +Subject: [PATCH] Fix type mismatch between declaration and definition + +Compiling with LTO otherwise fails with: + +wg_mempool.h:91:18: error: type of 'wgmempool_Init' does not match original declaration [-Werror=lto-type-mismatch] + 91 | extern void *wgmempool_Init(uint4 blocksize, size_t maxstrsize); + | ^ +wg_mempool.c:86:14: note: type mismatch in parameter 1 + 86 | extern void *wgmempool_Init(size_t blocksize, size_t maxstrsize) + | ^ +wg_mempool.c:86:14: note: type 'size_t' should match type 'uint4' +wg_mempool.c:86:14: note: 'wgmempool_Init' was previously declared here +wg_mempool.c:86:14: note: code may be misoptimized unless '-fno-strict-aliasing' is used +--- + src/wg_mempool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/wg_mempool.c b/src/wg_mempool.c +index 89d35a1..51ca894 100644 +--- a/src/wg_mempool.c ++++ b/src/wg_mempool.c +@@ -83,7 +83,7 @@ static void addblock(mempool_t * h) + } + + +-extern void *wgmempool_Init(size_t blocksize, size_t maxstrsize) ++extern void *wgmempool_Init(uint4 blocksize, size_t maxstrsize) + { + mempool_t *result = (mempool_t *) malloc(sizeof(mempool_t)); + + diff --git a/app-text/libexttextcat/libexttextcat-3.4.7-r1.ebuild b/app-text/libexttextcat/libexttextcat-3.4.7-r1.ebuild new file mode 100644 index 000000000000..f497da882439 --- /dev/null +++ b/app-text/libexttextcat/libexttextcat-3.4.7-r1.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit libtool + +DESCRIPTION="Library implementing N-gram-based text categorization" +HOMEPAGE="https://wiki.documentfoundation.org/Libexttextcat" +SRC_URI="https://dev-www.libreoffice.org/src/${P}.tar.xz" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" + +PATCHES=( + "${FILESDIR}"/${PN}-3.4.7-lto.patch +) + +src_prepare() { + default + + # Needed for LTO flags to be passed down to the linker + elibtoolize +} + +src_configure() { + econf \ + --disable-werror +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die +}