# Get it
cd
test -f installed/valgrind-3.14.0.tar.bz2 &&
mv -f installed/valgrind-3.14.0.tar.bz2 .
test ! -f valgrind-3.14.0.tar.bz2 &&
wget http://valgrind.org/downloads/valgrind-3.14.0.tar.bz2
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "valgrind-*" -exec rm -r {} \;
tar xjvf ~/valgrind-3.14.0.tar.bz2
cd valgrind-3.14.0
test $UID = 0 && chown -R root:root .
# Configure the build
test $(uname -m) = 'x86_64' &&
./configure --docdir=/usr/local/doc/valgrind-3.14.0 --libdir=/usr/local/lib64 --mandir=/usr/local/man
test $(uname -m) != 'x86_64' &&
./configure --docdir=/usr/local/doc/valgrind-3.14.0 --libdir=/usr/local/lib --mandir=/usr/local/man
# Build it
make
# Become root to install it
su
# Install it
make install
# It doesn't seem to listen to --docdir so move the files to the intended
# location
test -d /usr/local/share/doc/valgrind &&
mv -f /usr/local/share/doc/valgrind /usr/local/doc/valgrind-3.14.0
# Test run it
valgrind ls -l
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/valgrind-*.tar.*
mv valgrind-3.14.0.tar.bz2 installed/
# If you ever want to uninstall Valgrind, this should do it:
cd
su
test -d src/valgrind-* && ( cd src/valgrind-* ; make uninstall )
( cd /usr/local/bin
rm -f callgrind_annotate callgrind_control cg_annotate cg_diff cg_merge ms_print valgrind valgrind-di-server valgrind-listener vgdb )
test -d /usr/local/doc/valgrind && rm -r /usr/local/doc/valgrind
find /usr/local/doc -maxdepth 1 -type d -name "valgrind-*" -exec rm -r {} \;
test -d /usr/local/include/valgrind && rm -r /usr/local/include/valgrind
for libdir in /usr/local/lib /usr/local/lib64;
do
test ! -d $libdir && continue
test -d ${libdir}/valgrind && rm -r ${libdir}/valgrind
rm -f ${libdir}/pkgconfig/valgrind.pc
done
( cd /usr/local/man/man1
rm -f callgrind_annotate.1 callgrind_control.1 cg_annotate.1 cg_diff.1 cg_merge.1 ms_print.1 valgrind-listener.1 valgrind.1 vgdb.1 )
test -d /usr/local/share/doc/valgrind &&
rm -r /usr/local/share/doc/valgrind
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "valgrind-*" -exec rm -r {} \;
rm -f ~/installed/valgrind-*.tar.*