Skip to content

Commit

Permalink
feat: add windows/arm64 target (close #3308)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Feb 8, 2023
1 parent a4f4fb2 commit c2210d9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,20 @@ FetchWebRelease() {
rm -rf dist.tar.gz
}

BuildWinArm64() {
curl -L -o llvm-mingw-aarch64.tar.xz https://github.com/mstorsjo/llvm-mingw/releases/download/20220906/llvm-mingw-20220906-ucrt-ubuntu-18.04-aarch64.tar.xz
sudo tar -xf llvm-mingw-aarch64.tar.xz --strip-components 1 -C /usr/local
echo building for windows-arm64
export GOOS=windows
export GOARCH=arm64
export CC=aarch64-w64-mingw32-gcc
export CGO_ENABLED=1
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
Expand Down Expand Up @@ -80,6 +92,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
Expand Down

0 comments on commit c2210d9

Please sign in to comment.