4
9
Fork
You've already forked libchewing
3

chore: make doc and data optional for cross build #789

Merged
eagleoflqj merged 1 commit from option into master 2025年12月29日 03:14:52 +01:00
eagleoflqj commented 2025年12月20日 04:57:26 +01:00 (Migrated from github.com)
Copy link

libchewing uses chewing-cli to generate binary dictionaries from text files. When cross build (e.g. for wasm), the cli is not a natively-executable program, so the generation step needs to be skipped. Dictionaries can still be built natively and copied to wasm package.
The PR introduces BUILD_DATA that defaults to ON so that current behavior is preserved and it's easier to skip the data generation step.
BUILD_DOC is not as important as BUILD_DATA but also provides some convenience, as I'm not distributing man pages to the website that runs chewing wasm.

libchewing uses chewing-cli to generate binary dictionaries from text files. When cross build (e.g. for wasm), the cli is not a natively-executable program, so the generation step needs to be skipped. Dictionaries can still be built natively and copied to wasm package. The PR introduces `BUILD_DATA` that defaults to `ON` so that current behavior is preserved and it's easier to skip the data generation step. `BUILD_DOC` is not as important as `BUILD_DATA` but also provides some convenience, as I'm not distributing man pages to the website that runs chewing wasm.
codecov[bot] commented 2025年12月20日 04:59:15 +01:00 (Migrated from github.com)
Copy link

Codecov Report

All modified and coverable lines are covered by tests.
Project coverage is 92.06%. Comparing base (51fb091) to head (08655eb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@
## master #789 +/- ##
=======================================
 Coverage 92.06% 92.06% 
=======================================
 Files 37 37 
 Lines 9252 9252 
=======================================
 Hits 8518 8518 
 Misses 734 734 

View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
## [Codecov](https://app.codecov.io/gh/chewing/libchewing/pull/789?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chewing) Report :white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 92.06%. Comparing base ([`51fb091`](https://app.codecov.io/gh/chewing/libchewing/commit/51fb09179d2f60a0e014f31d40093c5aacf80460?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chewing)) to head ([`08655eb`](https://app.codecov.io/gh/chewing/libchewing/commit/08655eb93ebb49e19cac3d794a39c0f84ed0eb01?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chewing)). :warning: Report is 2 commits behind head on master. <details><summary>Additional details and impacted files</summary> ```diff @@ Coverage Diff @@ ## master #789 +/- ## ======================================= Coverage 92.06% 92.06% ======================================= Files 37 37 Lines 9252 9252 ======================================= Hits 8518 8518 Misses 734 734 ``` </details> [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/chewing/libchewing/pull/789?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chewing). :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chewing). <details><summary> :rocket: New features to boost your workflow: </summary> - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. </details>
kanru commented 2025年12月29日 03:13:41 +01:00 (Migrated from github.com)
Copy link

Thanks!

I'm very interested in your wasm build and how you plan to use it! Does the wasm build work out of the box?

Thanks! I'm very interested in your wasm build and how you plan to use it! Does the wasm build work out of the box?
eagleoflqj commented 2025年12月29日 05:28:21 +01:00 (Migrated from github.com)
Copy link

I'm very interested in your wasm build and how you plan to use it!

I've deployed wasm build of fcitx5-chewing to https://fcitx-contrib.github.io/online/
Usage: Click Plugin Manager button and download chewing, then upload it to the rectangle area. Select chewing input method and get the same experience with desktop fcitx5-chewing.

Does the wasm build work out of the box?

Wasm build could have multi-thread disabled or enabled. I choose to disable it so that it can be ran without specific HTTP response headers (COEP and COOP) set by server, in the hope that it can be embedded in more websites. That means for every usage of multi-thread, I have to patch it to be single-thread. See my current patch for libchewing as an example, in which I change the thread spawn to a direct function call.

> I'm very interested in your wasm build and how you plan to use it! I've deployed wasm build of fcitx5-chewing to https://fcitx-contrib.github.io/online/ Usage: Click Plugin Manager button and download chewing, then upload it to the rectangle area. Select chewing input method and get the same experience with desktop fcitx5-chewing. <img height="200" alt="" src="https://github.com/user-attachments/assets/bb43a56a-01a1-430a-848f-beb73a78394c" /> >Does the wasm build work out of the box? Wasm build could have multi-thread disabled or enabled. I choose to disable it so that it can be ran without specific HTTP response headers (COEP and COOP) set by server, in the hope that it can be embedded in more websites. That means for every usage of multi-thread, I have to patch it to be single-thread. See my current [patch](https://github.com/fcitx-contrib/fcitx5-prebuilder/blob/80574f08f1e859851d6b94dafe430a7eae8ca5d6/patches/libchewing.patch) for libchewing as an example, in which I change the thread spawn to a direct function call.
kanru commented 2025年12月29日 10:08:44 +01:00 (Migrated from github.com)
Copy link

Thanks. This is so cool!

If you'd like to contribute a wasm patch I will merge it. I was planning to add a wasm demo on the website anyway 😄

P.S. I played a bit and it seems the current version is using built-in fallback dictionary instead of the files from the plugin.

Thanks. This is so cool! If you'd like to contribute a wasm patch I will merge it. I was planning to add a wasm demo on the website anyway 😄 P.S. I played a bit and it seems the current version is using built-in fallback dictionary instead of the files from the plugin.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
dictionary
duplicate
fixed
0.11.0

Archived

fixed
0.13.0
refactoring

Archived

rewrite in rust
Might be fixed by the rust rewrite
thirdparty
arch
aarch64
系統架構是 Aarch64
arch
x86_64
系統架構是 x86_64
cannot reproduce
無法重現問題 Cannot reproduce the issue
contribution welcome
歡迎來幫忙 Contributions are very welcome, get started here
duplicate
重複的問題回報 This issue or pull request already exists
good first issue
適合新手 Interested in contributing? Get started here.
help wanted
需要高手相助 Need some help
invalid
回報的問題無效 Something is wrong
kind
bug
有東西不正常運作 Something is not working
kind
doc
加強文件說明 Enhance documentation
kind
enhancement
新功能 New feature
kind
mega issue
同一個問題回報中包含多個問題 Multiple issues reported
kind
question
只是問問題 Asking a question
needinfo
需要更多資訊 More information is needed
os
apple
作業系統是 MacOS 或 iOS
os
linux
作業系統是 GNU Linux
os
windows
作業系統是 Windows
to be determined
還未被說服有需求 Can't decide whether this is needed
upstream
跟上游軟體相關 Related to an upstream repository, already reported there
wontfix
我們決定不處理 Won't be fixed
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chewing/libchewing!789
Reference in a new issue
chewing/libchewing
No description provided.
Delete branch "option"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?