1#!/usr/bin/env bash 2 3set -ex 4 5die() { 6 echo "$@" >&2 7 exit 1 8} 9 10cd ${HOME} 11 12case "$PROTOBUF_VERSION" in 132*) 14 basename=protobuf-$PROTOBUF_VERSION 15 wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz 16 tar xzf $basename.tar.gz 17 cd protobuf-$PROTOBUF_VERSION 18 ./configure --prefix=${HOME} && make -j2 && make install 19 ;; 203*) 21 basename=protoc-$PROTOBUF_VERSION-linux-x86_64 22 wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.zip 23 unzip $basename.zip 24 ;; 25*) 26 die "unknown protobuf version: $PROTOBUF_VERSION" 27 ;; 28esac 29