Skip to content

Commit

Permalink
Download prebuilt protoc on Windows
Browse files Browse the repository at this point in the history
instead of full protobuf from sources
  • Loading branch information
stepancheg committed Dec 19, 2018
1 parent 4e1b526 commit 269f235
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ matrix:
before_install:
- ci/env-debug.sh
- ci/install-protobuf.sh
- export PATH="/home/travis/bin:$PATH"
- export LD_LIBRARY_PATH="/home/travis/lib"
- export PATH="$HOME/bin:$PATH"
- export LD_LIBRARY_PATH="$HOME/lib"
- which protoc
- protoc --version
- if [ -z "$ON_WINDOWS" ]; then PKG_CONFIG_PATH="/home/travis/lib/pkgconfig" interop/cxx/compile.sh; fi
Expand Down
55 changes: 34 additions & 21 deletions ci/install-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,44 @@ die() {
exit 1
}

if [ `uname` = Linux ]; then
# Check we have ccache
ccache --version
export CC="ccache gcc"
export CXX="ccache g++"
fi

test -n "$PROTOBUF_VERSION" || die "PROTOBUF_VERSION env var is undefined"

case "$PROTOBUF_VERSION" in
2*)
basename=protobuf-$PROTOBUF_VERSION
case `uname` in
Linux)
# Check we have ccache
ccache --version
export CC="ccache gcc"
export CXX="ccache g++"

case "$PROTOBUF_VERSION" in
2*)
basename=protobuf-$PROTOBUF_VERSION
;;
3*)
basename=protobuf-cpp-$PROTOBUF_VERSION
;;
*)
die "unknown protobuf version: $PROTOBUF_VERSION"
;;
esac

curl -sL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz | tar zx

cd protobuf-$PROTOBUF_VERSION

./configure --prefix=$HOME && make -j2 && make install

;;
3*)
basename=protobuf-cpp-$PROTOBUF_VERSION
MSYS_NT*)
(
cd $HOME
curl -sLO https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-win32.zip
unzip protoc-$PROTOBUF_VERSION-win32.zip
)
;;
*)
die "unknown protobuf version: $PROTOBUF_VERSION"
*)
die "unknown uname: `uname`"
;;
esac

curl -sL https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz | tar zx

cd protobuf-$PROTOBUF_VERSION

./configure --prefix=/home/travis && make -j2 && make install

test -x /home/travis/bin/protoc
$HOME/bin/protoc --version

0 comments on commit 269f235

Please sign in to comment.