Skip to content

Commit c052aa7

Browse files
committed
separated core module and fcitx5 part
*separated module is added as submodule. *github CI action for release may not work after this update. if fails need to build install using build instructions from readme
1 parent 376493c commit c052aa7

File tree

13 files changed

+407
-1536
lines changed

13 files changed

+407
-1536
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# .github/workflows/build.yml
21
name: Build & Test
32

43
on:
@@ -19,12 +18,16 @@ jobs:
1918
CC: ${{ matrix.cc }}
2019
CXX: ${{ matrix.cc == 'gcc' && 'g++' || 'clang++' }}
2120
steps:
22-
- uses: actions/checkout@v4
21+
- name: Checkout repository and submodules
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: 'recursive'
2325

2426
- name: Install distro dependencies
2527
run: |
2628
sudo apt-get update
2729
sudo apt-get install -y \
30+
build-essential \
2831
cmake ninja-build extra-cmake-modules \
2932
libfcitx5core-dev libfcitx5utils-dev libfcitx5config-dev \
3033
libsqlite3-dev qt6-base-dev qt6-base-dev-tools libicu-dev \
@@ -34,21 +37,18 @@ jobs:
3437
run: |
3538
cmake -B build -G Ninja \
3639
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
40+
-DCMAKE_INSTALL_PREFIX=/usr \
3741
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
3842
3943
- name: Build
4044
run: cmake --build build
4145

42-
- name: Test (CTest)
43-
run: |
44-
cd build
45-
ctest --output-on-failure || true # add real tests later
46+
- name: Stage install files into dist/ directory
47+
run: DESTDIR=dist cmake --install build
4648

4749
- name: Upload build artefacts
4850
uses: actions/upload-artifact@v4
4951
with:
5052
name: linux-${{ matrix.cc }}-${{ matrix.build_type }}
51-
path: |
52-
build/*.so
53-
build/lekhika-trainer
54-
build/Testing/Temporary/LastTest.log
53+
path: dist/
54+

.github/workflows/release.yml

Lines changed: 88 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@ jobs:
1414
tarball: ${{ steps.src.outputs.tarball }}
1515
version: ${{ steps.src.outputs.version }}
1616
steps:
17-
- uses: actions/checkout@v4
17+
- name: Checkout repository and submodules
18+
uses: actions/checkout@v4
1819
with:
19-
fetch-depth: 0
20+
fetch-depth: 0
21+
submodules: 'recursive'
22+
- id: version
23+
run: echo "version=$(cat version.txt)" >> "$GITHUB_OUTPUT"
2024
- name: Update metainfo
2125
run: ./update-metainfo.sh
22-
2326
- id: src
2427
run: |
2528
VER=${GITHUB_REF_NAME#v}
2629
TAR="fcitx5-lekhika-${VER}.tar.gz"
27-
git archive --format=tar.gz --prefix="fcitx5-lekhika-${VER}/" \
28-
-o "$TAR" "$GITHUB_REF_NAME"
30+
# Create a source tarball that includes the submodule content
31+
git archive --format=tar --prefix="fcitx5-lekhika-${VER}/" HEAD | (cd liblekhika && git archive --format=tar --prefix="fcitx5-lekhika-${VER}/liblekhika/" HEAD) | gzip > "$TAR"
2932
echo "tarball=$TAR" >> "$GITHUB_OUTPUT"
30-
echo "version=$VER" >> "$GITHUB_OUTPUT"
3133
- uses: actions/upload-artifact@v4
3234
with:
3335
name: source-tarball
@@ -45,10 +47,9 @@ jobs:
4547
sudo apt-get update
4648
sudo apt-get install -y --no-install-recommends \
4749
build-essential dpkg-dev debhelper devscripts \
48-
cmake ninja-build \
50+
cmake ninja-build extra-cmake-modules \
4951
libfcitx5core-dev libfcitx5utils-dev libfcitx5config-dev \
50-
libsqlite3-dev qt6-base-dev libicu-dev libgl-dev
51-
- uses: actions/checkout@v4
52+
libsqlite3-dev qt6-base-dev libicu-dev
5253
- uses: actions/download-artifact@v4
5354
with:
5455
name: source-tarball
@@ -57,66 +58,66 @@ jobs:
5758
mkdir pkg && tar -xf *.tar.gz -C pkg --strip-components=1
5859
cd pkg
5960
mkdir -p debian
60-
# control file
61+
# control file to define the two final packages
6162
{
6263
echo 'Source: fcitx5-lekhika'
6364
echo 'Section: utils'
6465
echo 'Priority: optional'
6566
echo 'Maintainer: KHUMNATH CG<nath.khum@gmail.com>'
66-
echo 'Build-Depends: debhelper-compat (= 13), cmake, ninja-build,'
67+
echo 'Build-Depends: debhelper-compat (= 13), cmake, ninja-build, extra-cmake-modules,'
6768
echo ' libfcitx5core-dev, libfcitx5utils-dev, libfcitx5config-dev,'
68-
echo ' libsqlite3-dev, qt6-base-dev, libicu-dev, libgl-dev'
69+
echo ' libsqlite3-dev, qt6-base-dev, libicu-dev'
6970
echo 'Standards-Version: 4.6.0'
7071
echo ''
7172
echo 'Package: fcitx5-lekhika'
7273
echo 'Architecture: any'
73-
echo 'Depends: ${shlibs:Depends}, ${misc:Depends}'
74-
echo 'Description: Lekhika input-method addon for Fcitx5'
74+
echo 'Depends: ${shlibs:Depends}, ${misc:Depends}, libfcitx5-qt1, libsqlite3-0, libicu70 | libicu71, libqt6core6'
75+
echo 'Description: Lekhika input-method addon for Fcitx5 (with bundled liblekhika)'
7576
echo ''
7677
echo 'Package: lekhika-trainer'
7778
echo 'Architecture: any'
7879
echo 'Depends: ${shlibs:Depends}, ${misc:Depends}, libqt6widgets6t64 | libqt6widgets6'
7980
echo 'Description: GUI training tool for fcitx5-lekhika'
8081
} > debian/control
81-
# Create .install files to map build artifacts to packages
82+
83+
# .install file for the main IME package, including liblekhika files
8284
{
85+
echo 'usr/lib/*/liblekhika.so.*'
86+
echo 'usr/share/lekhika-core/*'
8387
echo 'usr/lib/*/fcitx5/fcitx5lekhika.so'
8488
echo 'usr/share/fcitx5/addon/fcitx5lekhika.conf'
85-
echo 'usr/share/fcitx5/fcitx5-lekhika/*'
8689
echo 'usr/share/fcitx5/inputmethod/fcitx5lekhika.conf'
8790
echo 'usr/share/metainfo/fcitx5-lekhika.metainfo.xml'
8891
} > debian/fcitx5-lekhika.install
92+
93+
# .install file for the trainer GUI
8994
{
9095
echo 'usr/bin/lekhika-trainer'
9196
echo 'usr/share/applications/lekhika-trainer.desktop'
9297
echo 'usr/share/icons/hicolor/*/apps/*'
9398
echo 'usr/share/metainfo/lekhika-trainer.metainfo.xml'
9499
} > debian/lekhika-trainer.install
95-
# rules file with real TABs, overriding the auto-test step
100+
96101
printf '#!/usr/bin/make -f\n%%:\n\tdh $@ --buildsystem=cmake+ninja\noverride_dh_auto_configure:\n\tdh_auto_configure -- -DCMAKE_BUILD_TYPE=Release\noverride_dh_auto_test:\n' > debian/rules
97102
chmod +x debian/rules
103+
98104
export DEBEMAIL=nath.khum@gmail.com DEBFULLNAME="KHUMNATH CG"
99-
VER=$(cat version.txt)
105+
VER=${{ needs.source.outputs.version }}
100106
dch --create -v "${VER}-1" --package fcitx5-lekhika "CI build"
101107
dpkg-buildpackage -b -uc -us
102108
- name: Remove debug packages
103109
run: rm -f ./*.ddeb
104110
- name: Add t64 suffix for latest ubuntu build
105111
if: matrix.distro == 'ubuntu-latest'
106112
run: |
107-
# Rename all build artifacts with a _t64 suffix to avoid name collisions in the release.
108113
shopt -s nullglob
109-
for f in *.deb *.changes *.buildinfo; do
110-
new_name="${f%.*}_t64.${f##*.}"
111-
echo "Renaming $f to $new_name"
112-
mv -- "$f" "$new_name"
114+
for f in *.deb; do
115+
mv -- "$f" "${f%.deb}_t64.deb"
113116
done
114117
- uses: actions/upload-artifact@v4
115118
with:
116119
name: debian-packages-${{ matrix.distro }}
117-
path: |
118-
*deb
119-
*changes
120+
path: "*.deb"
120121

121122
rpm-fedora:
122123
needs: source
@@ -125,47 +126,56 @@ jobs:
125126
steps:
126127
- run: |
127128
dnf install -y rpm-build cmake ninja-build gcc-c++ \
128-
fcitx5-devel qt6-qtbase-devel sqlite-devel libicu-devel
129-
- uses: actions/checkout@v4
129+
fcitx5-devel qt6-qtbase-devel sqlite-devel libicu-devel qt6-qtwidgets-devel
130130
- uses: actions/download-artifact@v4
131131
with:
132132
name: source-tarball
133133
- run: |
134-
mkdir pkg && tar -xf *.tar.gz -C pkg --strip-components=1
135-
cd pkg
136-
VER=$(cat version.txt)
134+
VER=${{ needs.source.outputs.version }}
137135
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
138-
tar -czf ~/rpmbuild/SOURCES/fcitx5-lekhika-${VER}.tar.gz \
139-
--transform "s,^,fcitx5-lekhika-${VER}/," .
136+
cp *.tar.gz ~/rpmbuild/SOURCES/
140137
{
141-
echo "Name: fcitx5-lekhika"
138+
echo "Name: fcitx5-lekhika-meta" # A meta name for the spec file
142139
echo "Version: ${VER}"
143140
echo "Release: 1%{?dist}"
144-
echo "Summary: Lekhika input method for Fcitx5"
141+
echo "Summary: Lekhika input method for Fcitx5 and related tools"
145142
echo "License: GPL-3.0+"
146-
echo "Source0: %{name}-%{version}.tar.gz"
147-
echo "BuildRequires: cmake ninja-build gcc-c++ fcitx5-devel qt6-qtbase-devel sqlite-devel libicu-devel"
143+
echo "Source0: fcitx5-lekhika-%{version}.tar.gz"
144+
echo "BuildRequires: cmake, ninja-build, gcc-c++, fcitx5-devel, qt6-qtbase-devel, sqlite-devel, libicu-devel, qt6-qtwidgets-devel"
148145
echo "%description"
149-
echo "Lekhika input-method addon for Fcitx5"
146+
echo "This package provides the fcitx5-lekhika input method and its GUI trainer."
150147
echo "%prep"
151-
echo "%autosetup"
148+
echo "%autosetup -n fcitx5-lekhika-%{version}"
152149
echo "%build"
153150
echo "%cmake -DCMAKE_BUILD_TYPE=Release"
154151
echo "%cmake_build"
155152
echo "%install"
156153
echo "%cmake_install"
157-
echo "%files"
154+
155+
echo "%package -n fcitx5-lekhika"
156+
echo "Summary: Lekhika input method for Fcitx5 (with bundled liblekhika)"
157+
echo "Requires: fcitx5-qt, sqlite, libicu"
158+
echo "%description -n fcitx5-lekhika"
159+
echo "The core fcitx5-lekhika addon with its bundled runtime library."
160+
echo "%files -n fcitx5-lekhika"
161+
echo "%{_libdir}/liblekhika.so.*"
162+
echo "/usr/share/lekhika-core/*"
158163
echo "%{_libdir}/fcitx5/*.so"
159-
echo "%{_bindir}/lekhika-trainer"
160-
echo "%{_datadir}/metainfo/*.xml"
161164
echo "%{_datadir}/fcitx5/*"
165+
echo "%{_datadir}/metainfo/fcitx5-lekhika.metainfo.xml"
166+
167+
echo "%package -n lekhika-trainer"
168+
echo "Summary: GUI training tool for fcitx5-lekhika"
169+
echo "Requires: fcitx5-lekhika = %{version}-%{release}, qt6-qtwidgets"
170+
echo "%description -n lekhika-trainer"
171+
echo "A Qt-based GUI to manage the lekhika dictionary."
172+
echo "%files -n lekhika-trainer"
173+
echo "%{_bindir}/lekhika-trainer"
162174
echo "%{_datadir}/applications/*.desktop"
163175
echo "%{_datadir}/icons/hicolor/*/apps/lekhika.*"
164-
echo "%changelog"
165-
echo "* $(date +"%a %b %d %Y") KHUMNATH CG <nath.khum@gmail.com> - ${VER}-1"
166-
echo "- Automated build"
167-
} > ~/rpmbuild/SPECS/fcitx5-lekhika.spec
168-
rpmbuild -bb ~/rpmbuild/SPECS/fcitx5-lekhika.spec
176+
echo "%{_datadir}/metainfo/lekhika-trainer.metainfo.xml"
177+
} > ~/rpmbuild/SPECS/lekhika.spec
178+
rpmbuild -bb ~/rpmbuild/SPECS/lekhika.spec
169179
- name: Remove debug packages
170180
run: rm -f ~/rpmbuild/RPMS/*/*-debug{info,source}-*.rpm
171181
- uses: actions/upload-artifact@v4
@@ -178,9 +188,7 @@ jobs:
178188
runs-on: ubuntu-latest
179189
container: archlinux:latest
180190
steps:
181-
- run: |
182-
pacman -Sy --noconfirm base-devel cmake ninja fcitx5-qt sqlite qt6-base icu
183-
- uses: actions/checkout@v4
191+
- run: pacman -Sy --noconfirm base-devel cmake ninja fcitx5-qt sqlite qt6-base icu qt6-widgets
184192
- uses: actions/download-artifact@v4
185193
with:
186194
name: source-tarball
@@ -197,74 +205,70 @@ jobs:
197205
cd arch_build
198206
VER=$PKGVER
199207
{
200-
echo "pkgname=(fcitx5-lekhika lekhika-trainer)"
208+
echo "pkgname=('fcitx5-lekhika' 'lekhika-trainer')"
201209
echo "pkgver=${VER}"
202210
echo "pkgrel=1"
203-
echo "pkgdesc=\"Lekhika input method for Fcitx5\""
204-
echo "arch=(x86_64)"
211+
echo "arch=('x86_64')"
205212
echo "url=\"https://github.com/${GITHUB_REPOSITORY}\""
206-
echo "license=(GPL3)"
207-
echo "options=(\"!debug\")"
208-
echo "depends=(fcitx5 qt6-base icu sqlite)"
209-
echo "makedepends=(cmake ninja)"
210-
echo "source=(fcitx5-lekhika-\${pkgver}.tar.gz)"
213+
echo "license=('GPL3')"
214+
echo "makedepends=('cmake' 'ninja')"
215+
echo "source=(\"fcitx5-lekhika-\${pkgver}.tar.gz\")"
211216
echo "sha256sums=(\"SKIP\")"
212217
echo "build() {"
213218
echo " cd \"fcitx5-lekhika-\${pkgver}\""
214-
echo " cmake -B build -G Ninja \\"
215-
echo " -DCMAKE_BUILD_TYPE=Release \\"
216-
echo " -DCMAKE_INSTALL_PREFIX=/usr"
219+
echo " cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr"
217220
echo " cmake --build build"
218221
echo "}"
219222
echo "package_fcitx5-lekhika() {"
220-
echo " cd \"fcitx5-lekhika-\${pkgver}\""
221-
echo " DESTDIR=\"\$pkgdir\" cmake --install build --component Runtime"
223+
echo " pkgdesc=\"Lekhika input method for Fcitx5 (with bundled liblekhika)\""
224+
echo " depends=(\"fcitx5-qt\" \"sqlite\" \"icu\")"
225+
echo " cd \"fcitx5-lekhika-\${pkgver}/build\""
226+
# Install all runtime components, then remove trainer parts
227+
echo " DESTDIR=\"\$pkgdir\" cmake --install ."
228+
echo " rm -rf \"\$pkgdir/usr/bin/lekhika-trainer\""
229+
echo " rm -rf \"\$pkgdir/usr/share/applications/lekhika-trainer.desktop\""
230+
echo " rm -rf \"\$pkgdir/usr/share/metainfo/lekhika-trainer.metainfo.xml\""
231+
echo " rm -rf \"\$pkgdir/usr/bin/lekhika-cli\""
232+
echo " rm -rf \"\$pkgdir/usr/include\""
233+
echo " rm -rf \"\$pkgdir/usr/lib/cmake\""
222234
echo "}"
223235
echo "package_lekhika-trainer() {"
224-
echo " cd \"fcitx5-lekhika-\${pkgver}\""
225-
echo " DESTDIR=\"\$pkgdir\" cmake --install build --component Trainer"
236+
echo " pkgdesc=\"GUI training tool for fcitx5-lekhika\""
237+
echo " depends=(\"fcitx5-lekhika=\${pkgver}\" \"qt6-widgets\")"
238+
echo " cd \"fcitx5-lekhika-\${pkgver}/build\""
239+
echo " DESTDIR=\"\$pkgdir\" cmake --install . --component Trainer"
226240
echo "}"
227241
} > PKGBUILD
228-
makepkg -f
242+
makepkg -f --noconfirm
229243
'
230244
mv arch_build/*.pkg.tar.zst .
231245
- uses: actions/upload-artifact@v4
232246
with:
233247
name: arch-packages
234-
path: '*.pkg.tar.zst'
248+
path: "*.pkg.tar.zst"
235249

236250
release:
237251
needs: [source, deb, rpm-fedora, arch]
238252
runs-on: ubuntu-latest
239253
steps:
240-
- uses: actions/checkout@v4
241-
with:
242-
fetch-depth: 0
243254
- uses: actions/download-artifact@v4
244255
- run: |
245256
mkdir release
246257
shopt -s nullglob globstar
247-
files_to_copy=(
248-
source-tarball/*
249-
debian-packages-*/*
250-
fedora-rpms/**/*.rpm
251-
arch-packages/*.pkg.tar.zst
252-
)
253-
if [ ${#files_to_copy[@]} -gt 0 ]; then
254-
cp -v "${files_to_copy[@]}" release/
255-
fi
258+
cp -v source-tarball/* release/
259+
cp -v debian-packages-*/* release/
260+
cp -v fedora-rpms/* release/
261+
cp -v arch-packages/* release/
256262
cd release
257-
if [ -n "$(ls -A .)" ]; then
258-
sha256sum * > SHA256SUMS.txt
259-
fi
263+
sha2sum * > SHA256SUMS.txt
260264
- name: changelog
261265
run: |
262-
PREV=$(git describe --tags --abbrev=0 HEAD~1 2/dev/null || true)
266+
PREV=$(git describe --tags --abbrev=0 "$(git rev-list --tags --max-count=2)" | tail -n 1)
263267
if [ -n "$PREV" ]; then
264268
echo "### Changes since $PREV" > CHANGELOG.md
265269
git log --pretty=format:"- %s (%h)" "$PREV..HEAD" >> CHANGELOG.md
266270
else
267-
echo "### Initial release" > CHANGELOG.md
271+
git log --pretty=format:"- %s (%h)" > CHANGELOG.md
268272
fi
269273
- name: create GitHub release
270274
uses: softprops/action-gh-release@v1

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "liblekhika"]
2+
path = liblekhika
3+
url = https://github.com/khumnath/liblekhika.git

0 commit comments

Comments
 (0)