app-text/groonga: fix lto, relax blosc detection

backport lto patch, also introducing GRN_WITH_LTO (set to OFF)
relax c-blosc2 detection to allow fresh 3.X releases

Closes: https://bugs.gentoo.org/973576
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/819
Merges: https://codeberg.org/gentoo/gentoo/pulls/819
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-05-04 08:29:10 +02:00
committed by Sam James
parent 4c77f0d64c
commit cf464b7205
3 changed files with 72 additions and 5 deletions
@@ -0,0 +1,30 @@
PR pending https://github.com/groonga/groonga/pull/2799.patch
fix https://bugs.gentoo.org/973576
Blosc2's CMake file only accepts a requested version when the major
version matches the installed one. Requesting 2.10.0 fails even if 3.X
system version is installed and compiled fine. Rework the detection
logic.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1446,16 +1446,15 @@ if(NOT "${GRN_WITH_BLOSC}" STREQUAL "no")
if("${GRN_WITH_BLOSC}" STREQUAL "bundled")
set(Blosc2_FOUND FALSE)
else()
- if("${GRN_WITH_BLOSC}" STREQUAL "system")
- find_package(Blosc2 ${GRN_BLOSC_REQUIRED_VERSION} REQUIRED)
- else()
- find_package(Blosc2 ${GRN_BLOSC_REQUIRED_VERSION})
- endif()
+ find_package(Blosc2 QUIET)
endif()
- if(Blosc2_FOUND)
+ if(Blosc2_FOUND AND Blosc2_VERSION VERSION_GREATER_EQUAL GRN_BLOSC_REQUIRED_VERSION)
set(GRN_WITH_BLOSC TRUE)
target_link_libraries(grn_dependencies INTERFACE Blosc2::blosc2_shared)
message(STATUS "Blosc: system")
+ elseif("${GRN_WITH_BLOSC}" STREQUAL "system")
+ message(FATAL_ERROR
+ "Blosc2 >=${GRN_BLOSC_REQUIRED_VERSION} not found!")
elseif(NOT FETCHCONTENT_FULLY_DISCONNECTED)
# FETCHCONTENT_FULLY_DISCONNECTED isn't for disabling network
# access but deb uses it...
@@ -0,0 +1,36 @@
PR merged: https://github.com/groonga/groonga/pull/2790.patch
The ODR violation happens because function pointer types like `grn_tokenizer_init_func` take `grn_tokenizer_query` as an argument,
and `grn_tokenizer_query` has two different definitions.
Include `grn_tokenizer.h` from `grn_db.h` so that the non-deprecated definition is always used.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -562,6 +562,18 @@ if(GRN_WITH_UBSAN)
endif()
endif()
+option(GRN_WITH_LTO "Enable link-time optimization" OFF)
+if(GRN_WITH_LTO)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT lto_supported OUTPUT lto_error)
+ if(lto_supported)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
+ else()
+ message(FATAL_ERROR "LTO not supported: ${lto_error}")
+ endif()
+ check_build_flag("-Werror=odr")
+endif()
+
if(WIN32)
target_link_libraries(grn_dependencies INTERFACE dbghelp.lib)
target_link_libraries(grn_dependencies INTERFACE psapi.lib)
--- a/lib/grn_db.h
+++ b/lib/grn_db.h
@@ -21,6 +21,8 @@
#include "grn.h"
+#include "grn_tokenizer.h"
+
#include "grn_ctx.h"
#include "grn_options.h"
#include "grn_rset.h"
+6 -5
View File
@@ -4,7 +4,7 @@
EAPI=8
CMAKE_QA_COMPAT_SKIP=1 # unused bundled rapidjson
inherit cmake flag-o-matic
inherit cmake
DESCRIPTION="Embeddable Fulltext Search Engine"
HOMEPAGE="https://groonga.org/"
@@ -49,6 +49,10 @@ BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-16.0.1-cmakelists.patch
"${FILESDIR}"/${PN}-16.0.1-blosc2_detection.patch
# PR merged
"${FILESDIR}"/${P}-fix_lto.patch
)
src_prepare() {
@@ -57,10 +61,6 @@ src_prepare() {
}
src_configure() {
# -Werror=odr
# https://github.com/groonga/groonga/issues/2787
filter-lto
local mycmakeargs=(
-DCMAKE_SKIP_RPATH=TRUE
-DCMAKE_INSTALL_DOCDIR="${EPREFIX}/usr/share/doc/${PF}/html"
@@ -75,6 +75,7 @@ src_configure() {
-DGRN_WITH_BENCHMARKS=OFF # install nothing
-DGRN_WITH_BUNDLED_ONIGMO=OFF
-DGRN_WITH_BUNDLED_MESSAGE_PACK=OFF
-DGRN_WITH_LTO=OFF # handled by userflags
-DGRN_WITH_SIMDJSON=no # prefer rapidjson, unlike upstream
-DGRN_WITH_SIMSIMD=OFF # masked, old 3.8.0 bundled
-DGRN_WITH_UBSAN=OFF # it requires clang