2 # - warning: Installed (but unpackaged) file(s) found:
3 # /usr/sh64-linux/sh64-elf
7 %bcond_without alpha # enable alpha
8 %bcond_without arm # enable arm
9 %bcond_without aarch64 # enable aarch64
10 %bcond_without avr32 # enable avr32
11 %bcond_without blackfin # enable blackfin
12 %bcond_without c6x # enable c6x
13 %bcond_without cris # enable cris
14 %bcond_without frv # enable frv
15 %bcond_without h8300 # enable h8300
16 %bcond_without hppa # enable hppa
17 %bcond_without hppa64 # enable hppa64
18 %bcond_without ia64 # enable ia64
19 %bcond_without m32r # enable m32r
20 %bcond_without m68k # enable m68k
21 %bcond_without metag # enable metag
22 %bcond_without microblaze # enable microblaze
23 %bcond_without mips64 # enable mips64
24 %bcond_without mn10300 # enable mn10300
25 %bcond_without nios2 # enable nios2
26 %bcond_without openrisc # enable openrisc
27 %bcond_without powerpc64 # enable powerpc64
28 %bcond_without s390x # enable s390x
29 %bcond_without score # enable score
30 %bcond_without sh # enable sh
31 %bcond_without sh64 # enable sh64
32 %bcond_without sparc64 # enable sparc64
33 %bcond_without tile # enable tile
34 %bcond_without x86_64 # enable x86_64
35 %bcond_without xtensa # enable xtensa
37 # 32-bit packages we don't build as we can use the 64-bit package instead
40 %undefine with_powerpc
45 # not available in binutils-2.24
46 %undefine with_hexagon
47 %undefine with_unicore32
49 Summary: A GNU collection of cross-compilation binary utilities
54 Group: Development/Tools
55 # Note - the Linux Kernel binutils releases are too unstable and contain too
56 # many controversial patches so we stick with the official FSF version
58 Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2
59 # Source0-md5: d9f3303f802a5b6b0bb73a335ab89d66
60 Source2: binutils-2.19.50.0.1-output-format.sed
61 # Bring up to date with what's in the git release branch
62 #Patch00: binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch
63 Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
64 Patch02: binutils-2.20.51.0.10-ppc64-pie.patch
65 Patch03: binutils-2.20.51.0.2-ia64-lib64.patch
66 Patch04: binutils-2.25-version.patch
67 Patch05: binutils-2.25-set-long-long.patch
68 Patch06: binutils-2.20.51.0.10-copy-osabi.patch
69 Patch07: binutils-2.20.51.0.10-sec-merge-emit.patch
70 # Enable -zrelro by default: BZ #621983
71 Patch08: binutils-2.22.52.0.1-relro-on-by-default.patch
72 # Local patch - export demangle.h with the binutils-devel rpm.
73 Patch09: binutils-2.22.52.0.1-export-demangle.h.patch
74 # Disable checks that config.h has been included before system headers. BZ #845084
75 Patch10: binutils-2.22.52.0.4-no-config-h-check.patch
76 # Fix addr2line to use the dynamic symbol table if it could not find any ordinary symbols.
77 Patch11: binutils-2.23.52.0.1-addr2line-dynsymtab.patch
78 Patch12: binutils-2.25-kernel-ld-r.patch
79 # Correct bug introduced by patch 12
80 Patch13: binutils-2.23.2-aarch64-em.patch
81 # Fix detections little endian PPC shared libraries
82 Patch14: binutils-2.24-ldforcele.patch
83 URL: http://sources.redhat.com/binutils
86 BuildRequires: texinfo >= 4.0
87 BuildRequires: zlib-devel
88 # BZ 920545: We need pod2man in order to build the manual pages.
89 BuildRequires: /usr/bin/pod2man
90 # Required for: ld-bootstrap/bootstrap.exp bootstrap with --static
91 # It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array
92 Conflicts: gcc-c++ < 4.0.0
94 Obsoletes: gnupro <= 1117-1
96 Provides: bundled(libiberty)
97 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
99 # Where the binaries aimed at gcc will live (ie. /usr/<target>/bin/)
100 %define auxbin_prefix %{_exec_prefix}
101 %define srcdir binutils-%{version}
104 Binutils is a collection of binary utilities, including ar (for
105 creating, modifying and extracting from archives), as (a family of GNU
106 assemblers), gprof (for displaying call graph profile data), ld (the
107 GNU linker), nm (for listing symbols from object files), objcopy (for
108 copying and translating object files), objdump (for displaying
109 information from object files), ranlib (for generating an index for
110 the contents of an archive), readelf (for displaying detailed
111 information about binary files), size (for listing the section sizes
112 of an object or archive file), strings (for listing printable strings
113 from files), strip (for discarding symbols), and addr2line (for
114 converting addresses to file and line).
117 Summary: Cross-build binary utility documentation and translation files
118 Group: Development/Tools
119 %if "%{_rpmversion}" >= "5"
124 Documentation, manual pages and translation files for cross-build
125 binary image generation, manipulation and query tools.
127 %define do_package() \
128 %package -n binutils-%1 \
129 Summary: Cross-build binary utilities for %1 \
130 Group: Development/Tools \
131 Requires: %{name}-common = %{version}-%{release}\
133 %description -n binutils-%1 \
134 Cross-build binary image generation, manipulation and query tools. \
136 %define do_symlink() \
137 %package -n binutils-%1 \
138 Summary: Cross-build binary utilities for %1 \
139 Group: Development/Tools \
140 Requires: binutils-%2 = %{version}-%{release}\
142 %description -n binutils-%1 \
143 Cross-build binary image generation, manipulation and query tools. \
145 %do_package alpha-linux-gnu
146 %do_package arm-linux-gnu
147 %do_package aarch64-linux-gnu
148 %do_package avr32-linux-gnu
149 %do_package bfin-linux-gnu
150 %do_package c6x-linux-gnu
151 %do_package cris-linux-gnu
152 %do_package frv-linux-gnu
153 %do_package h8300-linux-gnu
154 %do_package hexagon-linux-gnu
155 %do_package hppa-linux-gnu
156 %do_package hppa64-linux-gnu
157 %do_package i386-linux-gnu
158 %do_package ia64-linux-gnu
159 %do_package m32r-linux-gnu
160 %do_package m68k-linux-gnu
161 %do_package metag-linux-gnu
162 %do_package microblaze-linux-gnu
163 %do_package mips-linux-gnu
164 %do_package mips64-linux-gnu
165 %do_package mn10300-linux-gnu
166 %do_package nios2-linux-gnu
167 %do_package openrisc-linux-gnu
168 %do_package powerpc-linux-gnu
169 %do_package powerpc64-linux-gnu
170 %do_symlink ppc-linux-gnu powerpc-linux-gnu
171 %do_symlink ppc64-linux-gnu powerpc64-linux-gnu
172 %do_package s390-linux-gnu
173 %do_package s390x-linux-gnu
174 %do_package score-linux-gnu
175 %do_package sh-linux-gnu
176 %do_package sh4-linux-gnu
177 %do_package sh64-linux-gnu
178 %do_package sparc-linux-gnu
179 %do_package sparc64-linux-gnu
180 %do_package tile-linux-gnu
181 %do_package unicore32-linux-gnu
182 %do_package x86_64-linux-gnu
183 %do_package xtensa-linux-gnu
189 #%patch00 -p1 -b .latest-git~
193 %if "%{_lib}" == "lib64"
210 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
212 # On ppc64 we might use 64KiB pages
213 sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
215 # exclude "gas/config", "libiberty/config", it's a dir
216 %{__sed} -i -e 's/i\[3-7\]86/i[34567]86/g' $(echo */conf* | sed -e 's#gas/config##;s#libiberty/config##;')
217 sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in}
218 sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in}
219 # Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible.
220 if %{__cc} %{rpmcflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then
221 sed -i -e 's/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in}
222 sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in}
225 # $PACKAGE is used for the gettext catalog name.
226 sed -i -e 's/^ PACKAGE=/ PACKAGE=cross-/' */configure
227 # Undo the name change to run the testsuite.
228 for tool in binutils gas ld; do
229 sed -i -e "2aDEJATOOL = $tool" $tool/Makefile.am
230 sed -i -e "s/^DEJATOOL = .*/DEJATOOL = $tool/" $tool/Makefile.in
235 cat > target.list <<EOF
236 %{?with_alpha:alpha-linux-gnu}
237 %{?with_arm:arm-linux-gnu}
238 %{?with_aarch64:aarch64-linux-gnu}
239 %{?with_avr32:avr32-linux-gnu}
240 %{?with_blackfin:bfin-linux-gnu}
241 %{?with_c6x:c6x-linux-gnu}
242 %{?with_cris:cris-linux-gnu}
243 %{?with_frv:frv-linux-gnu}
244 %{?with_h8300:h8300-linux-gnu}
245 %{?with_hexagon:hexagon-linux-gnu}
246 %{?with_hppa:hppa-linux-gnu}
247 %{?with_hppa64:hppa64-linux-gnu}
248 %{?with_i386:i386-linux-gnu}
249 %{?with_ia64:ia64-linux-gnu}
250 %{?with_m32r:m32r-linux-gnu}
251 %{?with_m68k:m68k-linux-gnu}
252 %{?with_metag:metag-linux-gnu}
253 %{?with_microblaze:microblaze-linux-gnu}
254 %{?with_mips:mips-linux-gnu}
255 %{?with_mips64:mips64-linux-gnu}
256 %{?with_mn10300:mn10300-linux-gnu}
257 %{?with_nios2:nios2-linux-gnu}
258 %{?with_openrisc:openrisc-linux-gnu}
259 %{?with_powerpc:powerpc-linux-gnu}
260 %{?with_powerpc64:powerpc64-linux-gnu}
261 %{?with_s390:s390-linux-gnu}
262 %{?with_s390x:s390x-linux-gnu}
263 %{?with_score:score-linux-gnu}
264 %{?with_sh:sh-linux-gnu}
265 %{?with_sh4:sh4-linux-gnu}
266 %{?with_sh64:sh64-linux-gnu}
267 %{?with_sparc:sparc-linux-gnu}
268 %{?with_sparc64:sparc64-linux-gnu}
269 %{?with_tile:tile-linux-gnu}
270 %{?with_unicore32:unicore32-linux-gnu}
271 %{?with_x86_64:x86_64-linux-gnu}
272 %{?with_xtensa:xtensa-linux-gnu}
275 if [ $(wc -w < target.list) = 0 ]; then
276 echo >&2 "No targets selected"
284 local build_dir=${1%%%%-*}
287 arm-*) target=arm-linux-gnueabi;;
288 aarch64-*) target=aarch64-linux-gnu;;
289 avr32-*) target=avr-linux;;
290 bfin-*) target=bfin-uclinux;;
291 c6x-*) target=c6x-uclinux;;
292 h8300-*) target=h8300-elf;;
293 m32r-*) target=m32r-elf;;
294 mn10300-*) target=am33_2.0-linux;;
295 m68knommu-*) target=m68k-linux;;
296 openrisc-*) target=or1k-linux-gnu;;
297 parisc-*) target=hppa-linux;;
298 score-*) target=score-elf;;
299 sh64-*) target=sh64-linux;;
300 tile-*) target=tilegx-linux;;
301 v850-*) target=v850e-linux;;
302 x86-*) target=x86_64-linux;;
306 echo $arch: target is $target
309 case $target in i?86*|sparc*|ppc*|s390*|sh*|arm*)
310 CARGS="$CARGS --enable-64-bit-bfd"
314 case $target in ia64*)
315 CARGS="$CARGS --enable-targets=i386-linux"
319 case $target in ppc*|ppc64*)
320 CARGS="$CARGS --enable-targets=spu"
324 case $target in sh-*)
325 CARGS="$CARGS --enable-targets=sh4-linux"
329 case $target in sh64*)
330 CARGS="$CARGS --enable-targets=sh64-linux,sh-elf,sh-linux,sh4-linux"
337 # We could optimize the cross builds size by --enable-shared but the produced
338 # binaries may be less convenient in the embedded environment.
340 CFLAGS="%{rpmcflags}" \
341 LDFLAGS="%{rpmldflags} -Wl,-z,relro" \
342 ../%{srcdir}/configure \
343 --disable-dependency-tracking \
344 --disable-silent-rules \
346 --prefix=%{_prefix} \
347 --exec-prefix=%{auxbin_prefix} \
348 --bindir=%{_bindir} \
349 --sbindir=%{_sbindir} \
350 --sysconfdir=%{_sysconfdir} \
351 --datadir=%{_datadir} \
352 --includedir=%{_includedir} \
353 --libdir=%{_libdir} \
354 --libexecdir=%{_libexecdir} \
355 --localstatedir=%{_localstatedir} \
356 --sharedstatedir=%{_sharedstatedir} \
357 --mandir=%{_mandir} \
358 --infodir=%{_infodir} \
359 --build=%{_target_platform} \
360 --host=%{_target_platform} \
362 --program-prefix=$prefix \
364 --disable-install_libbfd \
365 --with-sysroot=%{_prefix}/$arch/sys-root \
367 --with-bugurl="http://bugs.pld-linux.org"
371 for target in $(cat target.list); do
372 config_target $target
376 local build_dir=${1%%%%-*}
377 %{__make} -C $build_dir tooldir=%{_prefix} all
380 for target in $(cat target.list); do
384 # for documentation purposes only
385 install -d cross-binutils
387 ../%{srcdir}/configure \
388 --disable-dependency-tracking \
389 --disable-silent-rules \
390 --prefix=%{_prefix} \
391 --exec-prefix=%{auxbin_prefix} \
392 --bindir=%{_bindir} \
393 --sbindir=%{_sbindir} \
394 --sysconfdir=%{_sysconfdir} \
395 --datadir=%{_datadir} \
396 --includedir=%{_includedir} \
397 --libdir=%{_libdir} \
398 --libexecdir=%{_libexecdir} \
399 --localstatedir=%{_localstatedir} \
400 --sharedstatedir=%{_sharedstatedir} \
401 --mandir=%{_mandir} \
402 --infodir=%{_infodir} \
403 --program-prefix=cross- \
405 --with-bugurl="http://bugs.pld-linux.org"
407 %{__make} tooldir=%{_prefix} all
411 rm -rf $RPM_BUILD_ROOT
416 %{__make} install -C $build_dir DESTDIR=$RPM_BUILD_ROOT
418 # We want links for ppc and ppc64 also if we make powerpc or powerpc64
421 cd $RPM_BUILD_ROOT%{_bindir}
423 ln -s $i ppc${i#powerpc}
426 cd $RPM_BUILD_ROOT%{_prefix}
428 ln -s $i ppc${i#powerpc}
431 cd $RPM_BUILD_ROOT%{_mandir}/man1
433 ln -s $i ppc${i#powerpc}
440 for target in $(cat target.list); do
441 echo "=== INSTALL target $target ==="
442 install -d $RPM_BUILD_ROOT%{_prefix}/$target/sys-root
445 if [ $target = sh64-linux-gnu ]; then
446 ln -s %{auxbin_prefix}/sh64-elf $RPM_BUILD_ROOT%{auxbin_prefix}/sh64-linux
450 echo "=== INSTALL man targets ==="
451 %{__make} install-man1 -C cross-binutils/binutils/doc DESTDIR=$RPM_BUILD_ROOT
452 %{__make} install-man1 -C cross-binutils/gas/doc DESTDIR=$RPM_BUILD_ROOT
453 %{__make} install-man1 -C cross-binutils/ld DESTDIR=$RPM_BUILD_ROOT
454 %{__make} install-man1 -C cross-binutils/gprof DESTDIR=$RPM_BUILD_ROOT
456 echo "=== INSTALL po targets ==="
457 %{__make} install -C cross-binutils/binutils/po DESTDIR=$RPM_BUILD_ROOT
458 %{__make} install -C cross-binutils/gas/po DESTDIR=$RPM_BUILD_ROOT
459 %{__make} install -C cross-binutils/ld/po DESTDIR=$RPM_BUILD_ROOT
460 %{__make} install -C cross-binutils/gprof/po DESTDIR=$RPM_BUILD_ROOT
461 %{__make} install -C cross-binutils/bfd/po DESTDIR=$RPM_BUILD_ROOT
462 %{__make} install -C cross-binutils/opcodes/po DESTDIR=$RPM_BUILD_ROOT
464 # Add the additional symlink-only targets
465 grep ^powerpc target.list | sed -e s/powerpc/ppc/ > symlink-target.list
467 # For cross-binutils we drop the documentation.
468 echo "=== REMOVE documentation ==="
469 rm -rf $RPM_BUILD_ROOT%{_infodir}
470 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
472 echo "=== REMOVE libraries and scripts ==="
473 rm -rf $RPM_BUILD_ROOT%{_libdir}/libiberty.a
474 rm -rf $RPM_BUILD_ROOT%{auxbin_prefix}/*/lib/ldscripts
475 rmdir $RPM_BUILD_ROOT%{auxbin_prefix}/*/lib || :
477 echo "=== BUILD file lists ==="
480 local cpu=${arch%%%%-*}
483 avr32) target_cpu=avr;;
484 bfin) target_cpu=bfin;;
485 h8300) target_cpu=h8300;;
486 mn10300) target_cpu=am33_2.0;;
487 openrisc) target_cpu=or1k;;
488 score) target_cpu=score;;
489 tile) target_cpu=tilegx;;
490 v850) target_cpu=v850e;;
495 echo "%%defattr(-,root,root,-)"
496 echo "%{_bindir}/$arch-[!l]*"
497 echo "%{_bindir}/$arch-ld*"
498 if [ -L $RPM_BUILD_ROOT%{auxbin_prefix}/$target_cpu-* ]; then
499 echo "%{auxbin_prefix}/$target_cpu-*"
501 echo "%dir %{auxbin_prefix}/$target_cpu-*"
502 echo "%dir %{auxbin_prefix}/$target_cpu-*/bin"
503 echo "%{auxbin_prefix}/$target_cpu-*/bin/*"
504 if [ "$target_cpu" != "$cpu" ]; then
505 echo "%dir %{_prefix}/$arch"
507 echo "%{_prefix}/$arch/sys-root"
509 echo "%{_mandir}/man1/$arch-*"
513 for target in $(cat target.list symlink-target.list); do
514 build_file_list $target
517 # All the installed manual pages and translation files for each program are the
518 # same, so symlink them to the core package
519 echo "=== CROSSLINK man pages ==="
520 cd $RPM_BUILD_ROOT%{_mandir}/man1
521 for i in cross-*.1*; do
525 if [ $k != $i ]; then
531 # Add ld.bfd manual pages
532 find * -name "*ld.1*" -a ! -name "cross-ld.1*" -print |
534 y=$(echo $x | sed -e s/ld[.]1/ld.bfd.1/)
539 # Find the language files which only exist in the common package
540 %find_lang cross-binutils
541 %find_lang cross-opcodes
545 %find_lang cross-gprof
547 cross-binutils.lang \
556 rm -rf $RPM_BUILD_ROOT
558 %files common -f files.cross
559 %defattr(644,root,root,755)
560 %doc %{srcdir}/README
561 %doc %{srcdir}/COPYING*
562 %{_mandir}/man1/cross-*
565 %files -n binutils-%1 -f files.%1 \
566 %defattr(644,root,root,755) \
568 %{?with_alpha:%do_files alpha-linux-gnu}
569 %{?with_arm:%do_files arm-linux-gnu}
570 %{?with_aarch64:%do_files aarch64-linux-gnu}
571 %{?with_avr32:%do_files avr32-linux-gnu}
572 %{?with_blackfin:%do_files bfin-linux-gnu}
573 %{?with_c6x:%do_files c6x-linux-gnu}
574 %{?with_cris:%do_files cris-linux-gnu}
575 %{?with_frv:%do_files frv-linux-gnu}
576 %{?with_h8300:%do_files h8300-linux-gnu}
577 %{?with_hexagon:%do_files hexagon-linux-gnu}
578 %{?with_hppa:%do_files hppa-linux-gnu}
579 %{?with_hppa64:%do_files hppa64-linux-gnu}
580 %{?with_i386:%do_files i386-linux-gnu}
581 %{?with_ia64:%do_files ia64-linux-gnu}
582 %{?with_m32r:%do_files m32r-linux-gnu}
583 %{?with_m68k:%do_files m68k-linux-gnu}
584 %{?with_metag:%do_files metag-linux-gnu}
585 %{?with_microblaze:%do_files microblaze-linux-gnu}
586 %{?with_mips:%do_files mips-linux-gnu}
587 %{?with_mips64:%do_files mips64-linux-gnu}
588 %{?with_mn10300:%do_files mn10300-linux-gnu}
589 %{?with_nios2:%do_files nios2-linux-gnu}
590 %{?with_openrisc:%do_files openrisc-linux-gnu}
591 %{?with_powerpc:%do_files powerpc-linux-gnu}
592 %{?with_powerpc64:%do_files powerpc64-linux-gnu}
593 %{?with_powerpc:%do_files ppc-linux-gnu}
594 %{?with_powerpc64:%do_files ppc64-linux-gnu}
595 %{?with_s390:%do_files s390-linux-gnu}
596 %{?with_s390x:%do_files s390x-linux-gnu}
597 %{?with_score:%do_files score-linux-gnu}
598 %{?with_sh:%do_files sh-linux-gnu}
599 %{?with_sh4:%do_files sh4-linux-gnu}
600 %{?with_sh64:%do_files sh64-linux-gnu}
601 %{?with_sparc:%do_files sparc-linux-gnu}
602 %{?with_sparc64:%do_files sparc64-linux-gnu}
603 %{?with_tile:%do_files tile-linux-gnu}
604 %{?with_unicore32:%do_files unicore32-linux-gnu}
605 %{?with_x86_64:%do_files x86_64-linux-gnu}
606 %{?with_xtensa:%do_files xtensa-linux-gnu}