123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #!/bin/sh
- #
- # mindist: create minimum distribution for running cputil
- #
- # Copyright (C) 2016,2021 Matthew R. Wette
- #
- # Copying and distribution of this file, with or without modification,
- # are permitted in any medium without royalty provided the copyright
- # notice and this notice are preserved. This file is offered as-is,
- # without any warranty.
- prefix=@prefix@
- exec_prefix=@exec_prefix@
- libexecdir=@libexecdir@
- libdir=@libdir@
- includedir=@includedir@
- fail () {
- echo "usage: mindist DESTDIR=<dir>"
- echo "example:"
- echo " mindist DESTDIR=/var/tmp/mindist"
- exit 1
- }
- if [ $# -ne 1 ]; then fail; fi
- case $1 in
- DESTDIR=*) destdir=`echo $1 | sed -e 's/DESTDIR=//'` ;;
- *) fail ;;
- esac
- if echo $destdir | grep '.*\/$'; then
- true
- else
- destdir=$destdir/
- fi
- cu_execdir=$libexecdir/cputil
- top=$destdir$prefix
- exe=$destdir$libexecdir/valgrind
- lib=$destdir$libdir
- inc=$destdir$includedir
- cu_exe=$destdir$cu_execdir
- if [ ! -f $top/bin/valgrind ]; then
- echo "do not see $top/bin/valgrind -- quitting"
- exit 1
- fi
-
- mv $top/bin/valgrind $exe
- rm $top/bin/*
- if [ -f $top/include/valgrind/libvex_ir.h ]; then
- cp $top/include/valgrind/libvex_ir.h $exe
- fi
- if [ -f $top/include/valgrind/cputil.h ]; then
- cp $top/include/valgrind/cputil.h $inc
- cp $top/include/valgrind/cputil.h $exe
- fi
- rm -rf $top/include/valgrind
- rm -rf $top/share
- rm -rf $top/lib/pkgconfig
- rm -f $exe/vgpreload_dhat*
- rm -f $exe/vgpreload_drd*
- rm -f $exe/vgpreload_exp*
- rm -f $exe/vgpreload_helgrind*
- rm -f $exe/vgpreload_massif*
- rm -f $exe/vgpreload_memcheck*
- rm -f $exe/s390*
- rm -f $exe/power*
- rm -f $exe/mips*
- rm -f $exe/arm*
- rm -f $exe/none*
- rm -f $exe/memcheck*
- rm -f $exe/massif*
- rm -f $exe/getoff*
- rm -f $exe/helgrind*
- rm -f $exe/lackey*
- rm -f $exe/exp*
- rm -f $exe/drd*
- rm -f $exe/cachegrind*
- rm -f $exe/callgrind*
- rm -f $lib/*.a
- rm -f $lib/libmpiwrap*.so
- rm -f $exe/dh*
- rm -f $exe/*.xml
- rm -f $exe/valgrind-monitor-def.py
- rm -f $exe/valgrind-monitor.py
- if [ ! -d $cu_exe ]; then mv $exe $cu_exe; fi
- # cleanup
- rm -rf $exe $lib
- # generate driver script
- echo '#!/bin/sh' >$top/bin/cputil
- echo 'top=$(realpath $(dirname $0)/..)' >>$top/bin/cputil
- echo 'VALGRIND_LIB=$top/libexec/cputil' >>$top/bin/cputil
- echo 'VALGRIND_LAUNCHER=$VALGRIND_LIB' >>$top/bin/cputil
- echo 'export VALGRIND_LIB VALGRIND_LAUNCHER' >>$top/bin/cputil
- echo '$VALGRIND_LIB/valgrind -q --tool=cputil "$@"' >>$top/bin/cputil
- chmod +x $top/bin/cputil
- # --- last line ---
|