From af80ab5441ee3c3ee3c362ae817374004aec10b7 Mon Sep 17 00:00:00 2001 From: Rocka Date: Thu, 16 Jan 2025 17:33:57 +0800 Subject: [PATCH 01/32] Update libraries boost 1.87.0 fmt 11.1.2 libiconv 1.18 libuv 1.50.0 --- build.cfg | 6 +++--- fmt | 2 +- libiconv | 2 +- libuv | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.cfg b/build.cfg index 732b3303..9e9ce0b4 100644 --- a/build.cfg +++ b/build.cfg @@ -30,10 +30,10 @@ py_stroke_sha256 = 8eb128a9bfa43952e67cf2fcee1fd134c6f4cfd317bc2f6c38a615f5eb64e py_table = py_table-20121124.tar.gz py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c04 -## https://github.com/boostorg/boost/releases +## https://github.com/boostorg/boost/releases boost--cmake.tar.xz # boost -boost_version = 1.86.0 -boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 +boost_version = 1.87.0 +boost_sha256 = 7da75f171837577a52bbf217e17f8ea576c7c246e4594d617bfde7fafd408be5 ## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict diff --git a/fmt b/fmt index 0c9fce2f..8303d140 160000 --- a/fmt +++ b/fmt @@ -1 +1 @@ -Subproject commit 0c9fce2ffefecfdce794e1859584e25877b7b592 +Subproject commit 8303d140a1a11f19b982a9f664bbe59a1ccda3f4 diff --git a/libiconv b/libiconv index 4b9c27be..ed5a57cf 160000 --- a/libiconv +++ b/libiconv @@ -1 +1 @@ -Subproject commit 4b9c27bec873392533dd3ef309cd62962a644e18 +Subproject commit ed5a57cfedda75a6abbe4d0fb89a6f7b832f073e diff --git a/libuv b/libuv index e1095c7a..8fb9cb91 160000 --- a/libuv +++ b/libuv @@ -1 +1 @@ -Subproject commit e1095c7a4373ce00cd8874d8e820de5afb25776e +Subproject commit 8fb9cb919489a48880680a56efecff6a7dfb4504 From 5d36c7eb9cb879cb206b781232d50a146f8cd000 Mon Sep 17 00:00:00 2001 From: Rocka Date: Thu, 16 Jan 2025 19:21:36 +0800 Subject: [PATCH 02/32] generate libiconv configure file by cmake --- patches/libiconv/CMakeLists.txt | 15 +++++++-- patches/libiconv/libiconv.patch | 58 --------------------------------- src/Rules/LibIconv.hs | 5 +-- 3 files changed, 13 insertions(+), 65 deletions(-) delete mode 100644 patches/libiconv/libiconv.patch diff --git a/patches/libiconv/CMakeLists.txt b/patches/libiconv/CMakeLists.txt index 4ae69d36..0ae23e06 100644 --- a/patches/libiconv/CMakeLists.txt +++ b/patches/libiconv/CMakeLists.txt @@ -1,8 +1,17 @@ cmake_minimum_required(VERSION 3.22.1) project(libiconv) +set(DLL_VARIABLE "") +set(EILSEQ "") +set(ICONV_CONST "") +set(USE_MBSTATE_T "1") +set(BROKEN_WCHAR_H "0") +set(HAVE_WCHAR_T "1") +configure_file("include/iconv.h.in" "iconv.h" @ONLY) +configure_file("libcharset/include/localcharset.h.in" "localcharset.h" @ONLY) + set(LIBICONV_HEADER - "include/iconv.h" + "${CMAKE_CURRENT_BINARY_DIR}/iconv.h" ) set(LIBICONV_SOURCE lib/iconv.c @@ -10,6 +19,6 @@ set(LIBICONV_SOURCE ) add_library(iconv STATIC ${LIBICONV_SOURCE}) -target_include_directories(iconv PRIVATE include libcharset/include) +target_include_directories(iconv PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") install(TARGETS iconv) -install(FILES ${LIBICONV_HEADER} DESTINATION include) +install(FILES ${LIBICONV_HEADER} DESTINATION "include") diff --git a/patches/libiconv/libiconv.patch b/patches/libiconv/libiconv.patch deleted file mode 100644 index 70609114..00000000 --- a/patches/libiconv/libiconv.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/include/iconv.h -+++ b/include/iconv.h -@@ -21,7 +21,7 @@ - #define _LIBICONV_H - - #define _LIBICONV_VERSION 0x0111 /* version number: (major<<8) + minor */ --extern @DLL_VARIABLE@ int _libiconv_version; /* Likewise */ -+extern int _libiconv_version; /* Likewise */ - - /* We would like to #include any system header file which could define - iconv_t, 1. in order to eliminate the risk that the user gets compilation -@@ -55,7 +55,7 @@ - have EILSEQ in a different header. On these systems, define EILSEQ - ourselves. */ - #ifndef EILSEQ --#define EILSEQ @EILSEQ@ -+#define EILSEQ - #endif - - -@@ -79,7 +79,7 @@ - #ifndef LIBICONV_PLUG - #define iconv libiconv - #endif --extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); -+extern size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); - - /* Frees resources allocated for conversion descriptor ‘cd’. */ - #ifndef LIBICONV_PLUG -@@ -97,8 +97,8 @@ - - /* Nonstandard extensions. */ - --#if @USE_MBSTATE_T@ --#if @BROKEN_WCHAR_H@ -+#if 1 -+#if 0 - /* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be -@@ -118,7 +118,7 @@ - A pointer to such an object can be used as an iconv_t. */ - typedef struct { - void* dummy1[28]; --#if @USE_MBSTATE_T@ -+#if 1 - mbstate_t dummy2; - #endif - } iconv_allocation_t; -@@ -165,7 +165,7 @@ - void* callback_arg), - void* callback_arg, - void* data); --#if @HAVE_WCHAR_T@ -+#if 1 - /* Fallback function. Invoked when a number of bytes could not be converted to - a wide character. This function should process all bytes from inbuf and may - produce replacement wide characters by calling the write_replacement diff --git a/src/Rules/LibIconv.hs b/src/Rules/LibIconv.hs index 787fcf71..e32826aa 100644 --- a/src/Rules/LibIconv.hs +++ b/src/Rules/LibIconv.hs @@ -20,11 +20,8 @@ libiconvRule = do useCMake $ (cmakeBuilder "libiconv") { preBuild = BuildAction $ \_ src -> do - copyFile' "patches/libiconv/config.h" (src "include/config.h") + copyFile' "patches/libiconv/config.h" (src "config.h") copyFile' "patches/libiconv/CMakeLists.txt" (src "CMakeLists.txt") - copyFile' (src "libcharset/include/localcharset.h.in") (src "libcharset/include/localcharset.h") cmd_ (Cwd src) "make -f Makefile.devel lib/aliases.h lib/flags.h lib/translit.h" - copyFile' (src "include/iconv.h.in") (src "include/iconv.h") - cmd_ (Cwd src) "git apply ../patches/libiconv/libiconv.patch" } "libiconv" ~> buildWithAndroidEnv buildLibIconv LibIconv From a0b2d4112c0f3e785dc29b32d74544d06636a066 Mon Sep 17 00:00:00 2001 From: Rocka Date: Thu, 16 Jan 2025 19:38:50 +0800 Subject: [PATCH 03/32] change libiconv submodule upstream to github mirror --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 25500b88..17bf453e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -65,4 +65,4 @@ url = https://github.com/tlwg/libthai [submodule "libiconv"] path = libiconv - url = https://git.savannah.gnu.org/git/libiconv + url = https://github.com/fcitx5-android/libiconv From 76b64978f4eb9677bf07b6bf1766e5c0309d4b36 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 13:29:56 +0800 Subject: [PATCH 04/32] revert boost --- build.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cfg b/build.cfg index 9e9ce0b4..d68dc033 100644 --- a/build.cfg +++ b/build.cfg @@ -32,8 +32,8 @@ py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c ## https://github.com/boostorg/boost/releases boost--cmake.tar.xz # boost -boost_version = 1.87.0 -boost_sha256 = 7da75f171837577a52bbf217e17f8ea576c7c246e4594d617bfde7fafd408be5 +boost_version = 1.86.0 +boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 ## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict From bc6291123f5697da6c469ed690f4f261cb663d2e Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 13:45:30 +0800 Subject: [PATCH 05/32] retry with ndk r28-rc3 --- .github/workflows/ci.yml | 4 ++-- build.cfg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 680d22bc..3c2fc366 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,8 @@ jobs: container: archlinux:base-devel env: ABI: "armeabi-v7a,arm64-v8a,x86,x86_64" - NDK_VERSION: "25.2.9519653" - CMAKE_VERSION: "3.22.1" + NDK_VERSION: "28.0.12916984" + CMAKE_VERSION: "3.31.1" ANDROID_PLATFORM: "23" steps: diff --git a/build.cfg b/build.cfg index d68dc033..9e9ce0b4 100644 --- a/build.cfg +++ b/build.cfg @@ -32,8 +32,8 @@ py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c ## https://github.com/boostorg/boost/releases boost--cmake.tar.xz # boost -boost_version = 1.86.0 -boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 +boost_version = 1.87.0 +boost_sha256 = 7da75f171837577a52bbf217e17f8ea576c7c246e4594d617bfde7fafd408be5 ## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict From 9dd2c0fa3c9d8048f37018f1926e6ae5e685d3aa Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 14:00:19 +0800 Subject: [PATCH 06/32] try fix libuv build --- patches/libuv.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/patches/libuv.patch b/patches/libuv.patch index ad755281..e911d3e3 100644 --- a/patches/libuv.patch +++ b/patches/libuv.patch @@ -842,3 +842,14 @@ index 857a4ef8a..9deec0ef5 100644 -- 2.47.0 + +-- +--- a/src/unix/linux.c ++++ b/src/unix/linux.c +@@ -26,4 +26,5 @@ + #include "uv.h" + #include "internal.h" + ++#include /* LLONG_MAX */ + #include + From 4b58c58dea45e4e4266dda11faa3751071b37fb6 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 14:35:39 +0800 Subject: [PATCH 07/32] try fix libuv build (take 2) --- patches/libuv.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/libuv.patch b/patches/libuv.patch index e911d3e3..1cb97de7 100644 --- a/patches/libuv.patch +++ b/patches/libuv.patch @@ -850,6 +850,6 @@ index 857a4ef8a..9deec0ef5 100644 #include "uv.h" #include "internal.h" -+#include /* LLONG_MAX */ ++# define LLONG_MAX 0x7fffffffffffffffLL #include From 3062062fa7d046f4174a137a76c60a9f1dc6a274 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 15:56:49 +0800 Subject: [PATCH 08/32] try fix lua build --- patches/lua.patch | 14 ++++++++++++++ src/Rules/Lua.hs | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 patches/lua.patch diff --git a/patches/lua.patch b/patches/lua.patch new file mode 100644 index 00000000..606d76eb --- /dev/null +++ b/patches/lua.patch @@ -0,0 +1,14 @@ +diff --git a/lua-5.4.7/src/liolib.c b/lua-5.4.7/src/liolib.c +index c5075f3..1946943 100644 +--- a/lua-5.4.7/src/liolib.c ++++ b/lua-5.4.7/src/liolib.c +@@ -115,7 +115,8 @@ static int l_checkmode (const char *mode) { + + #if !defined(l_fseek) /* { */ + +-#if defined(LUA_USE_POSIX) /* { */ ++#if defined(LUA_USE_POSIX) && \ ++ (!defined(ANDROID) || (defined(__LP64__) || ANDROID_PLATFORM >= 24)) /* { */ + + #include + diff --git a/src/Rules/Lua.hs b/src/Rules/Lua.hs index 8ff87e2c..dbf7e2d3 100644 --- a/src/Rules/Lua.hs +++ b/src/Rules/Lua.hs @@ -20,6 +20,10 @@ luaRule = do useCMake $ (cmakeBuilder "lua") { source = const $ pure "Lua", + preBuild = BuildAction $ \_ src -> do + cmd_ (Cwd src) "git checkout ." + -- fix build for 32-bit devices + cmd_ (Cwd src) "git apply ../patches/lua.patch", cmakeFlags = const [ "-DLUA_BUILD_BINARY=OFF", From d4e47889541cfa55335546acf65a2ba848ca1caa Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 16:03:57 +0800 Subject: [PATCH 09/32] fixup --- src/Rules/Boost.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index 32e27c07..b04ed081 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -38,7 +38,6 @@ boostRule = do [ "atomic", "charconv", "chrono", - "context", "contract", "coroutine", "date_time", From 98c2cdf6be02a613d1dfc63d89c3fc416d45a5dd Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 16:11:47 +0800 Subject: [PATCH 10/32] fixup fixup --- src/Rules/Boost.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index b04ed081..1fb17523 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -36,8 +36,10 @@ boostRule = do <> intercalate ";" [ "atomic", + "asio", "charconv", "chrono", + "context", "contract", "coroutine", "date_time", From e2b9f8904747491d6a27c7874c30b58983e023ba Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 16:20:44 +0800 Subject: [PATCH 11/32] fixup^3 --- src/Rules/Boost.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index 1fb17523..0f108a98 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -39,6 +39,7 @@ boostRule = do "asio", "charconv", "chrono", + "cobalt", "context", "contract", "coroutine", From 0ee1ed1cd621e806bc63ef621427ac0a4ed68a3f Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 18 Jan 2025 16:48:46 +0800 Subject: [PATCH 12/32] revert boost (again) --- build.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cfg b/build.cfg index 9e9ce0b4..d68dc033 100644 --- a/build.cfg +++ b/build.cfg @@ -32,8 +32,8 @@ py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c ## https://github.com/boostorg/boost/releases boost--cmake.tar.xz # boost -boost_version = 1.87.0 -boost_sha256 = 7da75f171837577a52bbf217e17f8ea576c7c246e4594d617bfde7fafd408be5 +boost_version = 1.86.0 +boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 ## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict From 89d118d83203dcddbc998ae96afff8e3ec3c7d81 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sun, 16 Mar 2025 22:09:18 +0800 Subject: [PATCH 13/32] update libs --- .gitmodules | 1 - fmt | 2 +- librime | 2 +- zstd | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 17bf453e..eb01829f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -53,7 +53,6 @@ [submodule "libime"] path = libime url = https://github.com/fcitx/libime - fetchRecurseSubmodules = true [submodule "libime-jyutping"] path = libime-jyutping url = https://github.com/fcitx/libime-jyutping diff --git a/fmt b/fmt index 8303d140..12391371 160000 --- a/fmt +++ b/fmt @@ -1 +1 @@ -Subproject commit 8303d140a1a11f19b982a9f664bbe59a1ccda3f4 +Subproject commit 123913715afeb8a437e6388b4473fcc4753e1c9a diff --git a/librime b/librime index 6f6f5401..1c233581 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit 6f6f5401b0178b789a0ea6a5c49dbf1358be6f5c +Subproject commit 1c23358157934bd6e6d6981f0c0164f05393b497 diff --git a/zstd b/zstd index 794ea1b0..f8745da6 160000 --- a/zstd +++ b/zstd @@ -1 +1 @@ -Subproject commit 794ea1b0afca0f020f4e57b6732332231fb23c70 +Subproject commit f8745da6ff1ad1e7bab384bd1f9d742439278e99 From 430cbccf5a50873aabf74d385ada26db709264d9 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sun, 16 Mar 2025 22:12:34 +0800 Subject: [PATCH 14/32] try ndk r28 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c2fc366..6c31ec82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: container: archlinux:base-devel env: ABI: "armeabi-v7a,arm64-v8a,x86,x86_64" - NDK_VERSION: "28.0.12916984" + NDK_VERSION: "28.0.13004108" CMAKE_VERSION: "3.31.1" ANDROID_PLATFORM: "23" From 422acf0d7b60fc3930d93c1e1ccacd8bbb0ffd5f Mon Sep 17 00:00:00 2001 From: Rocka Date: Sun, 16 Mar 2025 22:27:35 +0800 Subject: [PATCH 15/32] try boost 1.87.0 again --- build.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cfg b/build.cfg index d68dc033..9e9ce0b4 100644 --- a/build.cfg +++ b/build.cfg @@ -32,8 +32,8 @@ py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c ## https://github.com/boostorg/boost/releases boost--cmake.tar.xz # boost -boost_version = 1.86.0 -boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 +boost_version = 1.87.0 +boost_sha256 = 7da75f171837577a52bbf217e17f8ea576c7c246e4594d617bfde7fafd408be5 ## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict From c452a6072be74755e2db13e0400745d9e29fca6b Mon Sep 17 00:00:00 2001 From: Rocka Date: Sun, 16 Mar 2025 22:52:22 +0800 Subject: [PATCH 16/32] disable boost's inline asm debug_gdb_scripts --- src/Rules/Boost.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index 0f108a98..a5252605 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -68,7 +68,11 @@ boostRule = do "-DBOOST_IOSTREAMS_ENABLE_ZLIB=OFF", "-DBOOST_IOSTREAMS_ENABLE_LZMA=OFF", "-DBOOST_IOSTREAMS_ENABLE_ZSTD=OFF", - "-DBOOST_INSTALL_LAYOUT=system" + "-DBOOST_INSTALL_LAYOUT=system", + -- disable inline asm debug_gdb_scripts + "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", + "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", + "-DBOOST_JSON_DEBUG_PRINTERS_HPP" ] } "boost" ~> do From 970c5aec0e70d9b6011930ce50cc82448fade2ad Mon Sep 17 00:00:00 2001 From: Rocka Date: Sun, 16 Mar 2025 23:06:28 +0800 Subject: [PATCH 17/32] try define 1 --- src/Rules/Boost.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index a5252605..ef1151e8 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -70,9 +70,9 @@ boostRule = do "-DBOOST_IOSTREAMS_ENABLE_ZSTD=OFF", "-DBOOST_INSTALL_LAYOUT=system", -- disable inline asm debug_gdb_scripts - "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", - "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", - "-DBOOST_JSON_DEBUG_PRINTERS_HPP" + "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS=1", + "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS=1", + "-DBOOST_JSON_DEBUG_PRINTERS_HPP=1" ] } "boost" ~> do From 7dfce5a4db51d022cca689b2f1893718f1cb38df Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Sun, 16 Mar 2025 12:56:59 -0400 Subject: [PATCH 18/32] Add cmake env --- src/CMakeBuilder.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CMakeBuilder.hs b/src/CMakeBuilder.hs index 1f49df81..f9951ed1 100644 --- a/src/CMakeBuilder.hs +++ b/src/CMakeBuilder.hs @@ -69,7 +69,9 @@ data CmakeBuilder q = CmakeBuilder doInstall :: Bool, -- | path the cmake file -- if not specified, run cmake in source dir - cmakeFile :: Maybe FilePath + cmakeFile :: Maybe FilePath, + -- | Additional cmake environment variables + cmakeEnv :: BuildEnv -> [(String, String)] } cmakeBuilder :: String -> CmakeBuilder b @@ -83,7 +85,8 @@ cmakeBuilder name = source = const $ pure name, name = name, doInstall = True, - cmakeFile = Nothing + cmakeFile = Nothing, + cmakeEnv = const mempty } useCMake :: @@ -107,9 +110,11 @@ useCMake CmakeBuilder {..} = addOracle $ \(WithAndroidEnv q env) -> do forM_ abiList $ \a -> do let bEnv@BuildEnv {..} = buildEnv a unBuildActionABI preBuildEachABI q bEnv + let cmakeEnvOptions = [AddEnv k v | (k, v) <- cmakeEnv bEnv] cmd_ (Cwd src) - (AddPath [] [ ninja ]) + (AddPath [] [ninja]) + cmakeEnvOptions cmake "-B" buildEnvBuildDir From ed9db6bea6ac2d753a52723037711a8ed9cc6a43 Mon Sep 17 00:00:00 2001 From: Rocka Date: Mon, 17 Mar 2025 01:57:13 +0800 Subject: [PATCH 19/32] try CXXFLAGS env --- src/CMakeBuilder.hs | 2 +- src/Rules/Boost.hs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/CMakeBuilder.hs b/src/CMakeBuilder.hs index f9951ed1..c697e9f2 100644 --- a/src/CMakeBuilder.hs +++ b/src/CMakeBuilder.hs @@ -129,7 +129,7 @@ useCMake CmakeBuilder {..} = addOracle $ \(WithAndroidEnv q env) -> do <> cmakeFlags bEnv ) (maybeToList cmakeFile) - cmd_ (Cwd src) cmake "--build" buildEnvBuildDir + cmd_ (Cwd src) cmakeEnvOptions cmake "--build" buildEnvBuildDir when doInstall $ cmd_ (Cwd src) cmake "--install" buildEnvBuildDir unBuildActionABI postBuildEachABI q bEnv diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index ef1151e8..0354018b 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -68,11 +68,18 @@ boostRule = do "-DBOOST_IOSTREAMS_ENABLE_ZLIB=OFF", "-DBOOST_IOSTREAMS_ENABLE_LZMA=OFF", "-DBOOST_IOSTREAMS_ENABLE_ZSTD=OFF", - "-DBOOST_INSTALL_LAYOUT=system", - -- disable inline asm debug_gdb_scripts - "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS=1", - "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS=1", - "-DBOOST_JSON_DEBUG_PRINTERS_HPP=1" + "-DBOOST_INSTALL_LAYOUT=system" + ], + cmakeEnv = + const + [ ("CXXFLAGS", + intercalate " " + -- disable inline asm debug_gdb_scripts + [ "BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", + "BOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", + "BOOST_JSON_DEBUG_PRINTERS_HPP" + ] + ) ] } "boost" ~> do From d62d61257363fcb7ca84b883845a9a5189378cff Mon Sep 17 00:00:00 2001 From: Rocka Date: Mon, 17 Mar 2025 22:03:47 +0800 Subject: [PATCH 20/32] try CXXFLAGS on librime --- src/Rules/Boost.hs | 11 ----------- src/Rules/LibRime.hs | 7 ++++++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index 0354018b..0f108a98 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -69,17 +69,6 @@ boostRule = do "-DBOOST_IOSTREAMS_ENABLE_LZMA=OFF", "-DBOOST_IOSTREAMS_ENABLE_ZSTD=OFF", "-DBOOST_INSTALL_LAYOUT=system" - ], - cmakeEnv = - const - [ ("CXXFLAGS", - intercalate " " - -- disable inline asm debug_gdb_scripts - [ "BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", - "BOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", - "BOOST_JSON_DEBUG_PRINTERS_HPP" - ] - ) ] } "boost" ~> do diff --git a/src/Rules/LibRime.hs b/src/Rules/LibRime.hs index c1cf04cf..09a58814 100644 --- a/src/Rules/LibRime.hs +++ b/src/Rules/LibRime.hs @@ -66,7 +66,12 @@ librimeRule = do ] <> ["."] ) - ] + ], + cmakeEnv = + const + -- disable inline asm debug_gdb_scripts + [ ("CXXFLAGS", "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS") + ] } "librime" ~> do need From 6e921bfd3ba1587136803cb1412864b970cf15e1 Mon Sep 17 00:00:00 2001 From: Rocka Date: Mon, 17 Mar 2025 22:18:13 +0800 Subject: [PATCH 21/32] it needs more --- src/Rules/LibRime.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Rules/LibRime.hs b/src/Rules/LibRime.hs index 09a58814..f2f4bf2d 100644 --- a/src/Rules/LibRime.hs +++ b/src/Rules/LibRime.hs @@ -70,7 +70,12 @@ librimeRule = do cmakeEnv = const -- disable inline asm debug_gdb_scripts - [ ("CXXFLAGS", "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS") + [ ("CXXFLAGS", intercalate " " + [ "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", + "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", + "-DBOOST_JSON_DEBUG_PRINTERS_HPP" + ] + ) ] } "librime" ~> do From d0eba288c9cf9453c7c294992229b958ed2424a9 Mon Sep 17 00:00:00 2001 From: Rocka Date: Mon, 17 Mar 2025 22:49:45 +0800 Subject: [PATCH 22/32] use CMAKE_CXX_FLAGS --- src/Rules/LibRime.hs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Rules/LibRime.hs b/src/Rules/LibRime.hs index f2f4bf2d..c6c18307 100644 --- a/src/Rules/LibRime.hs +++ b/src/Rules/LibRime.hs @@ -51,6 +51,12 @@ librimeRule = do "-DBUILD_TEST=OFF", "-DBUILD_TOOLS=OFF", "-DALSO_LOG_TO_STDERR=ON", + "-DCMAKE_CXX_FLAGS=" + <> intercalate + " " + -- disable boost's inline asm gdb_debug_scripts + [ "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS" + ], "-DCMAKE_FIND_ROOT_PATH=" <> intercalate ";" @@ -66,17 +72,7 @@ librimeRule = do ] <> ["."] ) - ], - cmakeEnv = - const - -- disable inline asm debug_gdb_scripts - [ ("CXXFLAGS", intercalate " " - [ "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS", - "-DBOOST_OUTCOME_SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS", - "-DBOOST_JSON_DEBUG_PRINTERS_HPP" - ] - ) - ] + ] } "librime" ~> do need From 5de49871bfd741ad9631d721184ef159a27ca331 Mon Sep 17 00:00:00 2001 From: Rocka Date: Mon, 17 Mar 2025 23:42:29 +0800 Subject: [PATCH 23/32] path librime target_compile_definitions --- .github/workflows/ci.yml | 2 +- patches/librime.patch | 2 +- src/Rules/LibRime.hs | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c31ec82..b48455bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: env: ABI: "armeabi-v7a,arm64-v8a,x86,x86_64" NDK_VERSION: "28.0.13004108" - CMAKE_VERSION: "3.31.1" + CMAKE_VERSION: "3.31.6" ANDROID_PLATFORM: "23" steps: diff --git a/patches/librime.patch b/patches/librime.patch index dc503ce1..e5e70afb 100644 --- a/patches/librime.patch +++ b/patches/librime.patch @@ -16,7 +16,7 @@ index 16082869..c4a5b5ca 100644 add_library(rime-static STATIC ${rime_src}) target_link_libraries(rime-static ${rime_deps}) + target_compile_options(rime-static PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") -+ target_compile_definitions(rime-static PRIVATE BOOST_DISABLE_CURRENT_LOCATION) ++ target_compile_definitions(rime-static PRIVATE BOOST_DISABLE_CURRENT_LOCATION BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS) set_target_properties(rime-static PROPERTIES OUTPUT_NAME "rime" PREFIX "lib" ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) diff --git a/src/Rules/LibRime.hs b/src/Rules/LibRime.hs index c6c18307..c1cf04cf 100644 --- a/src/Rules/LibRime.hs +++ b/src/Rules/LibRime.hs @@ -51,12 +51,6 @@ librimeRule = do "-DBUILD_TEST=OFF", "-DBUILD_TOOLS=OFF", "-DALSO_LOG_TO_STDERR=ON", - "-DCMAKE_CXX_FLAGS=" - <> intercalate - " " - -- disable boost's inline asm gdb_debug_scripts - [ "-DBOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS" - ], "-DCMAKE_FIND_ROOT_PATH=" <> intercalate ";" From 51f1abec7661d8e0e53d1c9ea2eb0ceb5effd9b5 Mon Sep 17 00:00:00 2001 From: Rocka Date: Tue, 18 Mar 2025 00:17:19 +0800 Subject: [PATCH 24/32] also patch librime-lua --- patches/librime-lua.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patches/librime-lua.patch b/patches/librime-lua.patch index 5eb8c099..8add6138 100644 --- a/patches/librime-lua.patch +++ b/patches/librime-lua.patch @@ -11,11 +11,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f2ebb..4f068d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -40,6 +40,7 @@ aux_source_directory(src RIME_LUA_SRC) +@@ -40,6 +40,8 @@ aux_source_directory(src RIME_LUA_SRC) aux_source_directory(src/lib RIME_LUA_LIB_SRC) add_library(rime-lua-objs OBJECT ${RIME_LUA_SRC} ${RIME_LUA_LIB_SRC} ${LUA_SRC}) +target_compile_options(rime-lua-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") ++target_compile_definitions(rime-lua-objs PRIVATE BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS) if(BUILD_SHARED_LIBS) set_target_properties(rime-lua-objs PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() From 08738239d2825d74c87a31496144405aaa00671d Mon Sep 17 00:00:00 2001 From: Rocka Date: Tue, 18 Mar 2025 00:28:08 +0800 Subject: [PATCH 25/32] patch all librime plugins --- patches/librime-octagram.patch | 3 ++- patches/librime-predict.patch | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/librime-octagram.patch b/patches/librime-octagram.patch index 3ac4201b..c41f7160 100644 --- a/patches/librime-octagram.patch +++ b/patches/librime-octagram.patch @@ -2,11 +2,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4115fa7..162ffb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.10) +@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.10) aux_source_directory(src octagram_src) add_library(rime-octagram-objs OBJECT ${octagram_src}) +target_compile_options(rime-octagram-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") ++target_compile_definitions(rime-octagram-objs PRIVATE BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS) if(BUILD_SHARED_LIBS) set_target_properties(rime-octagram-objs PROPERTIES diff --git a/patches/librime-predict.patch b/patches/librime-predict.patch index 229b0e3f..20cb9dc6 100644 --- a/patches/librime-predict.patch +++ b/patches/librime-predict.patch @@ -2,11 +2,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 07703bf..5ab6d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.10) +@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.10) aux_source_directory(src predict_src) add_library(rime-predict-objs OBJECT ${predict_src}) +target_compile_options(rime-predict-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") ++target_compile_definitions(rime-predict-objs PRIVATE BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS) if(BUILD_SHARED_LIBS) set_target_properties(rime-predict-objs PROPERTIES From a59c298ca2fb6de841bf7e6fc3408c442fec126b Mon Sep 17 00:00:00 2001 From: Rocka Date: Tue, 18 Mar 2025 22:27:14 +0800 Subject: [PATCH 26/32] refine libuv patch --- patches/libuv.patch | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/patches/libuv.patch b/patches/libuv.patch index 1cb97de7..2548c4f8 100644 --- a/patches/libuv.patch +++ b/patches/libuv.patch @@ -18,10 +18,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 28c6df256..3ec932e54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -277,6 +277,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android") +@@ -277,6 +277,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android") src/unix/random-getentropy.c src/unix/random-getrandom.c src/unix/random-sysctl-linux.c) ++ list(APPEND uv_defines LLONG_MAX=0x7fffffffffffffffLL) + if(ANDROID_PLATFORM_LEVEL LESS 24) + list(APPEND uv_sources + src/unix/android-ifaddrs.c) @@ -842,14 +843,3 @@ index 857a4ef8a..9deec0ef5 100644 -- 2.47.0 - --- ---- a/src/unix/linux.c -+++ b/src/unix/linux.c -@@ -26,4 +26,5 @@ - #include "uv.h" - #include "internal.h" - -+# define LLONG_MAX 0x7fffffffffffffffLL - #include - From 3cd4670a909cfcc8c75cee55307e6b602dc12fbc Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 18:35:35 +0800 Subject: [PATCH 27/32] try build host fcitx5 before libime --- .gitmodules | 3 ++ Lua | 2 +- build.cfg | 10 +++--- fcitx5 | 1 + libime | 2 +- libime-jyutping | 2 +- prebuilder.cabal | 2 +- src/Main.hs | 3 +- src/Rules/Fcitx5.hs | 64 +++++++++++++++++++++++++++++++++++++ src/Rules/Fcitx5Data.hs | 19 ----------- src/Rules/LibIME.hs | 18 ++++++----- src/Rules/LibIMEJyutping.hs | 10 +++--- 12 files changed, 94 insertions(+), 42 deletions(-) create mode 160000 fcitx5 create mode 100644 src/Rules/Fcitx5.hs delete mode 100644 src/Rules/Fcitx5Data.hs diff --git a/.gitmodules b/.gitmodules index eb01829f..26f252ea 100644 --- a/.gitmodules +++ b/.gitmodules @@ -65,3 +65,6 @@ [submodule "libiconv"] path = libiconv url = https://github.com/fcitx5-android/libiconv +[submodule "fcitx5"] + path = fcitx5 + url = https://github.com/fcitx/fcitx5 diff --git a/Lua b/Lua index 52674cd1..3ed55a56 160000 --- a/Lua +++ b/Lua @@ -1 +1 @@ -Subproject commit 52674cd192943015b99f51225f8cf8a116aa7293 +Subproject commit 3ed55a56eaa05c9221f40b3c07d0e908eb1067b0 diff --git a/build.cfg b/build.cfg index 9e9ce0b4..e712285a 100644 --- a/build.cfg +++ b/build.cfg @@ -9,8 +9,8 @@ lm_sc = lm_sc.arpa-20250113.tar.zst lm_sc_sha256 = ee83ecf20d52e8bccdba4cf6cd57183d53c257713a5eb77ee3a63d50fc3796dd # pinyin dict -pinyin_dict = dict-20241001.tar.zst -pinyin_dict_sha256 = d3313b88a68620a23bc8d5f9564cf1b678848dc7af541c4f5f02198e5a3686bf +pinyin_dict = dict-20250327.tar.zst +pinyin_dict_sha256 = 7ca6be4754c0d4c27ba7702c0dce651659bd2ca1faa5cbf2848d81a0053c8c13 # table dict table = table-20240108.tar.gz @@ -18,13 +18,13 @@ table_sha256 = 729c596d86907de727c74d0fc3fd241c406c5debd2b4cb74eefe022387ee9dae ## https://github.com/fcitx/fcitx5-chinese-addons/blob/master/im/pinyin/chaizi.txt # extra pinyin dict -chinese_addon_repo = https://raw.githubusercontent.com/fcitx/fcitx5-chinese-addons/5.1.2/im/pinyin/ +chinese_addon_repo = https://raw.githubusercontent.com/fcitx/fcitx5-chinese-addons/5.0.0/im/pinyin/ chaizi_sha256 = cd659605360120f7390fda1a278eea12c4df6d763a95c8099068ab09cfafd058 ## https://github.com/fcitx/fcitx5-chinese-addons/blob/master/modules/pinyinhelper/CMakeLists.txt # py stroke -py_stroke = py_stroke-20121124.tar.gz -py_stroke_sha256 = 8eb128a9bfa43952e67cf2fcee1fd134c6f4cfd317bc2f6c38a615f5eb64e248 +py_stroke = py_stroke-20250329.tar.gz +py_stroke_sha256 = c1a7ca7225d3614ab83353fc827503006a980447762018f53760425d7b5303a6 # py table py_table = py_table-20121124.tar.gz diff --git a/fcitx5 b/fcitx5 new file mode 160000 index 00000000..8af72c58 --- /dev/null +++ b/fcitx5 @@ -0,0 +1 @@ +Subproject commit 8af72c581e9315271006d254fda4f3eb83d1f9be diff --git a/libime b/libime index d5a28230..020b4573 160000 --- a/libime +++ b/libime @@ -1 +1 @@ -Subproject commit d5a28230c4794426437f31a5b774006a41a443e1 +Subproject commit 020b4573ff13e7e0f474e587dd26c2f5eea55373 diff --git a/libime-jyutping b/libime-jyutping index 25231d82..eeb43c90 160000 --- a/libime-jyutping +++ b/libime-jyutping @@ -1 +1 @@ -Subproject commit 25231d82c658753209f7b675273f2918d6be4f82 +Subproject commit eeb43c90fa6ef38f4983b12344a6606cfcf7380d diff --git a/prebuilder.cabal b/prebuilder.cabal index 77e672df..e3619195 100644 --- a/prebuilder.cabal +++ b/prebuilder.cabal @@ -24,7 +24,7 @@ executable prebuilder CMakeBuilder Rules.AnthyData Rules.Boost - Rules.Fcitx5Data + Rules.Fcitx5 Rules.Fmt Rules.GLog Rules.LevelDB diff --git a/src/Main.hs b/src/Main.hs index 20451147..09fdeb0b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -15,7 +15,7 @@ import Data.Text.Lazy.Builder qualified as TLB import Development.Shake.Config import Rules.AnthyData import Rules.Boost -import Rules.Fcitx5Data +import Rules.Fcitx5 import Rules.Fmt import Rules.GLog import Rules.LevelDB @@ -49,6 +49,7 @@ main = do want files usingConfigFile "build.cfg" downloadFileRule + hostFcitx5Rule spellDictRule libIMERule chineseAddonsRule diff --git a/src/Rules/Fcitx5.hs b/src/Rules/Fcitx5.hs new file mode 100644 index 00000000..7d3c9d88 --- /dev/null +++ b/src/Rules/Fcitx5.hs @@ -0,0 +1,64 @@ +module Rules.Fcitx5 + ( hostFcitx5Rule, + spellDictRule, + ) +where + +import Base +import Data.Maybe (fromJust) + +hostFcitx5Rule :: Rules () +hostFcitx5Rule = do + "host-fcitx5" ~> do + let fcitx5Src = "fcitx5" + cmd_ + "cmake" + "-B" + (fcitx5Src "build-host") + "-G" + "Ninja" + [ "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_INSTALL_PREFIX=" <> outputDir, + "-DCMAKE_PREFIX_PATH=" <> outputDir, + "-DENABLE_TEST=OFF", + "-DENABLE_COVERAGE=OFF", + "-DENABLE_ENCHANT=OFF", + "-DENABLE_X11=OFF", + "-DENABLE_WAYLAND=OFF", + "-DENABLE_DBUS=OFF", + "-DENABLE_DOC=OFF", + "-DENABLE_SERVER=OFF", + "-DENABLE_KEYBOARD=OFF", + "-DENABLE_XDGAUTOSTART=OFF", + "-DENABLE_EMOJI=OFF", + "-DENABLE_LIBUUID=OFF" + ] + fcitx5Src + cmd_ + "cmake" + "--build" + (fcitx5Src "build-host") + "--target" + [ "Fcitx5Utils", + "comp-spell-dict" + ] + Exit _ <- cmd "cmake" "--install" (fcitx5Src "build-host") + pure () + +-------------------------------------------------------------------------------- + +spellDictRule :: Rules () +spellDictRule = do + outputDir "en_dict.txt" %> \out -> do + src <- getConfig' "en_dict" + sha256 <- getConfig' "en_dict_sha256" + fcitxDataUrl <- getConfig' "fcitx_data_url" + tar <- download fcitxDataUrl src sha256 + cmd_ "tar" "xf" tar "-C" outputDir (takeFileName out) + outputDir "en_dict.fscd" %> \out -> do + let compSpellDict = outputDir "lib" "fcitx5" "libexec" "comp-spell-dict" + let src = outputDir "en_dict.txt" + need [src, "host-fcitx5"] + cmd_ compSpellDict "--comp-dict" [src, out] + "spell-dict" ~> do + copyFile' (outputDir "en_dict.fscd") $ outputDir "spell-dict" "en_dict.fscd" diff --git a/src/Rules/Fcitx5Data.hs b/src/Rules/Fcitx5Data.hs deleted file mode 100644 index 5b268b0f..00000000 --- a/src/Rules/Fcitx5Data.hs +++ /dev/null @@ -1,19 +0,0 @@ -module Rules.Fcitx5Data (spellDictRule) where - -import Base - -spellDictRule :: Rules () -spellDictRule = do - outputDir "en_dict.txt" %> \out -> do - src <- getConfig' "en_dict" - sha256 <- getConfig' "en_dict_sha256" - fcitxDataUrl <- getConfig' "fcitx_data_url" - tar <- download fcitxDataUrl src sha256 - cmd_ "tar" "xf" tar "-C" outputDir (takeFileName out) - outputDir "en_dict.fscd" %> \out -> do - let src = outputDir "en_dict.txt" - need [src] - compSpellDict <- getEnvWithDefault "/usr/lib/fcitx5/libexec/comp-spell-dict" "COMP_SPELL_DICT" - cmd_ compSpellDict "--comp-dict" [src, out] - "spell-dict" ~> do - copyFile' (outputDir "en_dict.fscd") $ outputDir "spell-dict" "en_dict.fscd" diff --git a/src/Rules/LibIME.hs b/src/Rules/LibIME.hs index 1c37cea5..4868b6e9 100644 --- a/src/Rules/LibIME.hs +++ b/src/Rules/LibIME.hs @@ -33,24 +33,26 @@ libIMERule = do libIMEToolsRule :: Rules () libIMEToolsRule = do "libime-tools" ~> do - need ["host-libzstd"] + need [ "host-libzstd", + "host-fcitx5" + ] let libIMESrc = "libime" cmd_ "cmake" "-B" - (libIMESrc "build") + (libIMESrc "build-host") "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=" <> outputDir, - "-DCMAKE_PREFIX_PATH=" <> outputDir, + "-DCMAKE_FIND_ROOT_PATH=" <> outputDir, "-DENABLE_TEST=OFF" ] libIMESrc cmd_ "cmake" "--build" - (libIMESrc "build") + (libIMESrc "build-host") "--target" [ "libime_slm_build_binary", "libime_prediction", @@ -59,10 +61,10 @@ libIMEToolsRule = do "libime_tabledict" ] -- ignore install errors - Exit _ <- cmd "cmake" "--install" (libIMESrc "build") "--component" "lib" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build") "--component" "header" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build") "--component" "tools" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build") "--component" "Devel" + Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "lib" + Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "header" + Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "tools" + Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "Devel" pure () -------------------------------------------------------------------------------- diff --git a/src/Rules/LibIMEJyutping.hs b/src/Rules/LibIMEJyutping.hs index f64b41b9..ede90fe1 100644 --- a/src/Rules/LibIMEJyutping.hs +++ b/src/Rules/LibIMEJyutping.hs @@ -15,12 +15,12 @@ libIMEJyutpingRule = do jyutpingToolsRule :: Rules () jyutpingToolsRule = do "libime-jyutping-tools" ~> do - need ["libime-tools", "host-libzstd"] + need ["libime-tools"] let libIMEJyutpingSrc = "libime-jyutping" cmd_ "cmake" "-B" - (libIMEJyutpingSrc "build") + (libIMEJyutpingSrc "build-host") "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", @@ -30,10 +30,10 @@ jyutpingToolsRule = do "-DENABLE_ENGINE=OFF" ] libIMEJyutpingSrc - cmd_ "cmake" "--build" (libIMEJyutpingSrc "build") "--target" "libime_jyutpingdict" + cmd_ "cmake" "--build" (libIMEJyutpingSrc "build-host") "--target" "libime_jyutpingdict" -- ignore install errors - Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build") "--component" "lib" - Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build") "--component" "tools" + Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build-host") "--component" "lib" + Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build-host") "--component" "tools" pure () jyutpingDictRule :: Rules () From 760144cba482a80f8fcc38ba726b915cf46daf67 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 18:46:03 +0800 Subject: [PATCH 28/32] allow running workflow manually --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b48455bf..e3f7d1a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: [master] pull_request: + workflow_dispatch: + repository_dispatch: jobs: build: From 3e72beed70a6a40abdec637f290acc2ae60d590c Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 19:13:08 +0800 Subject: [PATCH 29/32] install comp-spell-dict manually --- src/Rules/Fcitx5.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Rules/Fcitx5.hs b/src/Rules/Fcitx5.hs index 7d3c9d88..553adbe7 100644 --- a/src/Rules/Fcitx5.hs +++ b/src/Rules/Fcitx5.hs @@ -42,7 +42,10 @@ hostFcitx5Rule = do [ "Fcitx5Utils", "comp-spell-dict" ] + -- ignore install errors Exit _ <- cmd "cmake" "--install" (fcitx5Src "build-host") + -- install "comp-spell-dict" manually + copyFile' (fcitx5Src "build-host" "bin" "comp-spell-dict") $ outputDir "bin" "comp-spell-dict" pure () -------------------------------------------------------------------------------- @@ -56,7 +59,7 @@ spellDictRule = do tar <- download fcitxDataUrl src sha256 cmd_ "tar" "xf" tar "-C" outputDir (takeFileName out) outputDir "en_dict.fscd" %> \out -> do - let compSpellDict = outputDir "lib" "fcitx5" "libexec" "comp-spell-dict" + let compSpellDict = outputDir "bin" "comp-spell-dict" let src = outputDir "en_dict.txt" need [src, "host-fcitx5"] cmd_ compSpellDict "--comp-dict" [src, out] From 063797ca3204ffac9333307d6aff20b3d8276609 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 22:48:08 +0800 Subject: [PATCH 30/32] tidy host build dir --- .github/workflows/ci.yml | 4 +--- src/Base.hs | 4 ++-- src/Rules/Fcitx5.hs | 17 ++++++++--------- src/Rules/LibIME.hs | 19 +++++++++++-------- src/Rules/LibIMEJyutping.hs | 15 +++++++++------ src/Rules/ZSTD.hs | 10 ++++++---- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3f7d1a5..1ce100f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,6 @@ on: push: branches: [master] pull_request: - workflow_dispatch: - repository_dispatch: jobs: build: @@ -22,7 +20,7 @@ jobs: run: | pacman -Syu --needed --noconfirm \ git unzip ghc cabal-install haskell-shake haskell-aeson-pretty \ - cmake extra-cmake-modules ninja fmt fcitx5 boost python opencc jre-openjdk gperf + cmake extra-cmake-modules ninja boost python opencc jre-openjdk gperf - name: Fetch source code uses: actions/checkout@v4 diff --git a/src/Base.hs b/src/Base.hs index 4b6d4cbb..19a2409e 100644 --- a/src/Base.hs +++ b/src/Base.hs @@ -173,8 +173,8 @@ execute :: String -> (CmdArguments args) => args :-> Action () execute tool = cmdArguments ( CmdArgument - [ Right (outputDir "bin" tool), - Left (AddEnv "LD_LIBRARY_PATH" (outputDir "lib")) + [ Right (outputDir "host" "bin" tool), + Left (AddEnv "LD_LIBRARY_PATH" (outputDir "host" "lib")) ] ) diff --git a/src/Rules/Fcitx5.hs b/src/Rules/Fcitx5.hs index 553adbe7..3f2e776a 100644 --- a/src/Rules/Fcitx5.hs +++ b/src/Rules/Fcitx5.hs @@ -5,21 +5,21 @@ module Rules.Fcitx5 where import Base -import Data.Maybe (fromJust) hostFcitx5Rule :: Rules () hostFcitx5Rule = do "host-fcitx5" ~> do let fcitx5Src = "fcitx5" + let buildDir = outputDir "fcitx5-build-host" + let hostPrefix = outputDir "host" cmd_ "cmake" "-B" - (fcitx5Src "build-host") + buildDir "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_INSTALL_PREFIX=" <> outputDir, - "-DCMAKE_PREFIX_PATH=" <> outputDir, + "-DCMAKE_INSTALL_PREFIX=" <> hostPrefix, "-DENABLE_TEST=OFF", "-DENABLE_COVERAGE=OFF", "-DENABLE_ENCHANT=OFF", @@ -37,15 +37,15 @@ hostFcitx5Rule = do cmd_ "cmake" "--build" - (fcitx5Src "build-host") + buildDir "--target" [ "Fcitx5Utils", "comp-spell-dict" ] -- ignore install errors - Exit _ <- cmd "cmake" "--install" (fcitx5Src "build-host") + Exit _ <- cmd "cmake" "--install" buildDir -- install "comp-spell-dict" manually - copyFile' (fcitx5Src "build-host" "bin" "comp-spell-dict") $ outputDir "bin" "comp-spell-dict" + copyFile' (buildDir "bin" "comp-spell-dict") $ hostPrefix "bin" "comp-spell-dict" pure () -------------------------------------------------------------------------------- @@ -59,9 +59,8 @@ spellDictRule = do tar <- download fcitxDataUrl src sha256 cmd_ "tar" "xf" tar "-C" outputDir (takeFileName out) outputDir "en_dict.fscd" %> \out -> do - let compSpellDict = outputDir "bin" "comp-spell-dict" let src = outputDir "en_dict.txt" need [src, "host-fcitx5"] - cmd_ compSpellDict "--comp-dict" [src, out] + execute "comp-spell-dict" "--comp-dict" src out "spell-dict" ~> do copyFile' (outputDir "en_dict.fscd") $ outputDir "spell-dict" "en_dict.fscd" diff --git a/src/Rules/LibIME.hs b/src/Rules/LibIME.hs index 4868b6e9..77d9fc76 100644 --- a/src/Rules/LibIME.hs +++ b/src/Rules/LibIME.hs @@ -37,22 +37,25 @@ libIMEToolsRule = do "host-fcitx5" ] let libIMESrc = "libime" + let buildDir = outputDir "libime-build-host" + let hostPrefix = outputDir "host" cmd_ "cmake" "-B" - (libIMESrc "build-host") + buildDir "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_INSTALL_PREFIX=" <> outputDir, - "-DCMAKE_FIND_ROOT_PATH=" <> outputDir, + "-DCMAKE_INSTALL_PREFIX=" <> hostPrefix, + "-DCMAKE_FIND_ROOT_PATH=" <> hostPrefix, -- for find_package + "-DCMAKE_PREFIX_PATH=" <> hostPrefix, -- for pkg_check_modules "-DENABLE_TEST=OFF" ] libIMESrc cmd_ "cmake" "--build" - (libIMESrc "build-host") + buildDir "--target" [ "libime_slm_build_binary", "libime_prediction", @@ -61,10 +64,10 @@ libIMEToolsRule = do "libime_tabledict" ] -- ignore install errors - Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "lib" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "header" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "tools" - Exit _ <- cmd "cmake" "--install" (libIMESrc "build-host") "--component" "Devel" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "lib" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "header" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "tools" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "Devel" pure () -------------------------------------------------------------------------------- diff --git a/src/Rules/LibIMEJyutping.hs b/src/Rules/LibIMEJyutping.hs index ede90fe1..2c1a33c4 100644 --- a/src/Rules/LibIMEJyutping.hs +++ b/src/Rules/LibIMEJyutping.hs @@ -17,23 +17,26 @@ jyutpingToolsRule = do "libime-jyutping-tools" ~> do need ["libime-tools"] let libIMEJyutpingSrc = "libime-jyutping" + let buildDir = outputDir "libime-jyutping-build-host" + let hostPrefix = outputDir "host" cmd_ "cmake" "-B" - (libIMEJyutpingSrc "build-host") + buildDir "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_INSTALL_PREFIX=" <> outputDir, - "-DCMAKE_PREFIX_PATH=" <> outputDir, + "-DCMAKE_INSTALL_PREFIX=" <> hostPrefix, + "-DCMAKE_FIND_ROOT_PATH=" <> hostPrefix, -- for find_package + "-DCMAKE_PREFIX_PATH=" <> hostPrefix, -- for pkg_check_modules "-DENABLE_TEST=OFF", "-DENABLE_ENGINE=OFF" ] libIMEJyutpingSrc - cmd_ "cmake" "--build" (libIMEJyutpingSrc "build-host") "--target" "libime_jyutpingdict" + cmd_ "cmake" "--build" buildDir "--target" "libime_jyutpingdict" -- ignore install errors - Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build-host") "--component" "lib" - Exit _ <- cmd "cmake" "--install" (libIMEJyutpingSrc "build-host") "--component" "tools" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "lib" + Exit _ <- cmd "cmake" "--install" buildDir "--component" "tools" pure () jyutpingDictRule :: Rules () diff --git a/src/Rules/ZSTD.hs b/src/Rules/ZSTD.hs index 760bce5c..572e93ca 100644 --- a/src/Rules/ZSTD.hs +++ b/src/Rules/ZSTD.hs @@ -41,14 +41,16 @@ hostLibzstdRule :: Rules () hostLibzstdRule = do "host-libzstd" ~> do let zstdSrc = "zstd" + let buildDir = outputDir "zstd-build-host" + let hostPrefix = outputDir "host" cmd_ "cmake" "-B" - (zstdSrc "build-host") + buildDir "-G" "Ninja" [ "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_INSTALL_PREFIX=" <> outputDir, + "-DCMAKE_INSTALL_PREFIX=" <> hostPrefix, "-DZSTD_LEGACY_SUPPORT=OFF", "-DZSTD_BUILD_PROGRAMS=OFF", "-DZSTD_BUILD_TESTS=OFF" @@ -57,8 +59,8 @@ hostLibzstdRule = do cmd_ "cmake" "--build" - (zstdSrc "build-host") + buildDir cmd_ "cmake" "--install" - (zstdSrc "build-host") + buildDir From cb57cda2239dcdc9304835a296587d4e6936a5b2 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 23:07:36 +0800 Subject: [PATCH 31/32] cleanup build deps --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ce100f7..73e93f5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,13 @@ jobs: - name: Install build dependencies run: | pacman -Syu --needed --noconfirm \ - git unzip ghc cabal-install haskell-shake haskell-aeson-pretty \ - cmake extra-cmake-modules ninja boost python opencc jre-openjdk gperf + git \ + ghc cabal-install haskell-shake haskell-aeson-pretty \ + cmake extra-cmake-modules ninja \ + jre-openjdk \ + boost \ + python opencc \ + gperf - name: Fetch source code uses: actions/checkout@v4 From d32643bd453ace84808247064a0000307fdb2908 Mon Sep 17 00:00:00 2001 From: Rocka Date: Sat, 5 Apr 2025 23:14:59 +0800 Subject: [PATCH 32/32] fixup --- .github/workflows/ci.yml | 5 +++-- README.md | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73e93f5e..473be9b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,13 @@ jobs: steps: - name: Install build dependencies + # android-actions/setup-android needs unzip + # sdkmanager needs jre run: | pacman -Syu --needed --noconfirm \ - git \ + git unzip jre-openjdk \ ghc cabal-install haskell-shake haskell-aeson-pretty \ cmake extra-cmake-modules ninja \ - jre-openjdk \ boost \ python opencc \ gperf diff --git a/README.md b/README.md index 76a51ce7..fdef0dac 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,22 @@ Build static libraries for [fcitx5-android](https://github.com/fcitx5-android/fc Cabal is required to build this project. -* NDK Vesion: `25.2.9519653` -* CMake Version: `3.22.1` +### Android related + * Android Platform (API Level): `23` -* `bash tar unzip curl git python ghc haskell-shake haskell-aeson-pretty cabal-install` -* `fcitx5` (`fcitx5-modules` on Debian): for `comp-spell-dict` -* `libime` (`libime-bin` on Debian) >= 1.0.5 : for various `libime_*` tools +* Android NDK: `28.0.13004108` +* CMake Version: `3.31.6` + +both can be installed with `sdkmanager` command line tool. + +### System dependencies + +* `tar curl git` +* `ghc haskell-shake haskell-aeson-pretty cabal-install`: haskell stuff +* `cmake extra-cmake-modules ninja`: cmake stuff +* `python`: build dep of `opencc` * `opencc`: for `opencc_dict` +* `gperf`: build dep of `libiconv` ## Libraries