#!/bin/sh #mingw64_find-debuginfo.sh - automagically generate debug info and file list #for inclusion in an rpm spec file for mingw64-* packages. target="mingw64" host="x86_64-w64-mingw32" if [ -z "$1" ] ; then BUILDDIR="." else 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 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