[mingw-filesystem: 25/73] - Add script to create -debuginfo subpackages This script was created by Fridrich Strba - All mi

Kalev Lember kalev at fedoraproject.org
Thu Feb 23 19:14:44 UTC 2012


commit d9bad00f487fddc4d476d05bcafecfdbb67594d1
Author: epienbro <epienbro at fedoraproject.org>
Date:   Mon Jun 22 10:18:35 2009 +0000

    - Add script to create -debuginfo subpackages This script was created by
        Fridrich Strba
    - All mingw32 packages now need to add these lines to their .spec files:
        %define __os_install_post %{_mingw32_debug_install_post}
        %{_mingw32_debug_package}

 macros.mingw32            |   18 ++++++++++++++++++
 mingw32-filesystem.spec   |   12 ++++++++++--
 mingw32-find-debuginfo.sh |   31 +++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 2 deletions(-)
---
diff --git a/macros.mingw32 b/macros.mingw32
index 6a257fd..27ac79e 100644
--- a/macros.mingw32
+++ b/macros.mingw32
@@ -52,6 +52,24 @@
 
 %_mingw32_findprovides    /usr/lib/rpm/mingw32-find-provides.sh
 %_mingw32_findrequires    /usr/lib/rpm/mingw32-find-requires.sh
+%_mingw32_finddebuginfo   /usr/lib/rpm/mingw32-find-debuginfo.sh
+
+%_mingw32_debug_install_post   \
+   /usr/lib/rpm/mingw32-find-debuginfo.sh %{_builddir}/%{?buildsubdir}\
+%{nil}
+
+# Template for debug sub-package.
+%_mingw32_debug_package(n:) \
+%package %{-n:-n %{-n*}-}debuginfo \
+Summary: Debug information for package %{name} \
+Group: Development/debug \
+%description %{-n:-n %{-n*}-}debuginfo \
+This package provides debug information for package %{name}.\
+Debug information is useful when developing applications that use this\
+package or when debugging this package.\
+%files debuginfo -f debugfiles.list\
+%defattr(-,root,root,-)\
+%{nil}
 
 %_mingw32_env HOST_CC=gcc; export HOST_CC; \
   PKG_CONFIG_LIBDIR="%{_mingw32_libdir}/pkgconfig"; export PKG_CONFIG_LIBDIR; \
diff --git a/mingw32-filesystem.spec b/mingw32-filesystem.spec
index d31c8df..49669e8 100644
--- a/mingw32-filesystem.spec
+++ b/mingw32-filesystem.spec
@@ -1,7 +1,7 @@
 %define debug_package %{nil}
 
 Name:           mingw32-filesystem
-Version:        51
+Version:        52
 Release:        1%{?dist}
 Summary:        MinGW base filesystem and environment
 
@@ -20,6 +20,7 @@ Source5:        mingw32-find-provides.sh
 Source6:        mingw32-scripts.sh
 Source7:        mingw32-rpmlint.config
 Source8:        Toolchain-mingw32.cmake
+Source9:        mingw32-find-debuginfo.sh
 
 Requires:       setup
 Requires:       rpm
@@ -137,11 +138,11 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man{
 mkdir -p $RPM_BUILD_ROOT/usr/lib/rpm
 install -m 0755 mingw32-find-requires.sh $RPM_BUILD_ROOT/usr/lib/rpm
 install -m 0755 %{SOURCE5} $RPM_BUILD_ROOT/usr/lib/rpm
+install -m 0755 %{SOURCE9} $RPM_BUILD_ROOT/usr/lib/rpm
 
 mkdir -p $RPM_BUILD_ROOT%{_datadir}/mingw32
 install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_datadir}/mingw32
 
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -164,6 +165,13 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Jun 22 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 52-0
+- Add script to create -debuginfo subpackages
+  This script was created by Fridrich Strba
+- All mingw32 packages now need to add these lines to their .spec files:
+  %%define __os_install_post %%{_mingw32_debug_install_post}
+  %%{_mingw32_debug_package}
+
 * Thu Jun  4 2009 Adam Goode <adam at spicenitz.org> - 51-1
 - Add CMake rules
 
diff --git a/mingw32-find-debuginfo.sh b/mingw32-find-debuginfo.sh
new file mode 100755
index 0000000..7758058
--- /dev/null
+++ b/mingw32-find-debuginfo.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#mingw32_find-debuginfo.sh - automagically generate debug info and file list
+#for inclusion in an rpm spec file for mingw32-* 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-mingw32-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-mingw32-objcopy --only-keep-debug $f $f.debug || :
+	pushd `dirname $f`
+	i686-pc-mingw32-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
+
+


More information about the scm-commits mailing list