/[packages]/cauldron/binutils/current/SPECS/binutils.spec
ViewVC logotype

Contents of /cauldron/binutils/current/SPECS/binutils.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1757007 - (show annotations) (download)
Mon Nov 15 20:53:43 2021 UTC (2 years, 5 months ago) by tmb
File size: 11884 byte(s)
gold: Place .note.gnu.property section before other note sections
1 %define lib_major 2
2 %define lib_name_orig %{package_prefix}%mklibname binutils
3 %define lib_name %{lib_name_orig}%{lib_major}
4 %define dev_name %mklibname binutils -d
5
6 %define rpm_ver 2.37
7 %define tar_ver 2.37
8 %define rel 19
9
10 # Define if building a cross-binutils
11 %define build_cross 0
12 %{expand: %{?cross: %%global build_cross 1}}
13
14 %if %{build_cross}
15 %define target_cpu %{cross}
16 %define target_platform %{target_cpu}-%_real_vendor-linux%{gnuext}
17 %define program_prefix %{target_platform}-
18 %define package_prefix cross-%{target_cpu}-
19 %else
20 %define target_cpu %{_target_cpu}
21 %define target_platform %{_target_platform}
22 %define program_prefix %{nil}
23 %define package_prefix %{nil}
24 %endif
25
26 %define arch %(echo %{target_cpu}|sed -e "s/\(i.86\|athlon\)/i386/" -e "s/amd64/x86_64/")
27 %define isarch() %(case " %* " in (*" %{arch} "*) echo 1;; (*) echo 0;; esac)
28
29 %if %{build_cross}
30 %if %isarch %arm
31 %define gnuext -gnueabi
32 %else
33 %define gnuext -gnu
34 %endif
35 %endif
36
37 # List of targets where gold can be enabled
38 %define gold_arches %{ix86} x86_64 %{arm} aarch64
39
40 Summary: GNU Binary Utility Development Utilities
41 Name: %{package_prefix}binutils
42 Epoch: 1
43 Version: %{rpm_ver}
44 Release: %mkrel %{rel}
45 License: GPLv3+
46 Group: Development/Other
47 URL: https://www.gnu.org/software/binutils/
48 Source0: https://ftp.gnu.org/gnu/binutils/binutils-%{tar_ver}.tar.xz
49 Source1: build_cross_binutils.sh
50 Source2: binutils-2.19.50.0.1-output-format.sed
51 Source3: binutils-git.sh
52 %if "%{name}" == "binutils"
53 Provides: %{lib_name} = %{epoch}:%{version}-%{release}
54 %endif
55 # (tmb) force build with gcc 11.2
56 BuildRequires: gcc >= 11.2.0
57 # (tmb) force fixed binutils
58 BuildRequires: binutils >= 1:2.37-1
59 BuildRequires: autoconf
60 BuildRequires: automake
61 BuildRequires: bison
62 BuildRequires: flex
63 BuildRequires: gettext
64 BuildRequires: texinfo-tex
65 BuildRequires: dejagnu
66 BuildRequires: pkgconfig(zlib)
67 # make check'ing requires libdl.a
68 BuildRequires: glibc-static-devel
69 # gold make check'ing requires libstdc++.a
70 BuildRequires: libstdc++-static-devel
71
72 # revert devel enabling on branch
73 Source101: binutils-disable-development.patch
74
75 # upstream 2.37 branch
76 Patch001: 0001-Change-uint-to-unsigned.patch
77 Patch002: 0002-PR28106-build-of-2.37-fails-on-FreeBSD-and-Clang.patch
78 Patch003: 0003-Updated-Russian-translation-for-the-bfd-library.patch
79 Patch004: 0004-Re-ld-script-expression-parsing.patch
80 Patch005: 0005-Revert-PowerPC-Don-t-generate-unused-section-symbols.patch
81 Patch006: 0006-texi2pod.pl-add-no-op-no-split-option-support-PR2814.patch
82 Patch007: 0007-Re-opcodes-constify-local-meps-macros.patch
83 Patch008: 0008-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch
84 Patch009: 0009-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_s.patch
85 Patch010: 0010-Revert-Re-ld-script-expression-parsing.patch
86 Patch011: 0011-Revert-ld-defsym.patch
87 Patch012: 0012-Revert-ld-script-expression-parsing.patch
88 Patch013: 0013-PR28391-strip-objcopy-preserve-dates-.a-cannot-set-t.patch
89 Patch014: 0014-ld-pru-Fix-resource_table-output-section-alignment.patch
90 Patch015: 0015-PR28422-build_id-use-after-free.patch
91 Patch016: 0016-PR28459-readelf-issues-bogus-warning.patch
92 Patch017: 0017-PR28417-std-string-no-longer-allows-accepting-nullpt.patch
93 Patch018: 0018-PR28540-segmentation-fault-on-NULL-byte_get.patch
94 Patch019: 0019-gold-Place-.note.gnu.property-section-before-other-n.patch
95
96 # upstream master branch
97 Patch100: 0100-PR28264-ld.bfd-crash-on-linking-efivar-with-LTO.patch
98 Patch101: 0101-PR28250-Null-pointer-dereference-in-debug_class_type.patch
99
100 # patches once liberated from Fedora:
101 # NOTE! Do not add more without maintainer approval
102 Patch301: binutils-2.20.51.0.2-libtool-lib64.patch
103 Patch302: binutils-2.37-export-demangle.h.patch
104 Patch303: binutils-2.22.52.0.4-no-config-h-check.patch
105 Patch304: binutils-2.37-filename-in-error-messages.patch
106
107 # Mageia patches
108 Patch401: binutils-2.37-linux32.patch
109 Patch402: binutils-2.37-skip-gold-check.patch
110
111 # security fixes
112
113 %description
114 Binutils is a collection of binary utilities, including:
115
116 * ar: creating modifying and extracting from archives
117 * nm: for listing symbols from object files
118 * objcopy: for copying and translating object files
119 * objdump: for displaying information from object files
120 * ranlib: for generating an index for the contents of an archive
121 * size: for listing the section sizes of an object or archive file
122 * strings: for listing printable strings from files
123 * strip: for discarding symbols (a filter for demangling encoded C++ symbols
124 * addr2line: for converting addresses to file and line
125 * nlmconv: for converting object code into an NLM
126
127 Install binutils if you need to perform any of these types of actions on
128 binary files. Most programmers will want to install binutils.
129
130 %package -n %{dev_name}
131 Summary: Main library for %{name}
132 Group: Development/Other
133 Provides: %{name}-devel = %{epoch}:%{version}-%{release}
134 Provides: %{lib_name}-devel = %{epoch}:%{version}-%{release}
135 Requires: zlib-devel
136 # filter out self-requries
137 %global __requires_exclude ^devel\\(libbfd-%{version}
138
139 %description -n %{dev_name}
140 This package contains BFD and opcodes static libraries and associated
141 header files. Only *.a libraries are included, because BFD doesn't
142 have a stable ABI. Developers starting new projects are strongly encouraged
143 to consider using libelf instead of BFD.
144
145 %prep
146 %setup -q -n binutils-%{tar_ver}
147 %autopatch -p1
148 # remove to force regenerating it because of reverts in P10-P12
149 rm -f ld/ldlex.c
150
151 %build
152 # Additional targets
153 ADDITIONAL_TARGETS=""
154 case %{target_cpu} in
155 i*86 | athlon*)
156 ADDITIONAL_TARGETS="x86_64-%{_target_vendor}-%{_target_os}"
157 ;;
158 esac
159 if [[ -n "$ADDITIONAL_TARGETS" ]]; then
160 TARGET_CONFIG="$TARGET_CONFIG --enable-targets=$ADDITIONAL_TARGETS"
161 fi
162
163 case %{target_cpu} in
164 i*86 | athlon* | aarch64*)
165 TARGET_CONFIG="$TARGET_CONFIG --enable-64-bit-bfd"
166 ;;
167 esac
168
169 case %{target_cpu} in x86_64*|i?86*|arm*|aarch64*)
170 TARGET_CONFIG="$TARGET_CONFIG --enable-targets=x86_64-pep"
171 ;;
172 esac
173
174 %if "%{name}" != "binutils"
175 %define _program_prefix %{program_prefix}
176 TARGET_CONFIG="$TARGET_CONFIG --target=%{target_platform}"
177 %endif
178
179 # Don't build shared libraries in cross binutils
180 %if "%{name}" == "binutils"
181 TARGET_CONFIG="$TARGET_CONFIG --enable-shared --with-pic"
182 %endif
183
184 # Binutils comes with its own custom libtool
185 # [gb] FIXME: but system libtool also works and has relink fix
186 %define __libtoolize /bin/true
187
188 # Build main binaries
189 rm -rf objs
190 mkdir objs
191 pushd objs
192 CONFIGURE_TOP=.. %configure $TARGET_CONFIG --with-bugurl=https://bugs.mageia.org/ \
193 --enable-gold \
194 --enable-plugins \
195 --enable-compressed-debug-sections=none \
196 --enable-relro=yes
197 # There seems to be some problems with builds of gold randomly failing whenever
198 # going through the build system, so let's try workaround this by trying to do
199 # make once again when it happens...
200 %make_build tooldir=%{_prefix} || make tooldir=%{_prefix}
201 popd
202
203 %check
204 # All Tests must pass on x86 and x86_64
205 # rtp: some ld-arm tests are failing.
206 # they're fixed in 2.21 but didn't find the fixes
207 echo ====================TESTING=========================
208 %if %isarch i386 x86_64
209 %make_build -C objs check LDFLAGS="" || :
210 # random build failures with gold seems to happen during check as well...
211 make -k -C objs gold-check LDFLAGS="" || :
212 %else
213 %make_build -C objs -k check LDFLAGS="" || :
214 %endif
215 echo ====================TESTING END=====================
216
217 logfile="%{name}-%{version}-%{release}.log"
218 rm -f $logfile; find . -name "*.sum" | xargs cat >> $logfile
219
220 %install
221 # disable 'check-rpaths' only from warning about standard RPATHs (0x0001)
222 # (tmb) TODO / FIXME better ???
223 export QA_RPATHS=0x0001
224
225
226 mkdir -p $RPM_BUILD_ROOT%{_prefix}
227 %make_install -C objs
228
229 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/{dlltool,nlmconv,windres}*
230 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
231 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
232 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
233
234 %if "%{name}" == "binutils"
235 make -C objs prefix=$RPM_BUILD_ROOT%{_prefix} infodir=$RPM_BUILD_ROOT%{_infodir} install-info
236 install -m 644 include/libiberty.h $RPM_BUILD_ROOT%{_includedir}/
237 %if %isarch %mips
238 install -m 644 objs/libiberty/libiberty.a $RPM_BUILD_ROOT%{_libdir}/
239 # Ship with the PIC libiberty
240 %else
241 install -m 644 objs/libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}/
242 %endif
243 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{_target_platform}/
244
245 # Sanity check --enable-64-bit-bfd really works.
246 %if %isarch i*86 athlon*
247 grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h
248 %endif
249
250 # Fix multilib conflicts of generated values by __WORDSIZE-based expressions.
251 %if %isarch %{ix86} x86_64
252 sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
253 -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
254 -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
255 -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
256 #define BFD_HOST_64_BIT long long\
257 #else\
258 #define BFD_HOST_64_BIT long\
259 #endif/' \
260 -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
261 %{buildroot}%{_prefix}/include/bfd.h
262 %endif
263 touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
264
265 # Generate .so linker scripts for dependencies; imported from glibc/Makerules:
266
267 # This fragment of linker script gives the OUTPUT_FORMAT statement
268 # for the configuration we are building.
269 OUTPUT_FORMAT="\
270 /* Ensure this .so library will not be used by a link for a different format
271 on a multi-architecture system. */
272 $(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")"
273
274 tee %{buildroot}%{_libdir}/libbfd.so <<EOH
275 /* GNU ld script */
276
277 $OUTPUT_FORMAT
278
279 /* The libz dependency is unexpected by legacy build scripts. */
280 INPUT ( %{_libdir}/libbfd.a -liberty -lz )
281 EOH
282
283 tee %{buildroot}%{_libdir}/libopcodes.so <<EOH
284 /* GNU ld script */
285
286 $OUTPUT_FORMAT
287
288 INPUT ( %{_libdir}/libopcodes.a -lbfd -lz )
289 EOH
290
291 %else
292 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
293 rm -rf $RPM_BUILD_ROOT%{_infodir}
294 rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/
295 rm -f $RPM_BUILD_ROOT%{_prefix}/%{_target_platform}/%{target_cpu}-linux/lib/*.la
296 %endif
297
298 %find_lang binutils
299 %find_lang gas
300 %find_lang ld
301 %find_lang gold
302 %find_lang gprof
303 cat gas.lang >> binutils.lang
304 cat ld.lang >> binutils.lang
305 cat gold.lang>> binutils.lang
306 cat gprof.lang >> binutils.lang
307
308 %find_lang opcodes
309 %find_lang bfd
310 cat opcodes.lang >> binutils.lang
311 cat bfd.lang >> binutils.lang
312
313 %files -f binutils.lang
314 %{_bindir}/%{program_prefix}addr2line
315 %{_bindir}/%{program_prefix}ar
316 %{_bindir}/%{program_prefix}as
317 %{_bindir}/%{program_prefix}c++filt
318 %{_bindir}/%{program_prefix}dwp
319 %{_bindir}/%{program_prefix}elfedit
320 %{_bindir}/%{program_prefix}gprof
321 %{_bindir}/%{program_prefix}ld
322 %{_bindir}/%{program_prefix}ld.bfd
323 %if %isarch %{gold_arches}
324 %{_bindir}/%{program_prefix}ld.gold
325 %endif
326 %{_bindir}/%{program_prefix}nm
327 %{_bindir}/%{program_prefix}objcopy
328 %{_bindir}/%{program_prefix}objdump
329 %{_bindir}/%{program_prefix}ranlib
330 %{_bindir}/%{program_prefix}readelf
331 %{_bindir}/%{program_prefix}size
332 %{_bindir}/%{program_prefix}strings
333 %{_bindir}/%{program_prefix}strip
334 %{_mandir}/man1/*
335 %if "%{name}" == "binutils"
336 %{_infodir}/*info*
337 %{_libdir}/libbfd-%{version}*.so
338 %{_libdir}/libctf.so.0
339 %{_libdir}/libctf.so.0.0.0
340 %{_libdir}/libctf-nobfd.so.0
341 %{_libdir}/libctf-nobfd.so.0.0.0
342 %{_libdir}/libopcodes-%{version}*.so
343 %{_libdir}/bfd-plugins/libdep.so
344 %else
345 %{_prefix}/%{target_platform}/bin/*
346 %{_prefix}/%{target_platform}/lib/ldscripts
347 %endif
348
349 %if "%{name}" == "binutils"
350 %files -n %{dev_name}
351 %{_includedir}/*.h
352 %{_libdir}/libbfd.a
353 %{_libdir}/libbfd.so
354 %{_libdir}/libctf.a
355 %{_libdir}/libctf.so
356 %{_libdir}/libctf-nobfd.a
357 %{_libdir}/libctf-nobfd.so
358 %{_libdir}/libiberty.a
359 %{_libdir}/libopcodes.a
360 %{_libdir}/libopcodes.so
361 %endif

  ViewVC Help
Powered by ViewVC 1.1.30