summaryrefslogtreecommitdiffstats
path: root/run-stap.in
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-12-03 15:54:40 -0800
committerRoland McGrath <roland@redhat.com>2008-12-03 18:35:10 -0800
commit2f62657ce707b4011253d533c0423ed8d49a3e9e (patch)
tree59b2140ae77e138d9c11ef71ded066f48989d50d /run-stap.in
parentaad1a79ccc20268ba399f0e025f203e968978350 (diff)
downloadsystemtap-steved-2f62657ce707b4011253d533c0423ed8d49a3e9e.tar.gz
systemtap-steved-2f62657ce707b4011253d533c0423ed8d49a3e9e.tar.xz
systemtap-steved-2f62657ce707b4011253d533c0423ed8d49a3e9e.zip
PR6925: generate script to run stap from build directory
Diffstat (limited to 'run-stap.in')
-rw-r--r--run-stap.in36
1 files changed, 36 insertions, 0 deletions
diff --git a/run-stap.in b/run-stap.in
new file mode 100644
index 00000000..dfb53ab2
--- /dev/null
+++ b/run-stap.in
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+srcdir='@abs_top_srcdir@'
+builddir='@abs_top_builddir@'
+
+rundir="${0%/*}"
+[ "$rundir" == "$0" ] || builddir="$rundir"
+
+# Absolutify the paths.
+case "$srcdir" in
+/*) ;;
+*) srcdir=`cd "$srcdir" && pwd` || exit ;;
+esac
+case "$builddir" in
+/*) ;;
+*) builddir=`cd "$builddir" && pwd` || exit ;;
+esac
+
+# Set all the variables to find the source and build trees.
+SYSTEMTAP_TAPSET="${srcdir}/tapset"
+SYSTEMTAP_RUNTIME="${srcdir}/runtime"
+SYSTEMTAP_STAPIO="${builddir}/stapio"
+SYSTEMTAP_STAPRUN="sudo 'SYSTEMTAP_STAPIO=$SYSTEMTAP_STAPIO' \
+ 'SYSTEMTAP_STAPRUN=${builddir}/staprun' \
+ ${builddir}/staprun"
+export SYSTEMTAP_TAPSET SYSTEMTAP_RUNTIME SYSTEMTAP_STAPRUN SYSTEMTAP_STAPIO
+
+# If there were private elfutils libs built, use them.
+if [ -d "$rundir/lib-elfutils" ]; then
+ lib_elfutils="$rundir/lib-elfutils"
+ elfutils_path="${lib_elfutils}:${lib_elfutils}/systemtap"
+ LD_LIBRARY_PATH="${elfutils_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+ export LD_LIBRARY_PATH
+fi
+
+exec "${builddir}/stap" ${1+"$@"}