Last active
April 17, 2020 03:23
-
-
Save bzeron/4dd61c317f35a27c63496e8bc6e64763 to your computer and use it in GitHub Desktop.
This file contains 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/env bash | |
function mac() { | |
export CGO_ENABLED=1 | |
export CC=clang | |
export CXX=clang++ | |
export GOOS=darwin | |
export GOARCH=amd64 | |
} | |
function linux() { | |
export CGO_ENABLED=1 | |
export CC=gcc | |
export CXX=gcc++ | |
export GOOS=linux | |
export GOARCH=amd64 | |
} | |
function window32() { | |
export CGO_ENABLED=1 | |
export CC=i686-w64-mingw32-gcc | |
export CXX=i686-w64-mingw32-g++ | |
export GOOS=windows | |
export GOARCH=386 | |
} | |
function window64() { | |
export CGO_ENABLED=1 | |
export CC=x86_64-w64-mingw32-gcc | |
export CXX=x86_64-w64-mingw32-g++ | |
export GOOS=windows | |
export GOARCH=amd64 | |
} | |
function buildMacos() { | |
go build -x -v -ldflags "-s -w" -o app.bin main.go | |
} | |
function buildMacosStatic() { | |
go build -buildmode=c-archive -x -v -ldflags "-s -w" -o app.a main.go | |
} | |
function buildMacosDynamic() { | |
go build -buildmode=c-shared -x -v -ldflags "-s -w" -o app.so main.go | |
} | |
function buildLinux() { | |
go build -x -v -ldflags "-s -w" -o app.bin main.go | |
} | |
function buildLinuxStatic() { | |
go build -buildmode=c-archive -x -v -ldflags "-s -w" -o app.a main.go | |
} | |
function buildLinuxDynamic() { | |
go build -buildmode=c-shared -x -v -ldflags "-s -w" -o app.so main.go | |
} | |
function buildWindow32() { | |
go build -x -v -ldflags "-s -w -H windowsgui" -o app.exe main.go | |
} | |
function buildWindow32Static() { | |
go build -buildmode=c-archive -x -v -ldflags "-s -w -H windowsgui" -o app.a main.go | |
} | |
function buildWindow32Dynamic() { | |
go build -buildmode=c-shared -x -v -ldflags "-s -w -H windowsgui" -o app.so main.go | |
} | |
function buildWindow64() { | |
go build -x -v -ldflags "-s -w -H windowsgui" -o app.exe main.go | |
} | |
function buildWindow64Static() { | |
go build -buildmode=c-archive -x -v -ldflags "-s -w -H windowsgui" -o app.a main.go | |
} | |
function buildWindow64Dynamic() { | |
go build -buildmode=c-shared -x -v -ldflags "-s -w -H windowsgui" -o app.so main.go | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment