File mingw32-gdb.spec of Package mingw32-gdb

#
# spec file for package mingw32-gdb
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           mingw32-gdb
Version:        14.2
Release:        0
Summary:        MinGW port of the GNU debugger (gdb)
License:        GPL-2.0-or-later
Group:          Development/Libraries
Url:            http://www.gnu.org/software/gdb
Source0:        ftp://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.xz
Patch0:         gdb-14.2-fix-bug-1227348.patch
Patch1:         gdb-11.1-fix-python-compile-eol.patch
Patch2:         gdb-12.1-fix-init-_gdb-module.patch
Patch3:         gdb-14.2-fix-finding-python-when-cross-compi.patch

#!BuildIgnore: post-build-checks
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  flex
BuildRequires:  libtool
BuildRequires:  makeinfo
BuildRequires:  mingw32-cross-gcc
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-gettext-tools
BuildRequires:  mingw32-libexpat-devel
BuildRequires:  mingw32-mpfr-devel
BuildRequires:  mingw32-python3-devel
BuildRequires:  mingw32-readline-devel
BuildRequires:  mingw32-win_iconv-devel
BuildRequires:  mingw32-zlib-devel
BuildRequires:  xz
Requires:       %{name}-lang = %{version}
Requires:       mingw32-python3

%_mingw32_package_header_debug
BuildArch:      noarch

%description
This is the MinGW port of the GNU debugger (gdb).

%_mingw32_debug_package

%lang_package

%prep
%autosetup -p1 -n gdb-%{version}

# Remove the info and other generated files added by the FSF release
# process.
rm -f libdecnumber/gstdint.h
rm -f bfd/doc/*.info*
rm -f gdb/doc/*.info*
%if %{?suse_version} >= 1599
# fix configure.ac:21: error: Please use exactly Autoconf 2.69 instead of 2.72.
(sed -i 's,2.69,2.72,g' config/override.m4)
%endif

# recreate configure
(cd gdb; autoreconf)

%build
mkdir build
cd build
MINGW32_CFLAGS="%_mingw32_cflags -I%{_mingw32_python3_includedir}"
MINGW32_CXXFLAGS="%_mingw32_cxxflags -I%{_mingw32_python3_includedir}"
MINGW32_LDFLAGS="%_mingw32_ldflags -L%{_mingw32_prefix}/lib -l%{_mingw32_python3_library}"

%{_mingw32_configure} \
    --with-auto-load-dir='$debugdir\\\;$datadir/auto-load' \
    --with-python=yes \
    --with-system-gdbinit=%{_mingw32_sysconfdir}/gdbinit \
    --with-system-gdbinit-dir=%{_mingw32_sysconfdir}

%{_mingw32_make} maybe-configure-gdb
# make dirs relocatable
sed -i 's,RELOCATABLE 0,RELOCATABLE 1,g' gdb/config.h
echo "#define PYTHON_PATH_RELOCATABLE 1" >> gdb/config.h

%{_mingw32_make} %{?_smp_mflags} || %{_mingw32_make}

%install
cd build
%{_mingw32_make} DESTDIR=%{buildroot} install
cd ..

mkdir -p %{buildroot}%{_mingw32_sysconfdir}
echo "python import sys" >%{buildroot}%{_mingw32_sysconfdir}/gdbinit
echo "python print('using python %s' % sys.version)" >>%{buildroot}%{_mingw32_sysconfdir}/gdbinit

rm -rf %{buildroot}%{_mingw32_bindir}/gdb-add-index
rm -rf %{buildroot}%{_mingw32_libdir}/libbfd.a
rm -rf %{buildroot}%{_mingw32_libdir}/libctf-nobfd.a
rm -rf %{buildroot}%{_mingw32_libdir}/libctf.a
rm -rf %{buildroot}%{_mingw32_libdir}/libiberty.a
rm -rf %{buildroot}%{_mingw32_libdir}/libopcodes.a
rm -rf %{buildroot}%{_mingw32_libdir}/libsframe.a
rm -rf %{buildroot}%{_mingw32_includedir}/*
rm -rf %{buildroot}%{_mingw32_datadir}/info

%find_lang bfd gdb.lang
%find_lang opcodes gdb.lang

%files
%defattr(-,root,root)
%{_mingw32_bindir}/gdb*.exe
%{_mingw32_datadir}/gdb
%{_mingw32_mandir}/man1/*.1*
%{_mingw32_mandir}/man5/*.5*
%{_mingw32_sysconfdir}

%files lang -f gdb.lang
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by