]> git.pld-linux.org Git - packages/cross-gcc.git/blame - cross-gcc.spec
- unconditional noarch subpackages
[packages/cross-gcc.git] / cross-gcc.spec
CommitLineData
b5b0b447
ER
1#
2# Conditional build:
3%bcond_without cloog # cloog
4# Targets:
5%bcond_without aarch64 # enable aarch64
6%bcond_without alpha # enable alpha
7%bcond_without arm # enable arm
8%bcond_without avr32 # enable avr32
9%bcond_without blackfin # enable blackfin
10%bcond_without c6x # enable c6x
11%bcond_without cris # enable cris
12%bcond_without frv # enable frv
13%bcond_without h8300 # enable h8300
14%bcond_without hppa # enable hppa
15%bcond_without hppa64 # enable hppa64
16%bcond_without ia64 # enable ia64
17%bcond_without m32r # enable m32r
18%bcond_without m68k # enable m68k
19%bcond_without microblaze # enable microblaze
20%bcond_without mips64 # enable mips64
21%bcond_without mn10300 # enable mn10300
22%bcond_without nios2 # enable nios2
23%bcond_without powerpc64 # enable powerpc64
24%bcond_without s390x # enable s390x
25%bcond_without sh # enable sh
26%bcond_without sh64 # enable sh64
27%bcond_without sparc64 # enable sparc64
28%bcond_without tile # enable tile
29%bcond_without x86_64 # enable x86_64
30%bcond_without xtensa # enable xtensa
31
32# built compiler generates lots of ICEs
33# - none at this time
34
35# gcc considers obsolete
36%undefine with_score
37
38# gcc doesn't build
39# - sh64 doesn't build on pld:
40# ../../gcc-4.9.2-20141212/gcc/genmultilib[264]: shift: nothing to shift
41# Makefile:1851: recipe for target 's-mlib' failed
42%undefine with_sh64
43# packaging error, files packaged to gcc-hppa-linux-gnu and gcc-hppa64-linux-gnu
44%undefine with_hppa64
45
46# 32-bit packages we don't build as we can use the 64-bit package instead
47%undefine with_i386
48%undefine with_mips
49%undefine with_powerpc
50%undefine with_s390
51%undefine with_sh4
52%undefine with_sparc
53
54# gcc doesn't support
55%undefine with_metag
56%undefine with_openrisc
57
58# not available in binutils-2.22
59%undefine with_unicore32
60
61%define multilib_64_archs sparc64 ppc64 s390x x86_64
62
63# we won't build libgcc for these as it depends on C library or kernel headers
64%define no_libgcc_targets nios2*|tile-*
65
66###############################################################################
67#
68# The gcc versioning information. In a sed command below, the specfile winds
69# pre-release version numbers in BASE-VER back to the last actually-released
70# number.
71%define DATE 20141212
72%define SVNREV 218667
73
74%define srcdir gcc-%{version}-%{DATE}
75%define cross_binutils_version 2.24
76%define isl_version 0.12.2
77%define cloog_version 0.18.1
78
79Summary: Cross C compiler
80Name: cross-gcc
81Version: 4.9.2
82Release: 0.1
83# libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have GCC Runtime Exception.
84License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
85Group: Development/Languages
86URL: http://gcc.gnu.org/
87# The source for this package was pulled from upstream's vcs. Use the
88# following commands to generate the tarball:
89# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_7-branch@%{SVNREV} gcc-%{version}-%{DATE}
90# tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2
91Source0: http://pkgs.fedoraproject.org/repo/pkgs/cross-gcc/%{srcdir}.tar.bz2/ccd8cac944582f8d2ddf5274a15df176/%{srcdir}.tar.bz2
92# Source0-md5: ccd8cac944582f8d2ddf5274a15df176
93Source1: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2
94# Source1-md5: e039bfcfb6c2ab039b8ee69bf883e824
95Source2: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloog_version}.tar.gz
96# Source2-md5: e34fca0540d840e5d0f6427e98c92252
97Patch0: gcc49-hack.patch
98Patch1: gcc49-java-nomulti.patch
99Patch2: gcc49-ppc32-retaddr.patch
100Patch3: gcc49-rh330771.patch
101Patch4: gcc49-i386-libgomp.patch
102Patch5: gcc49-sparc-config-detection.patch
103Patch6: gcc49-libgomp-omp_h-multilib.patch
104Patch7: gcc49-libtool-no-rpath.patch
105Patch8: gcc49-cloog-dl.patch
106Patch9: gcc49-cloog-dl2.patch
107Patch10: gcc49-pr38757.patch
108Patch11: gcc49-libstdc++-docs.patch
109Patch12: gcc49-no-add-needed.patch
110Patch13: gcc49-color-auto.patch
111Patch14: gcc49-libgo-p224.patch
112Patch15: gcc49-aarch64-async-unw-tables.patch
113Patch16: gcc49-aarch64-unwind-opt.patch
114Patch17: gcc49-pr64269.patch
115Patch900: cross-intl-filename.patch
116# ia64 - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44553
117# m68k - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53557
118# alpha - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55344
119Patch901: cross-gcc-with-libgcc.patch
120Patch903: cross-gcc-bfin.patch
121Patch904: cross-gcc-c6x.patch
122Patch1100: cloog-0.18.1-ppc64le-config.patch
123BuildRequires: cross-binutils-common >= %{cross_binutils_version}
124BuildRequires: binutils >= 2.20.51.0.2-12
125BuildRequires: bison
126BuildRequires: dejagnu
127BuildRequires: flex
128BuildRequires: gettext
129BuildRequires: sharutils
130BuildRequires: texinfo
131BuildRequires: zlib-devel
132# make sure pthread.h doesn't contain __thread tokens
133# make sure glibc supports stack protector
134# make sure glibc supports DT_GNU_HASH
135BuildRequires: elfutils-devel >= 0.147
136BuildRequires: glibc-devel >= 2.4.90-13
137BuildRequires: gmp-devel >= 4.2
138BuildRequires: libmpc-devel >= 0.8.1
139BuildRequires: mpfr-devel >= 2.3.1
140Provides: bundled(libiberty)
141BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
142
143%define builddir %{_builddir}/%{name}-%{version}
144
629150be
ER
145# functions with printf format attribute but with special parser and also
146# receiving non constant format strings
147%define Werror_cflags %{nil}
148
82693282
ER
149# -march= from host is invalid when configuring targets
150%define filterout_c -march=.*
151%define filterout_cxx -march=.*
152
b5b0b447
ER
153%description
154Cross-build GNU C compiler collection.
155
156%package common
157Summary: Cross-build GNU C compiler documentation and translation files
158Group: Development/Languages
b5b0b447 159BuildArch: noarch
b5b0b447
ER
160
161%description common
162Documentation, manual pages and translation files for cross-build GNU
163C compiler.
164
165This is the common part of a set of cross-build GNU C compiler
166packages for building kernels for other architectures. No support for
167cross-building user space programs is currently supplied as that would
168massively multiply the number of packages.
169
170%define do_package() \
171%if %{expand:%%{?with_%{2}:1}%%{!?with_%{2}:0}} \
172%package -n gcc-%1 \
173Summary: Cross-build binary utilities for %1 \
174Group: Development/Languages \
175BuildRequires: binutils-%1 >= %{cross_binutils_version}\
176Requires: %{name}-common = %{version}-%{release}\
177Requires: binutils-%1 >= %{cross_binutils_version}\
178\
179%description -n gcc-%1 \
180Cross-build GNU C compiler. \
181\
182Only building kernels is currently supported. Support for cross-building \
183user space programs is not currently provided as that would massively multiply \
184the number of packages. \
185\
186%package -n gcc-c++-%1 \
187Summary: Cross-build binary utilities for %1 \
188Group: Development/Languages \
189Requires: gcc-%1 = %{version}-%{release}\
190\
191%description -n gcc-c++-%1 \
192Cross-build GNU C++ compiler. \
193\
194Only the compiler is provided; not libstdc++. Support for cross-building \
195user space programs is not currently provided as that would massively multiply \
196the number of packages. \
197%endif
198
199%define do_symlink() \
200%if %{expand:%%{?with_%{2}:1}%%{!?with_%{2}:0}} \
201%package -n gcc-%1 \
202Summary: Cross-build binary utilities for %1 \
203Group: Development/Languages \
204Requires: gcc-%3 = %{version}-%{release}\
205\
206%description -n gcc-%1 \
207Cross-build GNU C++ compiler. \
208\
209Only building kernels is currently supported. Support for cross-building \
210user space programs is not currently provided as that would massively multiply \
211the number of packages. \
212\
213%package -n gcc-c++-%1 \
214Summary: Cross-build binary utilities for %1 \
215Group: Development/Languages \
216Requires: gcc-%1 = %{version}-%{release}\
217Requires: gcc-c++-%3 = %{version}-%{release}\
218\
219%description -n gcc-c++-%1 \
220Cross-build GNU C++ compiler. \
221\
222Only the compiler is provided; not libstdc++. Support for cross-building \
223user space programs is not currently provided as that would massively multiply \
224the number of packages. \
225%endif
226
227%do_package alpha-linux-gnu alpha
228%do_package arm-linux-gnu arm
229%do_package aarch64-linux-gnu aarch64
230%do_package avr32-linux-gnu avr32
231%do_package bfin-linux-gnu blackfin
232%do_package c6x-linux-gnu c6x
233%do_package cris-linux-gnu cris
234%do_package frv-linux-gnu frv
235%do_package h8300-linux-gnu h8300
236%do_package hppa-linux-gnu hppa
237%do_package hppa64-linux-gnu hppa64
238%do_package i386-linux-gnu i386
239%do_package ia64-linux-gnu ia64
240%do_package m32r-linux-gnu m32r
241%do_package m68k-linux-gnu m68k
242%do_package metag-linux-gnu metag
243%do_package microblaze-linux-gnu microblaze
244%do_package mips-linux-gnu mips
245%do_package mips64-linux-gnu mips64
246%do_package mn10300-linux-gnu mn10300
247%do_package nios2-linux-gnu nios2
248%do_package openrisc-linux-gnu openrisc
249%do_package powerpc-linux-gnu powerpc
250%do_package powerpc64-linux-gnu powerpc64
251%do_symlink ppc-linux-gnu powerpc powerpc-linux-gnu
252%do_symlink ppc64-linux-gnu powerpc64 powerpc64-linux-gnu
253%do_package s390-linux-gnu s390
254%do_package s390x-linux-gnu s390x
255%do_package score-linux-gnu score
256%do_package sh-linux-gnu sh
257%do_package sh4-linux-gnu sh4
258%do_package sh64-linux-gnu sh64
259%do_package sparc-linux-gnu sparc
260%do_package sparc64-linux-gnu sparc64
261%do_package tile-linux-gnu tile
262%do_package unicore32-linux-gnu unicore32
263%do_package x86_64-linux-gnu x86_64
264%do_package xtensa-linux-gnu xtensa
265
266%prep
267%setup -qc -a 1 -a 2
268cd %{srcdir}
269%patch0 -p0
270%patch1 -p0
271%patch2 -p0
272%patch3 -p0
273%patch4 -p0
274%patch5 -p0
275%patch6 -p0
276%patch7 -p0
277%if %{with cloog}
278%patch8 -p0
279%patch9 -p0
280%endif
281%patch10 -p0
282# % if %{with libstdcxx_docs}
283# % patch11 -p0
284# % endif
285%patch12 -p0
286%patch13 -p0
287%patch14 -p0
288rm -f libgo/go/crypto/elliptic/p224{,_test}.go
289%patch15 -p0
290%patch16 -p0
291%patch17 -p0
292
293%patch900 -p0
294%patch901 -p1
295%patch903 -p0
296%patch904 -p0
297
298cd ..
299%patch1100 -p0
300cd %{srcdir}
301
302# Move the version number back
303sed -i -e 's/4\.9\.3/4.9.2/' gcc/BASE-VER
304echo 'PLD-Linux Cross %{version}-%{release}' > gcc/DEV-PHASE
305
306# Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
307sed -i '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' gcc/common.opt
308sed -i '/flag_debug_types_section/s/Init(1)/Init(0)/' gcc/common.opt
309sed -i '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' gcc/common.opt
310sed -i 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./' gcc/doc/invoke.texi
311
312./contrib/gcc_update --touch
313
314LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
315
316cat > target.list <<EOF
317%{?with_alpha:alpha-linux-gnu}
318%{?with_arm:arm-linux-gnu}
319%{?with_aarch64:aarch64-linux-gnu}
320%{?with_avr32:avr32-linux-gnu}
321%{?with_blackfin:bfin-linux-gnu}
322%{?with_c6x:c6x-linux-gnu}
323%{?with_cris:cris-linux-gnu}
324%{?with_frv:frv-linux-gnu}
325%{?with_h8300:h8300-linux-gnu}
326%{?with_hppa:hppa-linux-gnu}
327%{?with_hppa64:hppa64-linux-gnu}
328%{?with_i386:i386-linux-gnu}
329%{?with_ia64:ia64-linux-gnu}
330%{?with_m32r:m32r-linux-gnu}
331%{?with_m68k:m68k-linux-gnu}
332%{?with_metag:metag-linux-gnu}
333%{?with_microblaze:microblaze-linux-gnu}
334%{?with_mips:mips-linux-gnu}
335%{?with_mips64:mips64-linux-gnu}
336%{?with_mn10300:mn10300-linux-gnu}
337%{?with_nios2:nios2-linux-gnu}
338%{?with_openrisc:openrisc-linux-gnu}
339%{?with_powerpc:powerpc-linux-gnu}
340%{?with_powerpc64:powerpc64-linux-gnu}
341%{?with_s390:s390-linux-gnu}
342%{?with_s390x:s390x-linux-gnu}
343%{?with_score:score-linux-gnu}
344%{?with_sh:sh-linux-gnu}
345%{?with_sh4:sh4-linux-gnu}
346%{?with_sh64:sh64-linux-gnu}
347%{?with_sparc:sparc-linux-gnu}
348%{?with_sparc64:sparc64-linux-gnu}
349%{?with_tile:tile-linux-gnu}
350%{?with_unicore32:unicore32-linux-gnu}
351%{?with_x86_64:x86_64-linux-gnu}
352%{?with_xtensa:xtensa-linux-gnu}
353EOF
354
355if [ $(wc -w < target.list) = 0 ]; then
356 echo >&2 "No targets selected"
357 exit 8
358fi
359
360%build
361
362# Undo the broken autoconf change in recent Fedora versions
363export CONFIG_SITE=NONE
364
365#
366# Configure and build the ISL and CLooG libraries
367#
368%if %{with cloog}
369
370%define isl_source %{builddir}/isl-%{isl_version}
371%define isl_build %{builddir}/isl-build
372%define isl_install %{builddir}/isl-install
373
374mkdir %{isl_build} %{isl_install}
375%ifarch s390 s390x
376ISL_FLAG_PIC=-fPIC
377%else
378ISL_FLAG_PIC=-fpic
379%endif
380cd %{isl_build}
381 %{isl_source}/configure \
382 --disable-silent-rules \
383 --disable-shared \
384 CC="%{__cc}" \
385 CXX="%{__cxx}" \
386 CFLAGS="${CFLAGS:-%rpmcflags} $ISL_FLAG_PIC" \
387 --prefix=%{isl_install}
388 %{__make}
389 %{__make} install
390cd ..
391
392%define cloog_source %{builddir}/cloog-%{cloog_version}
393%define cloog_build %{builddir}/cloog-build
394%define cloog_install %{builddir}/cloog-install
395
396install -d %{cloog_build} %{builddir}/cloog-install
397cd %{cloog_build}
398cat >> %{cloog_source}/source/isl/constraints.c << \EOF
399#include <isl/flow.h>
400static void __attribute__((used)) *s1 = (void *) isl_union_map_compute_flow;
401static void __attribute__((used)) *s2 = (void *) isl_map_dump;
402EOF
403sed -i 's|libcloog|libgcc49privatecloog|g' %{cloog_source}/{,test/}Makefile.{am,in}
404
405%{cloog_source}/configure \
406 --disable-silent-rules \
407 --with-isl=system \
408 --with-isl-prefix=%{isl_install} \
409 CC="%{__cc}" \
410 CXX="%{__cxx}" \
411 CFLAGS="${CFLAGS:-%rpmcflags}" \
412 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
413 --prefix=%{cloog_install}
414sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
415sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
416%{__make}
417%{__make} install
418cd %{cloog_install}/lib
419rm libgcc49privatecloog-isl.so{,.4}
420mv libgcc49privatecloog-isl.so.4.0.0 libcloog-isl.so.4
421ln -sf libcloog-isl.so.4 libcloog-isl.so
422ln -sf libcloog-isl.so.4 libcloog.so
423
424%endif
425
426#
427# Configure the compiler
428#
b5b0b447
ER
429config_target() {
430 echo "=== CONFIGURING $1"
431
432 arch=$1
433 prefix=$arch-
434 build_dir=$1
435
436 case $arch in
437 arm-*) target=arm-linux-gnueabi;;
438 aarch64-*) target=aarch64-linux-gnu;;
439 avr32-*) target=avr-linux;;
440 bfin-*) target=bfin-uclinux;;
441 c6x-*) target=c6x-uclinux;;
442 h8300-*) target=h8300-elf;;
443 mn10300-*) target=am33_2.0-linux;;
444 m68knommu-*) target=m68k-linux;;
445 openrisc-*) target=or32-linux;;
446 parisc-*) target=hppa-linux;;
447 score-*) target=score-elf;;
448 sh64-*) target=sh64-linux;;
449 tile-*) target=tilegx-linux;;
450 v850-*) target=v850e-linux;;
451 x86-*) target=x86_64-linux;;
452 *) target=$arch;;
453 esac
454
455 echo $arch: target is $target
456 #export CFLAGS="$RPM_OPT_FLAGS"
457
458 CONFIG_FLAGS=
459 case $arch in
460 arm)
461 CONFIG_FLAGS="--with-cpu=cortex-a8 --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-abi=aapcs-linux"
462 ;;
463 powerpc-*|powerpc64-*)
464 CONFIG_FLAGS="--with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 --enable-secureplt"
465 ;;
466 s390*-*)
467 CONFIG_FLAGS="--with-arch=z9-109 --with-tune=z10 --enable-decimal-float"
468 ;;
469 sh-*)
470 CONFIG_FLAGS="--with-multilib-list=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,!m2a,!m2a-single"
471 ;;
472 sh64-*)
473 CONFIG_FLAGS="--with-multilib-list=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu"
474 ;;
475 sparc-*)
476 CONFIG_FLAGS="--disable-linux-futex"
477 ;;
478 tile-*)
479 #CONFIG_FLAGS="--with-arch_32=tilepro"
480 ;;
481 x86-*)
482 CONFIG_FLAGS="--with-arch_32=i686"
483 ;;
484 esac
485
486 case $arch in
487 alpha|powerpc*|s390*|sparc*)
488 CONFIG_FLAGS="$CONFIG_FLAGS --with-long-double-128" ;;
489 esac
490
491 install -d $build_dir
492 cd $build_dir
493
494 # We could optimize the cross builds size by --enable-shared but the produced
495 # binaries may be less convenient in the embedded environment.
496 AR_FOR_TARGET=%{_bindir}/$arch-ar \
497 AS_FOR_TARGET=%{_bindir}/$arch-as \
498 DLLTOOL_FOR_TARGET=%{_bindir}/$arch-dlltool \
499 LD_FOR_TARGET=%{_bindir}/$arch-ld \
500 NM_FOR_TARGET=%{_bindir}/$arch-nm \
501 OBJDUMP_FOR_TARGET=%{_bindir}/$arch-objdump \
502 RANLIB_FOR_TARGET=%{_bindir}/$arch-ranlib \
503 STRIP_FOR_TARGET=%{_bindir}/$arch-strip \
504 WINDRES_FOR_TARGET=%{_bindir}/$arch-windres \
505 WINDMC_FOR_TARGET=%{_bindir}/$arch-windmc \
506 CC="%{__cc}" \
507 CFLAGS="%{rpmcflags}" \
508 CXXFLAGS="%{rpmcxxflags}" \
ec60f96f
ER
509 LDFLAGS="-Wl,-z,relro" \
510 ../configure \
b5b0b447
ER
511 --bindir=%{_bindir} \
512 --build=%{_target_platform} \
513 --datadir=%{_datadir} \
514 --disable-decimal-float \
515 --disable-dependency-tracking \
516 --disable-gold \
517 --disable-libgomp \
518 --disable-libmudflap \
519 --disable-libquadmath \
520 --disable-libssp \
521 --disable-nls \
522 --disable-plugin \
523 --disable-shared \
524 --disable-silent-rules \
525 --disable-sjlj-exceptions \
526 --disable-threads \
527 --with-ld=/usr/bin/$arch-ld \
528 --enable-checking=$checking \
529 --enable-gnu-unique-object \
530 --enable-initfini-array \
531 --enable-languages=c,c++ \
532 --enable-linker-build-id \
533 --enable-nls \
534 --enable-obsolete \
535 --enable-targets=all \
536 --exec-prefix=%{_exec_prefix} \
537 --host=%{_target_platform} \
538 --includedir=%{_includedir} \
539 --infodir=%{_infodir} \
540 --libexecdir=%{_libexecdir} \
541 --localstatedir=%{_localstatedir} \
542 --mandir=%{_mandir} \
543 --prefix=%{_prefix} \
544 --program-prefix=$prefix \
545 --sbindir=%{_sbindir} \
546 --sharedstatedir=%{_sharedstatedir} \
547 --sysconfdir=%{_sysconfdir} \
548 --target=$target \
549 --with-bugurl="http://bugs.pld-linux.org" \
550 --with-linker-hash-style=gnu \
551 --with-newlib \
552 --with-sysroot=%{_prefix}/$arch/sys-root \
553 --with-system-libunwind \
554 --with-system-zlib \
555 --without-headers \
556%if %{with cloog}
557 --with-isl=%{isl_install} --with-cloog=%{cloog_install} \
558%else
559 --without-isl --without-cloog \
560%endif
561 $CONFIG_FLAGS
562%if 0
563 --libdir=%{_libdir} # we want stuff in /usr/lib/gcc/ not /usr/lib64/gcc
564%endif
565 cd ..
566}
567
ec60f96f 568cd %{builddir}/%{srcdir}
b5b0b447
ER
569for target in $(cat target.list); do
570 config_target $target
571done
572
573build_target() {
574 echo "=== BUILDING $1"
575
576 arch=$1
577 build_dir=$1
578
579 AR_FOR_TARGET=%{_bindir}/$arch-ar \
580 AS_FOR_TARGET=%{_bindir}/$arch-as \
581 DLLTOOL_FOR_TARGET=%{_bindir}/$arch-dlltool \
582 LD_FOR_TARGET=%{_bindir}/$arch-ld \
583 NM_FOR_TARGET=%{_bindir}/$arch-nm \
584 OBJDUMP_FOR_TARGET=%{_bindir}/$arch-objdump \
585 RANLIB_FOR_TARGET=%{_bindir}/$arch-ranlib \
586 STRIP_FOR_TARGET=%{_bindir}/$arch-strip \
587 WINDRES_FOR_TARGET=%{_bindir}/$arch-windres \
588 WINDMC_FOR_TARGET=%{_bindir}/$arch-windmc \
589 %{__make} -C $build_dir tooldir=%{_prefix} all-gcc
590
591 case $arch in
592 %{no_libgcc_targets})
593 ;;
594 *)
595 %{__make} -C $build_dir tooldir=%{_prefix} all-target-libgcc
596 ;;
597 esac
598}
599
600for target in $(cat target.list); do
601 build_target $target
602done
603
604%install
605rm -rf $RPM_BUILD_ROOT
606
607install_bin() {
608 echo "=== INSTALLING $1"
609
610 arch=$1
611 cpu=${1%%%%-*}
612
613 case $arch in
614 %{no_libgcc_targets}) with_libgcc="";;
615 *) with_libgcc="install-target-libgcc";;
616 esac
617
618 %{__make} -C $arch DESTDIR=$RPM_BUILD_ROOT install-gcc ${with_libgcc}
619
620 # We want links for ppc and ppc64 also if we make powerpc or powerpc64
621 case $cpu in
622 powerpc*)
623 cd $RPM_BUILD_ROOT%{_bindir}
624 for i in $cpu-*; do
625 ln -s $i ppc${i#powerpc}
626 done
627 cd -
628 ;;
629 esac
630}
631
ec60f96f 632cd %{builddir}/%{srcdir}
b5b0b447
ER
633for target in $(cat target.list); do
634 install -d $RPM_BUILD_ROOT%{_prefix}/$target/sys-root
635 install_bin $target
636done
637
638grep ^powerpc target.list | sed -e s/powerpc/ppc/ > symlink-target.list
639
640# We have to copy cloog somewhere graphite can dlopen it from
641%if %{with cloog}
642for i in $RPM_BUILD_ROOT%{_prefix}/lib/gcc/*/%{version}; do
643 cp -a %{cloog_install}/lib/libcloog-isl.so.4 $i
644done
645%endif
646
647# For cross-gcc we drop the documentation.
648rm -rf $RPM_BUILD_ROOT%{_infodir}
649
650# Remove binaries we will not be including, so that they don't end up in
651# gcc-debuginfo
652rm -f $RPM_BUILD_ROOT%{_libdir}/{libffi*,libiberty.a}
653rm -f $RPM_BUILD_ROOT%{_libexecdir}/gcc/*/%{version}/install-tools/{mkheaders,fixincl}
654rm -f $RPM_BUILD_ROOT%{_bindir}/*-gcc-%{version} || :
655rm -f $RPM_BUILD_ROOT%{_bindir}/*-ar || :
656rm -f $RPM_BUILD_ROOT%{_bindir}/*-nm || :
657rm -f $RPM_BUILD_ROOT%{_bindir}/*-ranlib || :
658rmdir $RPM_BUILD_ROOT%{_includedir}
659
660find $RPM_BUILD_ROOT%{_datadir} -name gcc.mo |
661while read x; do
662 y=$(dirname $x)
663 mv $x $y/cross-gcc.mo
664done
665
ec60f96f 666cd %{builddir}
b5b0b447
ER
667%find_lang cross-gcc
668
669rm $RPM_BUILD_ROOT%{_mandir}/man7/*.7
670rmdir $RPM_BUILD_ROOT%{_mandir}/man7
671
672# All the installed manual pages and translation files for each program are the
673# same, so symlink them to the common package
674cd $RPM_BUILD_ROOT%{_mandir}/man1
675 for i in cross-cpp.1 cross-gcc.1 cross-g++.1 cross-gcov.1; do
676 j=${i#cross-}
677
678 for k in *-$j; do
679 if [ $k != $i -a ! -L $k ]; then
680 mv $k $i
681 ln -s $i $k
682 fi
683 done
684 done
685
686 # Add manpages the additional symlink-only targets
687 %if %{with powerpc}%{with powerpc64}
688 for i in powerpc*; do
689 ln -s $i ppc${i#powerpc}
690 done
691 %endif
692cd -
693
694install_lang() {
695 arch=$1
696 cpu=${arch%%%%-*}
697
698 case $cpu in
699 avr32) target_cpu=avr;;
700 bfin) target_cpu=bfin;;
701 h8300) target_cpu=h8300;;
702 mn10300) target_cpu=am33_2.0;;
703 openrisc) target_cpu=openrisc;;
704 parisc) target_cpu=hppa;;
705 score) target_cpu=score;;
706 tile) target_cpu=tilegx;;
707 v850) target_cpu=v850e;;
708 x86) target_cpu=x86_64;;
709 *) target_cpu=$cpu;;
710 esac
711
712 (
713 echo "%%defattr(-,root,root,-)"
714 echo "%{_bindir}/$arch*-cpp"
715 echo "%{_bindir}/$arch*-gcc"
716 echo "%{_bindir}/$arch*-gcov"
717 echo "%{_mandir}/man1/$arch*-cpp*"
718 echo "%{_mandir}/man1/$arch*-gcc*"
719 echo "%{_mandir}/man1/$arch*-gcov*"
720 case $cpu in
ec60f96f 721 ppc*|ppc64*)
b5b0b447 722 ;;
ec60f96f 723 *)
b5b0b447
ER
724 echo "/usr/lib/gcc/$target_cpu-*/"
725 echo "%{_libexecdir}/gcc/$target_cpu*/*/cc1"
726 echo "%{_libexecdir}/gcc/$target_cpu*/*/collect2"
727 echo "%{_libexecdir}/gcc/$target_cpu*/*/[abd-z]*"
728 echo "%{_prefix}/$arch/sys-root"
729 esac
730
731 ) >files.$arch
732
733 (
734 echo "%%defattr(-,root,root,-)"
735 echo "%{_bindir}/$arch*-c++"
736 echo "%{_bindir}/$arch*-g++"
737 echo "%{_mandir}/man1/$arch*-g++*"
738 case $cpu in
ec60f96f 739 ppc*|ppc64*)
b5b0b447 740 ;;
ec60f96f 741 *)
b5b0b447
ER
742 echo "%{_libexecdir}/gcc/$target_cpu*/*/cc1plus"
743 esac
744 ) > files-c++.$arch
745}
746
ec60f96f
ER
747cd %{builddir}
748for target in $(cat %{srcdir}/target.list %{srcdir}/symlink-target.list); do
b5b0b447
ER
749 install_lang $target
750done
751
752%define __ar_no_strip $RPM_BUILD_DIR/%{name}-%{version}/ar-no-strip
753cat >%{__ar_no_strip} <<'EOF'
754#!/bin/sh
755f=$2
756if [ ${f##*/} = libgcc.a -o ${f##*/} = libgcov.a ]; then
757 :
758else
759 %{__strip} $*
760fi
761EOF
762chmod +x %{__ar_no_strip}
763%undefine __strip
764%define __strip %{__ar_no_strip}
765
766%clean
767rm -rf $RPM_BUILD_ROOT
768
769%files common -f cross-gcc.lang
770%doc %{srcdir}/COPYING*
771%doc %{srcdir}/README
772%{_mandir}/man1/cross-*
773
774%define do_files() \
775%files -n gcc-%1 -f files.%1 \
776%files -n gcc-c++-%1 -f files-c++.%1 \
777
778%{?with_alpha:%do_files alpha-linux-gnu}
779%{?with_arm:%do_files arm-linux-gnu}
780%{?with_aarch64:%do_files aarch64-linux-gnu}
781%{?with_avr32:%do_files avr32-linux-gnu}
782%{?with_blackfin:%do_files bfin-linux-gnu}
783%{?with_c6x:%do_files c6x-linux-gnu}
784%{?with_cris:%do_files cris-linux-gnu}
785%{?with_frv:%do_files frv-linux-gnu}
786%{?with_h8300:%do_files h8300-linux-gnu}
787%{?with_hppa:%do_files hppa-linux-gnu}
788%{?with_hppa64:%do_files hppa64-linux-gnu}
789%{?with_i386:%do_files i386-linux-gnu}
790%{?with_ia64:%do_files ia64-linux-gnu}
791%{?with_m32r:%do_files m32r-linux-gnu}
792%{?with_m68k:%do_files m68k-linux-gnu}
793%{?with_metag:%do_files metag-linux-gnu}
794%{?with_microblaze:%do_files microblaze-linux-gnu}
795%{?with_mips:%do_files mips-linux-gnu}
796%{?with_mips64:%do_files mips64-linux-gnu}
797%{?with_mn10300:%do_files mn10300-linux-gnu}
798%{?with_nios2:%do_files nios2-linux-gnu}
799%{?with_openrisc:%do_files openrisc-linux-gnu}
800%{?with_powerpc:%do_files powerpc-linux-gnu}
801%{?with_powerpc64:%do_files powerpc64-linux-gnu}
802%{?with_powerpc:%do_files ppc-linux-gnu}
803%{?with_powerpc64:%do_files ppc64-linux-gnu}
804%{?with_s390:%do_files s390-linux-gnu}
805%{?with_s390x:%do_files s390x-linux-gnu}
806%{?with_score:%do_files score-linux-gnu}
807%{?with_sh:%do_files sh-linux-gnu}
808%{?with_sh4:%do_files sh4-linux-gnu}
809%{?with_sh64:%do_files sh64-linux-gnu}
810%{?with_sparc:%do_files sparc-linux-gnu}
811%{?with_sparc64:%do_files sparc64-linux-gnu}
812%{?with_tile:%do_files tile-linux-gnu}
813%{?with_unicore32:%do_files unicore32-linux-gnu}
814%{?with_x86_64:%do_files x86_64-linux-gnu}
815%{?with_xtensa:%do_files xtensa-linux-gnu}
This page took 0.142227 seconds and 4 git commands to generate.