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