Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
cache dir; shrink rime patch (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Jan 17, 2024
1 parent ebcd3dc commit 4b7b9ad
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
if: ${{ matrix.arch == 'x86_64' }}
run: ./check-validity.sh

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

release:
needs: build
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down
3 changes: 3 additions & 0 deletions cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory caches tarball of build dependencies
(downloaded from [prebuilder](https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases)),
which will be extracted to `/tmp/fcitx5`.
18 changes: 6 additions & 12 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name=$1
ROOT=`pwd`
ADDON_ROOT=$ROOT/fcitx5-$name
DESTDIR=$ROOT/build/$name
CACHE_DIR=$ROOT/cache

# This is the same with INSTALL_PREFIX of prebuilder
INSTALL_PREFIX=/tmp/fcitx5
Expand All @@ -14,29 +15,22 @@ else
ARCH=$2
fi

# TODO: prebuild all homebrew dependencies
if [[ $ARCH == x86_64 ]]; then
HOMEBREW_PREFIX=/usr/local
else
HOMEBREW_PREFIX=/opt/homebrew
fi

: "${CMAKE_BUILD_TYPE:=Release}"

install_deps() {
for dep in "$@"; do
file=$dep-$ARCH.tar.bz2
[[ -f ../$file ]] || wget -P .. https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases/download/latest/$file
tar xjvf ../$file -C $INSTALL_PREFIX
[[ -f $CACHE_DIR/$file ]] || wget -P $CACHE_DIR https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases/download/latest/$file
tar xjvf $CACHE_DIR/$file -C $INSTALL_PREFIX
done
}

f5m_configure() {
rm -rf build
PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig:$HOMEBREW_PREFIX/lib/pkgconfig cmake -B build -G Ninja \
PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DCMAKE_FIND_ROOT_PATH="/Library/Input Methods/Fcitx5.app/Contents;$INSTALL_PREFIX;$HOMEBREW_PREFIX" \
-DCMAKE_FIND_ROOT_PATH="/Library/Input Methods/Fcitx5.app/Contents;$INSTALL_PREFIX" \
-DCMAKE_OSX_ARCHITECTURES=$ARCH "$@"
}

Expand All @@ -49,7 +43,7 @@ f5m_install() {
DESTDIR=$DESTDIR cmake --install build
for dep in "$@"; do
file=$dep-$ARCH.tar.bz2
tar xjvf ../$file -C $DESTDIR$INSTALL_PREFIX share
tar xjvf $CACHE_DIR/$file -C $DESTDIR$INSTALL_PREFIX share
done
}

Expand Down
2 changes: 1 addition & 1 deletion fcitx5-rime
15 changes: 1 addition & 14 deletions patches/rime.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fdc402..3d05b15 100644
index 6233bea..9958710 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,8 @@ find_package(PkgConfig REQUIRED)
Expand All @@ -12,16 +12,3 @@ index 6fdc402..3d05b15 100644
endif()

if ("${Rime_VERSION}" VERSION_LESS "1.7.0")
diff --git a/src/rimeengine.cpp b/src/rimeengine.cpp
index e9e9d8d..0965f92 100644
--- a/src/rimeengine.cpp
+++ b/src/rimeengine.cpp
@@ -291,7 +291,7 @@ RimeEngine::RimeEngine(Instance *instance)
: instance_(instance), api_(EnsureRimeApi()),
factory_([this](InputContext &ic) { return new RimeState(this, ic); }),
sessionPool_(this, getSharedStatePolicy()) {
- if constexpr (isAndroid()) {
+ if constexpr (true) {
const auto &sp = fcitx::StandardPath::global();
std::string defaultYaml = sp.locate(fcitx::StandardPath::Type::Data,
"rime-data/default.yaml");
2 changes: 1 addition & 1 deletion scripts/chinese-addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ f5m_configure "${ARGS[@]}"
f5m_build
f5m_install libime
# Install zh_CN.lm and zh_CN.lm.predict which are not in share
tar xjvf ../libime-$ARCH.tar.bz2 -C $DESTDIR$INSTALL_PREFIX lib/libime
tar xjvf $CACHE_DIR/libime-$ARCH.tar.bz2 -C $DESTDIR$INSTALL_PREFIX lib/libime
f5m_make_tarball

0 comments on commit 4b7b9ad

Please sign in to comment.