#find-debuginfo.sh - automagically generate debug info and file list
#for inclusion in an rpm spec file.
#
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
+# Usage: find-debuginfo.sh [--strict-build-id] [--strip-disable] [--strip-option] [-g] [-r]
# [-o debugfiles.list]
# [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
# [builddir]
# Barf on missing build IDs.
strict=false
+# With --strip-disable arg, no strip
+strip_disable=false
+
+# With --strip-option arg, this will be used as arg. of eu-strip
+strip_option=
+
BUILDDIR=.
out=debugfiles.list
nout=0
--strict-build-id)
strict=true
;;
+ --strip-disable)
+ strip_disable=true
+ ;;
+ *--strip-option*)
+ strip_option=$(echo $1 | sed 's/--strip-option=//')
+ ;;
-g)
strip_g=true
;;
strip_to_debug()
{
+ local g=
local r=
+
+ if test "$strip_disable" = true ; then
+ exit
+ fi
+
$strip_r && r=--reloc-debug-sections
+ $strip_g && case "$(file -bi "$2")" in
+ application/x-sharedlib*) g=-g ;;
+ esac
+
case $2 in
*.ko)
- # don't attempt to create a minimal backtrace binary for
- # kernel modules as this just causes the stripping process
- # to be skipped entirely
- eu-strip --remove-comment $r -f "$1" "$2" || exit
- ;;
+ # don't attempt to create a minimal backtrace binary for
+ # kernel modules as this just causes the stripping process
+ # to be skipped entirely
+ eu-strip --remove-comment $r $strip_option -f "$1" "$2" || exit
+ ;;
*)
- eu-strip --remove-comment -g -f "$1" "$2" || exit
+ eu-strip --remove-comment $g $strip_option -f "$1" "$2" || exit
esac
chmod 444 "$1" || exit
}
if test "$NO_DEBUGINFO_STRIP_DEBUG" = true ; then
strip_option=
fi
+ if test "$strip_disable" = true ; then
+ strip_option=
+ fi
objcopy --add-gnu-debuglink=$debugfn -R .comment -R .GCC.command.line $strip_option $f
chmod $mode $f
) || :