feat: add `windows/arm64` target (close #3308)

pull/3354/head
Noah Hsu 2023-02-09 19:43:29 +08:00
parent dca115506d
commit ab7dee49b0
5 changed files with 18 additions and 1 deletions

View File

@ -25,6 +25,7 @@ jobs:
- name: Install dependencies
run: |
sudo snap install zig --classic --beta
docker pull crazymax/xgo:latest
go install github.com/crazy-max/xgo@latest
sudo apt install upx

View File

@ -38,6 +38,7 @@ jobs:
- name: Install dependencies
run: |
sudo snap install zig --classic --beta
docker pull crazymax/xgo:latest
go install github.com/crazy-max/xgo@latest
sudo apt install upx

View File

@ -41,14 +41,24 @@ FetchWebRelease() {
rm -rf dist.tar.gz
}
BuildWinArm64() {
echo building for windows-arm64
export GOOS=windows
export GOARCH=arm64
export CC=$(pwd)/wrapper/zcc-arm64
export CXX=$(pwd)/wrapper/zcxx-arm64
go build -o "$1" -ldflags="$ldflags" -tags=jsoniter .
}
BuildDev() {
rm -rf .git/
BuildWinArm64 ./alist-windows-arm64.exe
xgo -targets=linux/amd64,windows/amd64,darwin/amd64 -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
mkdir -p "dist"
mv alist-* dist
cd dist
upx -9 ./alist-linux*
upx -9 ./alist-windows*
upx -9 ./alist-windows-amd64.exe
find . -type f -print0 | xargs -0 md5sum >md5.txt
cat md5.txt
}
@ -80,6 +90,7 @@ BuildRelease() {
export CGO_ENABLED=1
go build -o ./build/$appName-$os_arch -ldflags="$muslflags" -tags=jsoniter .
done
BuildWinArm64 ./build/alist-windows-arm64.exe
xgo -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
# why? Because some target platforms seem to have issues with upx compression
upx -9 ./alist-linux-amd64

2
wrapper/zcc-arm64 Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
zig cc -target aarch64-windows-gnu $@

2
wrapper/zcxx-arm64 Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
zig c++ -target aarch64-windows-gnu $@