2 # spec file for package cross-arm-binutils
4 # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
6 # All modifications and additions to the file contributed by third parties
7 # remain the property of their copyright owners, unless otherwise agreed
8 # upon. The license for this file, and modifications and additions to the
9 # file, is the same license as for the pristine package itself (unless the
10 # license for the pristine package is not an Open Source License, in which
11 # case the license is the MIT License). An "Open Source License" is a
12 # license that conforms to the Open Source Definition (Version 1.9)
13 # published by the Open Source Initiative.
15 # Please submit bugfixes or comments via http://bugs.opensuse.org/
19 Name: cross-arm-binutils
25 BuildRequires: gcc-c++
27 BuildRequires: glibc-devel-static
30 BuildRequires: makeinfo
31 BuildRequires: zlib-devel-static
36 %define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
37 # check the vanilla binutils, with no patches applied
39 %define test_vanilla %(test ! -f %_sourcedir/TEST_VANILLA ; echo $?)
41 # handle test suite failures
43 %ifarch alpha %arm hppa mips sh4 %sparc
44 %define make_check_handling true
47 # XXX disabled because gold is seriously broken for now
48 %define make_check_handling true
50 # let make check fail anyway if RUN_TESTS was requested
52 %define make_check_handling false
54 # handle all binary object formats supported by SuSE (and a few more)
55 %ifarch %ix86 %arm ia64 ppc ppc64 s390 s390x x86_64
56 %define build_multitarget 1
58 %define build_multitarget 0
60 %define target_list alpha armv5l armv7l armv8l hppa hppa64 i686 ia64 m68k mips powerpc powerpc64 s390 s390x sh4 sparc sparc64 x86_64
64 Url: http://www.gnu.org/software/binutils/
65 %define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
67 License: GFDL-1.3 and GPL-3.0+
68 Group: Development/Tools/Building
69 Source: binutils-%{binutils_version}.tar.bz2
70 Source1: pre_checkin.sh
71 Source2: README.First-for.SuSE.packagers
72 Source3: baselibs.conf
73 Patch3: binutils-skip-rpaths.patch
74 Patch4: s390-biarch.diff
75 Patch5: x86-64-biarch.patch
76 Patch6: unit-at-a-time.patch
79 Patch9: testsuite.diff
80 Patch10: enable-targets-gold.diff
81 Patch11: use-hashtype-both-by-default.diff
82 Patch14: binutils-build-as-needed.diff
83 Patch15: fixup-testcase-perturb.diff
84 Patch18: gold-depend-on-opcodes.diff
85 Patch19: bso12451.diff
86 Patch20: bso13449.diff
87 Patch90: cross-avr-nesc-as.patch
88 Patch92: cross-avr-omit_section_dynsym.patch
89 Patch93: avr-binutils-relocs.patch
90 BuildRoot: %{_tmppath}/%{name}-%{version}-build
93 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
94 size, strings, and strip. These utilities are needed whenever you want
95 to compile a program or kernel.
99 Summary: The gold linker
101 Group: Development/Tools/Building
102 Requires: binutils = %{version}-%{release}
104 %define gold_archs %ix86 %arm x86_64 ppc ppc64 %sparc
108 gold is an ELF linker. It is intended to have complete support for ELF
109 and to run as fast as possible on modern systems. For normal use it is
110 a drop-in replacement for the older GNU linker.
114 Summary: GNU binutils (BFD development files)
116 Group: Development/Libraries/C and C++
117 Requires: binutils = %{version}-%{release}
119 Provides: binutils:/usr/include/bfd.h
122 This package includes header files and static libraries necessary to
123 build programs which use the GNU BFD library, which is part of
128 %define HOST %{_target_cpu}-tizen-linux-gnueabi
130 %define HOST %(echo %{_target_cpu} | sed -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/" -e "s/sparc64v.*/sparc64/" -e "s/sparcv.*/sparc/")-tizen-linux
132 %define DIST %(echo '%distribution' | sed 's/ (.*)//')
135 echo "make check will return with %{make_check_handling} in case of testsuite failures."
136 %setup -q -n binutils-%{binutils_version}
152 %if "%{TARGET}" == "avr"
153 cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
161 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
164 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
166 # Building native binutils
167 echo "Building native binutils."
168 %if %build_multitarget
169 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
170 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
174 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
177 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
180 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
183 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
186 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
189 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
192 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
195 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
196 --prefix=%{_prefix} --libdir=%{_libdir} \\\
197 --infodir=%{_infodir} --mandir=%{_mandir} \\\
198 --with-bugurl=http://bugs.opensuse.org/ \\\
199 --with-pkgversion="GNU Binutils; %{DIST}" \\\
201 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
202 --with-pic --build=%{HOST}
205 ../configure %common_flags \
206 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
212 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
213 # force reconfiguring (???)
218 # building cross-TARGET-binutils
219 echo "Building cross binutils."
223 %if "%{TARGET}" == "sparc"
224 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
226 %if "%{TARGET}" == "powerpc"
227 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
229 %if "%{TARGET}" == "s390"
230 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
232 %if "%{TARGET}" == "s390x"
233 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
235 %if "%{TARGET}" == "i586"
236 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
238 %if "%{TARGET}" == "hppa"
239 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
241 %if "%{TARGET}" == "arm"
242 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
244 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
247 %if "%{TARGET}" == "arm"
248 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
250 TARGET_OS=%{TARGET}-tizen-linux
253 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
254 --prefix=%{_prefix} \
255 --with-bugurl=http://bugs.opensuse.org/ \
256 --with-pkgversion="GNU Binutils; %{DIST}" \
258 --build=%{HOST} --target=$TARGET_OS \
259 %if "%{TARGET}" == "spu"
260 --with-sysroot=/usr/spu \
262 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
264 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
265 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
266 # force reconfiguring
269 %if "%{TARGET}" == "avr"
270 # build an extra nesC version because nesC requires $'s in identifiers
272 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
273 make -C gas-nesc clean
274 make -C gas-nesc %{?_smp_mflags}
282 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
284 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
290 # installing native binutils
292 make DESTDIR=$RPM_BUILD_ROOT install-gold
293 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
295 make DESTDIR=$RPM_BUILD_ROOT install-info install
296 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
297 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
298 # we could eventually use alternatives for /usr/bin/ld
299 if test -f $RPM_BUILD_ROOT%{_bindir}/ld.bfd; then
300 rm $RPM_BUILD_ROOT%{_bindir}/ld
301 ln -sf ld.bfd $RPM_BUILD_ROOT%{_bindir}/ld;
303 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
304 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
305 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
306 #mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
307 #ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
308 # Install header files
309 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
310 # We want the PIC libiberty.a
311 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
313 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
314 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
315 # No shared linking outside binutils
316 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
317 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
318 # Remove unwanted files to shut up rpm
319 rm $RPM_BUILD_ROOT%{_infodir}/configure* $RPM_BUILD_ROOT%{_infodir}/standards.info*
320 rm $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
323 #%find_lang bfd binutils.lang
324 #%find_lang gas binutils.lang
325 #%find_lang ld binutils.lang
326 #%find_lang opcodes binutils.lang
327 #%find_lang gprof binutils.lang
329 #%find_lang gold binutils-gold.lang
331 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
332 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
333 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
334 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
336 # installing cross-TARGET-binutils and TARGET-binutils
337 make DESTDIR=$RPM_BUILD_ROOT install
338 # Replace hard links by symlinks, so that rpmlint doesn't complain
339 T=$(basename %buildroot/usr/%{TARGET}*)
340 for f in %buildroot/usr/$T/bin/* ; do
341 ln -sf /usr/bin/$T-$(basename $f) $f
343 %if "%{TARGET}" == "avr"
344 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
345 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
347 rm -rf $RPM_BUILD_ROOT%{_mandir}
348 rm -rf $RPM_BUILD_ROOT%{_infodir}
349 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
350 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
351 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
354 cd $RPM_BUILD_DIR/binutils-%version
357 rm -rf $RPM_BUILD_ROOT
364 %defattr(-,root,root)
367 %{_prefix}/%{HOST}/bin/*
368 %{_prefix}/%{HOST}/lib/ldscripts
369 #%{_libdir}/ldscripts
372 %exclude %{_bindir}/gold
373 %exclude %{_bindir}/ld.gold
375 %doc %{_infodir}/*.gz
376 %{_libdir}/lib*-%{version}*.so
378 %{_prefix}/%{TARGET}*
384 %defattr(-,root,root)
385 %doc gold/NEWS gold/README
392 %defattr(-,root,root)
393 %{_prefix}/include/*.h