Skip to content

Commit

Permalink
feat: 🎸 Support arm64 architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Nov 27, 2021
1 parent 62c152e commit 725a03f
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Folders
_obj
_test
dist/

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down
22 changes: 14 additions & 8 deletions build-commons.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash

docker run --rm -it -v "$PWD":/_ -w /_ golang:1.13 bash -c '
docker run --rm -it -v "$PWD":/_ -w /_ golang:1.17 bash -c '
go get -d ./...
GO111MODULE=off go get -d ./...
oslist=(darwin windows linux freebsd)
for os in "${oslist[@]}"; do
[ "$os" = "windows" ] && suffix=".exe" || suffix=""
dirname="dist/$os"
[ "$os" = windows ] && suffix=.exe || suffix=
dirname="dist/$os/amd64"
filename="twhelp$suffix"
(GOARCH=amd64 GOOS="$os" go build -ldflags="-s -w" -o "$dirname/$filename") &
(GO111MODULE=off GOARCH=amd64 GOOS="$os" go build -ldflags="-s -w" -o "$dirname/$filename") &
if [ "$os" = darwin ]; then
(GO111MODULE=off GOARCH=arm64 GOOS=darwin go build -ldflags="-s -w" -o dist/darwin/arm64/twhelp) &
fi
done
wait
Expand All @@ -18,11 +21,14 @@ docker run --rm -it -v "$PWD":/_ -w /_ golang:1.13 bash -c '

oslist=(darwin windows linux freebsd)
for os in "${oslist[@]}"; do
[ "$os" = "windows" ] && suffix=".exe" || suffix=""
dirname="dist/$os"
[ "$os" = windows ] && suffix=.exe || suffix=
dirname="dist/$os/amd64"
filename="twhelp$suffix"
zipname="../twhelp-x64$os-$1.zip"
zipname="../../twhelp-$os-amd64-$1.zip"
(cd "$dirname" && zip "$zipname" "$filename") &
if [ "$os" = darwin ]; then
(cd dist/darwin/arm64 && zip "../../twhelp-darwin-arm64-$1.zip" "twhelp") &
fi
done

wait
Expand Down
6 changes: 6 additions & 0 deletions dist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
!/.gitignore
!/darwin/
!/freebsd/
!/linux/
!/windows/
Empty file removed dist/darwin/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions dist/darwin/amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions dist/darwin/arm64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Empty file removed dist/freebsd/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions dist/freebsd/amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Empty file removed dist/linux/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions dist/linux/amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Empty file removed dist/windows/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions dist/windows/amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 725a03f

Please sign in to comment.