Files
matchbox/scripts/dev/get-protoc
2017-05-25 10:32:42 -07:00

22 lines
517 B
Bash
Executable File

#!/usr/bin/env bash
# USAGE: ./get-protoc bin/protoc
# Get the 'protoc' protocol buffer compiler
set -eu
DEST=${1:-"bin"}
VERSION="3.2.0"
OS=$(uname | tr A-Z a-z)
if [[ $OS == 'darwin' ]]; then
OS=osx # protoc names downloads with OSX, not darwin
fi
FILE="protoc-${VERSION}-${OS}-x86_64.zip"
URL="https://github.com/google/protobuf/releases/download/v${VERSION}/${FILE}"
mkdir -p $DEST
curl -L -# -o protoc.zip ${URL}
unzip -p protoc.zip bin/protoc > ${DEST}/protoc
chmod +x ${DEST}/protoc
rm -f protoc.zip