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