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 <sam@gentoo.org>
This commit is contained in:
Sam James
2025-09-07 05:41:15 +01:00
parent 65587da413
commit ac82f85706
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
https://github.com/LibreOffice/libexttextcat/pull/5
From 96abcf3a68c7b3b089c256eb749e689879a61b10 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <alessandro.astone@canonical.com>
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));

View File

@@ -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
}