mingw-filesystem/mingw-find-debuginfo.sh

47 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/sh
Added support for both win32 and win64 targets - Fixed rpmlint issues - Fixed permissions of the scripts (775 -> 755) - Fixed description of the various subpackages - Make the various macros compliant with the new packaging guidelines: https://fedorahosted.org/fpc/ticket/71 - Suppress arch-independent-package-contains-binary-or-object rpmlint errors for static libraries - Improved the mingw_configure, mingw_make, mingw_make_install, mingw_cmake and mingw_cmake_kde4 RPM macros so packagers don't need to use quotes anymore when using arguments. Thanks to Kalev Lember for the initial proof of concept - Dropped the -mms-bitfields argument from the default CFLAGS as it is enabled by default as of gcc 4.7 - Replaced the CMake defines QT_HEADERS_DIR and QT_LIBRARY_DIR with QT_BINARY_DIR which is a more proper method to make CMake aware of the location of Qt. Thx to Dominik Schmidt for the hint - Make sure CMake can detect the qmake-qt4 binary in /usr/$target/bin - Make sure CMake can also detect the (native) Qt tools qdbuscpp2xml and qdbusxml2cpp - Added new RPM macros mingw_cmake_kde4, mingw32_cmake_kde4 and mingw64_cmake_kde4 - Added three new environment variables which can be set to influence the behaviour of the cmake macros: MINGW_CMAKE_ARGS, MINGW32_CMAKE_ARGS and MINGW64_CMAKE_ARGS - Dropped the mingw32-qmake-qt4 and mingw64-qmake-qt4 wrapper scripts as they're now provided by the mingw{32,64}-qt-qmake packages - Added a new RPM macro: %%{?mingw_package_header} Packagers can use this macro instead of the original boilerplate code which is needed for all mingw packages - Made argument passing using the backwards compatibility macro %%{_mingw32_cmake} work - Fixed an issue in the mingw_cmake macro where it could point to a non-existant CMakeLists.txt file - Fixed a bug in the find-requires script which causes all packages to depend on both the mingw32 and the mingw64 toolchains - Split out the RPM macros which require both the mingw{32,64}-filesystem packages in a new file and put it in the mingw-filesystem-base package - Generate seperate debuginfo packages for mingw32 and mingw64 - Set the minimum version of R: mingw{32,64}-filesystem to 70 - Use the correct FSF-address in some scripts - Thanks to all the contributors: Erik van Pienbroek, Kalev Lember, Levente Farkas, Marc-Andre Lureau.
2012-02-25 23:17:24 +00:00
# mingw-find-debuginfo.sh - automagically generate debug info and file list
# for inclusion in an rpm spec file for mingw-* packages.
if [ "$#" -lt 2 ] ; then
echo "Usage: $0 <BUILDDIR> [TARGET]..."
exit 1
Added support for both win32 and win64 targets - Fixed rpmlint issues - Fixed permissions of the scripts (775 -> 755) - Fixed description of the various subpackages - Make the various macros compliant with the new packaging guidelines: https://fedorahosted.org/fpc/ticket/71 - Suppress arch-independent-package-contains-binary-or-object rpmlint errors for static libraries - Improved the mingw_configure, mingw_make, mingw_make_install, mingw_cmake and mingw_cmake_kde4 RPM macros so packagers don't need to use quotes anymore when using arguments. Thanks to Kalev Lember for the initial proof of concept - Dropped the -mms-bitfields argument from the default CFLAGS as it is enabled by default as of gcc 4.7 - Replaced the CMake defines QT_HEADERS_DIR and QT_LIBRARY_DIR with QT_BINARY_DIR which is a more proper method to make CMake aware of the location of Qt. Thx to Dominik Schmidt for the hint - Make sure CMake can detect the qmake-qt4 binary in /usr/$target/bin - Make sure CMake can also detect the (native) Qt tools qdbuscpp2xml and qdbusxml2cpp - Added new RPM macros mingw_cmake_kde4, mingw32_cmake_kde4 and mingw64_cmake_kde4 - Added three new environment variables which can be set to influence the behaviour of the cmake macros: MINGW_CMAKE_ARGS, MINGW32_CMAKE_ARGS and MINGW64_CMAKE_ARGS - Dropped the mingw32-qmake-qt4 and mingw64-qmake-qt4 wrapper scripts as they're now provided by the mingw{32,64}-qt-qmake packages - Added a new RPM macro: %%{?mingw_package_header} Packagers can use this macro instead of the original boilerplate code which is needed for all mingw packages - Made argument passing using the backwards compatibility macro %%{_mingw32_cmake} work - Fixed an issue in the mingw_cmake macro where it could point to a non-existant CMakeLists.txt file - Fixed a bug in the find-requires script which causes all packages to depend on both the mingw32 and the mingw64 toolchains - Split out the RPM macros which require both the mingw{32,64}-filesystem packages in a new file and put it in the mingw-filesystem-base package - Generate seperate debuginfo packages for mingw32 and mingw64 - Set the minimum version of R: mingw{32,64}-filesystem to 70 - Use the correct FSF-address in some scripts - Thanks to all the contributors: Erik van Pienbroek, Kalev Lember, Levente Farkas, Marc-Andre Lureau.
2012-02-25 23:17:24 +00:00
fi
BUILDDIR=$1
shift
for f in `find $RPM_BUILD_ROOT -type f -name "*.exe" -or -name "*.dll" -or -name "*.pyd"`
Added support for both win32 and win64 targets - Fixed rpmlint issues - Fixed permissions of the scripts (775 -> 755) - Fixed description of the various subpackages - Make the various macros compliant with the new packaging guidelines: https://fedorahosted.org/fpc/ticket/71 - Suppress arch-independent-package-contains-binary-or-object rpmlint errors for static libraries - Improved the mingw_configure, mingw_make, mingw_make_install, mingw_cmake and mingw_cmake_kde4 RPM macros so packagers don't need to use quotes anymore when using arguments. Thanks to Kalev Lember for the initial proof of concept - Dropped the -mms-bitfields argument from the default CFLAGS as it is enabled by default as of gcc 4.7 - Replaced the CMake defines QT_HEADERS_DIR and QT_LIBRARY_DIR with QT_BINARY_DIR which is a more proper method to make CMake aware of the location of Qt. Thx to Dominik Schmidt for the hint - Make sure CMake can detect the qmake-qt4 binary in /usr/$target/bin - Make sure CMake can also detect the (native) Qt tools qdbuscpp2xml and qdbusxml2cpp - Added new RPM macros mingw_cmake_kde4, mingw32_cmake_kde4 and mingw64_cmake_kde4 - Added three new environment variables which can be set to influence the behaviour of the cmake macros: MINGW_CMAKE_ARGS, MINGW32_CMAKE_ARGS and MINGW64_CMAKE_ARGS - Dropped the mingw32-qmake-qt4 and mingw64-qmake-qt4 wrapper scripts as they're now provided by the mingw{32,64}-qt-qmake packages - Added a new RPM macro: %%{?mingw_package_header} Packagers can use this macro instead of the original boilerplate code which is needed for all mingw packages - Made argument passing using the backwards compatibility macro %%{_mingw32_cmake} work - Fixed an issue in the mingw_cmake macro where it could point to a non-existant CMakeLists.txt file - Fixed a bug in the find-requires script which causes all packages to depend on both the mingw32 and the mingw64 toolchains - Split out the RPM macros which require both the mingw{32,64}-filesystem packages in a new file and put it in the mingw-filesystem-base package - Generate seperate debuginfo packages for mingw32 and mingw64 - Set the minimum version of R: mingw{32,64}-filesystem to 70 - Use the correct FSF-address in some scripts - Thanks to all the contributors: Erik van Pienbroek, Kalev Lember, Levente Farkas, Marc-Andre Lureau.
2012-02-25 23:17:24 +00:00
do
2022-10-06 06:51:53 +00:00
case $(mingw-objdump -h $f 2>/dev/null | grep -Eo '(debug[\.a-z_]*|gnu.version)') in
Added support for both win32 and win64 targets - Fixed rpmlint issues - Fixed permissions of the scripts (775 -> 755) - Fixed description of the various subpackages - Make the various macros compliant with the new packaging guidelines: https://fedorahosted.org/fpc/ticket/71 - Suppress arch-independent-package-contains-binary-or-object rpmlint errors for static libraries - Improved the mingw_configure, mingw_make, mingw_make_install, mingw_cmake and mingw_cmake_kde4 RPM macros so packagers don't need to use quotes anymore when using arguments. Thanks to Kalev Lember for the initial proof of concept - Dropped the -mms-bitfields argument from the default CFLAGS as it is enabled by default as of gcc 4.7 - Replaced the CMake defines QT_HEADERS_DIR and QT_LIBRARY_DIR with QT_BINARY_DIR which is a more proper method to make CMake aware of the location of Qt. Thx to Dominik Schmidt for the hint - Make sure CMake can detect the qmake-qt4 binary in /usr/$target/bin - Make sure CMake can also detect the (native) Qt tools qdbuscpp2xml and qdbusxml2cpp - Added new RPM macros mingw_cmake_kde4, mingw32_cmake_kde4 and mingw64_cmake_kde4 - Added three new environment variables which can be set to influence the behaviour of the cmake macros: MINGW_CMAKE_ARGS, MINGW32_CMAKE_ARGS and MINGW64_CMAKE_ARGS - Dropped the mingw32-qmake-qt4 and mingw64-qmake-qt4 wrapper scripts as they're now provided by the mingw{32,64}-qt-qmake packages - Added a new RPM macro: %%{?mingw_package_header} Packagers can use this macro instead of the original boilerplate code which is needed for all mingw packages - Made argument passing using the backwards compatibility macro %%{_mingw32_cmake} work - Fixed an issue in the mingw_cmake macro where it could point to a non-existant CMakeLists.txt file - Fixed a bug in the find-requires script which causes all packages to depend on both the mingw32 and the mingw64 toolchains - Split out the RPM macros which require both the mingw{32,64}-filesystem packages in a new file and put it in the mingw-filesystem-base package - Generate seperate debuginfo packages for mingw32 and mingw64 - Set the minimum version of R: mingw{32,64}-filesystem to 70 - Use the correct FSF-address in some scripts - Thanks to all the contributors: Erik van Pienbroek, Kalev Lember, Levente Farkas, Marc-Andre Lureau.
2012-02-25 23:17:24 +00:00
*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
2021-08-09 15:14:51 +00:00
dest=${RPM_BUILD_ROOT}/usr/lib/debug${f/$RPM_BUILD_ROOT/}.debug
mkdir -p `dirname $dest`
mingw-objcopy --only-keep-debug $f $dest || :
pushd `dirname $dest`
2017-09-10 11:51:18 +00:00
keep_symbols=`mktemp`
mingw-nm $dest --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "Function") print $1 }' | sort > "$keep_symbols"
mingw-objcopy --add-gnu-debuglink=`basename $dest` --strip-unneeded $f --keep-symbols="$keep_symbols" || :
2017-09-10 11:51:18 +00:00
rm -f "$keep_symbols"
Added support for both win32 and win64 targets - Fixed rpmlint issues - Fixed permissions of the scripts (775 -> 755) - Fixed description of the various subpackages - Make the various macros compliant with the new packaging guidelines: https://fedorahosted.org/fpc/ticket/71 - Suppress arch-independent-package-contains-binary-or-object rpmlint errors for static libraries - Improved the mingw_configure, mingw_make, mingw_make_install, mingw_cmake and mingw_cmake_kde4 RPM macros so packagers don't need to use quotes anymore when using arguments. Thanks to Kalev Lember for the initial proof of concept - Dropped the -mms-bitfields argument from the default CFLAGS as it is enabled by default as of gcc 4.7 - Replaced the CMake defines QT_HEADERS_DIR and QT_LIBRARY_DIR with QT_BINARY_DIR which is a more proper method to make CMake aware of the location of Qt. Thx to Dominik Schmidt for the hint - Make sure CMake can detect the qmake-qt4 binary in /usr/$target/bin - Make sure CMake can also detect the (native) Qt tools qdbuscpp2xml and qdbusxml2cpp - Added new RPM macros mingw_cmake_kde4, mingw32_cmake_kde4 and mingw64_cmake_kde4 - Added three new environment variables which can be set to influence the behaviour of the cmake macros: MINGW_CMAKE_ARGS, MINGW32_CMAKE_ARGS and MINGW64_CMAKE_ARGS - Dropped the mingw32-qmake-qt4 and mingw64-qmake-qt4 wrapper scripts as they're now provided by the mingw{32,64}-qt-qmake packages - Added a new RPM macro: %%{?mingw_package_header} Packagers can use this macro instead of the original boilerplate code which is needed for all mingw packages - Made argument passing using the backwards compatibility macro %%{_mingw32_cmake} work - Fixed an issue in the mingw_cmake macro where it could point to a non-existant CMakeLists.txt file - Fixed a bug in the find-requires script which causes all packages to depend on both the mingw32 and the mingw64 toolchains - Split out the RPM macros which require both the mingw{32,64}-filesystem packages in a new file and put it in the mingw-filesystem-base package - Generate seperate debuginfo packages for mingw32 and mingw64 - Set the minimum version of R: mingw{32,64}-filesystem to 70 - Use the correct FSF-address in some scripts - Thanks to all the contributors: Erik van Pienbroek, Kalev Lember, Levente Farkas, Marc-Andre Lureau.
2012-02-25 23:17:24 +00:00
popd
done
for target in $@; do
prefix=`rpm --eval "%{_prefix}/%{${target}_target}"`
2021-08-09 15:14:51 +00:00
if [ ! -d ${RPM_BUILD_ROOT}/usr/lib/debug/$prefix ] ; then
continue
fi
2021-08-09 15:14:51 +00:00
find ${RPM_BUILD_ROOT}/usr/lib/debug/$prefix -type f -name "*.exe.debug" -or -name "*.dll.debug" -or -name "*.pyd.debug" |
sed -n -e "s#^$RPM_BUILD_ROOT##p" > $BUILDDIR/${target}-debugfiles.list
2021-11-20 07:28:21 +00:00
find ${RPM_BUILD_ROOT}/usr/lib/debug/$prefix/* -type d |
sed -n -e "s#^$RPM_BUILD_ROOT#%dir #p" >> $BUILDDIR/${target}-debugfiles.list
done