Skip to content

Commit

Permalink
Merge pull request #544 from tch69/master
Browse files Browse the repository at this point in the history
  • Loading branch information
goatastronaut0212 committed Nov 16, 2024
2 parents b071c5c + 3b00f21 commit 3057789
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
with:
usesh: true
prepare: |
pkg install -y bash gmake go gcc pkgconf libX11 libXtst gtk3
pkg install -y go pkgconf libX11 libXtst gtk3
run: |
gmake test && gmake build
make test && make build
Build-test-nix-flake:
runs-on: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

CC=cc
SHELL=sh

engine_name=bamboo
engine_gui_name=ibus-setup-Bamboo.desktop
Expand All @@ -37,10 +38,10 @@ tar_options_src=--transform "s/^\./$(pkg_name)-$(version)/" --exclude=.git --exc
all: build

build:
bash scripts/build.bash
$(SHELL) scripts/build

test:
bash scripts/test.bash
$(SHELL) scripts/test

clean:
rm -f ibus-engine-bamboo
Expand All @@ -52,7 +53,7 @@ clean:


install: build
bash scripts/install.bash ${PREFIX} ${DESTDIR}
$(SHELL) scripts/install ${PREFIX} ${DESTDIR}

uninstall:
rm -rf $(DESTDIR)$(engine_dir)
Expand Down
24 changes: 24 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Ibus bamboo
ibus_e_name="ibus-engine-bamboo"
version="0.8.4"

# Go flags
LDFLAGS="-w -s -X main.Version=${version}"

# Go flags for FreeBSD
CGO_CFLAGS_FREEBSD="-I/usr/local/include -std=gnu99"
CGO_LDFLAGS_FREEBSD="-L/usr/local/lib -lX11 -lXtst -pthread"

case $(uname) in
"Linux") CGO_ENABLED=1 \
go build -o ${ibus_e_name} -ldflags "${LDFLAGS}" -mod=vendor
;;

"FreeBSD") CGO_ENABLED=1 \
CGO_CFLAGS=${CGO_CFLAGS_FREEBSD} \
CGO_LDFLAGS=${CGO_LDFLAGS_FREEBSD} \
go build -o ${ibus_e_name} -ldflags "${LDFLAGS}" -mod=vendor
;;
*) echo "Hiện tại chưa hỗ trợ hệ điều hành này!"
;;
esac
32 changes: 0 additions & 32 deletions scripts/build.bash

This file was deleted.

36 changes: 36 additions & 0 deletions scripts/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
PREFIX="$1"
DESTDIR="$2"

engine_name="bamboo"
engine_gui_name="ibus-setup-Bamboo.desktop"
ibus_e_name="ibus-engine-${engine_name}"
pkg_name="ibus-${engine_name}"
version="0.8.4"

engine_dir=${PREFIX}/share/${pkg_name}
ibus_dir=${PREFIX}/share/ibus

# Main script
case $(uname) in
"Linux") mkdir -p ${DESTDIR}${engine_dir} \
${DESTDIR}${PREFIX}/lib/ibus-${engine_name} \
${DESTDIR}${ibus_dir}/component/ \
${DESTDIR}${PREFIX}/share/applications/
cp -R -f icons data ${DESTDIR}${engine_dir}
cp -f ${ibus_e_name} ${DESTDIR}${PREFIX}/lib/ibus-${engine_name}/
cp -f data/${engine_name}.xml ${DESTDIR}${ibus_dir}/component/
cp -f data/${engine_gui_name} ${DESTDIR}${PREFIX}/share/applications/
;;
"FreeBSD") mkdir -p ${DESTDIR}${engine_dir} \
${DESTDIR}${PREFIX}/lib/ibus-${engine_name} \
${DESTDIR}${ibus_dir}/component/ \
${DESTDIR}${PREFIX}/share/applications/

cp -R -f icons data ${DESTDIR}${engine_dir}
cp -f ${ibus_e_name} ${DESTDIR}${PREFIX}/lib/ibus-${engine_name}/
cp -f data/${engine_name}-freebsd.xml ${DESTDIR}${ibus_dir}/component/
cp -f data/${engine_gui_name} ${DESTDIR}${PREFIX}/share/applications/
;;
*) echo "Hiện tại chưa hỗ trợ hệ điều hành này!"
;;
esac
36 changes: 0 additions & 36 deletions scripts/install.bash

This file was deleted.

18 changes: 18 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Go flags for FreeBSD
CGO_CFLAGS_FREEBSD="-I/usr/local/include -std=gnu99"
CGO_LDFLAGS_FREEBSD="-L/usr/local/lib -lX11 -lXtst -pthread"

# Functions
case $(uname) in
"Linux") CGO_ENABLED=1 \
go test . -mod=vendor
;;
"FreeBSD") CGO_ENABLED=1 \
CGO_CFLAGS=${CGO_CFLAGS_FREEBSD} \
CGO_LDFLAGS=${CGO_LDFLAGS_FREEBSD} \
go test . -mod=vendor
;;
*)
echo "Hiện tại chưa hỗ trợ hệ điều hành này!"
;;
esac
25 changes: 0 additions & 25 deletions scripts/test.bash

This file was deleted.

0 comments on commit 3057789

Please sign in to comment.