summaryrefslogtreecommitdiffstats
path: root/cygwin-find-debuginfo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cygwin-find-debuginfo.sh')
-rwxr-xr-xcygwin-find-debuginfo.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/cygwin-find-debuginfo.sh b/cygwin-find-debuginfo.sh
new file mode 100755
index 0000000..bbe7fc1
--- /dev/null
+++ b/cygwin-find-debuginfo.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#cygwin_find-debuginfo.sh - automagically generate debug info and file list
+#for inclusion in an rpm spec file for cygwin-* packages.
+
+if [ -z "$1" ] ; then BUILDDIR="."
+else BUILDDIR=$1
+fi
+
+for f in `find $RPM_BUILD_ROOT -type f -name "*.exe" -or -name "*.dll"`
+do
+ case $(i686-pc-cygwin-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
+ i686-pc-cygwin-objcopy --only-keep-debug $f $f.debug || :
+ pushd `dirname $f`
+ i686-pc-cygwin-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" |
+ sed -n -e "s#^$RPM_BUILD_ROOT##p" > $BUILDDIR/debugfiles.list
+
+