source: spec/trunk/SPECS/binutils.spec

Last change on this file was 1558, checked in by dmik, 7 years ago

spec: binutils: Release version 2.27-3.

File size: 14.3 KB
Line 
1# rpmbuild parameters:
2# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils.
3# --with=bootstrap: Build with minimal dependencies.
4# --with=debug: Build without optimizations and without splitting the debuginfo.
5# --without=docs: Skip building documentation.
6# --without=testsuite: Do not run the testsuite.
7
8%if 0%{!?binutils_target:1}
9# we always use _build, as target_platform isn't recognised by configure
10# define binutils_target %{_target_platform}
11%define binutils_target %{_build}
12%define isnative 1
13%define enable_shared 1
14%else
15%define cross %{binutils_target}-
16%define isnative 0
17%define enable_shared 0
18%endif
19# BZ 1124342: Provide a way to enable deterministic archives.
20# BZ 1195883: But do not do this by default.
21%define enable_deterministic_archives 0
22
23# BZ 1342618: Enable support for GCC LTO compilation.
24%define enable_lto 0
25# Disable the default generation of compressed debug sections.
26%define default_compress_debug 0
27
28# Default: Not bootstrapping.
29%bcond_with bootstrap
30# Default: Not debug
31%bcond_with debug
32# Default: Always build documentation.
33%bcond_without docs
34# Default: don't run run the testsuite.
35%bcond_with testsuite
36
37%if %{with bootstrap}
38%undefine with_docs
39%undefine with_testsuite
40%endif
41
42%if %{with debug}
43%undefine with_testsuite
44%endif
45
46
47Summary: A GNU collection of binary utilities
48Name: %{?cross}binutils%{?_with_debug:-debug}
49Version: 2.27
50Release: 3%{?dist}
51License: GPLv3+
52Group: Development/Tools
53URL: http://sources.redhat.com/binutils
54
55Vendor: bww bitwise works GmbH
56%scm_source svn http://svn.netlabs.org/repos/ports/binutils/trunk 2204
57
58Provides: bundled(libiberty)
59
60# BZ 1173780: Building GOLD for PPC is not working at the moment.
61# %define gold_arches %ix86 x86_64 %arm aarch64 ppc* %{power64}
62%define gold_arches %ix86 x86_64 %arm aarch64
63
64%if %{with bootstrap}
65%define build_gold no
66%else
67%ifarch %gold_arches
68# we don't build on elf, so no gold for us
69#define build_gold both
70%define build_gold no
71%else
72%define build_gold no
73%endif
74%endif
75
76%if %{with debug}
77# Define this if you want to skip the strip step and preserve debug info.
78# Useful for testing.
79%define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list
80%define debug_package %{nil}
81%endif
82
83BuildRequires: gcc make autoconf automake libtool
84
85# Gold needs bison in order to build gold/yyscript.c.
86# Bison needs m4.
87%if "%{build_gold}" == "both"
88BuildRequires: bison, m4, gcc-c++
89%endif
90
91%if %{without bootstrap}
92BuildRequires: gettext, flex, zlib-devel
93%endif
94
95%if %{with docs}
96BuildRequires: texinfo >= 4.0
97# BZ 920545: We need pod2man in order to build the manual pages.
98BuildRequires: /@unixroot/usr/bin/pod2man
99Requires(post): %{_sbindir}/install-info.exe
100Requires(preun): %{_sbindir}/install-info.exe
101%endif
102
103# Required for: ld-bootstrap/bootstrap.exp bootstrap with --static
104# It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array
105%if %{with testsuite}
106# relro_test.sh uses dc which is part of the bc rpm, hence its inclusion here.
107BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc
108%if "%{build_gold}" == "both"
109# The GOLD testsuite needs a static libc++
110BuildRequires: libstdc++-static
111%endif
112%endif
113
114Conflicts: gcc-c++ < 4.0.0
115
116# The higher of these two numbers determines the default ld.
117%{!?ld_bfd_priority: %global ld_bfd_priority 50}
118%{!?ld_gold_priority:%global ld_gold_priority 30}
119
120%if "%{build_gold}" == "both"
121Requires(post): coreutils
122Requires(post): %{_sbindir}/alternatives
123Requires(preun): %{_sbindir}/alternatives
124%endif
125
126# On ARM EABI systems, we do want -gnueabi to be part of the
127# target triple.
128%ifnarch %{arm}
129%define _gnu %{nil}
130%endif
131
132%description
133Binutils is a collection of binary utilities, including ar (for
134creating, modifying and extracting from archives), as (a family of GNU
135assemblers), gprof (for displaying call graph profile data), ld (the
136GNU linker), nm (for listing symbols from object files), objcopy (for
137copying and translating object files), objdump (for displaying
138information from object files), ranlib (for generating an index for
139the contents of an archive), readelf (for displaying detailed
140information about binary files), size (for listing the section sizes
141of an object or archive file), strings (for listing printable strings
142from files), strip (for discarding symbols), and addr2line (for
143converting addresses to file and line).
144
145%package devel
146Summary: BFD and opcodes static and dynamic libraries and header files
147Group: System Environment/Libraries
148Provides: binutils-static = %{version}-%{release}
149%if %{with docs}
150Requires(post): %{_sbindir}/install-info.exe
151Requires(preun): %{_sbindir}/install-info.exe
152%endif
153Requires: zlib-devel
154Requires: binutils = %{version}-%{release}
155# BZ 1215242: We need touch...
156Requires: coreutils
157
158# To avoid header clashes (demangle.h etc)
159Requires: libc-devel >= 0.6.6-40
160
161%description devel
162This package contains BFD and opcodes static and dynamic libraries.
163
164The dynamic libraries are in this package, rather than a seperate
165base package because they are actually linker scripts that force
166the use of the static libraries. This is because the API of the
167BFD library is too unstable to be used dynamically.
168
169The static libraries are here because they are now needed by the
170dynamic libraries.
171
172Developers starting new projects are strongly encouraged to consider
173using libelf instead of BFD.
174
175%debug_package
176
177%prep
178%scm_setup
179
180autogen.sh
181
182%if %{without docs}
183 find . -name *.info -print -exec touch {} \;
184%endif
185
186%build
187echo target is %{binutils_target}
188%ifarch %{power64}
189export CFLAGS="$RPM_OPT_FLAGS -Wno-error"
190%else
191export CFLAGS="$RPM_OPT_FLAGS"
192%endif
193CARGS=
194
195case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*)
196 CARGS="$CARGS --enable-64-bit-bfd"
197 ;;
198esac
199
200case %{binutils_target} in ia64*)
201 CARGS="$CARGS --enable-targets=i386-linux"
202 ;;
203esac
204
205case %{binutils_target} in ppc*|ppc64*)
206 CARGS="$CARGS --enable-targets=spu"
207 ;;
208esac
209
210case %{binutils_target} in ppc64-*)
211 CARGS="$CARGS --enable-targets=powerpc64le-linux"
212 ;;
213esac
214
215case %{binutils_target} in ppc64le*)
216 CARGS="$CARGS --enable-targets=powerpc-linux"
217 ;;
218esac
219
220# we are not elf
221#case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*)
222# CARGS="$CARGS --enable-targets=x86_64-pep"
223# ;;
224#esac
225
226
227%if 0%{?_with_debug:1}
228CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
229%define enable_shared 0
230%endif
231
232export LDFLAGS="-Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
233export LIBS="-lcx"
234export VENDOR="%{vendor}"
235
236# We could optimize the cross builds size by --enable-shared but the produced
237# binaries may be less convenient in the embedded environment.
238# the below configure switchs we don't use
239# --build=%{_target_platform} --host=%{_target_platform} \
240%configure \
241 --target=%{binutils_target} \
242 --with-system-zlib \
243%ifarch %gold_arches
244%if "%{build_gold}" == "both"
245 --enable-gold=default --enable-ld \
246%else
247 --enable-ld \
248%endif
249%endif
250%if %{isnative}
251 --with-sysroot=/@unixroot \
252%else
253 --enable-targets=%{_host} \
254 --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \
255 --program-prefix=%{cross} \
256%endif
257%if %{enable_shared}
258 --enable-shared --disable-static \
259%else
260 --disable-shared \
261%endif
262%if %{enable_deterministic_archives}
263 --enable-deterministic-archives \
264%else
265 --enable-deterministic-archives=no \
266%endif
267%if %{enable_lto}
268 --enable-lto \
269%endif
270%if %{default_compress_debug}
271 --enable-compressed-debug-sections=all \
272%else
273 --enable-compressed-debug-sections=none \
274%endif
275 $CARGS \
276 --enable-plugins=no \
277 --with-bugurl=http://trac.netlabs.org/ports/
278
279%if %{with docs}
280make %{_smp_mflags} tooldir=%{_prefix} all
281make %{_smp_mflags} tooldir=%{_prefix} info
282%else
283make %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all
284%endif
285
286# Do not use %%check as it is run after %%install where libbfd.so is rebuild
287# with -fvisibility=hidden no longer being usable in its shared form.
288%if %{without testsuite}
289echo ====================TESTSUITE DISABLED=========================
290%else
291make -k check < /dev/null || :
292echo ====================TESTING=========================
293cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
294echo ====================TESTING END=====================
295for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
296do
297 ln $file binutils-%{_target_platform}-$(basename $file) || :
298done
299tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
300uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
301rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
302%endif
303
304%install
305rm -rf %{buildroot}
306%if %{with docs}
307make install DESTDIR=%{buildroot}
308%else
309make install DESTDIR=%{buildroot} MAKEINFO=true
310%endif
311
312%if %{isnative}
313%if %{with docs}
314make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
315%endif
316
317# Install libiberty stuff as we provide it
318install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
319install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
320install -m 644 include/demangle.h %{buildroot}%{_prefix}/include
321install -m 644 include/dyn-string.h %{buildroot}%{_prefix}/include
322install -m 644 include/fibheap.h %{buildroot}%{_prefix}/include
323install -m 644 include/floatformat.h %{buildroot}%{_prefix}/include
324install -m 644 include/hashtab.h %{buildroot}%{_prefix}/include
325install -m 644 include/objalloc.h %{buildroot}%{_prefix}/include
326install -m 644 include/partition.h %{buildroot}%{_prefix}/include
327install -m 644 include/sort.h %{buildroot}%{_prefix}/include
328install -m 644 include/splay-tree.h %{buildroot}%{_prefix}/include
329
330# Remove Windows/Novell only man pages
331rm -f %{buildroot}%{_mandir}/man1/dlltool*
332rm -f %{buildroot}%{_mandir}/man1/nlmconv*
333rm -f %{buildroot}%{_mandir}/man1/windres*
334rm -f %{buildroot}%{_mandir}/man1/windmc*
335
336%if %{enable_shared}
337chmod +x %{buildroot}%{_libdir}/*.dll
338%endif
339
340# Remove libtool files, which reference the .dll libs
341rm -f %{buildroot}%{_libdir}/*.la
342
343%else # !%{isnative}
344# For cross-binutils we drop the documentation.
345rm -rf %{buildroot}%{_infodir}
346# We keep these as one can have native + cross binutils of different versions.
347#rm -rf %{buildroot}%{_prefix}/share/locale
348#rm -rf %{buildroot}%{_mandir}
349rm -rf %{buildroot}%{_libdir}/libiberty.a
350%endif # !%{isnative}
351
352# This one comes from gcc
353rm -f %{buildroot}%{_infodir}/dir
354#rm -rf %{buildroot}%{_prefix}/%{binutils_target}
355
356%find_lang %{?cross}binutils
357%find_lang %{?cross}opcodes
358%find_lang %{?cross}bfd
359%find_lang %{?cross}gas
360%find_lang %{?cross}gprof
361cat %{?cross}opcodes.lang >> %{?cross}binutils.lang
362cat %{?cross}bfd.lang >> %{?cross}binutils.lang
363cat %{?cross}gas.lang >> %{?cross}binutils.lang
364cat %{?cross}gprof.lang >> %{?cross}binutils.lang
365
366if [ -x ld/ld-new ]; then
367 %find_lang %{?cross}ld
368 cat %{?cross}ld.lang >> %{?cross}binutils.lang
369fi
370if [ -x gold/ld-new ]; then
371 %find_lang %{?cross}gold
372 cat %{?cross}gold.lang >> %{?cross}binutils.lang
373fi
374
375%clean
376rm -rf %{buildroot}
377
378%post
379%if "%{build_gold}" == "both"
380%__rm -f %{_bindir}/%{?cross}ld
381%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
382 %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority}
383%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
384 %{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
385%{_sbindir}/alternatives --auto %{?cross}ld
386%endif
387%if %{isnative}
388#/sbin/ldconfig
389%if %{with docs}
390 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz
391 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
392 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
393# %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
394%endif
395%endif # %{isnative}
396exit 0
397
398%preun
399%if "%{build_gold}" == "both"
400if [ $1 = 0 ]; then
401 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
402 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
403fi
404%endif
405%if %{isnative}
406if [ $1 = 0 ]; then
407 if [ -f %{_infodir}/binutils.info.gz ]
408 then
409 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
410 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
411 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
412# %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
413 fi
414fi
415%endif
416exit 0
417
418%if %{isnative}
419%postun
420#/sbin/ldconfig
421 if [ -f %{_infodir}/binutils.info.gz ]
422 then
423 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
424 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
425 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
426# %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
427 fi
428%endif # %{isnative}
429
430%files -f %{?cross}binutils.lang
431%defattr(-,root,root,-)
432%license COPYING COPYING3 COPYING3.LIB COPYING.LIB
433%doc README
434%{_bindir}/%{?cross}[!l]*.exe
435%{_prefix}/%{binutils_target}/bin/%{?cross}[!l]*.exe
436%if "%{build_gold}" == "both"
437%{_bindir}/%{?cross}ld*.exe
438%ghost %{_bindir}/%{?cross}ld
439%else
440#%{_bindir}/%{?cross}ld*.exe
441%endif
442%{_mandir}/man1/*
443%if %{enable_shared}
444%{_libdir}/*.dll
445%endif
446
447%if %{isnative}
448%if %{with docs}
449%{_infodir}/[^b]*info*
450%{_infodir}/binutils*info*
451%endif
452
453%files devel
454%defattr(-,root,root,-)
455%{_prefix}/include/*
456%{_libdir}/*.a
457%if %{with docs}
458%{_infodir}/bfd*info*
459%endif # with docs
460
461%endif # %{isnative}
462
463%changelog
464* Tue Jan 15 2019 Dmitriy Kuminov <coding@dmik.org> 2.27-3
465- Restore installation of libiberty.a (broken by 2.25-1).
466- Install all libibetry headers.
467
468* Thu Jun 15 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.27-2
469- fix ticket #165 (needs to be reverted after gcc issue #27 fix)
470- add bldlevel info to the dll
471
472* Mon Mar 20 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.27-1
473- update to version 2.27
474- adjust spec to scm_ macros usage
475
476* Tue May 31 2016 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.25-1
477- update to version 2.25
478
479* Wed Oct 5 2011 yd <yd@os2power.com> 2.21-1
480- Initial version
Note: See TracBrowser for help on using the repository browser.