]>
Commit | Line | Data |
---|---|---|
b9e07146 ER |
1 | # TODO |
2 | # - warning: Installed (but unpackaged) file(s) found: | |
3 | # /usr/sh64-linux/sh64-elf | |
d480c358 ER |
4 | # |
5 | # Conditional build: | |
6 | # Targets: | |
7 | %bcond_without alpha # enable alpha | |
8 | %bcond_without arm # enable arm | |
9 | %bcond_without aarch64 # enable aarch64 | |
10 | %bcond_without avr32 # enable avr32 | |
11 | %bcond_without blackfin # enable blackfin | |
12 | %bcond_without c6x # enable c6x | |
13 | %bcond_without cris # enable cris | |
14 | %bcond_without frv # enable frv | |
15 | %bcond_without h8300 # enable h8300 | |
16 | %bcond_without hppa # enable hppa | |
17 | %bcond_without hppa64 # enable hppa64 | |
18 | %bcond_without ia64 # enable ia64 | |
19 | %bcond_without m32r # enable m32r | |
20 | %bcond_without m68k # enable m68k | |
21 | %bcond_without metag # enable metag | |
22 | %bcond_without microblaze # enable microblaze | |
23 | %bcond_without mips64 # enable mips64 | |
24 | %bcond_without mn10300 # enable mn10300 | |
25 | %bcond_without nios2 # enable nios2 | |
26 | %bcond_without openrisc # enable openrisc | |
27 | %bcond_without powerpc64 # enable powerpc64 | |
28 | %bcond_without s390x # enable s390x | |
29 | %bcond_without score # enable score | |
30 | %bcond_without sh # enable sh | |
31 | %bcond_without sh64 # enable sh64 | |
32 | %bcond_without sparc64 # enable sparc64 | |
33 | %bcond_without tile # enable tile | |
34 | %bcond_without x86_64 # enable x86_64 | |
35 | %bcond_without xtensa # enable xtensa | |
59e455fe ER |
36 | |
37 | # 32-bit packages we don't build as we can use the 64-bit package instead | |
d480c358 ER |
38 | %undefine with_i386 |
39 | %undefine with_mips | |
40 | %undefine with_powerpc | |
41 | %undefine with_s390 | |
42 | %undefine with_sparc | |
43 | %undefine with_sh4 | |
59e455fe ER |
44 | |
45 | # not available in binutils-2.24 | |
d480c358 ER |
46 | %undefine with_hexagon |
47 | %undefine with_unicore32 | |
59e455fe ER |
48 | |
49 | Summary: A GNU collection of cross-compilation binary utilities | |
12a20bb3 | 50 | Name: cross-binutils |
59e455fe | 51 | Version: 2.25 |
3ceaf547 | 52 | Release: 0.10 |
59e455fe ER |
53 | License: GPL v3+ |
54 | Group: Development/Tools | |
59e455fe ER |
55 | # Note - the Linux Kernel binutils releases are too unstable and contain too |
56 | # many controversial patches so we stick with the official FSF version | |
57 | # instead. | |
58 | Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2 | |
59 | # Source0-md5: d9f3303f802a5b6b0bb73a335ab89d66 | |
60 | Source2: binutils-2.19.50.0.1-output-format.sed | |
61 | # Bring up to date with what's in the git release branch | |
62 | #Patch00: binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch | |
63 | Patch01: binutils-2.20.51.0.2-libtool-lib64.patch | |
64 | Patch02: binutils-2.20.51.0.10-ppc64-pie.patch | |
65 | Patch03: binutils-2.20.51.0.2-ia64-lib64.patch | |
66 | Patch04: binutils-2.25-version.patch | |
67 | Patch05: binutils-2.25-set-long-long.patch | |
68 | Patch06: binutils-2.20.51.0.10-copy-osabi.patch | |
69 | Patch07: binutils-2.20.51.0.10-sec-merge-emit.patch | |
70 | # Enable -zrelro by default: BZ #621983 | |
71 | Patch08: binutils-2.22.52.0.1-relro-on-by-default.patch | |
72 | # Local patch - export demangle.h with the binutils-devel rpm. | |
73 | Patch09: binutils-2.22.52.0.1-export-demangle.h.patch | |
74 | # Disable checks that config.h has been included before system headers. BZ #845084 | |
75 | Patch10: binutils-2.22.52.0.4-no-config-h-check.patch | |
76 | # Fix addr2line to use the dynamic symbol table if it could not find any ordinary symbols. | |
77 | Patch11: binutils-2.23.52.0.1-addr2line-dynsymtab.patch | |
78 | Patch12: binutils-2.25-kernel-ld-r.patch | |
79 | # Correct bug introduced by patch 12 | |
80 | Patch13: binutils-2.23.2-aarch64-em.patch | |
81 | # Fix detections little endian PPC shared libraries | |
82 | Patch14: binutils-2.24-ldforcele.patch | |
12a20bb3 | 83 | URL: http://sources.redhat.com/binutils |
59e455fe ER |
84 | BuildRequires: bison |
85 | BuildRequires: flex | |
59e455fe ER |
86 | BuildRequires: texinfo >= 4.0 |
87 | BuildRequires: zlib-devel | |
88 | # BZ 920545: We need pod2man in order to build the manual pages. | |
89 | BuildRequires: /usr/bin/pod2man | |
90 | # Required for: ld-bootstrap/bootstrap.exp bootstrap with --static | |
91 | # It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array | |
92 | Conflicts: gcc-c++ < 4.0.0 | |
93 | %ifarch ia64 | |
94 | Obsoletes: gnupro <= 1117-1 | |
95 | %endif | |
96 | Provides: bundled(libiberty) | |
97 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
98 | ||
99 | # Where the binaries aimed at gcc will live (ie. /usr/<target>/bin/) | |
100 | %define auxbin_prefix %{_exec_prefix} | |
101 | %define srcdir binutils-%{version} | |
102 | ||
103 | %description | |
104 | Binutils is a collection of binary utilities, including ar (for | |
105 | creating, modifying and extracting from archives), as (a family of GNU | |
106 | assemblers), gprof (for displaying call graph profile data), ld (the | |
107 | GNU linker), nm (for listing symbols from object files), objcopy (for | |
108 | copying and translating object files), objdump (for displaying | |
109 | information from object files), ranlib (for generating an index for | |
110 | the contents of an archive), readelf (for displaying detailed | |
111 | information about binary files), size (for listing the section sizes | |
112 | of an object or archive file), strings (for listing printable strings | |
113 | from files), strip (for discarding symbols), and addr2line (for | |
114 | converting addresses to file and line). | |
115 | ||
12a20bb3 | 116 | %package common |
59e455fe ER |
117 | Summary: Cross-build binary utility documentation and translation files |
118 | Group: Development/Tools | |
59e455fe | 119 | BuildArch: noarch |
59e455fe | 120 | |
12a20bb3 | 121 | %description common |
59e455fe ER |
122 | Documentation, manual pages and translation files for cross-build |
123 | binary image generation, manipulation and query tools. | |
124 | ||
125 | %define do_package() \ | |
12a20bb3 | 126 | %package -n binutils-%1 \ |
59e455fe ER |
127 | Summary: Cross-build binary utilities for %1 \ |
128 | Group: Development/Tools \ | |
12a20bb3 | 129 | Requires: %{name}-common = %{version}-%{release}\ |
59e455fe | 130 | \ |
12a20bb3 | 131 | %description -n binutils-%1 \ |
59e455fe ER |
132 | Cross-build binary image generation, manipulation and query tools. \ |
133 | ||
134 | %define do_symlink() \ | |
12a20bb3 | 135 | %package -n binutils-%1 \ |
59e455fe ER |
136 | Summary: Cross-build binary utilities for %1 \ |
137 | Group: Development/Tools \ | |
d480c358 | 138 | Requires: binutils-%2 = %{version}-%{release}\ |
59e455fe | 139 | \ |
12a20bb3 | 140 | %description -n binutils-%1 \ |
59e455fe ER |
141 | Cross-build binary image generation, manipulation and query tools. \ |
142 | ||
d480c358 ER |
143 | %do_package alpha-linux-gnu |
144 | %do_package arm-linux-gnu | |
145 | %do_package aarch64-linux-gnu | |
146 | %do_package avr32-linux-gnu | |
147 | %do_package bfin-linux-gnu | |
148 | %do_package c6x-linux-gnu | |
149 | %do_package cris-linux-gnu | |
150 | %do_package frv-linux-gnu | |
151 | %do_package h8300-linux-gnu | |
152 | %do_package hexagon-linux-gnu | |
153 | %do_package hppa-linux-gnu | |
154 | %do_package hppa64-linux-gnu | |
155 | %do_package i386-linux-gnu | |
156 | %do_package ia64-linux-gnu | |
157 | %do_package m32r-linux-gnu | |
158 | %do_package m68k-linux-gnu | |
159 | %do_package metag-linux-gnu | |
160 | %do_package microblaze-linux-gnu | |
161 | %do_package mips-linux-gnu | |
162 | %do_package mips64-linux-gnu | |
163 | %do_package mn10300-linux-gnu | |
164 | %do_package nios2-linux-gnu | |
165 | %do_package openrisc-linux-gnu | |
166 | %do_package powerpc-linux-gnu | |
167 | %do_package powerpc64-linux-gnu | |
168 | %do_symlink ppc-linux-gnu powerpc-linux-gnu | |
169 | %do_symlink ppc64-linux-gnu powerpc64-linux-gnu | |
170 | %do_package s390-linux-gnu | |
171 | %do_package s390x-linux-gnu | |
172 | %do_package score-linux-gnu | |
173 | %do_package sh-linux-gnu | |
174 | %do_package sh4-linux-gnu | |
175 | %do_package sh64-linux-gnu | |
176 | %do_package sparc-linux-gnu | |
177 | %do_package sparc64-linux-gnu | |
178 | %do_package tile-linux-gnu | |
179 | %do_package unicore32-linux-gnu | |
180 | %do_package x86_64-linux-gnu | |
181 | %do_package xtensa-linux-gnu | |
59e455fe ER |
182 | |
183 | %prep | |
184 | %setup -qc | |
185 | cd %{srcdir} | |
186 | %if 1 | |
187 | #%patch00 -p1 -b .latest-git~ | |
188 | %patch01 -p1 | |
189 | %patch02 -p1 | |
190 | %ifarch ia64 | |
191 | %if "%{_lib}" == "lib64" | |
192 | %patch03 -p1 | |
193 | %endif | |
194 | %endif | |
195 | %patch04 -p1 | |
196 | %patch05 -p1 | |
197 | %patch06 -p1 | |
198 | %patch07 -p1 | |
199 | %patch08 -p1 | |
200 | %patch09 -p1 | |
201 | %patch10 -p1 | |
202 | %patch11 -p1 | |
203 | %patch12 -p1 | |
204 | %patch13 -p1 | |
205 | %patch14 -p1 | |
206 | %endif | |
207 | ||
208 | # We cannot run autotools as there is an exact requirement of autoconf-2.59. | |
209 | ||
210 | # On ppc64 we might use 64KiB pages | |
211 | sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c | |
212 | # LTP sucks | |
8f81d42d ER |
213 | # exclude "gas/config", "libiberty/config", it's a dir |
214 | %{__sed} -i -e 's/i\[3-7\]86/i[34567]86/g' $(echo */conf* | sed -e 's#gas/config##;s#libiberty/config##;') | |
59e455fe ER |
215 | sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in} |
216 | sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in} | |
217 | # Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible. | |
8f81d42d | 218 | if %{__cc} %{rpmcflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then |
59e455fe ER |
219 | sed -i -e 's/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in} |
220 | sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in} | |
221 | fi | |
222 | ||
223 | # $PACKAGE is used for the gettext catalog name. | |
12a20bb3 | 224 | sed -i -e 's/^ PACKAGE=/ PACKAGE=cross-/' */configure |
59e455fe ER |
225 | # Undo the name change to run the testsuite. |
226 | for tool in binutils gas ld; do | |
227 | sed -i -e "2aDEJATOOL = $tool" $tool/Makefile.am | |
228 | sed -i -e "s/^DEJATOOL = .*/DEJATOOL = $tool/" $tool/Makefile.in | |
229 | done | |
230 | touch */configure | |
234e1aa3 | 231 | cd .. |
59e455fe | 232 | |
dba7baa1 ER |
233 | cat > target.list <<EOF |
234 | %{?with_alpha:alpha-linux-gnu} | |
235 | %{?with_arm:arm-linux-gnu} | |
236 | %{?with_aarch64:aarch64-linux-gnu} | |
237 | %{?with_avr32:avr32-linux-gnu} | |
238 | %{?with_blackfin:bfin-linux-gnu} | |
239 | %{?with_c6x:c6x-linux-gnu} | |
240 | %{?with_cris:cris-linux-gnu} | |
241 | %{?with_frv:frv-linux-gnu} | |
242 | %{?with_h8300:h8300-linux-gnu} | |
243 | %{?with_hexagon:hexagon-linux-gnu} | |
244 | %{?with_hppa:hppa-linux-gnu} | |
245 | %{?with_hppa64:hppa64-linux-gnu} | |
246 | %{?with_i386:i386-linux-gnu} | |
247 | %{?with_ia64:ia64-linux-gnu} | |
248 | %{?with_m32r:m32r-linux-gnu} | |
249 | %{?with_m68k:m68k-linux-gnu} | |
250 | %{?with_metag:metag-linux-gnu} | |
251 | %{?with_microblaze:microblaze-linux-gnu} | |
252 | %{?with_mips:mips-linux-gnu} | |
253 | %{?with_mips64:mips64-linux-gnu} | |
254 | %{?with_mn10300:mn10300-linux-gnu} | |
255 | %{?with_nios2:nios2-linux-gnu} | |
256 | %{?with_openrisc:openrisc-linux-gnu} | |
257 | %{?with_powerpc:powerpc-linux-gnu} | |
258 | %{?with_powerpc64:powerpc64-linux-gnu} | |
259 | %{?with_s390:s390-linux-gnu} | |
260 | %{?with_s390x:s390x-linux-gnu} | |
261 | %{?with_score:score-linux-gnu} | |
262 | %{?with_sh:sh-linux-gnu} | |
263 | %{?with_sh4:sh4-linux-gnu} | |
264 | %{?with_sh64:sh64-linux-gnu} | |
265 | %{?with_sparc:sparc-linux-gnu} | |
266 | %{?with_sparc64:sparc64-linux-gnu} | |
267 | %{?with_tile:tile-linux-gnu} | |
268 | %{?with_unicore32:unicore32-linux-gnu} | |
269 | %{?with_x86_64:x86_64-linux-gnu} | |
270 | %{?with_xtensa:xtensa-linux-gnu} | |
271 | EOF | |
59e455fe | 272 | |
dba7baa1 | 273 | if [ $(wc -w < target.list) = 0 ]; then |
59e455fe ER |
274 | echo >&2 "No targets selected" |
275 | exit 8 | |
276 | fi | |
277 | ||
278 | %build | |
59e455fe | 279 | config_target() { |
d480c358 ER |
280 | local arch=$1 |
281 | local prefix=$arch- | |
282 | local build_dir=${1%%%%-*} | |
59e455fe ER |
283 | |
284 | case $arch in | |
285 | arm-*) target=arm-linux-gnueabi;; | |
286 | aarch64-*) target=aarch64-linux-gnu;; | |
287 | avr32-*) target=avr-linux;; | |
288 | bfin-*) target=bfin-uclinux;; | |
289 | c6x-*) target=c6x-uclinux;; | |
290 | h8300-*) target=h8300-elf;; | |
291 | m32r-*) target=m32r-elf;; | |
292 | mn10300-*) target=am33_2.0-linux;; | |
293 | m68knommu-*) target=m68k-linux;; | |
294 | openrisc-*) target=or1k-linux-gnu;; | |
295 | parisc-*) target=hppa-linux;; | |
296 | score-*) target=score-elf;; | |
297 | sh64-*) target=sh64-linux;; | |
298 | tile-*) target=tilegx-linux;; | |
299 | v850-*) target=v850e-linux;; | |
300 | x86-*) target=x86_64-linux;; | |
301 | *) target=$arch;; | |
302 | esac | |
303 | ||
304 | echo $arch: target is $target | |
59e455fe ER |
305 | CARGS= |
306 | ||
307 | case $target in i?86*|sparc*|ppc*|s390*|sh*|arm*) | |
308 | CARGS="$CARGS --enable-64-bit-bfd" | |
309 | ;; | |
310 | esac | |
311 | ||
312 | case $target in ia64*) | |
313 | CARGS="$CARGS --enable-targets=i386-linux" | |
314 | ;; | |
315 | esac | |
316 | ||
317 | case $target in ppc*|ppc64*) | |
318 | CARGS="$CARGS --enable-targets=spu" | |
319 | ;; | |
320 | esac | |
321 | ||
322 | case $target in sh-*) | |
323 | CARGS="$CARGS --enable-targets=sh4-linux" | |
324 | ;; | |
325 | esac | |
326 | ||
327 | case $target in sh64*) | |
328 | CARGS="$CARGS --enable-targets=sh64-linux,sh-elf,sh-linux,sh4-linux" | |
329 | ;; | |
330 | esac | |
331 | ||
332 | mkdir $build_dir | |
333 | cd $build_dir | |
334 | ||
335 | # We could optimize the cross builds size by --enable-shared but the produced | |
336 | # binaries may be less convenient in the embedded environment. | |
3ceaf547 | 337 | CC="%{__cc}" \ |
ccc401bb ER |
338 | CFLAGS="%{rpmcflags}" \ |
339 | LDFLAGS="%{rpmldflags} -Wl,-z,relro" \ | |
59e455fe ER |
340 | ../%{srcdir}/configure \ |
341 | --disable-dependency-tracking \ | |
342 | --disable-silent-rules \ | |
343 | --enable-checking \ | |
344 | --prefix=%{_prefix} \ | |
345 | --exec-prefix=%{auxbin_prefix} \ | |
346 | --bindir=%{_bindir} \ | |
347 | --sbindir=%{_sbindir} \ | |
348 | --sysconfdir=%{_sysconfdir} \ | |
349 | --datadir=%{_datadir} \ | |
350 | --includedir=%{_includedir} \ | |
351 | --libdir=%{_libdir} \ | |
352 | --libexecdir=%{_libexecdir} \ | |
353 | --localstatedir=%{_localstatedir} \ | |
354 | --sharedstatedir=%{_sharedstatedir} \ | |
355 | --mandir=%{_mandir} \ | |
356 | --infodir=%{_infodir} \ | |
357 | --build=%{_target_platform} \ | |
358 | --host=%{_target_platform} \ | |
359 | --target=$target \ | |
360 | --program-prefix=$prefix \ | |
361 | --disable-shared \ | |
362 | --disable-install_libbfd \ | |
363 | --with-sysroot=%{_prefix}/$arch/sys-root \ | |
364 | $CARGS \ | |
365 | --with-bugurl="http://bugs.pld-linux.org" | |
366 | cd .. | |
367 | } | |
368 | ||
369 | for target in $(cat target.list); do | |
370 | config_target $target | |
371 | done | |
372 | ||
373 | build_target() { | |
d480c358 | 374 | local build_dir=${1%%%%-*} |
ccc401bb | 375 | %{__make} -C $build_dir tooldir=%{_prefix} all |
59e455fe ER |
376 | } |
377 | ||
378 | for target in $(cat target.list); do | |
379 | build_target $target | |
380 | done | |
381 | ||
382 | # for documentation purposes only | |
12a20bb3 ER |
383 | install -d cross-binutils |
384 | cd cross-binutils | |
59e455fe ER |
385 | ../%{srcdir}/configure \ |
386 | --disable-dependency-tracking \ | |
387 | --disable-silent-rules \ | |
388 | --prefix=%{_prefix} \ | |
389 | --exec-prefix=%{auxbin_prefix} \ | |
390 | --bindir=%{_bindir} \ | |
391 | --sbindir=%{_sbindir} \ | |
392 | --sysconfdir=%{_sysconfdir} \ | |
393 | --datadir=%{_datadir} \ | |
394 | --includedir=%{_includedir} \ | |
395 | --libdir=%{_libdir} \ | |
396 | --libexecdir=%{_libexecdir} \ | |
397 | --localstatedir=%{_localstatedir} \ | |
398 | --sharedstatedir=%{_sharedstatedir} \ | |
399 | --mandir=%{_mandir} \ | |
400 | --infodir=%{_infodir} \ | |
12a20bb3 | 401 | --program-prefix=cross- \ |
59e455fe ER |
402 | --disable-shared \ |
403 | --with-bugurl="http://bugs.pld-linux.org" | |
404 | ||
405 | %{__make} tooldir=%{_prefix} all | |
406 | cd .. | |
407 | ||
408 | %install | |
409 | rm -rf $RPM_BUILD_ROOT | |
410 | ||
411 | install_bin() { | |
d480c358 ER |
412 | local cpu=${1%%%%-*} |
413 | local build_dir=$cpu | |
59e455fe ER |
414 | %{__make} install -C $build_dir DESTDIR=$RPM_BUILD_ROOT |
415 | ||
416 | # We want links for ppc and ppc64 also if we make powerpc or powerpc64 | |
417 | case $cpu in | |
418 | powerpc*) | |
419 | cd $RPM_BUILD_ROOT%{_bindir} | |
420 | for i in $cpu-*; do | |
421 | ln -s $i ppc${i#powerpc} | |
422 | done | |
423 | cd - | |
424 | cd $RPM_BUILD_ROOT%{_prefix} | |
425 | for i in $cpu-*; do | |
426 | ln -s $i ppc${i#powerpc} | |
427 | done | |
428 | cd - | |
429 | cd $RPM_BUILD_ROOT%{_mandir}/man1 | |
430 | for i in $cpu-*; do | |
431 | ln -s $i ppc${i#powerpc} | |
432 | done | |
433 | cd - | |
434 | ;; | |
435 | esac | |
436 | } | |
437 | ||
438 | for target in $(cat target.list); do | |
439 | echo "=== INSTALL target $target ===" | |
440 | install -d $RPM_BUILD_ROOT%{_prefix}/$target/sys-root | |
441 | install_bin $target | |
442 | ||
443 | if [ $target = sh64-linux-gnu ]; then | |
444 | ln -s %{auxbin_prefix}/sh64-elf $RPM_BUILD_ROOT%{auxbin_prefix}/sh64-linux | |
445 | fi | |
446 | done | |
447 | ||
448 | echo "=== INSTALL man targets ===" | |
12a20bb3 ER |
449 | %{__make} install-man1 -C cross-binutils/binutils/doc DESTDIR=$RPM_BUILD_ROOT |
450 | %{__make} install-man1 -C cross-binutils/gas/doc DESTDIR=$RPM_BUILD_ROOT | |
451 | %{__make} install-man1 -C cross-binutils/ld DESTDIR=$RPM_BUILD_ROOT | |
452 | %{__make} install-man1 -C cross-binutils/gprof DESTDIR=$RPM_BUILD_ROOT | |
59e455fe ER |
453 | |
454 | echo "=== INSTALL po targets ===" | |
12a20bb3 ER |
455 | %{__make} install -C cross-binutils/binutils/po DESTDIR=$RPM_BUILD_ROOT |
456 | %{__make} install -C cross-binutils/gas/po DESTDIR=$RPM_BUILD_ROOT | |
457 | %{__make} install -C cross-binutils/ld/po DESTDIR=$RPM_BUILD_ROOT | |
458 | %{__make} install -C cross-binutils/gprof/po DESTDIR=$RPM_BUILD_ROOT | |
459 | %{__make} install -C cross-binutils/bfd/po DESTDIR=$RPM_BUILD_ROOT | |
460 | %{__make} install -C cross-binutils/opcodes/po DESTDIR=$RPM_BUILD_ROOT | |
59e455fe ER |
461 | |
462 | # Add the additional symlink-only targets | |
463 | grep ^powerpc target.list | sed -e s/powerpc/ppc/ > symlink-target.list | |
59e455fe ER |
464 | |
465 | # For cross-binutils we drop the documentation. | |
466 | echo "=== REMOVE documentation ===" | |
467 | rm -rf $RPM_BUILD_ROOT%{_infodir} | |
468 | rm -f $RPM_BUILD_ROOT%{_infodir}/dir | |
469 | ||
470 | echo "=== REMOVE libraries and scripts ===" | |
471 | rm -rf $RPM_BUILD_ROOT%{_libdir}/libiberty.a | |
472 | rm -rf $RPM_BUILD_ROOT%{auxbin_prefix}/*/lib/ldscripts | |
473 | rmdir $RPM_BUILD_ROOT%{auxbin_prefix}/*/lib || : | |
474 | ||
475 | echo "=== BUILD file lists ===" | |
476 | build_file_list() { | |
d480c358 ER |
477 | local arch=$1 |
478 | local cpu=${arch%%%%-*} | |
59e455fe ER |
479 | |
480 | case $cpu in | |
481 | avr32) target_cpu=avr;; | |
482 | bfin) target_cpu=bfin;; | |
483 | h8300) target_cpu=h8300;; | |
484 | mn10300) target_cpu=am33_2.0;; | |
485 | openrisc) target_cpu=or1k;; | |
486 | score) target_cpu=score;; | |
487 | tile) target_cpu=tilegx;; | |
488 | v850) target_cpu=v850e;; | |
489 | *) target_cpu=$cpu;; | |
490 | esac | |
491 | ||
492 | ( | |
268d7a93 ER |
493 | echo "%%defattr(-,root,root,-)" |
494 | echo "%{_bindir}/$arch-[!l]*" | |
495 | echo "%{_bindir}/$arch-ld*" | |
59e455fe | 496 | if [ -L $RPM_BUILD_ROOT%{auxbin_prefix}/$target_cpu-* ]; then |
268d7a93 | 497 | echo "%{auxbin_prefix}/$target_cpu-*" |
59e455fe | 498 | else |
b9e07146 ER |
499 | echo "%dir %{auxbin_prefix}/$target_cpu-*" |
500 | echo "%dir %{auxbin_prefix}/$target_cpu-*/bin" | |
268d7a93 | 501 | echo "%{auxbin_prefix}/$target_cpu-*/bin/*" |
688e32ec ER |
502 | if [ "$target_cpu" != "$cpu" ]; then |
503 | echo "%dir %{_prefix}/$arch" | |
504 | fi | |
268d7a93 | 505 | echo "%{_prefix}/$arch/sys-root" |
59e455fe | 506 | fi |
268d7a93 | 507 | echo "%{_mandir}/man1/$arch-*" |
59e455fe ER |
508 | ) > files.$arch |
509 | } | |
510 | ||
10ca4dcc | 511 | for target in $(cat target.list symlink-target.list); do |
59e455fe ER |
512 | build_file_list $target |
513 | done | |
514 | ||
515 | # All the installed manual pages and translation files for each program are the | |
516 | # same, so symlink them to the core package | |
517 | echo "=== CROSSLINK man pages ===" | |
518 | cd $RPM_BUILD_ROOT%{_mandir}/man1 | |
12a20bb3 ER |
519 | for i in cross-*.1*; do |
520 | j=${i#cross-} | |
59e455fe ER |
521 | |
522 | for k in *-$j; do | |
523 | if [ $k != $i ]; then | |
524 | ln -sf $i $k | |
525 | fi | |
526 | done | |
527 | done | |
528 | ||
529 | # Add ld.bfd manual pages | |
12a20bb3 | 530 | find * -name "*ld.1*" -a ! -name "cross-ld.1*" -print | |
59e455fe ER |
531 | while read x; do |
532 | y=$(echo $x | sed -e s/ld[.]1/ld.bfd.1/) | |
533 | ln -s $x $y | |
534 | done | |
535 | cd - | |
536 | ||
537 | # Find the language files which only exist in the common package | |
12a20bb3 ER |
538 | %find_lang cross-binutils |
539 | %find_lang cross-opcodes | |
540 | %find_lang cross-bfd | |
541 | %find_lang cross-gas | |
542 | %find_lang cross-ld | |
543 | %find_lang cross-gprof | |
59e455fe | 544 | cat \ |
12a20bb3 ER |
545 | cross-binutils.lang \ |
546 | cross-opcodes.lang \ | |
547 | cross-bfd.lang \ | |
548 | cross-gas.lang \ | |
549 | cross-ld.lang \ | |
550 | cross-gprof.lang \ | |
59e455fe ER |
551 | > files.cross |
552 | ||
553 | %clean | |
554 | rm -rf $RPM_BUILD_ROOT | |
555 | ||
12a20bb3 | 556 | %files common -f files.cross |
59e455fe ER |
557 | %defattr(644,root,root,755) |
558 | %doc %{srcdir}/README | |
559 | %doc %{srcdir}/COPYING* | |
12a20bb3 | 560 | %{_mandir}/man1/cross-* |
59e455fe ER |
561 | |
562 | %define do_files() \ | |
12a20bb3 | 563 | %files -n binutils-%1 -f files.%1 \ |
59e455fe | 564 | %defattr(644,root,root,755) \ |
59e455fe | 565 | |
d480c358 ER |
566 | %{?with_alpha:%do_files alpha-linux-gnu} |
567 | %{?with_arm:%do_files arm-linux-gnu} | |
568 | %{?with_aarch64:%do_files aarch64-linux-gnu} | |
569 | %{?with_avr32:%do_files avr32-linux-gnu} | |
570 | %{?with_blackfin:%do_files bfin-linux-gnu} | |
571 | %{?with_c6x:%do_files c6x-linux-gnu} | |
572 | %{?with_cris:%do_files cris-linux-gnu} | |
573 | %{?with_frv:%do_files frv-linux-gnu} | |
574 | %{?with_h8300:%do_files h8300-linux-gnu} | |
575 | %{?with_hexagon:%do_files hexagon-linux-gnu} | |
576 | %{?with_hppa:%do_files hppa-linux-gnu} | |
577 | %{?with_hppa64:%do_files hppa64-linux-gnu} | |
578 | %{?with_i386:%do_files i386-linux-gnu} | |
579 | %{?with_ia64:%do_files ia64-linux-gnu} | |
580 | %{?with_m32r:%do_files m32r-linux-gnu} | |
581 | %{?with_m68k:%do_files m68k-linux-gnu} | |
582 | %{?with_metag:%do_files metag-linux-gnu} | |
583 | %{?with_microblaze:%do_files microblaze-linux-gnu} | |
584 | %{?with_mips:%do_files mips-linux-gnu} | |
585 | %{?with_mips64:%do_files mips64-linux-gnu} | |
586 | %{?with_mn10300:%do_files mn10300-linux-gnu} | |
587 | %{?with_nios2:%do_files nios2-linux-gnu} | |
588 | %{?with_openrisc:%do_files openrisc-linux-gnu} | |
589 | %{?with_powerpc:%do_files powerpc-linux-gnu} | |
590 | %{?with_powerpc64:%do_files powerpc64-linux-gnu} | |
591 | %{?with_powerpc:%do_files ppc-linux-gnu} | |
592 | %{?with_powerpc64:%do_files ppc64-linux-gnu} | |
593 | %{?with_s390:%do_files s390-linux-gnu} | |
594 | %{?with_s390x:%do_files s390x-linux-gnu} | |
595 | %{?with_score:%do_files score-linux-gnu} | |
596 | %{?with_sh:%do_files sh-linux-gnu} | |
597 | %{?with_sh4:%do_files sh4-linux-gnu} | |
598 | %{?with_sh64:%do_files sh64-linux-gnu} | |
599 | %{?with_sparc:%do_files sparc-linux-gnu} | |
600 | %{?with_sparc64:%do_files sparc64-linux-gnu} | |
601 | %{?with_tile:%do_files tile-linux-gnu} | |
602 | %{?with_unicore32:%do_files unicore32-linux-gnu} | |
603 | %{?with_x86_64:%do_files x86_64-linux-gnu} | |
604 | %{?with_xtensa:%do_files xtensa-linux-gnu} |