Skip to content

Commit

Permalink
add chinese-addons (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf authored Dec 29, 2023
1 parent b9f5e02 commit aabe203
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
fmt \
extra-cmake-modules \
json-c \
lua \
boost \
opencc \
ninja
- name: Setup arm homebrew
Expand All @@ -45,6 +48,9 @@ jobs:
json-c \
gettext \
openssl@3 \
lua \
boost \
opencc \
libevent
wget https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases/download/latest/local-x86_64.tar.bz2
tar xjvf local-x86_64.tar.bz2 -C /usr/local --strip-components=1 # need marisa-build
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "fcitx5-hallelujah"]
path = fcitx5-hallelujah
url = https://github.com/fcitx-contrib/fcitx5-hallelujah
[submodule "fcitx5-chinese-addons"]
path = fcitx5-chinese-addons
url = [email protected]:fcitx/fcitx5-chinese-addons.git
[submodule "fcitx5-lua"]
path = fcitx5-lua
url = https://github.com/fcitx/fcitx5-lua.git
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
Build plugins for [fcitx5-macos](https://github.com/fcitx-contrib/fcitx5-macos).

## Plugins
### Chinese
* [chinese-addons](https://github.com/fcitx/fcitx5-chinese-addons): LGPL-2.1-or-later

### English
* [hallelujah](https://github.com/fcitx-contrib/fcitx5-hallelujah): GPL-3.0-only

### Other
* [lua](https://github.com/fcitx/fcitx5-lua): LGPL-2.1-or-later
(NOT WORKING)

## Manual installation
```sh
tar -xjvC /usr/local -f hallelujah-x86_64.tar.bz2
Expand Down
13 changes: 12 additions & 1 deletion all.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
#!/bin/bash

set -e
scripts/hallelujah.sh $1

all_plugins=(
lua
hallelujah
chinese-addons # Optional dependency: lua
)

for plugin in "${all_plugins[@]}"; do
scripts/$plugin.sh $1
done
24 changes: 15 additions & 9 deletions common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name=$1
export DESTDIR=`pwd`/build/$name
cd fcitx5-$name

ROOT=`pwd`
ADDON_ROOT=$ROOT/fcitx5-$name
DESTDIR=$ROOT/build/$name

if [[ -z $2 ]]; then
ARCH=`uname -m`
Expand All @@ -14,23 +16,27 @@ else
HOMEBREW_PREFIX=/opt/homebrew
fi

cbr() {
f5m_configure() {
# Install plugins to /usr/local for both arm and x86 to ease fcitx5 search
PKG_CONFIG_PATH=$HOMEBREW_PREFIX/lib/pkgconfig cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH="/Library/Input Methods/Fcitx5.app/Contents;$HOMEBREW_PREFIX" \
-DCMAKE_OSX_ARCHITECTURES=$ARCH "$@"
}

cb() {
f5m_build() {
cmake --build build
}

ci() {
cmake --install build
f5m_install() {
cmake --install build # install for other plugins
DESTDIR=$DESTDIR cmake --install build # install for package
}

tbz() {
cd $DESTDIR/..
tar cjvf $name-$ARCH.tar.bz2 -C $name/usr/local lib share
f5m_make_tarball() {
cd $DESTDIR/usr/local
tar cjvf ../../../$name-$ARCH.tar.bz2 *
}

set -x
cd $ADDON_ROOT
1 change: 1 addition & 0 deletions fcitx5-chinese-addons
Submodule fcitx5-chinese-addons added at d84878
1 change: 1 addition & 0 deletions fcitx5-lua
Submodule fcitx5-lua added at 6e0221
16 changes: 16 additions & 0 deletions scripts/chinese-addons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set -e
. ./common.sh chinese-addons $1

ARGS=(
-DENABLE_TEST=OFF
-DENABLE_GUI=OFF
)

if [[ $ARCH != $(uname -m) ]]; then
ARGS+=("-DENABLE_DATA=OFF")
fi

f5m_configure "${ARGS[@]}"
f5m_build
f5m_install
f5m_make_tarball
10 changes: 6 additions & 4 deletions scripts/hallelujah.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set -e

. ./common.sh hallelujah $1
cbr -D ENABLE_TEST=OFF
cb
ci
tbz

f5m_configure -DENABLE_TEST=OFF
f5m_build
f5m_install
f5m_make_tarball
9 changes: 9 additions & 0 deletions scripts/lua.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -e
. ./common.sh lua $1

# Turning on dlopen produces wrong config.h,
# and even fixed it will hard-code lua dylib path in code.
f5m_configure -DENABLE_TEST=OFF -DUSE_DLOPEN=OFF
f5m_build
f5m_install
f5m_make_tarball

0 comments on commit aabe203

Please sign in to comment.