This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1adfaaf
commit 603df86
Showing
8 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
env: | ||
EMSCRIPTEN_VERSION: '3.1.64' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt install -y ninja-build \ | ||
extra-cmake-modules \ | ||
gettext \ | ||
marisa | ||
./install-deps.sh | ||
- name: Install emsdk | ||
run: | | ||
git clone https://github.com/emscripten-core/emsdk | ||
cd emsdk | ||
./emsdk install ${{ env.EMSCRIPTEN_VERSION }} | ||
./emsdk activate ${{ env.EMSCRIPTEN_VERSION }} | ||
- name: Build | ||
run: | | ||
. emsdk/emsdk_env.sh | ||
python scripts/hallelujah.py | ||
- name: Release | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
uses: 'marvinpinto/action-automatic-releases@latest' | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
automatic_release_tag: latest | ||
prerelease: true | ||
title: "Nightly Build" | ||
files: | | ||
build/*.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
*.tar.bz2 | ||
build | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-js-prebuilder/releases)), | ||
which will be extracted to `build/sysroot/usr`. |
Submodule fcitx5-hallelujah
updated
3 files
+1 −0 | src/hallelujah.cpp | |
+2 −2 | src/hallelujah.h | |
+1 −1 | test/testhallelujah.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
deps=( | ||
json-c | ||
marisa | ||
) | ||
|
||
EXTRACT_DIR=build/sysroot/usr | ||
mkdir -p $EXTRACT_DIR | ||
|
||
for dep in "${deps[@]}"; do | ||
file=$dep.tar.bz2 | ||
[[ -f cache/$file ]] || wget -P cache https://github.com/fcitx-contrib/fcitx5-js-prebuilder/releases/download/latest/$file | ||
tar xjvf cache/$file -C $EXTRACT_DIR | ||
done | ||
|
||
file=fcitx5-js-dev.tar.bz2 | ||
[[ -f cache/$file ]] || wget -P cache https://github.com/fcitx-contrib/fcitx5-js/releases/download/latest/$file | ||
tar xjvf cache/$file -C $EXTRACT_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 02daeea..17cf5c9 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.6.0) | ||
|
||
project(fcitx5-hallelujah VERSION 5.0.0) | ||
|
||
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) | ||
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-sSIDE_MODULE") | ||
+set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-sSIDE_MODULE") | ||
+ | ||
find_package(ECM 1.0.0 REQUIRED) | ||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) | ||
include(FeatureSummary) | ||
@@ -33,7 +37,7 @@ endif() | ||
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-hallelujah\") | ||
fcitx5_add_i18n_definition() | ||
|
||
-include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake") | ||
+include("../build/sysroot${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake") | ||
|
||
add_subdirectory(src) | ||
if (ENABLE_TEST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import os | ||
|
||
INSTALL_PREFIX = '/usr' | ||
|
||
|
||
def ensure(program: str, args: list[str]): | ||
command = " ".join([program, *args]) | ||
print(command) | ||
if os.system(command) != 0: | ||
raise Exception("Command failed") | ||
|
||
|
||
class Builder: | ||
def __init__(self, name: str, options: list[str] | None=None): | ||
self.name = name | ||
self.root = os.getcwd() | ||
self.destdir = f'{self.root}/build/{self.name}' | ||
self.options = options or [] | ||
|
||
def patch(self): | ||
os.chdir(f'{self.root}/fcitx5-{self.name}') | ||
file = f'../patches/{self.name}.patch' | ||
if os.system('git diff --ignore-submodules --exit-code > /dev/null') == 0 and os.path.isfile(file): | ||
ensure('git', ['apply', file]) | ||
ensure('sed', [ | ||
'-i', | ||
f'"s|\\"/usr/include|\\"{self.root}/build/sysroot/usr/include|g"', | ||
'$(find ../build/sysroot/usr -name "*.cmake")' | ||
]) | ||
ensure('sed', [ | ||
'-i', | ||
f'"s|=/usr/include|={self.root}/build/sysroot/usr/include|g"', | ||
'$(find ../build/sysroot/usr -name "*.pc")' | ||
]) | ||
|
||
def configure(self): | ||
os.environ['PKG_CONFIG_PATH'] = f'{self.root}/build/sysroot/usr/lib/pkgconfig' | ||
ensure('emcmake', ['cmake', | ||
'-B', 'build', '-G', 'Ninja', | ||
f'-DCMAKE_INSTALL_PREFIX={INSTALL_PREFIX}', | ||
f'-DCMAKE_FIND_ROOT_PATH="{self.root}/build/sysroot/usr;/usr"', | ||
'-DCMAKE_BUILD_TYPE=Release', | ||
*self.options | ||
]) | ||
|
||
def build(self): | ||
ensure('cmake', ['--build', 'build']) | ||
|
||
def install(self): | ||
os.environ['DESTDIR'] = self.destdir | ||
ensure('cmake', ['--install', 'build']) | ||
|
||
def package(self): | ||
os.chdir(f'{self.destdir}{INSTALL_PREFIX}') | ||
ensure('tar', ['cjvf', f'{self.destdir}.tar.bz2', '*']) | ||
|
||
def exec(self): | ||
self.patch() | ||
self.configure() | ||
ensure('sed', [ | ||
'-i', | ||
f'"s|-I/usr|-I{self.root}/build/sysroot/usr|g"', | ||
'build/build.ninja' | ||
]) | ||
ensure('sed', [ | ||
'-i', | ||
f'"s|-isystem /usr|-isystem {self.root}/build/sysroot/usr|g"', | ||
'build/build.ninja' | ||
]) | ||
self.build() | ||
self.install() | ||
self.package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from common import Builder | ||
|
||
Builder('hallelujah', [ | ||
'-DENABLE_TEST=OFF' | ||
]).exec() |