diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..964176c
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ testsuite
+
diff --git a/gdb.changes b/gdb.changes
index eef4d5e..dfc0a15 100644
--- a/gdb.changes
+++ b/gdb.changes
@@ -4,6 +4,11 @@ Wed Jul 29 15:44:22 UTC 2020 - Tom de Vries
- Fix internal error on aarch64 [swo#26316].
gdb-aarch64-fix-erroneous-use-of-spu-architecture-bfd.patch
+-------------------------------------------------------------------
+Tue Jul 28 11:29:35 UTC 2020 - Tom de Vries
+
+- Change into multibuild package and add flavour gdb-testsuite.
+
-------------------------------------------------------------------
Fri Jul 24 12:39:06 UTC 2020 - Tom de Vries
diff --git a/gdb.spec b/gdb.spec
index f3eb6d8..03c1a36 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -17,17 +17,52 @@
#
+%define flavor @BUILD_FLAVOR@%{nil}
+
+%bcond_with ringdisabled
+
+%if "%flavor" == "testsuite"
+%if %{with ringdisabled}
+ExclusiveArch: do_not_build
+%endif
%if 0%{?qemu_user_space_build}
# In a qemu_user_space_build ptrace is not supported, so we can't test gdb.
-%global _without_testsuite 1
+ExclusiveArch: do_not_build
%endif
-%bcond_without testsuite
+%define build_main 0
+%define build_testsuite 1
+%else
+%define build_main 1
+%define build_testsuite 0
+%endif
+
+%if %{build_testsuite}
+%define debug_package %{nil}
+%endif
+
+%if %{build_main}
+%define name_suffix %{nil}
+%else
+%if %{build_testsuite}
+%define name_suffix -testresults
+%else
+%define name_suffix -%{flavor}
+%endif
+%endif
+
%bcond_without fpc
+%if %{build_main}
Summary: A GNU source-level debugger for C, C++, Fortran and other languages
-License: GPL-3.0-or-later AND GPL-3.0-with-GCC-exception AND LGPL-2.1-or-later AND LGPL-3.0-or-later
-Group: Development/Tools/Debuggers
-Name: gdb
+License: SUSE-Public-Domain
+Group: Development/Languages/C and C++
+%endif
+%if %{build_testsuite}
+Summary: GDB testsuite results
+License: SUSE-Public-Domain
+Group: Development/Languages/C and C++
+%endif
+Name: gdb%{name_suffix}
Version: 9.2
Release: 0
@@ -46,9 +81,9 @@ Obsoletes: devtoolset-1.0-%{pkg_name}
%endif
# For our convenience
-%global gdb_src %{name}-%{version}
+%global gdb_src gdb-%{version}
%global gdb_build build-%{_target_platform}
-%global gdb_docdir %{_docdir}/%{name}-doc
+%global gdb_docdir %{_docdir}/gdb-doc
%global have_inproctrace 0
%ifarch %{ix86} x86_64
@@ -96,6 +131,18 @@ Source10: patchlist.pl
Source11: patchname_get.sh
Source12: baselibs.conf
Source13: gdb-rpmlintrc
+%if %{build_testsuite}
+NoSource: 0
+NoSource: 2
+NoSource: 3
+NoSource: 4
+NoSource: 5
+NoSource: 7
+NoSource: 10
+NoSource: 11
+NoSource: 12
+NoSource: 13
+%endif
#Fedora Packages begin
Patch2: gdb-vla-intel-fortran-strides.patch
@@ -282,7 +329,7 @@ BuildRequires: cmake
ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x
%endif # 0%{?el5:1}
-%if %{with testsuite}
+%if %{build_testsuite}
# Copied from gcc9/gcc.spec.in
# Ada currently fails to build on a few platforms, enable it only
@@ -374,13 +421,15 @@ BuildRequires: binutils-gold
BuildRequires: binutils-gold
%endif
-%endif # %%{with testsuite}
+%endif # %%{build_testsuite}
%ifarch ia64
BuildRequires: libunwind-devel
Requires: libunwind
%endif
+%if %{build_main}
+
%description
GDB, the GNU debugger, allows you to debug programs written in C, C++,
Java, and other languages, by executing them in a controlled fashion
@@ -417,14 +466,12 @@ Java, and other languages, by executing them in a controlled fashion
and printing their data.
This package provides INFO, HTML and PDF user manual for GDB.
+%endif
-%package testresults
-Summary: GDB testsuite results
-License: SUSE-Public-Domain
-Group: Development/Languages/C and C++
-
-%description testresults
+%if %{build_testsuite}
+%description
Results from running the GDB testsuite.
+%endif
%prep
%setup -q -n %{gdb_src}
@@ -790,7 +837,7 @@ fi
# This is a build-time test, but still a test. So, skip if we don't do tests.
# This is relevant for %%qemu_user_space_build == 1 builds, which atm is
# the case for riscv64.
-%if %{with testsuite}
+%if %{build_testsuite}
if [ "$LIBRPM" != "no" ]; then
cd gdb
cat \
@@ -870,7 +917,7 @@ cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src}
# Initially we're in the %%{gdb_src} directory.
cd %{gdb_build}
-%if %{without testsuite}
+%if !%{build_testsuite}
echo ====================TESTSUITE DISABLED=========================
%else
echo ====================TESTING=========================
@@ -1042,11 +1089,24 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/configure*
rm -rf $RPM_BUILD_ROOT%{_includedir}
rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*}
+%if %{build_testsuite}
+rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit
+rm -rf $RPM_BUILD_ROOT%{_bindir}
+rm -rf $RPM_BUILD_ROOT%{_libdir}
+rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb
+rm -rf $RPM_BUILD_ROOT%{_infodir}
+rm -rf $RPM_BUILD_ROOT%{_mandir}
+rm -rf $RPM_BUILD_ROOT/usr/src
+%endif
+
# pstack obsoletion
+%if %{build_main}
cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1
+%endif
%endif # 0%{!?_with_upstream:1}
+%if %{build_main}
# Packaged GDB is not a cross-target one.
(cd $RPM_BUILD_ROOT%{_datadir}/gdb/syscalls
rm -f mips*.xml
@@ -1095,6 +1155,7 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
# build" ( https://sourceware.org/bugzilla/show_bug.cgi?id=24575 ).
rm %{buildroot}/usr/share/man/man1/gdbserver.1
%endif
+%endif
%post
# This step is part of the installation of the RPM. Not to be confused
@@ -1118,6 +1179,7 @@ then
fi
fi
+%if %{build_main}
%files
%defattr(-,root,root)
%doc README NEWS
@@ -1140,9 +1202,10 @@ fi
%{_datadir}/gdb
%{_infodir}/annotate.info*
%{_infodir}/gdb.info*
+%endif
-%if %{with testsuite}
-%files testresults
+%if %{build_testsuite}
+%files
%defattr(-,root,root)
%doc %{gdb_build}/gdb/gdb-*.sum
%doc %{gdb_build}/gdb/gdb-*.log
@@ -1150,6 +1213,7 @@ fi
# don't include the files in include, they are part of binutils
+%if %{build_main}
%ifnarch riscv64 sparcv9 hppa
%files -n gdbserver
%defattr(-,root,root)
@@ -1159,7 +1223,9 @@ fi
%{_libdir}/libinproctrace.so
%endif # %%{have_inproctrace}
%endif
+%endif
+%if %{build_main}
%post doc
# This step is part of the installation of the RPM. Not to be confused
# with the 'make install ' of the build (rpmbuild) process.
@@ -1181,5 +1247,6 @@ then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || :
fi
fi
+%endif
%changelog