2016-10-04 10:45:23 +05:30
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
# This is a script to download protoc. Rather than depending on the version on
|
|
|
|
# a developer's machine, always download a specific version.
|
|
|
|
|
|
|
|
VERSION="3.1.0"
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "Usage: ./get-protoc [dest]"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Use the go tool to determine OS.
|
|
|
|
OS=$( go env GOOS )
|
|
|
|
|
|
|
|
if [ "$OS" = "darwin" ]; then
|
|
|
|
OS="osx"
|
|
|
|
fi
|
|
|
|
|
2016-10-28 03:05:38 +05:30
|
|
|
mkdir -p bin
|
|
|
|
|
2016-10-04 10:45:23 +05:30
|
|
|
# TODO(ericchiang): Architectures other than amd64?
|
|
|
|
ZIP="protoc-${VERSION}-${OS}-x86_64.zip"
|
|
|
|
URL="https://github.com/google/protobuf/releases/download/v${VERSION}/${ZIP}"
|
|
|
|
|
|
|
|
wget ${URL}
|
|
|
|
# Unpack the protoc binary. Later we might want to grab additional data.
|
|
|
|
unzip -p ${ZIP} bin/protoc > $1
|
|
|
|
chmod +x $1
|
|
|
|
rm ${ZIP}
|