app-i18n/libime: fix build with -Werror=odr

Fixes already accepted in upstream repo

Closes: https://bugs.gentoo.org/962546
Signed-off-by: Yongxiang Liang <tanekliang@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43758
Closes: https://github.com/gentoo/gentoo/pull/43758
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Yongxiang Liang
2025-09-13 01:14:55 +08:00
committed by Sam James
parent e8d1a04aaf
commit a0c1b7e6cc
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
https://github.com/fcitx/libime/commit/39ced92b4450f49b03e38bdd6a58d1f1b9430824
fix odr: build kenlm with C++20
--- a/src/libime/core/CMakeLists.txt
+++ b/src/libime/core/CMakeLists.txt
@@ -14,9 +14,14 @@ target_include_directories(kenlm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE
target_compile_definitions(kenlm PUBLIC -DKENLM_MAX_ORDER=3 PRIVATE -DNDEBUG)
target_link_libraries(kenlm PUBLIC Boost::boost PkgConfig::ZSTD)
set_target_properties(kenlm PROPERTIES
- CXX_STANDARD 11
POSITION_INDEPENDENT_CODE ON)
+include(CheckCXXSymbolExists)
+check_cxx_symbol_exists(_LIBCPP_VERSION version LIBCPP)
+if(LIBCPP)
+ target_compile_definitions(kenlm PUBLIC -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+endif()
+
if(UNIX)
check_library_exists(rt clock_gettime "clock_gettime from librt" HAVE_CLOCKGETTIME_RT)
if (HAVE_CLOCKGETTIME_RT)

View File

@@ -30,6 +30,8 @@ BDEPEND="
)
"
PATCHES=( "${FILESDIR}"/${P}-fix-kenlm-odr.patch )
src_configure() {
# 957570 : remove unused kenlm CMakeLists.txt
rm src/libime/core/kenlm/CMakeLists.txt || die