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