mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-01-01 08:30:12 +00:00
enhance(x11/libime): Build dictionary files
This commit is contained in:
@@ -3,14 +3,43 @@ TERMUX_PKG_DESCRIPTION="A library to support generic input method implementation
|
||||
TERMUX_PKG_LICENSE="LGPL-2.1"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION="1.1.10"
|
||||
TERMUX_PKG_REVISION=2
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_SRCURL=git+https://github.com/fcitx/libime
|
||||
TERMUX_PKG_GIT_BRANCH="${TERMUX_PKG_VERSION}"
|
||||
TERMUX_PKG_DEPENDS="boost, fcitx5, libc++, zstd"
|
||||
TERMUX_PKG_BUILD_DEPENDS="boost-headers, extra-cmake-modules"
|
||||
TERMUX_PKG_DEPENDS="boost, fcitx5, libc++, libime-data, zstd"
|
||||
TERMUX_PKG_BUILD_DEPENDS="aosp-libs, boost-headers, extra-cmake-modules"
|
||||
TERMUX_PKG_AUTO_UPDATE=true
|
||||
# FIXME: Enable generating dictionary data
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
-DENABLE_DATA=OFF
|
||||
-DENABLE_TEST=OFF
|
||||
"
|
||||
|
||||
termux_step_pre_configure() {
|
||||
if [[ "$TERMUX_ON_DEVICE_BUILD" == "false" ]]; then
|
||||
termux_setup_proot
|
||||
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/data-CMakeLists.txt.diff
|
||||
fi
|
||||
}
|
||||
|
||||
termux_step_post_make_install() {
|
||||
echo -e "termux - building libime-data..."
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=' -DENABLE_DATA=ON'
|
||||
termux_step_configure
|
||||
termux_step_make
|
||||
|
||||
# from add_custom_commands in data/CMakeLists.txt
|
||||
if [[ "$TERMUX_ON_DEVICE_BUILD" == "false" ]]; then
|
||||
pushd data
|
||||
termux-proot-run ../tools/libime_slm_build_binary -s -a 22 -q 8 trie lm_sc.arpa sc.lm
|
||||
termux-proot-run ../tools/libime_prediction sc.lm lm_sc.arpa sc.lm.predict
|
||||
termux-proot-run ../tools/libime_pinyindict dict_sc.txt sc.dict
|
||||
termux-proot-run ../tools/libime_pinyindict dict_extb.txt extb.dict
|
||||
declare -a files=(db.txt erbi.txt qxm.txt wanfeng.txt wbpy.txt wbx.txt zrm.txt cj.txt)
|
||||
for file in "${files[@]}"; do
|
||||
termux-proot-run ../tools/libime_tabledict "$file" "${file/.txt/.main.dict}"
|
||||
done
|
||||
popd
|
||||
fi
|
||||
|
||||
termux_step_make_install
|
||||
}
|
||||
|
||||
50
x11-packages/libime/data-CMakeLists.txt.diff
Normal file
50
x11-packages/libime/data-CMakeLists.txt.diff
Normal file
@@ -0,0 +1,50 @@
|
||||
--- a/data/CMakeLists.txt
|
||||
+++ b/data/CMakeLists.txt
|
||||
@@ -13,13 +13,13 @@
|
||||
add_custom_command(
|
||||
OUTPUT "${LM_OUTPUT}"
|
||||
DEPENDS "${LM_SRC}" LibIME::slm_build_binary
|
||||
- COMMAND LibIME::slm_build_binary -s -a 22 -q 8 trie "${LM_SRC}" "${LM_OUTPUT}")
|
||||
+ COMMAND echo LibIME::slm_build_binary -s -a 22 -q 8 trie "${LM_SRC}" "${LM_OUTPUT}")
|
||||
add_custom_target(lm ALL DEPENDS "${LM_OUTPUT}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${LM_PREDICT_OUTPUT}"
|
||||
DEPENDS "${LM_SRC}" lm LibIME::prediction
|
||||
- COMMAND LibIME::prediction "${LM_OUTPUT}" "${LM_SRC}" "${LM_PREDICT_OUTPUT}")
|
||||
+ COMMAND echo LibIME::prediction "${LM_OUTPUT}" "${LM_SRC}" "${LM_PREDICT_OUTPUT}")
|
||||
add_custom_target(lm-predict ALL DEPENDS "${LM_PREDICT_OUTPUT}")
|
||||
|
||||
install(FILES "${LM_OUTPUT}" RENAME zh_CN.lm DESTINATION "${LIBIME_INSTALL_LIBDATADIR}")
|
||||
@@ -38,19 +38,20 @@
|
||||
add_custom_command(
|
||||
OUTPUT "${DICT_OUTPUT}"
|
||||
DEPENDS "${DICT_SRC}" LibIME::pinyindict
|
||||
- COMMAND LibIME::pinyindict "${DICT_SRC}" "${DICT_OUTPUT}")
|
||||
+ COMMAND echo LibIME::pinyindict "${DICT_SRC}" "${DICT_OUTPUT}")
|
||||
|
||||
set(DICT_EXTB_SRC "${CMAKE_CURRENT_BINARY_DIR}/dict_extb.txt")
|
||||
set(DICT_EXTB_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/extb.dict")
|
||||
add_custom_command(
|
||||
OUTPUT "${DICT_EXTB_OUTPUT}"
|
||||
DEPENDS "${DICT_EXTB_SRC}" LibIME::pinyindict
|
||||
- COMMAND LibIME::pinyindict "${DICT_EXTB_SRC}" "${DICT_EXTB_OUTPUT}")
|
||||
+ COMMAND echo LibIME::pinyindict "${DICT_EXTB_SRC}" "${DICT_EXTB_OUTPUT}")
|
||||
add_custom_target(dict ALL DEPENDS "${DICT_OUTPUT}" "${DICT_EXTB_OUTPUT}")
|
||||
install(FILES "${DICT_OUTPUT}" "${DICT_EXTB_OUTPUT}" DESTINATION "${LIBIME_INSTALL_PKGDATADIR}")
|
||||
|
||||
set(TABLE_DICT_TAR "table-20240108.tar.zst")
|
||||
set(TABLE_DICT_URL "https://download.fcitx-im.org/data/${TABLE_DICT_TAR}")
|
||||
+# if this list changes, rebase this patch and modify the matching list in build.sh
|
||||
set(TABLE_TXT_FILES db.txt erbi.txt qxm.txt wanfeng.txt
|
||||
wbpy.txt wbx.txt zrm.txt cj.txt)
|
||||
fcitx5_download(table-dict-download ${TABLE_DICT_URL} ${TABLE_DICT_TAR}
|
||||
@@ -63,7 +64,7 @@
|
||||
string(REPLACE .txt .main.dict TABLE_DICT_FILE ${TABLE_TXT_FILE})
|
||||
add_custom_command(OUTPUT ${TABLE_DICT_FILE}
|
||||
DEPENDS ${TABLE_TXT_FILE} LibIME::tabledict
|
||||
- COMMAND LibIME::tabledict ${TABLE_TXT_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${TABLE_DICT_FILE})
|
||||
+ COMMAND echo LibIME::tabledict ${TABLE_TXT_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${TABLE_DICT_FILE})
|
||||
list(APPEND TABLE_DICT_FILES ${CMAKE_CURRENT_BINARY_DIR}/${TABLE_DICT_FILE})
|
||||
endforeach()
|
||||
|
||||
6
x11-packages/libime/libime-data.subpackage.sh
Normal file
6
x11-packages/libime/libime-data.subpackage.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
TERMUX_SUBPKG_DESCRIPTION="Platform-independent data for libime"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_INCLUDE="
|
||||
lib/libime/
|
||||
share/libime/
|
||||
"
|
||||
Reference in New Issue
Block a user