summaryrefslogtreecommitdiff
path: root/scripts/find-debuginfo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/find-debuginfo.sh')
-rw-r--r--scripts/find-debuginfo.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
new file mode 100644
index 000000000..33776899d
--- /dev/null
+++ b/scripts/find-debuginfo.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+#find-debuginfo.sh - automagically generate debug info and file list
+#for inclusion in an rpm spec file.
+
+LISTFILE=debugfiles.list
+
+# Strip ELF binaries
+for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
+ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
+ BASEDIR=`dirname $f | sed -n -e "s#^$RPM_BUILD_ROOT#/#p"`
+ OUTPUTDIR=${RPM_BUILD_ROOT}/usr/lib/debug${BASEDIR}
+ mkdir -p ${OUTPUTDIR}
+ echo extracting debug info from $f
+ striptofile -g -u -o $OUTPUTDIR $f || :
+done
+
+find ${RPM_BUILD_ROOT}/usr/lib/debug -type f | sed -n -e "s#^$RPM_BUILD_ROOT#/#p" > $LISTFILE