Skip to content

Commit

Permalink
fake find fcitx5 packages in engines to reduce patch (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Nov 16, 2024
1 parent 9800da7 commit 122e0ba
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 57 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ function(copy_to_keyboard cmd file relative_path)
\")
endfunction()

function(copy_share_to_keyboard cmd relative_path)
copy_to_keyboard(${cmd} "${PREBUILDER_SHARE_DIR}/${relative_path}" "share/${relative_path}")
endfunction()

function(copy_to_app cmd file relative_path)
add_custom_command(TARGET ${BUNDLE_NAME}
POST_BUILD COMMAND /bin/sh -c \"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ git apply --directory=engines/fcitx5-rime patches/rime.patch # if building with
### Build with CMake
```sh
cmake -B build -G Xcode \
-DURL_SCHEME=fcitx \
-DRIME=ON \
-DCMAKE_TOOLCHAIN_FILE=cmake/ios.cmake \
-DIOS_PLATFORM=SIMULATOR
Expand Down
1 change: 1 addition & 0 deletions cmake/Fcitx5Utils/Fcitx5CompilerSettings.cmake
2 changes: 2 additions & 0 deletions cmake/FindFcitx5Core.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(Fcitx5Core_FOUND TRUE)
find_package(Fcitx5Utils REQUIRED MODULE)
1 change: 1 addition & 0 deletions cmake/FindFcitx5Module.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(Fcitx5Module_FOUND TRUE)
6 changes: 6 additions & 0 deletions cmake/FindFcitx5Utils.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(Fcitx5Utils_FOUND TRUE)

# dependent projects usually use
# "${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake"
# to locate Fcitx5CompilerSettings
set(FCITX_INSTALL_CMAKECONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}")
22 changes: 0 additions & 22 deletions patches/hallelujah.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ffcf34..a57a061 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,8 +12,6 @@ option(ENABLE_TEST "Build Test" On)
option(BUILD_DATA "Build data" On)

find_package(Gettext REQUIRED)
-find_package(Fcitx5Core 5.1.9 REQUIRED)
-find_package(Fcitx5Module REQUIRED COMPONENTS Spell TestFrontend)
find_package(PkgConfig REQUIRED)

if (NOT TARGET fmt::fmt)
@@ -33,7 +31,7 @@ endif()
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-hallelujah\")
fcitx5_add_i18n_definition()

-include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
+include("../../fcitx5/cmake/Fcitx5CompilerSettings.cmake")

add_subdirectory(src)
if (ENABLE_TEST)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bf6da01..e117fa5 100644
--- a/src/CMakeLists.txt
Expand Down
34 changes: 0 additions & 34 deletions patches/rime.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1637a..92a41e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,8 +10,6 @@ include(ECMSetupVersion)
include(ECMUninstallTarget)

find_package(Gettext REQUIRED)
-find_package(Fcitx5Core 5.1.11 REQUIRED)
-find_package(Fcitx5Module REQUIRED COMPONENTS Notifications)
find_package(PkgConfig REQUIRED)
find_package(Pthread REQUIRED)

@@ -45,7 +43,7 @@ add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-rime\")
add_definitions(-DFCITX_RIME_VERSION=\"${PROJECT_VERSION}\")
fcitx5_add_i18n_definition()

-include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
+include("../../fcitx5/cmake/Fcitx5CompilerSettings.cmake")

add_subdirectory(po)
add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 78ef79b..c4abccd 100644
--- a/src/CMakeLists.txt
Expand Down Expand Up @@ -119,15 +97,3 @@ index 49fc5b8..b3212fa 100644
blockMessage = true;
}
} else if (messageType == "option") {
diff --git a/src/rimefactory.cpp b/src/rimefactory.cpp
index 91a2f37..b061d11 100644
--- a/src/rimefactory.cpp
+++ b/src/rimefactory.cpp
@@ -11,7 +11,6 @@
namespace fcitx {

AddonInstance *RimeEngineFactory::create(AddonManager *manager) {
- registerDomain("fcitx5-rime", FCITX_INSTALL_LOCALEDIR);
return new RimeEngine(manager->instance());
}

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if (RIME)
set(RIME_BINARY_DIR "${PROJECT_BINARY_DIR}/engines/fcitx5-rime")
copy_to_keyboard(copy "${RIME_BINARY_DIR}/src/rime-addon.conf" "${ADDON_PREFIX}/rime.conf")
copy_to_keyboard(copy "${RIME_BINARY_DIR}/src/rime.conf" "${IM_PREFIX}/rime.conf")
copy_to_keyboard(copy_directory "${PREBUILDER_SHARE_DIR}/rime-data" "share/rime-data")
copy_share_to_keyboard(copy_directory "rime-data")
endif()

# Embed keyboard.appex in app.
Expand Down

0 comments on commit 122e0ba

Please sign in to comment.