Last active
December 19, 2020 04:21
-
-
Save growtopiajaw/90c252d1cfeaefd74dccd2de937eee5c 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 | |
# Originally written by Marko Mudrinić (DigitalOcean) | |
# Source: https://www.digitalocean.com/community/tutorials/how-to-build-go-executables-for-multiple-platforms-on-ubuntu-16-04 | |
# Modified to suit gdrive’s compatible build list | |
package=$1 | |
if [[ -z "$package" ]]; then | |
echo "usage: $0 <package-name>" | |
exit 1 | |
fi | |
package_split=(${package//\// }) | |
package_name=${package_split[-1]} | |
platforms=("aix/ppc64" "darwin/amd64" "dragonfly/amd64" "freebsd/386" "freebsd/amd64" "freebsd/arm" "freebsd/arm64" "illumos/amd64" "js/wasm" "linux/386" "linux/amd64" "linux/arm" "linux/arm64" "linux/ppc64" "linux/ppc64le" "linux/mips64" "linux/mips64le" "linux/riscv64" "linux/s390x" "netbsd/386" "netbsd/amd64" "netbsd/arm" "netbsd/arm64" "openbsd/386" "openbsd/amd64" "openbsd/arm" "openbsd/arm64" plan9/386" "plan9/amd64" "plan9/arm" "solaris/amd64" "windows/386" "windows/amd64" "windows/arm") | |
# Unsupported architectures | |
# "darwin/386" "linux/mips" "linux/mipsle" | |
for platform in "${platforms[@]}" | |
do | |
platform_split=(${platform//\// }) | |
GOOS=${platform_split[0]} | |
GOARCH=${platform_split[1]} | |
output_name=$package_name'-'$GOOS'-'$GOARCH | |
if [ $GOOS = "windows" ]; then | |
output_name+='.exe' | |
fi | |
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name $package | |
if [ $? -ne 0 ]; then | |
echo 'An error has occurred! Aborting the script execution...' | |
exit 1 | |
fi | |
done |
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
2492ad0cf8fbee5053e50978a1a1bf5b81a9205c gdrive-aix-ppc64 | |
251775eface53fa4a2141ceb08787a3795937bb4 gdrive-darwin-amd64 | |
46f08e725ff25fdcfa9cb1738dd746b60710e4f2 gdrive-dragonfly-amd64 | |
143391848e252fca0bad8a5fdeefb631e6e90454 gdrive-freebsd-386 | |
e5cd1612c65cb00de15f270dcd58c0975962413e gdrive-freebsd-amd64 | |
3a3a4282e22052bf573769dc1ac3879d5f80fb3a gdrive-freebsd-arm | |
889eac15d59ccfecbbb53e69b3cc8cae45c583b6 gdrive-freebsd-arm64 | |
038bcbae01a402493f115e3d498a3bd5fd1d1578 gdrive-illumos-amd64 | |
c1ea534da91a459e0fbcffeb14e9aed8b7894735 gdrive-js-wasm | |
af4ac6a4f870d425bd847d617f69642fa0f9a3ea gdrive-linux-386 | |
0bca1f0c2aa2dedb0e472a1548bcf1290d91ccf3 gdrive-linux-amd64 | |
161784785cfd4e5d38b49bcdd96aee30923e19eb gdrive-linux-arm | |
4b42f9d0ebffc70b996e77c275f4be0f955d0935 gdrive-linux-arm64 | |
9636026bbcb5597e79c22a8875719494b01f54c7 gdrive-linux-mips64 | |
ef912846915bc84ce533266cc19a38a95eb381ab gdrive-linux-mips64le | |
1b26d4cb08bd714a46d409e25ef331659ee2ba69 gdrive-linux-ppc64 | |
4920c772c14b583dbf9ba4b77259f50eaccd1be8 gdrive-linux-ppc64le | |
29569f5f7b7224c1adad1763c0dfbca9f25b4a77 gdrive-linux-riscv64 | |
7db6f0cddd2dec5da4dc706020ea101ee064be86 gdrive-linux-s390x | |
d53a6e282322a8e12bf57ea338f1a701a2cb764e gdrive-netbsd-386 | |
ea9a0643963df28ebf8ae87f5200a7ed14ed6ce1 gdrive-netbsd-amd64 | |
91a8428610b9753535df9e028de3baa63b005a31 gdrive-netbsd-arm | |
43c7e597a3072c49c359978c7a663681b9536000 gdrive-netbsd-arm64 | |
bb862c5a482c0201b8003d154ac6f7e97629893f gdrive-plan9-386 | |
d6141e25383c4ca0aa9f936255f4bcb6c245fb98 gdrive-plan9-amd64 | |
d7eadb68323ddd3fa30cc5033b390859f3c3044f gdrive-plan9-arm | |
dbb07443a1a48aeef15753b6740035bb572fe800 gdrive-solaris-amd64 | |
b3c8c1dc754edb84b629e33f17fee184f4b57024 gdrive-windows-386.exe | |
83b00d0c5d32fa89ffb96b3b97f43a4d9817d82a gdrive-windows-amd64.exe | |
a679421b4a5460dcf223d7cd51d48ac6ff97155d gdrive-windows-arm.exe |
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
599fdcdd3e4fd7b0ffda4eabcdd3224892c4b7d6 gdrive-android-16-386 | |
2bc29f69714216995dec9f0d0cfe3b2189b15794 gdrive-android-16-arm | |
f65619906bb887d3fc377607cbce7537120034b7 gdrive-darwin-10.6-386 | |
53786df39a2705e03a4bd23b6019c9022e47f33d gdrive-darwin-10.6-amd64 | |
3f3c3b70adea1c0d990b29cfa7ca737ce235ea37 gdrive-ios-5.0-arm64 | |
8674d64f324366289f205bb05ddbdacfa69377f8 gdrive-ios-5.0-armv7 | |
9b2218618a5feff37c1b7be868fafb0616e580e7 gdrive-linux-386 | |
97e38d4e51219a2f4872f745618be24669a6bda0 gdrive-linux-amd64 | |
a2078b5fb673f11e7aaf88ca1c915f04c8834994 gdrive-linux-arm-5 | |
01dfa25d24a027a78edca12cea2b2dc4a8319e22 gdrive-linux-arm-6 | |
f469bfedfdbd5f32bedaf7316c8d2accc16fe8c6 gdrive-linux-arm-7 | |
187a9bfb66c6e82ba8891348aaf543189d4de790 gdrive-linux-mips64 | |
1f17078b2dff6441dd6ecad1d9787050cffdcf8b gdrive-linux-mips64le | |
5d03c8510ec49bce8b927e4c4cf03e4f16826caa gdrive-windows-4.0-386.exe | |
d974be4690dd3faef81a36baba5123fa156a8379 gdrive-windows-4.0-amd64.exe |
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
dd4feaa6c3e1cac73e90ba72c49f9a78768991c8 gdrive-freebsd-armv6 | |
d21d450c89fbcf8f581b401b64a38408fc4dae2f gdrive-freebsd-armv7 | |
161784785cfd4e5d38b49bcdd96aee30923e19eb gdrive-linux-armv5 | |
66ab7104848ac2af9455a12e87b4559b27d8d5f0 gdrive-linux-armv6 | |
350c731c5c17c5d963325b1ab59abe19c86814b6 gdrive-linux-armv7 | |
96b643e05baf6f0f4d13b82128c90d974e3c1a46 gdrive-netbsd-armv6 | |
11960c53b90959faa13b60854e82cfd56b89f4c7 gdrive-netbsd-armv7 | |
81d14a457d9459249a12411813539f44e13a814e gdrive-openbsd-armv6 | |
d28b2dffdbbcffebfbd583b216d69dd08361a45b gdrive-openbsd-armv7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment