Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use protoc3 binaries if possible, make CI faster
- Loading branch information
Showing
1 changed file
with
20 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
#! /usr/bin/env bash | ||
|
||
PROTO3_ROOT=/proto3 | ||
mkdir $PROTO3_ROOT | ||
|
||
PROTO3_VER=3.6.0 | ||
PROTO3_PATH=$PROTO3_ROOT/protobuf-$PROTO3_VER | ||
PROTO3_SRC=https://github.com/google/protobuf/releases/download/v${PROTO3_VER}/protobuf-cpp-${PROTO3_VER}.tar.gz | ||
|
||
curl -s -L ${PROTO3_SRC} | tar -C ${PROTO3_ROOT} -x -z -f - | ||
cd ${PROTO3_PATH} && mkdir install && ./autogen.sh && ./configure --prefix=${PROTO3_PATH}/install && make install | ||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
PROTO3_BIN=https://github.com/google/protobuf/releases/download/v${PROTO3_VER}/protoc-${PROTO3_VER}-linux-x86_64.zip | ||
curl -OL $PROTO3_BIN | ||
mkdir -p ${PROTO3_PATH}/install/bin | ||
unzip protoc-${PROTO3_VER}-linux-x86_64.zip -d ${PROTO3_PATH}/install | ||
rm protoc-${PROTO3_VER}-linux-x86_64.zip | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
PROTO3_BIN=https://github.com/google/protobuf/releases/download/v${PROTO3_VER}/protoc-${PROTO3_VER}-osx-x86_64.zip | ||
curl -OL $PROTO3_BIN | ||
mkdir -p ${PROTO3_PATH}/install/bin | ||
unzip protoc-${PROTO3_VER}-osx-x86_64.zip -d ${PROTO3_PATH}/install | ||
rm protoc-${PROTO3_VER}-osx-x86_64.zip | ||
else | ||
# compile from source | ||
PROTO3_SRC=https://github.com/google/protobuf/releases/download/v${PROTO3_VER}/protobuf-cpp-${PROTO3_VER}.tar.gz | ||
curl -s -L ${PROTO3_SRC} | tar -C ${PROTO3_ROOT} -x -z -f - | ||
cd ${PROTO3_PATH} && mkdir install && ./autogen.sh && ./configure --prefix=${PROTO3_PATH}/install && make install | ||
fi |