Skip to content

Commit

Permalink
Cross-compilation script.
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshvarun committed Apr 15, 2023
1 parent c50b4f5 commit 1371d4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
bin/
15 changes: 15 additions & 0 deletions cross-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
TARGETS="linux/386 linux/amd64 linux/arm linux/arm64 windows/386 windows/amd64 windows/arm windows/arm64 darwin/amd64 darwin/arm64"

rm -rf ./bin
for target in $TARGETS; do
GOOS=${target%/*}
GOARCH=${target#*/}
echo "Building for $GOOS/$GOARCH"
GOOS=$GOOS GOARCH=$GOARCH go build -o "bin/$GOOS-$GOARCH/"
(
cd bin/$GOOS-$GOARCH/
zip -r "../$GOOS-$GOARCH.zip" .
)
rm -rf "bin/$GOOS-$GOARCH/"
done

0 comments on commit 1371d4b

Please sign in to comment.