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