1 %define binutils_target %{_target_platform}
3 %define enable_shared 1
4 %define run_testsuite 0
5 %define accelerator_crossbuild 0
12 Summary: A GNU collection of binary utilities
13 Name: cross-armv5tel-binutils
17 Group: Development/Tools
18 URL: http://sources.redhat.com/binutils
19 Source: ftp://ftp.kernel.org/pub/linux/devel/binutils/binutils-%{version}.tar.bz2
20 Source2: binutils-2.19.50.0.1-output-format.sed
21 Source100: baselibs.conf
22 Source200: precheckin.sh
23 Source201: README.PACKAGER
24 Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
25 Patch04: binutils-2.20.51.0.2-version.patch
26 Patch05: binutils-2.20.51.0.2-set-long-long.patch
27 Patch06: binutils-2.20.51.0.10-copy-osabi.patch
28 Patch07: binutils-2.20.51.0.10-sec-merge-emit.patch
29 Patch08: binutils-2.20.51.0.2-build-id.patch
30 Patch09: binutils-2.22-branch-updates.patch
31 Patch10: binutils-2.22-156-pr10144.patch
32 Patch11: fixbug13534_1.patch
33 Patch12: fixbug13534_2.patch
34 Patch13: fixbug13534_3.patch
35 Patch14: fixbug13534_4.patch
36 Patch15: fixbug13534_5.patch
37 Patch16: pr_13990_14189.patch
38 Patch17: pr_13177.patch
40 %if "%{name}" != "binutils"
41 %if "%{name}" != "cross-mipsel-binutils"
42 %define binutils_target %(echo %{name} | sed -e "s/cross-\\(.*\\)-binutils/\\1/")-tizen-linux-gnueabi
44 %define binutils_target %(echo %{name} | sed -e "s/cross-\\(.*\\)-binutils/\\1/")-tizen-linux-gnu
46 %define _prefix /opt/cross
47 %define enable_shared 0
49 %define run_testsuite 0
50 %define cross %{binutils_target}-
52 ExclusiveArch: %ix86 x86_64
53 # special handling for Tizen ARM build acceleration
54 %if "%(echo %{name} | sed -e "s/cross-.*-binutils-\\(.*\\)-.*/\\1/")" == "accel"
55 %define binutils_target %(echo %{name} | sed -e "s/cross-\\(.*\\)-binutils-accel-.*/\\1/")-tizen-linux-gnueabi
58 %define accelerator_crossbuild 1
60 %define _build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.dontuse.rpm
64 BuildRequires: texinfo >= 4.0, gettext, flex, bison, zlib-devel
65 # Required for: ld-bootstrap/bootstrap.exp bootstrap with --static
66 # It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array
68 BuildRequires: dejagnu, zlib-static, glibc-static, sharutils
70 BuildRequires: elfutils-libelf-devel
71 Conflicts: gcc-c++ < 4.0.0
72 Requires(post): /sbin/install-info
73 Requires(preun): /sbin/install-info
75 # On ARM EABI systems, we do want -gnueabi to be part of the
82 Binutils is a collection of binary utilities, including ar (for
83 creating, modifying and extracting from archives), as (a family of GNU
84 assemblers), gprof (for displaying call graph profile data), ld (the
85 GNU linker), nm (for listing symbols from object files), objcopy (for
86 copying and translating object files), objdump (for displaying
87 information from object files), ranlib (for generating an index for
88 the contents of an archive), readelf (for displaying detailed
89 information about binary files), size (for listing the section sizes
90 of an object or archive file), strings (for listing printable strings
91 from files), strip (for discarding symbols), and addr2line (for
92 converting addresses to file and line).
95 Summary: BFD and opcodes static libraries and header files
96 Group: System/Libraries
97 Conflicts: binutils < 2.17.50.0.3-4
98 Requires(post): /sbin/install-info
99 Requires(preun): /sbin/install-info
103 This package contains BFD and opcodes static libraries and associated
104 header files. Only *.a libraries are included, because BFD doesn't
105 have a stable ABI. Developers starting new projects are strongly encouraged
106 to consider using libelf instead of BFD.
109 %setup -q -n binutils-%{version}
110 %patch01 -p0 -b .libtool-lib64~
111 # Causes build churn --cvm
112 #%patch04 -p0 -b .version~
113 %patch05 -p0 -b .set-long-long~
114 %patch06 -p0 -b .copy-osabi~
115 %patch07 -p0 -b .sec-merge-emit~
116 %patch08 -p0 -b .build-id~
117 %patch09 -p1 -b .branchupdates
118 %patch10 -p1 -b .pr10144
119 %patch11 -p1 -b .fixbug13534_1
120 %patch12 -p1 -b .fixbug13534_2
121 %patch13 -p1 -b .fixbug13534_3
122 %patch14 -p1 -b .fixbug13534_4
123 %patch15 -p1 -b .fixbug13534_5
127 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
129 # On ppc64 we might use 64KiB pages
130 sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
132 perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf*
133 sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in}
134 sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in}
135 # Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible.
136 if gcc %{optflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then
137 sed -i -e 's/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in}
138 sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in}
140 # $PACKAGE is used for the gettext catalog name.
141 sed -i -e 's/^ PACKAGE=/ PACKAGE=%{?cross}/' */configure
142 # Undo the name change to run the testsuite.
143 for tool in binutils gas ld
145 sed -i -e "2aDEJATOOL = $tool" $tool/Makefile.am
146 sed -i -e "s/^DEJATOOL = .*/DEJATOOL = $tool/" $tool/Makefile.in
151 echo target is %{binutils_target}
152 export CFLAGS="$RPM_OPT_FLAGS"
155 case %{binutils_target} in i?86*)
156 CARGS="$CARGS --enable-64-bit-bfd"
160 %if 0%{?_with_debug:1}
161 CFLAGS="$CFLAGS -O0 -ggdb2"
162 %define enable_shared 0
165 # We could optimize the cross builds size by --enable-shared but the produced
166 # binaries may be less convenient in the embedded environment.
167 %if %{accelerator_crossbuild}
168 export CFLAGS="$CFLAGS -Wl,-rpath,/emul/ia32-linux/usr/%{_lib}:/emul/ia32-linux/%{_lib}:/usr/%{_lib}:/%{_lib}:/usr/lib:/lib"
171 --build=%{_target_platform} --host=%{_target_platform} \
172 --target=%{binutils_target} \
174 %if !%{accelerator_crossbuild}
175 --enable-targets=%{_host} \
176 --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \
177 --program-prefix=%{cross} \
180 --program-prefix="" \
196 --with-bugurl=http://bugzilla.tizen.com
197 make %{_smp_mflags} tooldir=%{_prefix} all
198 make %{_smp_mflags} tooldir=%{_prefix} info
200 # Do not use %%check as it is run after %%install where libbfd.so is rebuild
201 # with -fvisibility=hidden no longer being usable in its shared form.
202 %if !%{run_testsuite}
203 echo ====================TESTSUITE DISABLED=========================
205 make -k check < /dev/null || :
206 echo ====================TESTING=========================
207 cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
208 echo ====================TESTING END=====================
209 for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
211 ln $file binutils-%{_target_platform}-$(basename $file) || :
213 tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
214 uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
215 rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
220 make install DESTDIR=%{buildroot}
222 make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
224 # Rebuild libiberty.a with -fPIC.
225 # Future: Remove it together with its header file, projects should bundle it.
226 make -C libiberty clean
227 make CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
229 # Rebuild libbfd.a with -fPIC.
230 # Without the hidden visibility the 3rd party shared libraries would export
231 # the bfd non-stable ABI.
233 make CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
235 install -m 644 bfd/libbfd.a %{buildroot}%{_prefix}/%{_lib}
236 install -m 644 libiberty/libiberty.a %{buildroot}%{_prefix}/%{_lib}
237 install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
238 # Remove Windows/Novell only man pages
239 rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres}*
242 chmod +x %{buildroot}%{_prefix}/%{_lib}/lib*.so*
245 # Prevent programs to link against libbfd and libopcodes dynamically,
246 # they are changing far too often
247 rm -f %{buildroot}%{_prefix}/%{_lib}/lib{bfd,opcodes}.so
249 # Remove libtool files, which reference the .so libs
250 rm -f %{buildroot}%{_prefix}/%{_lib}/lib{bfd,opcodes}.la
252 %if "%{__isa_bits}" == "64"
253 # Sanity check --enable-64-bit-bfd really works.
254 grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h
256 # Fix multilib conflicts of generated values by __WORDSIZE-based expressions.
257 %ifarch %{ix86} x86_64
258 sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
259 -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
260 -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
261 -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
262 #define BFD_HOST_64_BIT long long\
264 #define BFD_HOST_64_BIT long\
266 -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
267 %{buildroot}%{_prefix}/include/bfd.h
269 touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
271 # Generate .so linker scripts for dependencies; imported from glibc/Makerules:
273 # This fragment of linker script gives the OUTPUT_FORMAT statement
274 # for the configuration we are building.
276 /* Ensure this .so library will not be used by a link for a different format
277 on a multi-architecture system. */
278 $(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")"
280 tee %{buildroot}%{_prefix}/%{_lib}/libbfd.so <<EOH
285 /* The libz dependency is unexpected by legacy build scripts. */
286 INPUT ( %{_libdir}/libbfd.a -liberty -lz )
289 tee %{buildroot}%{_prefix}/%{_lib}/libopcodes.so <<EOH
294 INPUT ( %{_libdir}/libopcodes.a -lbfd )
298 # For cross-binutils we drop the documentation.
299 rm -rf %{buildroot}%{_infodir}
300 # We keep these as one can have native + cross binutils of different versions.
301 #rm -rf %{buildroot}%{_prefix}/share/locale
302 #rm -rf %{buildroot}%{_mandir}
303 rm -rf %{buildroot}%{_prefix}/%{_lib}/libiberty.a
304 %endif # !%{isnative}
306 # This one comes from gcc
307 rm -f %{buildroot}%{_infodir}/dir
308 rm -rf %{buildroot}%{_prefix}/%{binutils_target}
311 %find_lang %{?cross}binutils
312 %find_lang %{?cross}opcodes
313 %find_lang %{?cross}bfd
314 %find_lang %{?cross}gas
315 %find_lang %{?cross}ld
316 %find_lang %{?cross}gprof
317 cat %{?cross}opcodes.lang >> %{?cross}binutils.lang
318 cat %{?cross}bfd.lang >> %{?cross}binutils.lang
319 cat %{?cross}gas.lang >> %{?cross}binutils.lang
320 cat %{?cross}ld.lang >> %{?cross}binutils.lang
321 cat %{?cross}gprof.lang >> %{?cross}binutils.lang
324 %if %{accelerator_crossbuild}
325 # Fixed x86 dependencies
326 sed "s/@X86@/%{!?x64:x86}%{?x64}/g" -i %{_sourcedir}/baselibs.conf
335 %install_info --info-dir=%{_infodir} %{_infodir}/as.info
336 %install_info --info-dir=%{_infodir} %{_infodir}/binutils.info
337 %install_info --info-dir=%{_infodir} %{_infodir}/gprof.info
338 %install_info --info-dir=%{_infodir} %{_infodir}/ld.info
339 %install_info --info-dir=%{_infodir} %{_infodir}/standards.info
340 %install_info --info-dir=%{_infodir} %{_infodir}/configure.info
345 %install_info --delete --info-dir=%{_infodir} %{_infodir}/as.info
346 %install_info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info
347 %install_info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info
348 %install_info --delete --info-dir=%{_infodir} %{_infodir}/ld.info
349 %install_info --delete --info-dir=%{_infodir} %{_infodir}/standards.info
350 %install_info --delete --info-dir=%{_infodir} %{_infodir}/configure.info
354 %postun -p /sbin/ldconfig
357 %install_info --info-dir=%{_infodir} %{_infodir}/bfd.info
361 %install_info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info
368 %files -f %{?cross}binutils.lang
370 %defattr(-,root,root,-)
375 %{_prefix}/%{_lib}/lib*.so
376 %exclude %{_prefix}/%{_lib}/libbfd.so
377 %exclude %{_prefix}/%{_lib}/libopcodes.so
380 %{_infodir}/[^b]*info*
381 %{_infodir}/binutils*info*
384 %defattr(-,root,root,-)
386 %{_prefix}/%{_lib}/libbfd.so
387 %{_prefix}/%{_lib}/libopcodes.so
388 %{_prefix}/%{_lib}/lib*.a
389 %{_infodir}/bfd*info*
393 * Tue Feb 7 2012 Carsten Munk <carsten.munk@gmail.com> - 2.22
394 - Pull some patches relevant to MIPS from branch update, and
396 * Mon Dec 12 2011 Ray Donnelly <mingw.android@gmail.com> - 2.22
397 - Updated to binutils 2.22
398 * Tue Jun 28 2011 Junfeng Dong <junfeng.dong@intel.com> - 2.21.51.0.8
399 - Add patch binutils-2.21.51.0.8-pr12778.patch to fix dbus failure on arm.
400 * Tue May 3 2011 Junfeng Dong <junfeng.dong@intel.com> - 2.21.51.0.8
401 - Update to latest version 2.21.51.0.8.
402 - Clean unused patch files.
403 - Drop binutils.spec.diff.
404 * Sun Apr 24 2011 Jan-Simon Möller <jsmoeller@linuxfoundation.org> - 1.0
405 - Add baselibs.conf to src.rpm
406 * Thu Mar 10 2011 Junfeng Dong <junfeng.dong@intel.com> -2.21
407 - Update to 2.21. The changes include:
408 - Drop the following patch which have been merged into 2.21 already.
409 binutils-2.20.51.0.2-ifunc-ld-s.patch, binutils-2.20.51.0.2-lwp.patch
410 binutils-2.20.51.0.2-tag-div-use.patch
411 - Drop binutils-2.20.51.0.2-build-id.patch because of the code evolvement.
412 - Recreate binutils-2.20.51.0.2-libtool-lib64.patch for 2.21 and rename
413 the new patch as binutils-2.21-libtool-lib64.patch.
414 * Fri Jan 7 2011 Carsten Munk <carsten@maemo.org> - 2.20.51.0.2
415 - Add armv7hl, armv7nhl cross-binutils- packages. Part of fix for BMC#11463
416 * Fri Dec 31 2010 Carsten Munk <carsten@maemo.org> - 2.20.51.0.2
417 - Add support for Tag_MPextension_use and Tag_DIV_use. Fixes BMC#11431
418 * Wed Dec 29 2010 Austin Zhang <austin.zhang@intel.com> - 2.20.51.0.2
420 BMC#10336 - Error when installing binutils with --excludedocs in .ks
421 * Tue May 25 2010 Austin Zhang <austin.zhang@intel.com> - 2.20.51.0.2
422 - enable LTO (link time optimization)
423 * Mon May 3 2010 Jan-Simon Möller <jansimon.moeller@linuxfoundation.org> - 2.20.51.0.2
424 - Add precheckin.sh, README.packager
425 - add cross-binutils-* packages (cross-compiler)
426 * Thu Mar 4 2010 Anas Nashif <anas.nashif@intel.com> - 2.20.51.0.2
427 - Use %%{_target_platform} as the build target
428 * Sat Dec 12 2009 Arjan van de Ven <arjan@linux.intel.com> - 2.20.51.0.2
429 - add the LD_AS_NEEDED env variable back, and get us closer to upstream
430 * Fri Nov 27 2009 Austin Zhang <austin.zhang@intel.com> - 2.20.51.0.2
431 - Update to 2.20.51.0.2
432 * Sat Aug 22 2009 Anas Nashif <anas.nashif@intel.com> - 2.19.51.0.14
433 - Update to 2.19.51.0.14
434 * Wed May 6 2009 Arjan van de Ven <arjan@linux.intel.com> 2.19
435 - Add LD_AS_NEEDED environment variable
436 * Tue Jan 13 2009 Anas Nashif <anas.nashif@intel.com> 2.19
438 * Thu Jan 8 2009 Anas Nashif <anas.nashif@intel.com> 2.19
440 * Tue Dec 16 2008 Anas Nashif <anas.nashif@intel.com> 2.18.50.0.6
441 - Fixed rpmlint errors in Summary tag
442 * Thu Dec 11 2008 Anas Nashif <anas.nashif@intel.com> 2.18.50.0.6
443 - Do not check for ia64
444 * Thu Sep 18 2008 Austin Zhang <austin.zhang@intel.com> 2.18.50.0.6
445 - add check for the info file before installation