File mingw32-find-debuginfo.sh of Package mingw32-filesystem

#!/bin/sh
#mingw32_find-debuginfo.sh - automagically generate debug info and file list
#for inclusion in an rpm spec file for mingw32-* packages.
target="mingw32"
host="i686-w64-mingw32"

BUILDDIR=.
if [ -n "$1" ]; then
	BUILDDIR="$1"
fi

SYMBOL_DIR="/usr/$host/sys-root/mingw/symbols"

for f in `find $RPM_BUILD_ROOT -type f -name "*.exe" -or -name "*.dll"`
do
	case $("$host-objdump" -h "$f" 2>/dev/null | egrep -o '(debug[\.a-z_]*|gnu.version)') in
	    *debuglink*) continue ;;
	    *debug*) ;;
	    *gnu.version*)
		echo "WARNING: "`echo $f | sed -e "s,^$RPM_BUILD_ROOT/*,/,"`" is already stripped!"
		continue
		;;
	    *) continue ;;
	esac

	echo extracting debug info from $f

	# breakpad symbols
	"$host-gen_sym_files" "$f" "$RPM_BUILD_ROOT$SYMBOL_DIR"

	"$host-objcopy" --only-keep-debug "$f" "$f.debug" || :
	pushd `dirname $f`
	"$host-objcopy" --add-gnu-debuglink=`basename "$f.debug"` --strip-unneeded `basename "$f"` || :
	popd
done

if [ ! -e "$BUILDDIR" ]; then
	mkdir -p "$BUILDDIR"
fi
find $RPM_BUILD_ROOT -type f \
		-name "*.exe.debug" \
	-or -name "*.dll.debug" \
	-or -name "*.exe.mdb" \
	-or -name "*.dll.mdb" \
| sed -n -e "s#^$RPM_BUILD_ROOT##p" >"$BUILDDIR/$target-debugfiles.list"

if [ -e "$RPM_BUILD_ROOT/$SYMBOL_DIR" ]; then
	echo "$SYMBOL_DIR" >>"$BUILDDIR/$target-debugfiles.list"
fi
openSUSE Build Service is sponsored by