# Get it
cd
mkdir -p -m 0700 src
cd src
test -d ./protobuf-c && ( cd protobuf-c ; git fetch )
test ! -d ./protobuf-c &&
git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
# Generate configure
test ! -f ./configure && ./autogen.sh
# If you've previously run configure, clean up everything
test -f Makefile && make distclean
# I was unable to build it against protobuf 3.6.0
# Adding --disable-protoc allows it to finish, but leaves me without the
# protoc binary
# I wonder if I would have more success with 3.5.1, but not enough to try it
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --libdir=/usr/local/lib64 --mandir=/usr/local/man \
--disable-static --with-gnu-ld --disable-protoc
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --mandir=/usr/local/man --disable-static --with-gnu-ld \
--disable-protoc
# Build it
make
# Check the build
make check
# Become root to install it
su
# Remove old version library files
( cd /usr/local ; rm -f libprotobuf-c.* )
test -d /usr/local/lib64 &&
( cd /usr/local/lib64 ; rm -f libprotobuf-c.* )
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
## Done
# If you ever want to uninstall protobuf-c, this should do it:
cd
su
test -d src/protobuf-c-* && ( cd src/protobuf-c-* ; make uninstall )
( cd /usr/local/bin rm -f protobuf-c_capture protobuf-c_dump protobuf-c_replay )
test -d /usr/local/include/protobuf-c && rm -r /usr/local/include/protobuf-c/
( cd /usr/local/man/man1
rm -f protobuf-c_capture.1 protobuf-c_dump.1 protobuf-c_replay.1 )
for libdir in /usr/local/lib /usr/local/lib64;
do
test -d $libdir &&
( cd $libdir
rm -f libprotobuf-c.*
test -d pkgconfig && rm -f pkgconfig/libprotobuf-c.pc )
done
rm -f /usr/local/include/protobuf-c.h
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "protobuf-c-*" -exec rm -r {} \;
test -d ~/src/protobuf-c && rm -r ~/src/protobuf-c
rm -f ~/installed/protobuf-c-*.tar.*