22 %define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
24 %define target_cpu %{?cross}%{!?cross:%{ARCH}}
25 %define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
27 %define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
30 %define binutils_run_tests 1
33 # Enable this when testing on device to:
34 # 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
35 # 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
36 # again on device after invoking rpmbuild --short-circuit -bc ...
37 # 3. Skip configure and make commands and go directly to 'make check'
38 %if 0%{?run_tests_on_device}
39 %define binutils_run_tests 1
40 %define binutils_keep_build_dir 1
41 %define binutils_skip_configure 1
42 %define binutils_skip_make 1
45 # Exit right after 'make ..' step to keep all object files produced by binutils build
46 %if 0%{?exit_on_make_finish}
47 %define binutils_exit_on_make_finish 1
50 Name: binutils%{?cross:-%{cross}}
51 BuildRequires: makeinfo
54 BuildRequires: expat-devel
55 BuildRequires: ncurses-devel
56 BuildRequires: zlib-devel
57 BuildRequires: gcc-c++
58 %if 0%{?binutils_run_tests}
59 BuildRequires: dejagnu
60 BuildRequires: glibc-devel-static
64 Url: http://www.gnu.org/software/binutils/
66 License: GFDL-1.3 and GPL-3.0+
67 Group: Development/Building
68 %{?cross:ExcludeArch: %{cross}}
69 Source: binutils-%{version}.tar.bz2
70 Source1001: binutils.manifest
73 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
74 size, strings, and strip. These utilities are needed whenever you want
75 to compile a program or kernel.
79 Summary: The gold linker
81 Group: Development/Building
84 gold is an ELF linker. It is intended to have complete support for ELF
85 and to run as fast as possible on modern systems. For normal use it is
86 a drop-in replacement for the older GNU linker.
90 Summary: GNU binutils (BFD development files)
92 Group: Development/Building
96 This package includes header files and static libraries necessary to
97 build programs which use the GNU BFD library, which is part of
102 Summary: A GNU source-level debugger for C, C++, Java and other languages
104 Group: Development/Building
108 GDB, the GNU debugger, allows you to debug programs written in C, C++,
109 Java, and other languages, by executing them in a controlled fashion
110 and printing their data.
112 %package -n gdb-server
113 Summary: A standalone server for GDB (the GNU source-level debugger)
115 %description -n gdb-server
116 GDB, the GNU debugger, allows you to debug programs written in C, C++,
117 Java, and other languages, by executing them in a controlled fashion
118 and printing their data.
120 This package provides a program that allows you to run GDB on a different machine than the one
121 which is running the program being debugged.
123 %{?binutils_run_tests:
125 Summary: Testsuite results
126 License: SUSE-Public-Domain
127 Group: Development/Languages
128 %description testresults
129 Results from running the gcc and target library testsuites.
134 %setup -q -n binutils-%{version}
139 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
140 export CFLAGS="${RPM_OPT_FLAGS}"
141 export CXXFLAGS="${RPM_OPT_FLAGS}"
143 %{!?binutils_keep_build_dir:
149 %{!?binutils_skip_configure:
151 --prefix=%{_prefix} --libdir=%{_libdir} \
152 --infodir=%{_infodir} --mandir=%{_mandir} \
153 --with-bugurl=https://bugs.tizen.org/ \
156 --with-separate-debug-dir=%{_prefix}/lib/debug \
158 --build=%{host_arch} --target=%{target_arch} \
159 --host=%{host_arch} \
160 %{?annobin_verification: --enable-annobin-verification=warn } \
161 %{?annobin_verification_strict: --enable-annobin-verification=strict } \
163 --enable-targets=%{target_arch} \
164 --enable-64-bit-bfd \
167 --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
173 --with-gdb-datadir=%{_datadir}/gdb \
174 --enable-gdb-build-warnings=,-Wno-unused \
175 --with-separate-debug-dir=/usr/lib/debug \
179 %{!?binutils_skip_make:
183 %{?binutils_exit_on_make_finish:
187 %{?binutils_run_tests:
189 # asan needs a whole shadow address space
190 ulimit -v unlimited || true
191 make -k check %{?_smp_mflags} || true
193 ../contrib/test_summary | tee ../testresults/test_summary.txt
198 make DESTDIR=$RPM_BUILD_ROOT install
200 # Copy instead of hardlinks
201 for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
203 rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
205 cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
208 cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
212 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
213 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
215 %{?binutils_run_tests:
216 find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
217 mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
218 find ../testresults/ -type f -exec chmod 644 {} \;
221 # Remove unwanted files to shut up rpm
223 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
225 rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
226 rm -rf %{buildroot}%{_prefix}/%{host_arch}
227 rm -rf %{buildroot}%{_includedir}
228 rm -rf %{buildroot}%{_prefix}/lib*
229 rm -rf %{buildroot}%{_datadir}
233 %manifest binutils.manifest
234 %defattr(-,root,root)
236 %{_prefix}/%{target_arch}/bin/*
238 %exclude %{_bindir}/gdb*
239 %exclude %{_bindir}/ld.gold
240 %exclude %{_prefix}/%{target_arch}/bin/ld.gold
242 %{_prefix}/%{host_arch}/lib/ldscripts
245 %manifest binutils.manifest
246 %defattr(-,root,root)
248 %{_includedir}/gdb/*.h
252 %manifest binutils.manifest
253 %defattr(-,root,root)
255 %{_prefix}/%{target_arch}/bin/ld.gold
261 %{_bindir}/gdb-add-index
267 %{?binutils_run_tests:
269 %defattr(-,root,root)
270 %doc testresults/test_summary.txt