Add armv7l support.
[platform/upstream/gcc47.git] / packaging / libffi47.spec
1 %define building_libffi 1
2 %define fast_build 1
3
4 # Ada currently fails to build on a few platforms, enable it only
5 # on those that work
6 # Note that AdaCore only supports %ix86, x86_64 and ia64
7 %ifarch %ix86 x86_64
8 %define build_ada !0%{?building_libjava:1}%{?building_libffi:1}
9 %else
10 %define build_ada 0
11 %endif
12
13 %define quadmath_arch %ix86 x86_64 
14
15 # We don't want to build java
16 %define build_java 1
17 %define build_libjava 0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
18
19 %define build_cp 1
20 %define build_fortran 1
21 %define build_objc 1
22 %define build_objcp !0%{?building_libjava:1}%{?building_libffi:1}
23 %define build_with_mudflap 0
24
25 %if %{build_objcp}
26 %define build_cp 1
27 %define build_objc 1
28 %endif
29
30 %if %{build_libjava}
31 %define build_cp 1
32 %endif
33
34 # For optional compilers only build C, C++ and Fortran
35 ##%if 0%{?build_optional_compiler:1}%{?build_optional_compiler_languages:1}
36 %if 0%{!?building_libffi:1}
37 %define build_ada 0
38 %define build_java 0
39 %define build_libjava 0
40 %define build_objc 1
41 %define build_objcp 1
42 %endif
43
44
45 Name: libffi47
46 BuildRequires: bison
47 BuildRequires: flex
48 BuildRequires: gettext-tools
49 BuildRequires: makeinfo
50 BuildRequires: glibc-devel-32bit
51 BuildRequires: mpc-devel
52 BuildRequires: mpfr-devel
53 BuildRequires: perl
54 BuildRequires: texinfo
55 BuildRequires: zlib-devel
56 %ifarch %ix86 x86_64 %arm
57 BuildRequires: cloog-devel
58 BuildRequires: ppl-devel
59 %endif
60 %if %{build_ada}
61 %define hostsuffix -4.7
62 BuildRequires: gcc47-ada
63 %endif
64 %if 0%{?building_libjava:1}%{?building_testsuite:1}
65 BuildRequires: fastjar
66 BuildRequires: unzip
67 %endif
68 %if 0%{?building_libffi:1}
69 BuildRequires: pkg-config
70 %endif
71 %if 0%{?run_tests:1}
72 BuildRequires: dejagnu
73 BuildRequires: expect
74 BuildRequires: gdb
75 %endif
76
77 # Define version number of libgcc_s
78 %define libgcc_s 1
79 %define build_nof 0
80
81 %define separate_bi32 0
82 %define separate_bi64 0
83 %ifarch x86_64 
84 %define separate_bi32 1
85 %endif
86
87 # Define two macros to trigger -32bit or -64bit package variants
88 %define separate_biarch 0
89 %if %{separate_bi32}
90 %define separate_biarch 1
91 %define separate_biarch_suffix -32bit
92 %endif
93 %if %{separate_bi64}
94 %define separate_biarch 1
95 %define separate_biarch_suffix -64bit
96 %endif
97
98 %ifarch x86_64
99 # 64-bit is primary build target
100 %define build_primary_64bit 1
101 %else
102 %define build_primary_64bit 0
103 %endif
104
105 %define biarch_libjava 0
106
107 # COMMON-BEGIN
108 %define biarch_targets x86_64 
109
110 URL:          http://gcc.gnu.org/
111 Version: 4.7.2
112 Release:      1
113 %define gcc_version %(echo %version | sed 's/_.*//')
114 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
115 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
116 %define binsuffix -4.7
117 # COMMON-END
118
119 %if !0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
120 Requires: binutils glibc-devel
121 Requires: cpp47 = %{version}-%{release}
122 %if 0%{!?build_optional_compiler:1}
123 Requires: libgcc%{libgcc_s} >= %{version}-%{release}
124 Requires: libgomp1 >= %{version}-%{release}
125 %if %{build_with_mudflap}
126 Requires: libmudflap0 >= %{version}-%{release}
127 Requires: libmudflapth0 >= %{version}-%{release}
128 %endif
129 %else
130 Requires: libgcc47 = %{version}-%{release}
131 Requires: libgomp47 = %{version}-%{release}
132 %endif
133 %endif
134
135 # COMMON-BEGIN
136 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
137 #Source:                gcc-%{gcc_version}%{snapshot_date}.tar.bz2
138 Source:     gcc-%{version}.tar.bz2
139
140 Source1:        change_spec
141 Source2:        libgcj47-rpmlintrc
142 Source3:        gcc47-rpmlintrc
143 Source4:        ecj.jar
144 Source6:        baselibs.conf
145 # Patches auto-generated by git-buildpackage:
146 Patch0:     0001-dir-version.patch
147 Patch1:     0002-textdomain.patch
148 Patch2:     0003-rename-info-files.patch
149 Patch3:     0004-ARM-linker.patch
150
151 # GCC-TESTSUITE-DELETE-BEGIN
152 # PACKAGE-BEGIN
153 # PACKAGE-BEGIN
154 Summary:      Foreign Function Interface library
155 License:        BSD-3-Clause
156 Group:        Base/Libraries
157 Provides: g-wrap:/usr/lib/libffi.so.4
158 Provides: libffi4 = %{version}-%{release}
159 Conflicts: libffi4 < %{version}-%{release}
160
161 %description 
162 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
163
164 %post 
165 /sbin/ldconfig
166
167 %postun 
168 /sbin/ldconfig
169 # PACKAGE-END
170 # PACKAGE-BEGIN
171 # PACKAGE-BEGIN
172 %package -n libffi47-32bit
173 Summary:      Foreign Function Interface library
174 License:        BSD-3-Clause
175 Group:        Base/Libraries
176 Provides: g-wrap:/usr/lib/libffi.so.4
177 Provides: libffi4-32bit = %{version}-%{release}
178 Conflicts: libffi4-32bit < %{version}-%{release}
179
180 %description -n libffi47-32bit
181 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
182
183 %post -n libffi47-32bit
184 /sbin/ldconfig
185
186 %postun -n libffi47-32bit
187 /sbin/ldconfig
188 # PACKAGE-END
189 # PACKAGE-BEGIN
190 # PACKAGE-BEGIN
191 %package -n libffi47-64bit
192 Summary:      Foreign Function Interface library
193 License:        BSD-3-Clause
194 Group:        Base/Libraries
195 Provides: g-wrap:/usr/lib/libffi.so.4
196 Provides: libffi4-64bit = %{version}-%{release}
197 Conflicts: libffi4-64bit < %{version}-%{release}
198
199 %description -n libffi47-64bit
200 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
201
202 %post -n libffi47-64bit
203 /sbin/ldconfig
204
205 %postun -n libffi47-64bit
206 /sbin/ldconfig
207 # PACKAGE-END
208
209 # PACKAGE-BEGIN
210 # PACKAGE-BEGIN
211 %package -n libffi47-devel
212 Summary:      Foreign Function Interface library development files
213 License:        BSD 3-Clause
214 Group:        Development/Toolchain
215 Requires: libffi4 >= %{version}-%{release}
216 Provides: libffi-devel = %{version}-%{release}
217 Conflicts: libffi-devel < %{version}-%{release}
218
219 %description -n libffi47-devel
220 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
221 # PACKAGE-END
222 # PACKAGE-BEGIN
223 # PACKAGE-BEGIN
224 %package -n libffi47-devel-32bit
225 Summary:      Foreign Function Interface library development files
226 License:        BSD 3-Clause
227 Group:        Development/Toolchain
228 Requires: libffi4-32bit >= %{version}-%{release}
229 Provides: libffi-devel-32bit = %{version}-%{release}
230 Conflicts: libffi-devel-32bit < %{version}-%{release}
231
232 %description -n libffi47-devel-32bit
233 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
234 # PACKAGE-END
235 # PACKAGE-BEGIN
236 # PACKAGE-BEGIN
237 %package -n libffi47-devel-64bit
238 Summary:      Foreign Function Interface library development files
239 License:        BSD 3-Clause
240 Group:        Development/Toolchain
241 Requires: libffi4-64bit >= %{version}-%{release}
242 Provides: libffi-devel-64bit = %{version}-%{release}
243 Conflicts: libffi-devel-64bit < %{version}-%{release}
244
245 %description -n libffi47-devel-64bit
246 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
247 # PACKAGE-END
248
249 %package -n gcc47-testresults
250 # GCC-TESTSUITE-DELETE-END
251 Summary:      Testsuite results
252 License:        Public-Domain
253 Group:        Development/Toolchain
254
255 %description -n gcc47-testresults
256 Results from running the gcc and target library testsuites.
257
258
259 # COMMON-BEGIN
260
261 # Define the canonical target and host architecture
262 #   %gcc_target_arch  is supposed to be the full target triple
263 #   %TARGET_ARCH      is the canonicalized CPU part
264 #   %CONFIGURE_TARGET is the target triple used for --target=
265 %if 0%{?gcc_target_arch:1}
266 %define CONFIGURE_TARGET %{gcc_target_arch}
267 %define TARGET_ARCH %(echo %{gcc_target_arch} | cut -d - -f 1 | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
268 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
269 %define CONFIGURE_TARGET i586-tizen-linux
270 %endif
271 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
272 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
273 %endif
274 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
275 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
276 %endif
277 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
278 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
279 %endif
280 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
281 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
282 %endif
283 %else
284 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
285 %endif
286 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
287
288 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
289
290 %ifarch %arm
291 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
292 %else
293 %define GCCDIST %{HOST_ARCH}-tizen-linux
294 %endif
295
296 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
297 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
298
299 # COMMON-END
300
301 # Versionspecific directories
302 %define versmainlibdir %{libsubdir}
303 %define versmainlibdirbi32 %{libsubdir}/32
304 %define versmainlibdirbi64 %{libsubdir}/64
305 %if %{build_primary_64bit}
306 %define versmainlibdirbi %{versmainlibdirbi32}
307 %else
308 %define versmainlibdirbi %{versmainlibdirbi64}
309 %endif
310
311 %if 0%{?build_optional_compiler:1}
312 %define mainlibdir %{versmainlibdir}
313 %define mainlibdirbi32 %{versmainlibdirbi32}
314 %define mainlibdirbi64 %{versmainlibdirbi64}
315 %define noflibdir %{versnoflibdir}
316 %define mainlibdirbi %{versmainlibdirbi}
317 %else
318 %define mainlibdir %{_libdir}
319 %define mainlibdirbi32 %{_prefix}/lib
320 %define mainlibdirbi64 %{_prefix}/lib64
321 %define noflibdir %{_prefix}/lib/nof
322 %if %{build_primary_64bit}
323 %define mainlibdirbi %{mainlibdirbi32}
324 %else
325 %define mainlibdirbi %{mainlibdirbi64}
326 %endif
327 %endif
328
329
330 # Now define a few macros that make it easy to package libs and
331 # related files just to the right package, without caring for the
332 # exact path the files are in.
333 #   %mainlib  package X from all dirs that belong to the main package
334 #   %biarchlib   package X from all dirs that belong to the -32/64bit package
335 # by default, nof libs go where the 32bit libs go.
336 %if %{build_nof}
337 %define mainlib() %{mainlibdir}/%1\
338 %{noflibdir}/%1\
339 %{nil}
340 %else
341 %define mainlib() %{mainlibdir}/%1\
342 %{nil}
343 %endif
344 %define biarchlib() %{nil}
345 %if %{biarch}
346 %if !%{separate_biarch}
347 %if %{build_nof}
348 %define mainlib() %{mainlibdir}/%1\
349 %{mainlibdirbi}/%1\
350 %{noflibdir}/%1\
351 %{nil}
352 %else
353 %define mainlib() %{mainlibdir}/%1\
354 %{mainlibdirbi}/%1\
355 %{nil}
356 %endif
357 %else
358 %if %{build_nof}
359 %define biarchlib() %{mainlibdirbi}/%1\
360 %{noflibdir}/%1\
361 %{nil}
362 %define mainlib() %{mainlibdir}/%1\
363 %{nil}
364 %else
365 %define biarchlib() %{mainlibdirbi}/%1\
366 %{nil}
367 %endif
368 %endif
369 %endif
370
371 %if %{build_nof}
372 %define versmainlib() %{versmainlibdir}/%1\
373 %{versnoflibdir}/%1\
374 %{nil}
375 %else
376 %define versmainlib() %{versmainlibdir}/%1\
377 %{nil}
378 %endif
379 %define versbiarchlib() %{nil}
380 %if %{biarch}
381 %if !%{separate_biarch}
382 %if %{build_nof}
383 %define versmainlib() %{versmainlibdir}/%1\
384 %{versmainlibdirbi}/%1\
385 %{versnoflibdir}/%1\
386 %{nil}
387 %else
388 %define versmainlib() %{versmainlibdir}/%1\
389 %{versmainlibdirbi}/%1\
390 %{nil}
391 %endif
392 %else
393 %if %{build_nof}
394 %define versbiarchlib() %{versmainlibdirbi}/%1\
395 %{versnoflibdir}/%1\
396 %{nil}
397 %define versmainlib() %{versmainlibdir}/%1\
398 %{nil}
399 %else
400 %define versbiarchlib() %{versmainlibdirbi}/%1\
401 %{nil}
402 %endif
403 %endif
404 %endif
405
406
407 # COMMON-BEGIN
408
409 %prep
410 #%setup -q -n gcc-%{gcc_version}%{snapshot_date}
411 %setup -q -n gcc-%{version}
412 # 0001-dir-version.patch
413 %patch0 -p1
414 %patch1 -p1
415 %patch2 -p1
416 %patch3 -p1
417
418 %build
419 # Avoid rebuilding of generated files
420 contrib/gcc_update --touch
421 # Avoid fucking up testsuite results with Java and indirect dispatch
422 export LD_AS_NEEDED=0
423 # Split version file into version used for directories (X.Y) and
424 # version to report with --version (X.Y.Z).
425 # See also gcc-dir-version.patch.
426 # Also decrement the patchlevel version by one
427 if test `cat gcc/DEV-PHASE` == "prerelease"; then
428   ( cat gcc/BASE-VER | cut -d '.' -f 1-2 | tr -d '\n'; echo -n .; cat gcc/BASE-VER | cut -d '.' -f 3 | tr '0123456789' '0012345678' ) > gcc/FULL-VER
429 else
430   mv gcc/BASE-VER gcc/FULL-VER
431 fi
432 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
433
434 rm -rf obj-%{GCCDIST}
435 mkdir obj-%{GCCDIST}
436 cd obj-%{GCCDIST}
437 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
438 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
439 %ifarch %ix86
440 # -mcpu is superceded by -mtune but -mtune is not supported by
441 # our bootstrap compiler.  -mcpu gives a warning that stops
442 # the build process, so remove it for now.  Also remove all other
443 # -march and -mtune flags.  They are superseeded by proper
444 # default compiler settings now.
445 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
446 %endif
447 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
448 # Kill all -march/tune/cpu because that screws building the target libs
449 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
450 %endif
451 # Replace 2 spaces by one finally
452 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
453
454 languages=c
455 %if %{build_cp}
456 languages=$languages,c++
457 %endif
458 %if %{build_objc}
459 languages=$languages,objc
460 %endif
461 %if %{build_fortran}
462 languages=$languages,fortran
463 %endif
464 %if %{build_objcp}
465 languages=$languages,obj-c++
466 %endif
467 %if %{build_java}
468 languages=$languages,java
469 %endif
470 %if %{build_ada}
471 languages=$languages,ada
472 %endif
473
474 J=%{?jobs:%jobs}
475 if test -z "$J"; then
476   J=$(getconf _NPROCESSORS_CONF)
477   JL=$(($J * 2))
478 else
479   test 1 -gt "$J" && J=1
480   JL=$(($(getconf _NPROCESSORS_CONF)*2))
481 fi
482 if test "$J" == "0"; then
483   J=1
484 fi
485 if test "$JL" == "0"; then
486   JL=1
487 fi
488 PARALLEL="-j$J -l$JL"
489
490 # we don't want some miscompiles in the testsuite, or some fault in
491 # the compiler to kill the machine.  Hence we limit the amount of memory
492 # by the physical RAM plus half of swap
493 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
494 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
495 #ulimit -v $(((MEM + SWAP/2)*1024))
496
497 # In general we want to ship release checking enabled compilers
498 # and run BETA with checking enabled.
499 #ENABLE_CHECKING="--enable-checking=yes"
500 ENABLE_CHECKING="--enable-checking=release"
501
502 # Work around tail/head -1 changes
503 export _POSIX2_VERSION=199209
504
505 # configure tries to parse include/features.h to detect
506 # if glibc supports SSP.  When cross compiling we would need
507 # to install a cross glibc, which we don't, or make the whole
508 # thing point to the native glibc, which is in /, hence the
509 # --with-sysroot=/
510
511 %if %{build_ada}
512 # Using the host gnatmake like
513 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
514 #   GNATMAKE="gnatmake%{hostsuffix}"
515 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
516 # available
517 mkdir -p host-tools/bin
518 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
519 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
520 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
521 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
522 ln -sf /usr/%{_lib} host-tools/%{_lib}
523 export PATH="`pwd`/host-tools/bin:$PATH"
524 %endif
525 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
526 #%else
527 #       --enable-threads=posix \
528 #%endif
529 #       --enable-shared \
530 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
531 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
532 ../configure \
533         --prefix=%{_prefix} \
534         --infodir=%{_infodir} \
535         --mandir=%{_mandir} \
536         --libdir=%{_libdir} \
537         --libexecdir=%{_libdir} \
538         --enable-languages=$languages \
539         $ENABLE_CHECKING \
540         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
541         --enable-ssp \
542         --disable-libssp \
543         --disable-libitm \
544 %if 0%{?fast_build}
545         --disable-bootstrap \
546 %endif
547         --disable-plugin \
548         --with-bugurl="http://bugs.tizen.org/" \
549         --with-pkgversion="Tizen Linux" \
550 %if !%{build_libjava}
551         --disable-libgcj \
552 %else
553         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
554         --with-ecj-jar=%{libsubdir}/ecj.jar \
555         --disable-java-awt \
556 %if !%{biarch_libjava}
557         --disable-libjava-multilib \
558 %endif
559 %endif
560 %if !%{build_with_mudflap}
561         --disable-libmudflap \
562 %endif
563         --with-slibdir=/%{_lib} \
564         --with-system-zlib \
565         --enable-__cxa_atexit \
566         --enable-libstdcxx-allocator=new \
567         --disable-libstdcxx-pch \
568         --enable-version-specific-runtime-libs \
569         --enable-linker-build-id \
570 %if 0%{?gcc_target_arch:1}
571 %if 0%{?gcc_icecream:1}
572         --with-build-sysroot=/ \
573         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
574         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
575         --enable-linux-futex \
576 %endif
577 %if 0%{?canonical_target:1}
578         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
579 %endif
580 %if 0%{?build_static:1}
581         --disable-shared \
582 %endif
583 %if "%{TARGET_ARCH}" == "spu"
584         --with-sysroot=/usr/spu \
585         --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
586         --with-newlib \
587 %endif
588         --disable-nls \
589         --target=%{CONFIGURE_TARGET} \
590 %else
591         --program-suffix=%{binsuffix} \
592         --enable-linux-futex \
593         --without-system-libunwind \
594 %endif
595 %if "%{TARGET_ARCH}" == "armv5tel"
596         --with-arch=armv5te \
597         --with-float=soft \
598         --with-mode=arm \
599         --with-abi=aapcs-linux \
600         --disable-sjlj-exceptions \
601 %endif
602 %if "%{TARGET_ARCH}" == "armv7el" 
603         --with-arch=armv7-a \
604         --with-tune=cortex-a9 \
605         --with-float=soft \
606         --with-abi=softfp \
607         --with-fpu=vfpv3 \
608         --disable-sjlj-exceptions \
609 %endif
610 %if "%{TARGET_ARCH}" == "armv7l"
611         --with-arch=armv7-a \
612         --with-tune=cortex-a8 \
613         --with-float=softfp \
614         --with-fpu=vfpv3 \
615         --disable-sjlj-exceptions \
616 %endif
617 %if "%{TARGET_ARCH}" == "armv7hl"
618         --with-arch=armv7-a \
619         --with-tune=cortex-a9 \
620         --with-float=hard \
621         --with-abi=aapcs-linux \
622         --with-fpu=vfpv3-d16 \
623         --disable-sjlj-exceptions \
624 %endif
625 %if "%{TARGET_ARCH}" == "i586"
626         --with-arch-32=i586 \
627         --with-tune=generic \
628 %endif
629 %if "%{TARGET_ARCH}" == "x86_64"
630         --with-arch-32=i586 \
631         --with-tune=generic \
632 %endif
633         --build=%{GCCDIST}
634
635 # COMMON-END
636
637 %if 0%{?building_libffi:1}
638 make stage1-bubble $PARALLEL
639 make all-target-libffi $PARALLEL
640 %else
641 # Only run profiled bootstrap on archs where it works
642 #%ifarch %ix86 x86_64 
643 #make profiledbootstrap-lean STAGE1_CFLAGS="-O -g" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
644 #%else
645 %ifarch %arm
646 STAGE1_FLAGS="-O0"
647 %else
648 STAGE1_FLAGS="-O -g"
649 %endif
650 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
651 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
652 #%endif
653 #make -C gcc proto
654 make info
655 %if 0%{?run_tests:1}
656 echo "Run testsuite"
657 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
658 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
659 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
660 make -k check $PARALLEL || true
661 mkdir ../testresults
662 ../contrib/test_summary | tee ../testresults/test_summary.txt
663 %endif
664 %endif
665
666 %install
667 export NO_BRP_CHECK_BYTECODE_VERSION=true
668 cd obj-%{GCCDIST}
669 # GCC-TESTSUITE-DELETE-BEGIN
670 # Work around tail/head -1 changes
671 export _POSIX2_VERSION=199209
672 export LIBRARY_PATH=$RPM_BUILD_ROOT%{libsubdir}:$RPM_BUILD_ROOT%{mainlibdirbi}
673 %if 0%{?building_libffi:1}
674 make -C %{GCCDIST}/libffi install DESTDIR=$RPM_BUILD_ROOT
675 %else
676 %if 0%{?building_libjava:1}
677 make -C %{GCCDIST}/libjava install DESTDIR=$RPM_BUILD_ROOT
678 make -C gcc java.install-man DESTDIR=$RPM_BUILD_ROOT
679 make -C gcc java.install-common DESTDIR=$RPM_BUILD_ROOT
680 make -C gcc install-common DESTDIR=$RPM_BUILD_ROOT COMPILERS='jc1$(exeext) jvgenmain$(exeext)'
681 # install-common also installs collect2, gcov and the g++ and gfortran driver
682 %if %{build_cp}
683 rm $RPM_BUILD_ROOT%{_prefix}/bin/g++%{binsuffix}
684 %endif
685 %if %{build_fortran}
686 rm $RPM_BUILD_ROOT%{_prefix}/bin/gfortran%{binsuffix}
687 %endif
688 rm $RPM_BUILD_ROOT%{_prefix}/bin/gcov%{binsuffix}
689 rm $RPM_BUILD_ROOT%{libsubdir}/collect2
690 %else
691 make install DESTDIR=$RPM_BUILD_ROOT
692 %if %{build_java}
693 make -C gcc java.uninstall DESTDIR=$RPM_BUILD_ROOT
694 make -C gcc java.install-info DESTDIR=$RPM_BUILD_ROOT
695 rm $RPM_BUILD_ROOT%{_prefix}/bin/jcf-dump%{binsuffix}
696 rm $RPM_BUILD_ROOT%{_mandir}/man1/jcf-dump%{binsuffix}.1
697 rm $RPM_BUILD_ROOT%{libsubdir}/jc1
698 rm $RPM_BUILD_ROOT%{libsubdir}/jvgenmain
699 %endif
700 %endif
701 %endif
702
703 # Remove libffi installed files if we did not want to build it
704 %if !0%{?building_libffi:1}
705 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.*
706 %if %{biarch}
707   rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.*
708 %endif
709 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h
710 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h
711 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi%{binsuffix}.3*
712 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_call%{binsuffix}.3*
713 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_prep_cif%{binsuffix}.3*
714 %endif
715
716 # Remove some useless .la files
717 for lib in libobjc libgfortran libgfortranbegin libquadmath libcaf_single \
718     libmudflap libmudflapth libgomp libstdc++ libsupc++ libgcj-tools libgij; do
719   rm -f $RPM_BUILD_ROOT%{versmainlibdir}/$lib.la
720 %if %{biarch}
721   rm -f $RPM_BUILD_ROOT%{versmainlibdirbi}/$lib.la
722 %endif
723 done
724
725 mkdir -p $RPM_BUILD_ROOT%{_libdir}
726 %if %{biarch}
727 %if %{build_primary_64bit}
728 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
729 %else
730 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib64
731 %endif
732 %endif
733
734
735 %if %{build_ada}
736 mv $RPM_BUILD_ROOT%{libsubdir}/adalib/lib*-*.so $RPM_BUILD_ROOT%{_libdir}
737 ln -sf %{_libdir}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnarl.so
738 ln -sf %{_libdir}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnat.so
739 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libgna*-*.so
740 %if %{biarch}
741 mv $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/lib*-*.so $RPM_BUILD_ROOT%{mainlibdirbi}/
742 ln -sf %{mainlibdirbi}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
743 ln -sf %{mainlibdirbi}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
744 chmod a+x $RPM_BUILD_ROOT%{mainlibdirbi}/libgna*-*.so
745 %endif
746 %endif
747
748 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/c++%{binsuffix}
749
750 # Remove some crap from the .la files:
751 for l in `find $RPM_BUILD_ROOT -name '*.la'`; do
752   echo "changing $l"
753 # -e '/^dependency_libs/s|%{libsubdir}/\([^.]*\)\.la |%{_libdir}/\1\.la |g'
754   sed -e '/^dependency_libs/s| -L%{_builddir}/[^ ]*||g' \
755       -e '/^dependency_libs/s| -L/usr/%{GCCDIST}/bin||g' \
756       -e '/^dependency_libs/s|-lm \(-lm \)*|-lm |' \
757       -e '/^dependency_libs/s|-L[^ ]* ||g' \
758 %if %{biarch}
759 %if %{build_primary_64bit}
760       -e '/^libdir/s|%{_libdir}/32|%{_prefix}/lib|' \
761       -e '/^libdir/s|lib64/\.\./||' \
762 %else
763       -e '/^libdir/s|%{_libdir}/64|%{_prefix}/lib64|' \
764 %endif
765 %endif
766       < $l  > $l.new
767   mv $l.new $l
768 done
769
770 # GCC-TESTSUITE-DELETE-END
771 %if 0%{?run_tests:1} 
772 cp `find . -name "*.sum"` ../testresults/
773 cp `find . -name "*.log"  \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
774 chmod 644 ../testresults/*
775 %endif
776 # GCC-TESTSUITE-DELETE-BEGIN
777 # Remove files that we do not need to clean up filelist
778 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{GCCDIST}-*
779 rm -rf $RPM_BUILD_ROOT%{libsubdir}/install-tools
780 #rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libgcj%{binsuffix}.pc
781 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/root
782 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/curses.h
783 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/asm-*
784 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/linux
785 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sound
786 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/features.h
787 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/ncurses.h
788 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/stdio.h
789 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/zutil.h
790 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/X11
791 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
792 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/obstack.h
793 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/spe.h
794 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/tgmath.h
795 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
796 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys
797 %if "%{TARGET_ARCH}" == "armv7l"
798 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/nss3/secport.h
799 %endif
800 # no plugins
801 rm -rf $RPM_BUILD_ROOT%{libsubdir}/plugin
802 rm -f  $RPM_BUILD_ROOT%{_infodir}/dir
803 rm -f  $RPM_BUILD_ROOT%{_prefix}/bin/gccbug%{binsuffix}
804
805 %if !0%{?building_libjava:1}%{?building_libffi:1}
806 # delete compile flag tracking from crt files
807 crt_list=$RPM_BUILD_ROOT%{versmainlibdir}/crt*.o
808 %if %{biarch}
809 %if %{build_primary_64bit}
810 crt32_list=$RPM_BUILD_ROOT%{versmainlibdirbi32}/crt*.o
811 %else
812 crt64_list=$RPM_BUILD_ROOT%{versmainlibdirbi64}/crt*.o
813 %endif
814 %endif
815 %endif
816
817 %if 0%{?building_libjava:1}
818 # gcj -static doesn't work properly anyway, unless using --whole-archive
819 # let's save the space instead.
820 find $RPM_BUILD_ROOT -name libgcj.a \
821         -o -name libgcj-tools.a \
822         -o -name libgij.a \
823         -o -name libjvm.a \
824         -o -name libgcj_bc.a \
825   | xargs rm -f
826
827 find $RPM_BUILD_ROOT -name libgcj.spec | xargs \
828   sed -i -e 's/lib: /&%%{static:%%eJava programs cannot be linked statically}/'
829
830 # security files have broken install locations, also they cause conflicts
831 # between libgcj versions.  Simply delete them here, libgcj will use its
832 # defaults in this case (which is what these files contain anyway).
833 rm $RPM_BUILD_ROOT%{_libdir}/logging.properties
834 rm -r $RPM_BUILD_ROOT%{_libdir}/security
835 %endif
836
837 %if 0%{?building_libffi:1}
838 # Move libffi headers, remove empty libffi libtool file
839 mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
840 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h $RPM_BUILD_ROOT%{_prefix}/include/
841 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h $RPM_BUILD_ROOT%{_prefix}/include/
842 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.la
843 %if %{biarch}
844 rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.la
845 %endif
846 # Generate a simple pkg-config file
847 mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
848 echo -e 'Name: libffi\nVersion: 3.0.9\nDescription: libffi\nLibs: -lffi' > $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libffi.pc
849 %endif
850
851 %if %{build_java}
852 %if !%{build_libjava}
853 rm $RPM_BUILD_ROOT%{_mandir}/man1/jv-convert%{binsuffix}.1
854 rm $RPM_BUILD_ROOT%{_mandir}/man1/gcj-dbtool%{binsuffix}.1
855 rm $RPM_BUILD_ROOT%{_mandir}/man1/gij%{binsuffix}.1
856 rm $RPM_BUILD_ROOT%{_mandir}/man1/grmic%{binsuffix}.1
857 rm $RPM_BUILD_ROOT%{_mandir}/man1/gc-analyze%{binsuffix}.1
858 rm $RPM_BUILD_ROOT%{_mandir}/man1/aot-compile%{binsuffix}.1
859 rm $RPM_BUILD_ROOT%{_mandir}/man1/rebuild-gcj-db%{binsuffix}.1
860 %endif
861 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/aotcompile.py
862 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/classfile.py
863 %endif
864 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/fsf-funding.7
865 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gfdl.7
866 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gpl.7
867 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
868 %if %{build_nof}
869 rm -f $RPM_BUILD_ROOT%{_prefix}/lib/nof/libiberty.a
870 %endif
871 %if %{biarch}
872 %if %{build_primary_64bit}
873 rm -f $RPM_BUILD_ROOT%{_prefix}/lib/libiberty.a
874 %else
875 rm -f $RPM_BUILD_ROOT%{_prefix}/lib64/libiberty.a
876 %endif
877 %endif
878 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.a
879 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.la
880
881
882 %if %{build_java}
883 %if 0%{?building_libffi:1}
884 %files 
885 %defattr(-,root,root)
886 %mainlib libffi.so.*
887
888 %if %{separate_biarch}
889 %files -n libffi47%{separate_biarch_suffix}
890 %defattr(-,root,root)
891 %biarchlib libffi.so.*
892 %endif
893
894 %files -n libffi47-devel
895 %defattr(-,root,root)
896 %{_prefix}/include/ffi.h
897 %{_prefix}/include/ffitarget.h
898 %mainlib libffi.so
899 %mainlib libffi.a
900 %{_libdir}/pkgconfig/libffi.pc
901 %doc %{_mandir}/man3/ffi%{binsuffix}.3.gz
902 %doc %{_mandir}/man3/ffi_call%{binsuffix}.3.gz
903 %doc %{_mandir}/man3/ffi_prep_cif%{binsuffix}.3.gz
904
905 %if %{separate_biarch}
906 %files -n libffi47-devel%{separate_biarch_suffix}
907 %defattr(-,root,root)
908 %biarchlib libffi.so
909 %biarchlib libffi.a
910 %endif
911 %endif
912 %endif
913 # GCC-TESTSUITE-DELETE-END
914
915 %if 0%{?run_tests:1}
916 %files -n gcc47-testresults
917 %defattr(-,root,root)
918 %doc testresults/test_summary.txt
919 %doc testresults/*.sum
920 %doc testresults/*.log
921 %endif
922
923
924 %changelog