From 84eef7c953ff4e8ae23a1205cb68b8883fa9140f Mon Sep 17 00:00:00 2001 From: Yongxiang Liang Date: Thu, 7 Dec 2023 20:07:34 +0800 Subject: [PATCH] app-i18n/libime: add kenlm patch Signed-off-by: Yongxiang Liang --- .../libime-1.1.3-use-c++11-for-kenlm.patch | 15 ++++++ app-i18n/libime/libime-1.1.3.ebuild | 48 +++++++++---------- app-i18n/libime/libime-9999.ebuild | 40 ++++++++-------- app-i18n/libime/metadata.xml | 3 -- 4 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch diff --git a/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch b/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch new file mode 100644 index 00000000000..21694c86085 --- /dev/null +++ b/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch @@ -0,0 +1,15 @@ +Backport of https://github.com/fcitx/libime/commit/95c1433500b089b0c2edbdd17720f66e6eafd5e0 + +--- a/src/libime/core/CMakeLists.txt ++++ b/src/libime/core/CMakeLists.txt +@@ -13,7 +13,9 @@ add_library(kenlm STATIC ${KENLM_SRCS}) + target_include_directories(kenlm PUBLIC $) + 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 POSITION_INDEPENDENT_CODE ON) ++set_target_properties(kenlm PROPERTIES ++ CXX_STANDARD 11 ++ POSITION_INDEPENDENT_CODE ON) + + if(UNIX) + check_library_exists(rt clock_gettime "clock_gettime from librt" HAVE_CLOCKGETTIME_RT) diff --git a/app-i18n/libime/libime-1.1.3.ebuild b/app-i18n/libime/libime-1.1.3.ebuild index 93f635add1e..38405c99bd2 100644 --- a/app-i18n/libime/libime-1.1.3.ebuild +++ b/app-i18n/libime/libime-1.1.3.ebuild @@ -3,53 +3,49 @@ EAPI=8 -inherit cmake xdg-utils flag-o-matic toolchain-funcs +inherit cmake -KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" -SRC_URI="https://download.fcitx-im.org/fcitx5/libime/libime-${PV}_dict.tar.xz" DESCRIPTION="Fcitx5 Next generation of fcitx " HOMEPAGE="https://fcitx-im.org/" +SRC_URI="https://download.fcitx-im.org/fcitx5/libime/libime-${PV}_dict.tar.xz" + LICENSE="LGPL-2+" SLOT="5" -IUSE="coverage doc test" +KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" +IUSE="doc test" RESTRICT="!test? ( test )" + RDEPEND=" >=app-i18n/fcitx-5.1.5:5 app-arch/zstd:= dev-libs/boost:= - doc? ( app-doc/doxygen ) -" -DEPEND=" - ${RDEPEND} - test? ( - coverage? ( - dev-util/lcov - ) - ) " +DEPEND="${RDEPEND}" BDEPEND=" kde-frameworks/extra-cmake-modules:0 virtual/pkgconfig + doc? ( + app-doc/doxygen + media-gfx/graphviz[svg] + ) " -src_prepare() { - cmake_src_prepare - xdg_environment_reset -} +PATCHES="${FILESDIR}/${P}-use-c++11-for-kenlm.patch" src_configure() { - # libcxx drop std::binary_function in accordance with the Standard for >= C++17. - # This macro is used to re-enable all the features removed in C++17. - if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then - append-cxxflags -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES - fi - local mycmakeargs=( - -DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)" - -DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}/etc" - -DENABLE_COVERAGE=$(usex coverage) -DENABLE_DOC=$(usex doc) -DENABLE_TEST=$(usex test) ) cmake_src_configure } + +src_compile() { + cmake_src_compile + use doc && cmake_src_compile doc +} + +src_install() { + cmake_src_install + use doc && dodoc -r "${BUILD_DIR}"/doc/* +} diff --git a/app-i18n/libime/libime-9999.ebuild b/app-i18n/libime/libime-9999.ebuild index 36c0ff73d60..c6c129a29c2 100644 --- a/app-i18n/libime/libime-9999.ebuild +++ b/app-i18n/libime/libime-9999.ebuild @@ -3,7 +3,8 @@ EAPI=8 -inherit cmake xdg-utils git-r3 flag-o-matic toolchain-funcs +inherit cmake git-r3 + EGIT_REPO_URI="https://github.com/fcitx/libime.git" EGIT_SUBMODULES=( 'src/libime/kenlm' ) SRC_URI=" @@ -15,46 +16,45 @@ DESCRIPTION="Fcitx5 Next generation of fcitx " HOMEPAGE="https://fcitx-im.org/" LICENSE="LGPL-2+" SLOT="5" -IUSE="coverage doc test" +IUSE="doc test" RESTRICT="!test? ( test )" + RDEPEND=" >=app-i18n/fcitx-5.1.5:5 app-arch/zstd:= dev-libs/boost:= - doc? ( app-doc/doxygen ) -" -DEPEND=" - ${RDEPEND} - test? ( - coverage? ( - dev-util/lcov - ) - ) " +DEPEND="${RDEPEND}" BDEPEND=" kde-frameworks/extra-cmake-modules:0 virtual/pkgconfig + doc? ( + app-doc/doxygen + media-gfx/graphviz[svg] + ) " src_prepare() { ln -sv "${DISTDIR}/${PN}-lm_sc.arpa-20230712.tar.xz" "${S}/data/lm_sc.arpa-20230712.tar.xz" || die ln -sv "${DISTDIR}/${PN}-dict-20230412.tar.xz" "${S}/data/dict-20230412.tar.xz" || die ln -sv "${DISTDIR}/${PN}-table.tar.gz" "${S}/data/table.tar.gz" || die - cmake_src_prepare - xdg_environment_reset + default } src_configure() { - if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then - append-cxxflags -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES - fi - local mycmakeargs=( - -DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)" - -DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}/etc" - -DENABLE_COVERAGE=$(usex coverage) -DENABLE_DOC=$(usex doc) -DENABLE_TEST=$(usex test) ) cmake_src_configure } + +src_compile() { + cmake_src_compile + use doc && cmake_src_compile doc +} + +src_install() { + cmake_src_install + use doc && dodoc -r "${BUILD_DIR}"/doc/* +} diff --git a/app-i18n/libime/metadata.xml b/app-i18n/libime/metadata.xml index 7414f769530..988b0fb5c2d 100644 --- a/app-i18n/libime/metadata.xml +++ b/app-i18n/libime/metadata.xml @@ -8,7 +8,4 @@ fcitx/libime - - Build the project with gcov support -