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/dwz.changes b/dwz.changes
index 593345a..e92be97 100644
--- a/dwz.changes
+++ b/dwz.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries
+
+- Split off dwz-testsuite package using multibuild, to remove build
+ cycle
+- Don't require binutils-gold for riscv64
+
-------------------------------------------------------------------
Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries
diff --git a/dwz.spec b/dwz.spec
index ef600e6..9f6bd71 100644
--- a/dwz.spec
+++ b/dwz.spec
@@ -15,24 +15,57 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
+%define flavor @BUILD_FLAVOR@%{nil}
-Name: dwz
+%if "%flavor" == "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
+%define name_suffix -%{flavor}
+%endif
+
+Name: dwz%{name_suffix}
Version: 0.13
Release: 0
+%if %{build_main}
Summary: DWARF optimization and duplicate removal tool
+%endif
+%if %{build_testsuite}
+Summary: Testsuite results from DWZ
+%endif
#Git-Clone: git://sourceware.org/git/dwz
#Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary
License: GPL-2.0-or-later AND LGPL-2.0-or-later
Group: Development/Tools/Building
-Source: %{name}-%{version}.tar.xz
+Source: dwz-%{version}.tar.xz
Url: https://sourceware.org/dwz/
BuildRequires: libelf-devel
BuildRequires: xz
+%if %{build_testsuite}
BuildRequires: dejagnu
BuildRequires: elfutils
BuildRequires: gdb
+%ifnarch riscv64
BuildRequires: binutils-gold
+%endif
+%endif
+%if !%{build_main}
+NoSource: 0
+%endif
+
+%if %{build_main}
%description
dwz optimizes DWARF debugging information contained in ELF shared
libraries and executables for size, by replacing DWARF information
@@ -50,22 +83,41 @@ When not using the -m option (multifile mode), GDB CVS snapshot (soon to be
7.5) is sufficient, when using -m option, GDB from a git branch
http://sources.redhat.com/git/?p=archer.git;a=shortlog;h=refs/heads/archer-tromey-dwz-multifile
is needed.
+%endif
+
+%if %{build_testsuite}
+%description
+This package contains the testsuite results from DWZ.
+%endif
%prep
-%setup -q -n %{name}
+%setup -q -n dwz
%build
make %{?_smp_mflags} CFLAGS="%{optflags}"
%check
+%if %{build_testsuite}
make -k check
+%endif
%install
+%if %{build_main}
%make_install
+%endif
+%if %{build_main}
%files
%license COPYING
%{_bindir}/dwz
%{_mandir}/man1/dwz.1%{?ext_man}
+%endif
+
+%if %{build_testsuite}
+%files
+%defattr(-,root,root)
+%doc dwz.sum
+%doc dwz.log
+%endif
%changelog