Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,26 @@ jobs:
- name: Build vanilla edition
run: |
python package.py $tag
mv build/src/Fcitx5Installer.zip .
rm -rf build
mv build/universal/src/Fcitx5Installer.zip .
rm -rf build/universal

- name: Build Pinyin edition
run: |
python package.py $tag 拼音版 chinese-addons,lua pinyin true
mv build/src/Fcitx5Installer.zip Fcitx5-Pinyin.zip
rm -rf build
mv build/universal/src/Fcitx5Installer.zip Fcitx5-Pinyin.zip
rm -rf build/universal

- name: Build Rime edition
run: |
python package.py $tag 中州韵版 rime rime true
mv build/src/Fcitx5Installer.zip Fcitx5-Rime.zip
rm -rf build
mv build/universal/src/Fcitx5Installer.zip Fcitx5-Rime.zip
rm -rf build/universal

- name: Build Japanese edition
run: |
python package.py $tag 日本語版 mozc mozc true
mv build/src/Fcitx5Installer.zip Fcitx5-Japanese.zip
rm -rf build
mv build/universal/src/Fcitx5Installer.zip Fcitx5-Japanese.zip
rm -rf build/universal

- name: Upload artifact
if: ${{ github.event_name == 'pull_request' }}
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 4.0)
cmake_minimum_required(VERSION 4.3)

set(CMAKE_OSX_DEPLOYMENT_TARGET 13.3)
set(CMAKE_Swift_COMPILER_TARGET "${CMAKE_OSX_ARCHITECTURES}-apple-macos${CMAKE_OSX_DEPLOYMENT_TARGET}")

project(fcitx5-macos-installer LANGUAGES Swift)

list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

set(CMAKE_OSX_DEPLOYMENT_TARGET 13)
set(F5M_TARGET "${CMAKE_OSX_ARCHITECTURES}-apple-macos${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_compile_options(-target "${F5M_TARGET}")
add_link_options(-target "${F5M_TARGET}")
add_compile_options(-target "${CMAKE_Swift_COMPILER_TARGET}")
add_link_options(-target "${CMAKE_Swift_COMPILER_TARGET}")
set(CMAKE_Swift_LANGUAGE_VERSION 6)

set(APP_NAME Fcitx5Installer)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ English

# Fcitx5 macOS Installer

Support macOS >= 13
Support macOS 13.3.

## Packaging
```sh
Expand Down
13 changes: 5 additions & 8 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

# 小企鹅输入法 macOS 版安装器

支持 macOS >= 13
支持 macOS 13.3。

请选择适合您的安装包:
* [拼音版](https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Pinyin.zip)(可选双拼、五笔、仓颉等,中、英切换快捷键为 Ctrl + 左 Shift)
* [中州韵版](https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Rime.zip)(可在`高级`中导入本地鼠须管的方案,或小企鹅 Android 版/仓输入法的备份文件;小企鹅的 rime 用户目录为 `~/.local/share/fcitx5/rime`)
* [原装版](https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5Installer.zip)(不适合新手,通过内置的`插件管理器`按需安装输入法)

安装包本身适用于 Intel 和 Apple Silicon,
但会根据您的机器类型,
安装单一架构的输入法,
减少不必要的空间占用。
安装包本身适用于 Intel 和 Apple Silicon,但会根据您的机器类型,安装单一架构的输入法,减少不必要的空间占用。

当您解压并打开安装程序时,系统可能阻止您打开未认证的程序。

Expand All @@ -41,15 +38,15 @@

### 拼音版
```sh
cd /tmp && rm -rf Fcitx5Installer.app && curl -LO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Pinyin.zip && unzip Fcitx5-Pinyin.zip && open Fcitx5Installer.app
cd /tmp && rm -rf Fcitx5Installer.app && curl -fsSLO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Pinyin.zip && unzip Fcitx5-Pinyin.zip && open Fcitx5Installer.app
```

### 中州韵版
```sh
cd /tmp && rm -rf Fcitx5Installer.app && curl -LO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Rime.zip && unzip Fcitx5-Rime.zip && open Fcitx5Installer.app
cd /tmp && rm -rf Fcitx5Installer.app && curl -fsSLO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5-Rime.zip && unzip Fcitx5-Rime.zip && open Fcitx5Installer.app
```

### 原装版
```sh
cd /tmp && rm -rf Fcitx5Installer.app && curl -LO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5Installer.zip && unzip Fcitx5Installer.zip && open Fcitx5Installer.app
cd /tmp && rm -rf Fcitx5Installer.app && curl -fsSLO https://github.com/fcitx-contrib/fcitx5-macos-installer/releases/download/latest/Fcitx5Installer.zip && unzip Fcitx5Installer.zip && open Fcitx5Installer.app
```
37 changes: 22 additions & 15 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@


ARCHES = ('x86_64', 'arm64')
CONTENTS_DIR = 'build/src/Fcitx5Installer.app/Contents'
BUILD_DIR = 'build/universal'
CONTENTS_DIR = f'{BUILD_DIR}/src/Fcitx5Installer.app/Contents'
INFO_PLIST = f'{CONTENTS_DIR}/Info.plist'
RESOURCES_DIR = f'{CONTENTS_DIR}/Resources'
EXECUTABLE_DIR = f'{CONTENTS_DIR}/MacOS'
EXECUTABLE = f'{EXECUTABLE_DIR}/Fcitx5Installer'
REGISTER_IM = 'build/im/register_im'
ENABLE_IM = 'build/im/enable_im'
REGISTER_IM = f'{BUILD_DIR}/im/register_im'
ENABLE_IM = f'{BUILD_DIR}/im/enable_im'
PLUGINS_DIR = f'{RESOURCES_DIR}/plugins'
CONFIG_DIR = f'{RESOURCES_DIR}/config'


def arm(path: str):
return path.replace('universal', 'arm64')


def x86(path: str):
return path.replace('universal', 'x86_64')


def sh(command: str):
print(command)
assert os.system(command) == 0
Expand All @@ -30,7 +40,7 @@ def download(url: str, key: str, path: str):
print(f'Using cached {key}')
else:
print(f'Downloading {key}')
sh(f'curl -L -o {cache_path} {url}')
sh(f'curl -fsSLo {cache_path} {url}')
sh(f'cp {cache_path} {path}')

def write_meta(tag: str):
Expand Down Expand Up @@ -65,25 +75,22 @@ def build():
sh(f'mkdir -p "{RESOURCES_DIR}"')
for arch in ARCHES:
print(f'Building {arch}')
sh(f'cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES={arch}')
sh('cmake --build build')
for exe in (EXECUTABLE, REGISTER_IM, ENABLE_IM):
sh(f'mv {exe} {exe}-{arch}')
sh(f'cmake -B build/{arch} -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES={arch}')
sh(f'cmake --build build/{arch}')
print('Generating universal')
sh(f'lipo -create {EXECUTABLE}-x86_64 {EXECUTABLE}-arm64 -output {EXECUTABLE}')
sh(f'lipo -create {REGISTER_IM}-x86_64 {REGISTER_IM}-arm64 -output {RESOURCES_DIR}/register_im')
sh(f'lipo -create {ENABLE_IM}-x86_64 {ENABLE_IM}-arm64 -output {RESOURCES_DIR}/enable_im')
for arch in ARCHES:
sh(f'rm {EXECUTABLE}-{arch}')
sh(f'mkdir -p {EXECUTABLE_DIR}')
sh(f'lipo -create {x86(EXECUTABLE)} {arm(EXECUTABLE)} -output {EXECUTABLE}')
sh(f'lipo -create {x86(REGISTER_IM)} {arm(REGISTER_IM)} -output {RESOURCES_DIR}/register_im')
sh(f'lipo -create {x86(ENABLE_IM)} {arm(ENABLE_IM)} -output {RESOURCES_DIR}/enable_im')

sh(f'cp {arm(INFO_PLIST)} {INFO_PLIST}')
sh(f'cp assets/fcitx.icns "{RESOURCES_DIR}"')

for name in os.listdir('assets'):
if name.endswith('.lproj'):
sh(f'cp -r assets/{name} "{RESOURCES_DIR}"')

sh(f'cp install.sh "{RESOURCES_DIR}"')
sh(f'rm -f "${EXECUTABLE_DIR}/Fcitx5Installer.d"')


def download_fcitx5(tag: str):
Expand Down Expand Up @@ -156,7 +163,7 @@ def generate_config():


def make_zip():
os.chdir('build/src')
os.chdir(f'{BUILD_DIR}/src')
sh('zip -r -0 Fcitx5Installer.zip Fcitx5Installer.app')


Expand Down