Skip to content

Instantly share code, notes, and snippets.

@ernoaapa
Created August 2, 2016 04:10
Show Gist options
  • Save ernoaapa/f98e358f5c235754ca9fa775679e0d27 to your computer and use it in GitHub Desktop.
Save ernoaapa/f98e358f5c235754ca9fa775679e0d27 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Install protobuf C++ library
# As described here: https://github.com/google/protobuf/blob/master/src/README.md#c-installation---unix
#
# NOTE:
# You should use 'libprotobuf10' package when it's available!
#
set -e
PROTOBUF_VERSION=${1:-3.0.0-beta-3}
if [ -d "/usr/local/include/google/protobuf/" ]; then
echo "Already installed! (directory /usr/local/include/google/protobuf/ exist)"
else
echo "Install Protobuf ${PROTOBUF_VERSION}"
apt-get install -y autoconf automake libtool make g++ wget
wget -O /tmp/protobuf.tar.gz https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz
mkdir -p /tmp/protobuf
tar -zxvf /tmp/protobuf.tar.gz -C /tmp/protobuf
cd /tmp/protobuf/protobuf-${PROTOBUF_VERSION}
# ./autogen.sh # Needed only if building from master branch
./configure
make
make check
make install
ldconfig
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment