%define binutils_run_tests 1
%endif
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
+# again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
Name: binutils%{?cross:-%{cross}}
BuildRequires: makeinfo
BuildRequires: bison
BuildRequires: flex
+BuildRequires: expat-devel
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
BuildRequires: gcc-c++
%if 0%{?binutils_run_tests}
BuildRequires: dejagnu
-BuildRequires: gdb
BuildRequires: glibc-devel-static
%endif
Version: 2.33.1
build programs which use the GNU BFD library, which is part of
binutils.
+%{!?cross:
+%package -n gdb
+Summary: A GNU source-level debugger for C, C++, Java and other languages
+License: GPL-3.0+
+Group: Development/Building
+Requires: python
+
+%description -n gdb
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+}
+%package -n gdb-server
+Summary: A standalone server for GDB (the GNU source-level debugger)
+
+%description -n gdb-server
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+
+This package provides a program that allows you to run GDB on a different machine than the one
+which is running the program being debugged.
+
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: SUSE-Public-Domain
+Group: Development/Languages
+%description testresults
+Results from running the gcc and target library testsuites.
+}
+
%prep
%setup -q -n binutils-%{version}
export CFLAGS="${RPM_OPT_FLAGS}"
export CXXFLAGS="${RPM_OPT_FLAGS}"
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
mkdir build-dir
cd build-dir
+%{!?binutils_skip_configure:
../configure \
--prefix=%{_prefix} --libdir=%{_libdir} \
--infodir=%{_infodir} --mandir=%{_mandir} \
- --with-bugurl=http://bugs.tizen.org/ \
+ --with-bugurl=https://bugs.tizen.org/ \
--with-sysroot=/ \
--disable-nls \
--with-separate-debug-dir=%{_prefix}/lib/debug \
--enable-plugins \
--enable-gold \
--enable-shared \
- --enable-new-dtags
-
+ --enable-new-dtags \
+ --with-gdb-datadir=%{_datadir}/gdb \
+ --enable-gdb-build-warnings=,-Wno-unused \
+ --with-separate-debug-dir=/usr/lib/debug \
+ --disable-sim \
+ --with-expat
+}
+%{!?binutils_skip_make:
make %{?_smp_mflags}
+}
+
+%{?binutils_exit_on_make_finish:
+ exit 1
+}
-%check
%{?binutils_run_tests:
- make %{?_smp_mflags} -C build-dir check -k
+ echo "Run testsuite"
+ # asan needs a whole shadow address space
+ ulimit -v unlimited || true
+ make -k check %{?_smp_mflags} || true
+ mkdir ../testresults
+ ../contrib/test_summary | tee ../testresults/test_summary.txt
}
%install
install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
# Remove unwanted files to shut up rpm
%{remove_docs}
-rm -rf %{buildroot}%{_bindir}/gcore
-rm -rf %{buildroot}%{_bindir}/gdb*
-rm -rf %{buildroot}%{_datadir}/gdb
rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
%{?cross:
rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
%{_bindir}/*
%{_prefix}/%{target_arch}/bin/*
%{!?cross:
+%exclude %{_bindir}/gdb*
%exclude %{_bindir}/ld.gold
%exclude %{_prefix}/%{target_arch}/bin/ld.gold
%{_libdir}/*.so
%defattr(-,root,root)
%{_bindir}/ld.gold
%{_prefix}/%{target_arch}/bin/ld.gold
+
+%files -n gdb
+%{_datadir}/gdb
+%{_bindir}/gcore
+%{_bindir}/gdb
+%{_bindir}/gdb-add-index
+
+%files -n gdb-server
+%{_bindir}/gdbserver
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
}
%changelog