Created
December 19, 2018 10:12
-
-
Save thehowl/a2b7497af1c96cbb2e19087f639365d9 to your computer and use it in GitHub Desktop.
uncomplicated crosscompilation of the major 9 platforms in go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Looking at the source, I see. | |
# Bear with me. I can barely understand bash, let alone writing it. | |
# See that something can be done in a much better way? Just Pull Request It (tm) | |
if [ -z ${1+x} ]; then nproj=${PWD##*/}; else nproj=$1; fi | |
echo project name $nproj | |
for GOOS in darwin linux windows; do | |
for GOARCH in 386 amd64; do | |
echo "Building $GOOS-$GOARCH" | |
if [ $GOOS == "windows" ]; then extension=".exe"; else extension=""; fi | |
export GOOS=$GOOS | |
export GOARCH=$GOARCH | |
go build -o bin/$nproj-$GOOS-$GOARCH$extension | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment