source: spec/trunk/SPECS/binutils.spec@ 1066

Last change on this file since 1066 was 1066, checked in by Silvan Scherrer, 8 years ago

spec: binutils: Release version 2.27-1.

File size: 13.5 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: 1%{?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 2151
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
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.
98#BuildRequires: /@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: %define ld_bfd_priority 50}
118%{!?ld_gold_priority:%define 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%description devel
159This package contains BFD and opcodes static and dynamic libraries.
160
161The dynamic libraries are in this package, rather than a seperate
162base package because they are actually linker scripts that force
163the use of the static libraries. This is because the API of the
164BFD library is too unstable to be used dynamically.
165
166The static libraries are here because they are now needed by the
167dynamic libraries.
168
169Developers starting new projects are strongly encouraged to consider
170using libelf instead of BFD.
171
172%debug_package
173
174%prep
175%scm_setup
176
177autogen.sh
178
179%if %{without docs}
180 find . -name *.info -print -exec touch {} \;
181%endif
182
183%build
184echo target is %{binutils_target}
185%ifarch %{power64}
186export CFLAGS="$RPM_OPT_FLAGS -Wno-error"
187%else
188export CFLAGS="$RPM_OPT_FLAGS"
189%endif
190CARGS=
191
192case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*)
193 CARGS="$CARGS --enable-64-bit-bfd"
194 ;;
195esac
196
197case %{binutils_target} in ia64*)
198 CARGS="$CARGS --enable-targets=i386-linux"
199 ;;
200esac
201
202case %{binutils_target} in ppc*|ppc64*)
203 CARGS="$CARGS --enable-targets=spu"
204 ;;
205esac
206
207case %{binutils_target} in ppc64-*)
208 CARGS="$CARGS --enable-targets=powerpc64le-linux"
209 ;;
210esac
211
212case %{binutils_target} in ppc64le*)
213 CARGS="$CARGS --enable-targets=powerpc-linux"
214 ;;
215esac
216
217# we are not elf
218#case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*)
219# CARGS="$CARGS --enable-targets=x86_64-pep"
220# ;;
221#esac
222
223
224%if 0%{?_with_debug:1}
225CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
226%define enable_shared 0
227%endif
228
229export LDFLAGS="-Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
230export LIBS="-lcx"
231
232# We could optimize the cross builds size by --enable-shared but the produced
233# binaries may be less convenient in the embedded environment.
234# the below configure switchs we don't use
235# --build=%{_target_platform} --host=%{_target_platform} \
236%configure \
237 --target=%{binutils_target} \
238 --with-system-zlib \
239%ifarch %gold_arches
240%if "%{build_gold}" == "both"
241 --enable-gold=default --enable-ld \
242%else
243 --enable-ld \
244%endif
245%endif
246%if %{isnative}
247 --with-sysroot=/@unixroot \
248%else
249 --enable-targets=%{_host} \
250 --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \
251 --program-prefix=%{cross} \
252%endif
253%if %{enable_shared}
254 --enable-shared --disable-static \
255%else
256 --disable-shared \
257%endif
258%if %{enable_deterministic_archives}
259 --enable-deterministic-archives \
260%else
261 --enable-deterministic-archives=no \
262%endif
263%if %{enable_lto}
264 --enable-lto \
265%endif
266%if %{default_compress_debug}
267 --enable-compressed-debug-sections=all \
268%else
269 --enable-compressed-debug-sections=none \
270%endif
271 $CARGS \
272 --enable-plugins=no \
273 --with-bugurl=http://trac.netlabs.org/ports/
274
275%if %{with docs}
276make %{_smp_mflags} tooldir=%{_prefix} all
277make %{_smp_mflags} tooldir=%{_prefix} info
278%else
279make %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all
280%endif
281
282# Do not use %%check as it is run after %%install where libbfd.so is rebuild
283# with -fvisibility=hidden no longer being usable in its shared form.
284%if %{without testsuite}
285echo ====================TESTSUITE DISABLED=========================
286%else
287make -k check < /dev/null || :
288echo ====================TESTING=========================
289cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
290echo ====================TESTING END=====================
291for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
292do
293 ln $file binutils-%{_target_platform}-$(basename $file) || :
294done
295tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
296uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
297rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
298%endif
299
300%install
301rm -rf %{buildroot}
302%if %{with docs}
303make install DESTDIR=%{buildroot}
304%else
305make install DESTDIR=%{buildroot} MAKEINFO=true
306%endif
307%if %{isnative}
308%if %{with docs}
309make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
310%endif
311
312#install -m 644 bfd/libbfd.a %{buildroot}%{_libdir}
313#install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
314install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
315#install -m 644 opcodes/libopcodes.a %{buildroot}%{_libdir}
316# Remove Windows/Novell only man pages
317rm -f %{buildroot}%{_mandir}/man1/dlltool*
318rm -f %{buildroot}%{_mandir}/man1/nlmconv*
319rm -f %{buildroot}%{_mandir}/man1/windres*
320rm -f %{buildroot}%{_mandir}/man1/windmc*
321
322%if %{enable_shared}
323chmod +x %{buildroot}%{_libdir}/*.dll
324%endif
325
326# Remove libtool files, which reference the .dll libs
327rm -f %{buildroot}%{_libdir}/*.la
328
329%else # !%{isnative}
330# For cross-binutils we drop the documentation.
331rm -rf %{buildroot}%{_infodir}
332# We keep these as one can have native + cross binutils of different versions.
333#rm -rf %{buildroot}%{_prefix}/share/locale
334#rm -rf %{buildroot}%{_mandir}
335rm -rf %{buildroot}%{_libdir}/libiberty.a
336%endif # !%{isnative}
337
338# This one comes from gcc
339rm -f %{buildroot}%{_infodir}/dir
340#rm -rf %{buildroot}%{_prefix}/%{binutils_target}
341
342%find_lang %{?cross}binutils
343%find_lang %{?cross}opcodes
344%find_lang %{?cross}bfd
345%find_lang %{?cross}gas
346%find_lang %{?cross}gprof
347cat %{?cross}opcodes.lang >> %{?cross}binutils.lang
348cat %{?cross}bfd.lang >> %{?cross}binutils.lang
349cat %{?cross}gas.lang >> %{?cross}binutils.lang
350cat %{?cross}gprof.lang >> %{?cross}binutils.lang
351
352if [ -x ld/ld-new ]; then
353 %find_lang %{?cross}ld
354 cat %{?cross}ld.lang >> %{?cross}binutils.lang
355fi
356if [ -x gold/ld-new ]; then
357 %find_lang %{?cross}gold
358 cat %{?cross}gold.lang >> %{?cross}binutils.lang
359fi
360
361%clean
362rm -rf %{buildroot}
363
364%post
365%if "%{build_gold}" == "both"
366%__rm -f %{_bindir}/%{?cross}ld
367%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
368 %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority}
369%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
370 %{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
371%{_sbindir}/alternatives --auto %{?cross}ld
372%endif
373%if %{isnative}
374#/sbin/ldconfig
375# For --excludedocs:
376if [ -e %{_infodir}/binutils.info.gz ]
377then
378 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz
379 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
380 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
381 %{_sbindir}/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
382fi
383%endif # %{isnative}
384exit 0
385
386exit 0
387
388%preun
389%if "%{build_gold}" == "both"
390if [ $1 = 0 ]; then
391 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
392 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
393fi
394%endif
395%if %{isnative}
396if [ $1 = 0 ]; then
397 if [ -e %{_infodir}/binutils.info.gz ]
398 then
399 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
400 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
401 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
402 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
403 fi
404fi
405%endif
406exit 0
407
408%if %{isnative}
409#%postun
410#/sbin/ldconfig
411 if [ -e %{_infodir}/binutils.info.gz ]
412 then
413 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
414 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
415 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
416 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
417 fi
418%endif # %{isnative}
419
420%files -f %{?cross}binutils.lang
421%defattr(-,root,root,-)
422%license COPYING COPYING3 COPYING3.LIB COPYING.LIB
423%doc README
424%{_bindir}/%{?cross}[!l]*.exe
425%{_prefix}/%{binutils_target}/bin/%{?cross}[!l]*.exe
426%if "%{build_gold}" == "both"
427%{_bindir}/%{?cross}ld*.exe
428%ghost %{_bindir}/%{?cross}ld
429%else
430#%{_bindir}/%{?cross}ld*.exe
431%endif
432%{_mandir}/man1/*
433%{_infodir}/as.info.gz
434%{_infodir}/binutils.info.gz
435%{_infodir}/gprof.info.gz
436#%{_infodir}/ld.info.gz
437%if %{enable_shared}
438%{_libdir}/*.dll
439%endif
440
441%if %{isnative}
442%if %{with docs}
443%{_infodir}/[^b]*info*
444%{_infodir}/binutils*info*
445%endif
446
447%files devel
448%defattr(-,root,root,-)
449%{_prefix}/include/*
450%{_libdir}/*_dll.a
451%if %{with docs}
452%{_infodir}/bfd*info*
453%endif # with docs
454
455%endif # %{isnative}
456
457%changelog
458* Mon Mar 20 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.27-1
459- update to version 2.27
460- adjust spec to scm_ macros usage
461
462* Tue May 31 2016 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.25-1
463- update to version 2.25
464
465* Wed Oct 5 2011 yd <yd@os2power.com> 2.21-1
466- Initial version
Note: See TracBrowser for help on using the repository browser.