# Get it
cd
test -f installed/protobuf-cpp-3.6.0.tar.gz &&
mv -f installed/protobuf-cpp-3.6.0.tar.gz .
test ! -f protobuf-cpp-3.6.0.tar.gz &&
wget --no-check-certificate https://github.com/google/protobuf/releases/\
download/v3.6.0/protobuf-cpp-3.6.0.tar.gz
# Extract the source
mkdir -p -m 0700 src
cd src
test -d ./protobuf && rm -r ./protobuf
find -maxdepth 1 -type d -name "protobuf-*" -exec rm -r {} \;
tar xzvf ~/protobuf-cpp-3.6.0.tar.gz
cd protobuf-3.6.0
test $UID = 0 && chown -R root:root .
# Read ./README.md
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --libdir=/usr/local/lib64 --with-gnu-ld --disable-static
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --with-gnu-ld --disable-static
# Build it
make
# Check the build
make check
# Become root to install it
su
# Install it
make install
ldconfig
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/protobuf-cpp-*.tar.*
mv protobuf-cpp-3.6.0.tar.gz installed/
# Get it
cd
test -f installed/protobuf-cpp-3.5.1.tar.gz &&
mv -f installed/protobuf-cpp-3.5.1.tar.gz .
test ! -f protobuf-cpp-3.5.1.tar.gz &&
wget --no-check-certificate https://github.com/google/protobuf/releases/\
download/v3.5.1/protobuf-cpp-3.5.1.tar.gz
# Extract the source
mkdir -p -m 0700 src
cd src
test -d ./protobuf && rm -r ./protobuf
find -maxdepth 1 -type d -name "protobuf-*" -exec rm -r {} \;
tar xzvf ~/protobuf-cpp-3.5.1.tar.gz
cd protobuf-3.5.1
test $UID = 0 && chown -R root:root .
# Read ./README.md
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --libdir=/usr/local/lib64 --with-gnu-ld --disable-static
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --with-gnu-ld --disable-static
# Build it
make
# Check the build
make check
# Become root to install it
su
# Install it
make install
ldconfig
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/protobuf-cpp-*.tar.*
mv protobuf-cpp-3.5.1.tar.gz installed/
# Get it - clone the repository
cd
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "protobuf-*" -exec rm -r {} \;
test ! -d protobuf && git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
# If you're re-using a clone from before
git fetch
# Generate ./configure, etc.
./autogen.sh
# Configure it
./configure --with-gnu-ld
# Build it
make
# Check the build
make check
# Become root to install it
su
# Install it
make install
ldconfig
# Become your non-root user again
exit
## Done
# If you ever want to uninstall protobuf, this should do it:
# ('make uninstall' as root should do it, the rest is just in case)
cd
su
test -d src/protobuf-* && ( cd src/protobuf-* ; make uninstall )
test -d src/protobuf &&
( cd src/protobuf ; make uninstall ; cd .. ; rm -r ./protobuf/ )
rm -f /usr/local/bin/protoc
test -d /usr/local/include/google/protobuf &&
rm -r /usr/local/include/google/protobuf
rmdir --ignore-fail-on-non-empty /usr/local/include/google
for libdir in /usr/local/lib /usr/local/lib64;
do
test -d $libdir &&
( cd $libdir
rm -f libprotobuf-lite.* libprotobuf.* libprotoc.*
test -d pkgconfig &&
( cd pkgconfig ; rm -f protobuf.pc protobuf-lite.pc ) )
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "protobuf-*" -exec rm -r {} \;
rm -f ~/installed/protobuf-*.tar.*