Skip to content

Instantly share code, notes, and snippets.

@traviskaufman
Created December 29, 2014 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save traviskaufman/02fb55240e3cc1929789 to your computer and use it in GitHub Desktop.
Save traviskaufman/02fb55240e3cc1929789 to your computer and use it in GitHub Desktop.
Shell Script to Compile and Install protobuf v2.6.0 on Ubuntu
# Installs protobuf 2.6.0 on Ubuntu (currently not a deb package ugh)
protodir=protobuf-2.6.0
filename="$(protodir).tar.gz"
known_md5=9959d86087e64524d7f91e7a5a6e4fd7
builddir="$(mktemp -d $TMPDIR/protobuild.XXXXXX)"
if [ ! -d $builddir ]; then
echo "$0: Can't create temp build dir! WTF??!"
exit 1
fi
echo "Entering $builddir"
pushd $builddir
echo "Fetching $filename"
curl -k https://protobuf.googlecode.com/svn/rc/protobuf-2.6.0.tar.gz > $filename
echo "Checking md5 of $filename"
md5=$(md5sum $filename | awk '{print $1}')
if [ "$md5" = "$known_md5" ]; then
echo 'md5 sums match'
else
echo "md5 sums do not match!\nexpected: $known_md5\nactual: $md5"
exit 1
fi
echo "Unpacking $filename"
tar -xzf $filename
echo "Entering $builddir/$protodir"
pushd $protodir
echo "Installing $protodir"
set -x
./configure --prefix=/usr
make
make check
sudo make install
set +x
echo "Cleaning up..."
popd
rm -rf $filename $protodir
popd
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment