File mingw64-gdb.spec of Package mingw64-gdb

#
# spec file for package mingw64-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:           mingw64-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:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-gettext-tools
BuildRequires:  mingw64-libexpat-devel
BuildRequires:  mingw64-mpfr-devel
BuildRequires:  mingw64-python3-devel
BuildRequires:  mingw64-readline-devel
BuildRequires:  mingw64-win_iconv-devel
BuildRequires:  mingw64-zlib-devel
BuildRequires:  xz
Requires:       %{name}-lang = %{version}
Requires:       mingw64-python3

%_mingw64_package_header_debug
BuildArch:      noarch

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

%_mingw64_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
MINGW64_CFLAGS="%_mingw64_cflags -I%{_mingw64_python3_includedir}"
MINGW64_CXXFLAGS="%_mingw64_cxxflags -I%{_mingw64_python3_includedir}"
MINGW64_LDFLAGS="%_mingw64_ldflags -L%{_mingw64_prefix}/lib -l%{_mingw64_python3_library}"

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

%{_mingw64_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

%{_mingw64_make} %{?_smp_mflags} || %{_mingw64_make}

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

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

rm -rf %{buildroot}%{_mingw64_bindir}/gdb-add-index
rm -rf %{buildroot}%{_mingw64_libdir}/libbfd.a
rm -rf %{buildroot}%{_mingw64_libdir}/libctf-nobfd.a
rm -rf %{buildroot}%{_mingw64_libdir}/libctf.a
rm -rf %{buildroot}%{_mingw64_libdir}/libiberty.a
rm -rf %{buildroot}%{_mingw64_libdir}/libopcodes.a
rm -rf %{buildroot}%{_mingw64_libdir}/libsframe.a
rm -rf %{buildroot}%{_mingw64_includedir}/*
rm -rf %{buildroot}%{_mingw64_datadir}/info

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

%files
%defattr(-,root,root)
%{_mingw64_bindir}/gdb*.exe
%{_mingw64_datadir}/gdb
%{_mingw64_mandir}/man1/*.1*
%{_mingw64_mandir}/man5/*.5*
%{_mingw64_sysconfdir}

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

%changelog
openSUSE Build Service is sponsored by