Skip to content

Commit

Permalink
app-i18n/libime: add kenlm patch
Browse files Browse the repository at this point in the history
Signed-off-by: Yongxiang Liang <[email protected]>
  • Loading branch information
liangyongxiang committed Dec 7, 2023
1 parent 8c0406d commit 84eef7c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 49 deletions.
15 changes: 15 additions & 0 deletions app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch
Original file line number Diff line number Diff line change
@@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/kenlm>)
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)
48 changes: 22 additions & 26 deletions app-i18n/libime/libime-1.1.3.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
}
40 changes: 20 additions & 20 deletions app-i18n/libime/libime-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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="
Expand All @@ -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/*
}
3 changes: 0 additions & 3 deletions app-i18n/libime/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@
<upstream>
<remote-id type="github">fcitx/libime</remote-id>
</upstream>
<use>
<flag name="coverage">Build the project with gcov support</flag>
</use>
</pkgmetadata>

0 comments on commit 84eef7c

Please sign in to comment.