From cf464b7205824a6d941f5fcd1960fe04507091e6 Mon Sep 17 00:00:00 2001 From: Nicolas PARLANT Date: Mon, 4 May 2026 08:29:10 +0200 Subject: [PATCH] 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 Part-of: https://codeberg.org/gentoo/gentoo/pulls/819 Merges: https://codeberg.org/gentoo/gentoo/pulls/819 Signed-off-by: Sam James --- .../groonga-16.0.1-blosc2_detection.patch | 30 ++++++++++++++++ .../files/groonga-16.0.1-fix_lto.patch | 36 +++++++++++++++++++ app-text/groonga/groonga-16.0.1.ebuild | 11 +++--- 3 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 app-text/groonga/files/groonga-16.0.1-blosc2_detection.patch create mode 100644 app-text/groonga/files/groonga-16.0.1-fix_lto.patch diff --git a/app-text/groonga/files/groonga-16.0.1-blosc2_detection.patch b/app-text/groonga/files/groonga-16.0.1-blosc2_detection.patch new file mode 100644 index 0000000000000..fcfda0b043326 --- /dev/null +++ b/app-text/groonga/files/groonga-16.0.1-blosc2_detection.patch @@ -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... diff --git a/app-text/groonga/files/groonga-16.0.1-fix_lto.patch b/app-text/groonga/files/groonga-16.0.1-fix_lto.patch new file mode 100644 index 0000000000000..dd4aee30c48ee --- /dev/null +++ b/app-text/groonga/files/groonga-16.0.1-fix_lto.patch @@ -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" diff --git a/app-text/groonga/groonga-16.0.1.ebuild b/app-text/groonga/groonga-16.0.1.ebuild index d398d1d8adf8c..4933a4d207821 100644 --- a/app-text/groonga/groonga-16.0.1.ebuild +++ b/app-text/groonga/groonga-16.0.1.ebuild @@ -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