diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index 261e9e4..dc22f74 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -28,7 +28,7 @@ jobs: # cache-dependency-path: go.sum - name: Install system dependencies - run: sudo apt-get install -y gcc-mingw-w64-x86-64 + run: sudo apt-get install -y gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu - name: Install dependencies run: go mod tidy diff --git a/README.md b/README.md index ab0ff45..a16465e 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,14 @@ + + ## 特性 - 单文件运行,多平台兼容,无需安装任何依赖。Windows运行截图: ![](https://raw.githubusercontent.com/Karmenzind/i/master/kd/win_terminal.png) - > 理论上可兼容[所有平台/架构](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63),但我只有Linux/Win可测试,欢迎使用其他平台的朋友试用反馈 - - 支持查单词、词组( :eyes: 长句翻译功能也快写好了) - 极速响应,超低延迟 - 本地词库(10W热词),可离线使用 diff --git a/scripts/build.sh b/scripts/build.sh index 7468e14..721dcbf 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,16 +21,29 @@ do_build() { local arch=$2 local targetfile=$3 - local cgo=0 cc= + local cgo=1 cc= - if [[ $os == "windows" ]]; then - local cgo=1 cc=x86_64-w64-mingw32-gcc - # cc=i686-w64-mingw32-gcc - # local buildopts=-buildmode=c-shared - fi + case $os in + windows ) + local cc=x86_64-w64-mingw32-gcc + local buildopts=-buildmode=c-shared + ;; + linux ) + if [[ $arch == "arm64" ]]; then + local cc=aarch64-linux-gnu-gcc + fi + ;; + darwin) + # TODO (k): <2023-12-21> + ;; + esac GOOS=$os GOARCH=$arch CGO_ENABLED=$cgo CC=$cc go build ${buildopts} -o ${targetfile} -ldflags="-s -w" -tags urfave_cli_no_docs cmd/kd.go - echo " Finished -> ${targetfile}" + if (($?==0)); then + echo " Finished -> ${targetfile}" + else + echo " Failed to build for $os $arch" + fi } if [[ $1 == "-a" ]]; then