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

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

spec: binutils: Release version 2.27-2.

File size: 13.6 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: 2%{?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
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: %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"
231export VENDOR="%{vendor}"
232
233# We could optimize the cross builds size by --enable-shared but the produced
234# binaries may be less convenient in the embedded environment.
235# the below configure switchs we don't use
236# --build=%{_target_platform} --host=%{_target_platform} \
237%configure \
238 --target=%{binutils_target} \
239 --with-system-zlib \
240%ifarch %gold_arches
241%if "%{build_gold}" == "both"
242 --enable-gold=default --enable-ld \
243%else
244 --enable-ld \
245%endif
246%endif
247%if %{isnative}
248 --with-sysroot=/@unixroot \
249%else
250 --enable-targets=%{_host} \
251 --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \
252 --program-prefix=%{cross} \
253%endif
254%if %{enable_shared}
255 --enable-shared --disable-static \
256%else
257 --disable-shared \
258%endif
259%if %{enable_deterministic_archives}
260 --enable-deterministic-archives \
261%else
262 --enable-deterministic-archives=no \
263%endif
264%if %{enable_lto}
265 --enable-lto \
266%endif
267%if %{default_compress_debug}
268 --enable-compressed-debug-sections=all \
269%else
270 --enable-compressed-debug-sections=none \
271%endif
272 $CARGS \
273 --enable-plugins=no \
274 --with-bugurl=http://trac.netlabs.org/ports/
275
276%if %{with docs}
277make %{_smp_mflags} tooldir=%{_prefix} all
278make %{_smp_mflags} tooldir=%{_prefix} info
279%else
280make %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all
281%endif
282
283# Do not use %%check as it is run after %%install where libbfd.so is rebuild
284# with -fvisibility=hidden no longer being usable in its shared form.
285%if %{without testsuite}
286echo ====================TESTSUITE DISABLED=========================
287%else
288make -k check < /dev/null || :
289echo ====================TESTING=========================
290cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
291echo ====================TESTING END=====================
292for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
293do
294 ln $file binutils-%{_target_platform}-$(basename $file) || :
295done
296tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
297uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
298rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
299%endif
300
301%install
302rm -rf %{buildroot}
303%if %{with docs}
304make install DESTDIR=%{buildroot}
305%else
306make install DESTDIR=%{buildroot} MAKEINFO=true
307%endif
308
309%if %{isnative}
310%if %{with docs}
311make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
312%endif
313
314#install -m 644 bfd/libbfd.a %{buildroot}%{_libdir}
315#install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
316install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
317#install -m 644 opcodes/libopcodes.a %{buildroot}%{_libdir}
318# Remove Windows/Novell only man pages
319rm -f %{buildroot}%{_mandir}/man1/dlltool*
320rm -f %{buildroot}%{_mandir}/man1/nlmconv*
321rm -f %{buildroot}%{_mandir}/man1/windres*
322rm -f %{buildroot}%{_mandir}/man1/windmc*
323
324%if %{enable_shared}
325chmod +x %{buildroot}%{_libdir}/*.dll
326%endif
327
328# Remove libtool files, which reference the .dll libs
329rm -f %{buildroot}%{_libdir}/*.la
330
331%else # !%{isnative}
332# For cross-binutils we drop the documentation.
333rm -rf %{buildroot}%{_infodir}
334# We keep these as one can have native + cross binutils of different versions.
335#rm -rf %{buildroot}%{_prefix}/share/locale
336#rm -rf %{buildroot}%{_mandir}
337rm -rf %{buildroot}%{_libdir}/libiberty.a
338%endif # !%{isnative}
339
340# This one comes from gcc
341rm -f %{buildroot}%{_infodir}/dir
342#rm -rf %{buildroot}%{_prefix}/%{binutils_target}
343
344%find_lang %{?cross}binutils
345%find_lang %{?cross}opcodes
346%find_lang %{?cross}bfd
347%find_lang %{?cross}gas
348%find_lang %{?cross}gprof
349cat %{?cross}opcodes.lang >> %{?cross}binutils.lang
350cat %{?cross}bfd.lang >> %{?cross}binutils.lang
351cat %{?cross}gas.lang >> %{?cross}binutils.lang
352cat %{?cross}gprof.lang >> %{?cross}binutils.lang
353
354if [ -x ld/ld-new ]; then
355 %find_lang %{?cross}ld
356 cat %{?cross}ld.lang >> %{?cross}binutils.lang
357fi
358if [ -x gold/ld-new ]; then
359 %find_lang %{?cross}gold
360 cat %{?cross}gold.lang >> %{?cross}binutils.lang
361fi
362
363%clean
364rm -rf %{buildroot}
365
366%post
367%if "%{build_gold}" == "both"
368%__rm -f %{_bindir}/%{?cross}ld
369%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
370 %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority}
371%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
372 %{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
373%{_sbindir}/alternatives --auto %{?cross}ld
374%endif
375%if %{isnative}
376#/sbin/ldconfig
377%if %{with docs}
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
382%endif
383%endif # %{isnative}
384exit 0
385
386%preun
387%if "%{build_gold}" == "both"
388if [ $1 = 0 ]; then
389 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
390 %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
391fi
392%endif
393%if %{isnative}
394if [ $1 = 0 ]; then
395 if [ -f %{_infodir}/binutils.info.gz ]
396 then
397 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
398 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
399 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
400# %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
401 fi
402fi
403%endif
404exit 0
405
406%if %{isnative}
407%postun
408#/sbin/ldconfig
409 if [ -f %{_infodir}/binutils.info.gz ]
410 then
411 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
412 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
413 %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
414# %{_sbindir}/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
415 fi
416%endif # %{isnative}
417
418%files -f %{?cross}binutils.lang
419%defattr(-,root,root,-)
420%license COPYING COPYING3 COPYING3.LIB COPYING.LIB
421%doc README
422%{_bindir}/%{?cross}[!l]*.exe
423%{_prefix}/%{binutils_target}/bin/%{?cross}[!l]*.exe
424%if "%{build_gold}" == "both"
425%{_bindir}/%{?cross}ld*.exe
426%ghost %{_bindir}/%{?cross}ld
427%else
428#%{_bindir}/%{?cross}ld*.exe
429%endif
430%{_mandir}/man1/*
431%{_infodir}/as.info.gz
432%{_infodir}/binutils.info.gz
433%{_infodir}/gprof.info.gz
434#%{_infodir}/ld.info.gz
435%if %{enable_shared}
436%{_libdir}/*.dll
437%endif
438
439%if %{isnative}
440%if %{with docs}
441%{_infodir}/[^b]*info*
442%{_infodir}/binutils*info*
443%endif
444
445%files devel
446%defattr(-,root,root,-)
447%{_prefix}/include/*
448%{_libdir}/*_dll.a
449%if %{with docs}
450%{_infodir}/bfd*info*
451%endif # with docs
452
453%endif # %{isnative}
454
455%changelog
456* Thu Jun 15 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.27-2
457- fix ticket #165 (needs to be reverted after gcc issue #27 fix)
458- add bldlevel info to the dll
459
460* Mon Mar 20 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.27-1
461- update to version 2.27
462- adjust spec to scm_ macros usage
463
464* Tue May 31 2016 Silvan Scherrer <silvan.scherrer@aroa.ch> 2.25-1
465- update to version 2.25
466
467* Wed Oct 5 2011 yd <yd@os2power.com> 2.21-1
468- Initial version
Note: See TracBrowser for help on using the repository browser.