add ARM linker patch
[platform/upstream/gcc48.git] / packaging / gcc47-testresults.spec
1 %define building_testsuite 1
2 %define run_tests 1
3 %define fast_build 1
4
5 # Ada currently fails to build on a few platforms, enable it only
6 # on those that work
7 # Note that AdaCore only supports %ix86, x86_64 and ia64
8 %ifarch %ix86 x86_64
9 %define build_ada !0%{?building_libjava:1}%{?building_libffi:1}
10 %else
11 %define build_ada 0
12 %endif
13
14 %define quadmath_arch %ix86 x86_64 ia64
15
16 # We don't want to build java
17 %ifarch mips
18 %define build_java 0
19 %define build_libjava 0
20 %else
21 %define build_java 1
22 %define build_libjava 0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
23 %endif
24
25 %define build_cp 1
26 %define build_fortran 1
27 %define build_objc 1
28 %define build_objcp !0%{?building_libjava:1}%{?building_libffi:1}
29 %define build_with_mudflap 0
30
31 %if %{build_objcp}
32 %define build_cp 1
33 %define build_objc 1
34 %endif
35
36 %if %{build_libjava}
37 %define build_cp 1
38 %endif
39
40 # For optional compilers only build C, C++ and Fortran
41 ##%if 0%{?build_optional_compiler:1}%{?build_optional_compiler_languages:1}
42 %if 0%{!?building_libffi:1}
43 %define build_ada 0
44 %define build_java 0
45 %define build_libjava 0
46 %define build_objc 1
47 %define build_objcp 1
48 %endif
49
50
51 Name: gcc47-testresults
52 BuildRequires: bison
53 BuildRequires: flex
54 BuildRequires: gettext-tools
55 BuildRequires: makeinfo
56 BuildRequires: glibc-devel-32bit
57 BuildRequires: mpc-devel
58 BuildRequires: mpfr-devel
59 BuildRequires: perl
60 BuildRequires: texinfo
61 BuildRequires: zlib-devel
62 %ifarch %ix86 x86_64 %arm
63 BuildRequires: cloog-devel
64 BuildRequires: ppl-devel
65 %endif
66 %if %{build_ada}
67 %define hostsuffix -4.7
68 BuildRequires: gcc47-ada
69 %endif
70 %if 0%{?building_libjava:1}%{?building_testsuite:1}
71 BuildRequires: fastjar
72 BuildRequires: unzip
73 %endif
74 %if 0%{?building_libffi:1}
75 BuildRequires: pkg-config
76 %endif
77 %ifarch ia64
78 BuildRequires: libunwind-devel
79 %endif
80 %if 0%{?run_tests:1}
81 BuildRequires: dejagnu
82 BuildRequires: expect
83 BuildRequires: gdb
84 %endif
85
86 # Define version number of libgcc_s
87 %ifarch hppa
88 %define libgcc_s 4
89 %else
90 %define libgcc_s 1
91 %endif
92 %ifarch ppc
93 # We support building the nof libraries, but don't want this in the
94 # regular rpms
95 %define build_nof 0
96 %else
97 %define build_nof 0
98 %endif
99
100 %define separate_bi32 0
101 %define separate_bi64 0
102 %ifarch x86_64 
103 %define separate_bi32 1
104 %endif
105
106 # Define two macros to trigger -32bit or -64bit package variants
107 %define separate_biarch 0
108 %if %{separate_bi32}
109 %define separate_biarch 1
110 %define separate_biarch_suffix -32bit
111 %endif
112 %if %{separate_bi64}
113 %define separate_biarch 1
114 %define separate_biarch_suffix -64bit
115 %endif
116
117 %ifarch x86_64
118 # 64-bit is primary build target
119 %define build_primary_64bit 1
120 %else
121 %define build_primary_64bit 0
122 %endif
123
124 %define biarch_libjava 0
125
126 # COMMON-BEGIN
127 %define biarch_targets x86_64 
128
129 URL:          http://gcc.gnu.org/
130 Version: 4.7.2
131 Release:      1
132 %define gcc_version %(echo %version | sed 's/_.*//')
133 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
134 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
135 %define binsuffix -4.7
136 # COMMON-END
137
138 %if !0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
139 Requires: binutils glibc-devel
140 Requires: cpp47 = %{version}-%{release}
141 %if 0%{!?build_optional_compiler:1}
142 Requires: libgcc%{libgcc_s} >= %{version}-%{release}
143 Requires: libgomp1 >= %{version}-%{release}
144 %if %{build_with_mudflap}
145 Requires: libmudflap0 >= %{version}-%{release}
146 Requires: libmudflapth0 >= %{version}-%{release}
147 %endif
148 %else
149 Requires: libgcc47 = %{version}-%{release}
150 Requires: libgomp47 = %{version}-%{release}
151 %endif
152 %endif
153
154 # COMMON-BEGIN
155 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
156 #Source:                gcc-%{gcc_version}%{snapshot_date}.tar.bz2
157 Source:     gcc-%{version}.tar.bz2
158
159 Source1:        change_spec
160 Source2:        libgcj47-rpmlintrc
161 Source3:        gcc47-rpmlintrc
162 Source4:        ecj.jar
163 Source6:        baselibs.conf
164 # Patches auto-generated by git-buildpackage:
165 Patch0:     0001-dir-version.patch
166 Patch1:     0002-textdomain.patch
167 Patch2:     0003-rename-info-files.patch
168 Patch3:     0004-ARM-linker.patch
169
170 Summary:      Testsuite results
171 License:        SUSE-Public-Domain
172 Group:        Development/Languages/C and C++
173
174 %description 
175 Results from running the gcc and target library testsuites.
176
177
178 # COMMON-BEGIN
179
180 # Define the canonical target and host architecture
181 #   %gcc_target_arch  is supposed to be the full target triple
182 #   %TARGET_ARCH      is the canonicalized CPU part
183 #   %CONFIGURE_TARGET is the target triple used for --target=
184 %if 0%{?gcc_target_arch:1}
185 %define CONFIGURE_TARGET %{gcc_target_arch}
186 %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/;")
187 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
188 %define CONFIGURE_TARGET i586-tizen-linux
189 %endif
190 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
191 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
192 %endif
193 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
194 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
195 %endif
196 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
197 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
198 %endif
199 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
200 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
201 %endif
202 %else
203 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
204 %endif
205 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
206
207 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
208
209 %ifarch %arm
210 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
211 %else
212 %define GCCDIST %{HOST_ARCH}-tizen-linux
213 %endif
214
215 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
216 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
217
218 # COMMON-END
219
220 # Versionspecific directories
221 %define versmainlibdir %{libsubdir}
222 %define versmainlibdirbi32 %{libsubdir}/32
223 %define versmainlibdirbi64 %{libsubdir}/64
224 %if %{build_primary_64bit}
225 %define versmainlibdirbi %{versmainlibdirbi32}
226 %else
227 %define versmainlibdirbi %{versmainlibdirbi64}
228 %endif
229
230 %if 0%{?build_optional_compiler:1}
231 %define mainlibdir %{versmainlibdir}
232 %define mainlibdirbi32 %{versmainlibdirbi32}
233 %define mainlibdirbi64 %{versmainlibdirbi64}
234 %define noflibdir %{versnoflibdir}
235 %define mainlibdirbi %{versmainlibdirbi}
236 %else
237 %define mainlibdir %{_libdir}
238 %define mainlibdirbi32 %{_prefix}/lib
239 %define mainlibdirbi64 %{_prefix}/lib64
240 %define noflibdir %{_prefix}/lib/nof
241 %if %{build_primary_64bit}
242 %define mainlibdirbi %{mainlibdirbi32}
243 %else
244 %define mainlibdirbi %{mainlibdirbi64}
245 %endif
246 %endif
247
248
249 # Now define a few macros that make it easy to package libs and
250 # related files just to the right package, without caring for the
251 # exact path the files are in.
252 #   %mainlib  package X from all dirs that belong to the main package
253 #   %biarchlib   package X from all dirs that belong to the -32/64bit package
254 # by default, nof libs go where the 32bit libs go.
255 %if %{build_nof}
256 %define mainlib() %{mainlibdir}/%1\
257 %{noflibdir}/%1\
258 %{nil}
259 %else
260 %define mainlib() %{mainlibdir}/%1\
261 %{nil}
262 %endif
263 %define biarchlib() %{nil}
264 %if %{biarch}
265 %if !%{separate_biarch}
266 %if %{build_nof}
267 %define mainlib() %{mainlibdir}/%1\
268 %{mainlibdirbi}/%1\
269 %{noflibdir}/%1\
270 %{nil}
271 %else
272 %define mainlib() %{mainlibdir}/%1\
273 %{mainlibdirbi}/%1\
274 %{nil}
275 %endif
276 %else
277 %if %{build_nof}
278 %define biarchlib() %{mainlibdirbi}/%1\
279 %{noflibdir}/%1\
280 %{nil}
281 %define mainlib() %{mainlibdir}/%1\
282 %{nil}
283 %else
284 %define biarchlib() %{mainlibdirbi}/%1\
285 %{nil}
286 %endif
287 %endif
288 %endif
289
290 %if %{build_nof}
291 %define versmainlib() %{versmainlibdir}/%1\
292 %{versnoflibdir}/%1\
293 %{nil}
294 %else
295 %define versmainlib() %{versmainlibdir}/%1\
296 %{nil}
297 %endif
298 %define versbiarchlib() %{nil}
299 %if %{biarch}
300 %if !%{separate_biarch}
301 %if %{build_nof}
302 %define versmainlib() %{versmainlibdir}/%1\
303 %{versmainlibdirbi}/%1\
304 %{versnoflibdir}/%1\
305 %{nil}
306 %else
307 %define versmainlib() %{versmainlibdir}/%1\
308 %{versmainlibdirbi}/%1\
309 %{nil}
310 %endif
311 %else
312 %if %{build_nof}
313 %define versbiarchlib() %{versmainlibdirbi}/%1\
314 %{versnoflibdir}/%1\
315 %{nil}
316 %define versmainlib() %{versmainlibdir}/%1\
317 %{nil}
318 %else
319 %define versbiarchlib() %{versmainlibdirbi}/%1\
320 %{nil}
321 %endif
322 %endif
323 %endif
324
325
326 # COMMON-BEGIN
327
328 %prep
329 #%setup -q -n gcc-%{gcc_version}%{snapshot_date}
330 %setup -q -n gcc-%{version}
331 # 0001-dir-version.patch
332 %patch0 -p1
333 %patch1 -p1
334 %patch2 -p1
335 %patch3 -p1
336
337 %build
338 # Avoid rebuilding of generated files
339 contrib/gcc_update --touch
340 # Avoid fucking up testsuite results with Java and indirect dispatch
341 export LD_AS_NEEDED=0
342 # Split version file into version used for directories (X.Y) and
343 # version to report with --version (X.Y.Z).
344 # See also gcc-dir-version.patch.
345 # Also decrement the patchlevel version by one
346 if test `cat gcc/DEV-PHASE` == "prerelease"; then
347   ( 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
348 else
349   mv gcc/BASE-VER gcc/FULL-VER
350 fi
351 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
352
353 rm -rf obj-%{GCCDIST}
354 mkdir obj-%{GCCDIST}
355 cd obj-%{GCCDIST}
356 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
357 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'`
358 %ifarch %ix86
359 # -mcpu is superceded by -mtune but -mtune is not supported by
360 # our bootstrap compiler.  -mcpu gives a warning that stops
361 # the build process, so remove it for now.  Also remove all other
362 # -march and -mtune flags.  They are superseeded by proper
363 # default compiler settings now.
364 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'`
365 %endif
366 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
367 # Kill all -march/tune/cpu because that screws building the target libs
368 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
369 %endif
370 # Replace 2 spaces by one finally
371 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
372
373 languages=c
374 %if %{build_cp}
375 languages=$languages,c++
376 %endif
377 %if %{build_objc}
378 languages=$languages,objc
379 %endif
380 %if %{build_fortran}
381 languages=$languages,fortran
382 %endif
383 %if %{build_objcp}
384 languages=$languages,obj-c++
385 %endif
386 %if %{build_java}
387 languages=$languages,java
388 %endif
389 %if %{build_ada}
390 languages=$languages,ada
391 %endif
392
393 J=%{?jobs:%jobs}
394 if test -z "$J"; then
395   J=$(getconf _NPROCESSORS_CONF)
396   JL=$(($J * 2))
397 else
398   test 1 -gt "$J" && J=1
399   JL=$(($(getconf _NPROCESSORS_CONF)*2))
400 fi
401 if test "$J" == "0"; then
402   J=1
403 fi
404 if test "$JL" == "0"; then
405   JL=1
406 fi
407 PARALLEL="-j$J -l$JL"
408
409 # we don't want some miscompiles in the testsuite, or some fault in
410 # the compiler to kill the machine.  Hence we limit the amount of memory
411 # by the physical RAM plus half of swap
412 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
413 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
414 #ulimit -v $(((MEM + SWAP/2)*1024))
415
416 # In general we want to ship release checking enabled compilers
417 # and run BETA with checking enabled.
418 #ENABLE_CHECKING="--enable-checking=yes"
419 ENABLE_CHECKING="--enable-checking=release"
420
421 # Work around tail/head -1 changes
422 export _POSIX2_VERSION=199209
423
424 # configure tries to parse include/features.h to detect
425 # if glibc supports SSP.  When cross compiling we would need
426 # to install a cross glibc, which we don't, or make the whole
427 # thing point to the native glibc, which is in /, hence the
428 # --with-sysroot=/
429
430 %if %{build_ada}
431 # Using the host gnatmake like
432 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
433 #   GNATMAKE="gnatmake%{hostsuffix}"
434 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
435 # available
436 mkdir -p host-tools/bin
437 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
438 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
439 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
440 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
441 ln -sf /usr/%{_lib} host-tools/%{_lib}
442 export PATH="`pwd`/host-tools/bin:$PATH"
443 %endif
444 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
445 #%else
446 #       --enable-threads=posix \
447 #%endif
448 #       --enable-shared \
449 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
450 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
451 ../configure \
452         --prefix=%{_prefix} \
453         --infodir=%{_infodir} \
454         --mandir=%{_mandir} \
455         --libdir=%{_libdir} \
456         --libexecdir=%{_libdir} \
457         --enable-languages=$languages \
458         $ENABLE_CHECKING \
459         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
460         --enable-ssp \
461         --disable-libssp \
462         --disable-libitm \
463 %if 0%{?fast_build}
464         --disable-bootstrap \
465 %endif
466         --disable-plugin \
467         --with-bugurl="http://bugs.tizen.org/" \
468         --with-pkgversion="Tizen Linux" \
469 %if !%{build_libjava}
470         --disable-libgcj \
471 %else
472         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
473         --with-ecj-jar=%{libsubdir}/ecj.jar \
474         --disable-java-awt \
475 %if !%{biarch_libjava}
476         --disable-libjava-multilib \
477 %endif
478 %endif
479 %if !%{build_with_mudflap}
480         --disable-libmudflap \
481 %endif
482         --with-slibdir=/%{_lib} \
483         --with-system-zlib \
484         --enable-__cxa_atexit \
485         --enable-libstdcxx-allocator=new \
486         --disable-libstdcxx-pch \
487         --enable-version-specific-runtime-libs \
488         --enable-linker-build-id \
489 %if 0%{?gcc_target_arch:1}
490 %if 0%{?gcc_icecream:1}
491         --with-build-sysroot=/ \
492         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
493         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
494         --enable-linux-futex \
495 %endif
496 %if 0%{?canonical_target:1}
497         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
498 %endif
499 %if 0%{?build_static:1}
500         --disable-shared \
501 %endif
502 %if "%{TARGET_ARCH}" == "spu"
503         --with-sysroot=/usr/spu \
504         --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
505         --with-newlib \
506 %endif
507         --disable-nls \
508         --target=%{CONFIGURE_TARGET} \
509 %else
510         --program-suffix=%{binsuffix} \
511         --enable-linux-futex \
512 %ifarch ia64
513         --with-system-libunwind \
514 %else
515         --without-system-libunwind \
516 %endif
517 %endif
518 %if "%{TARGET_ARCH}" == "armv5tel"
519         --with-arch=armv5te \
520         --with-float=soft \
521         --with-mode=arm \
522         --with-abi=aapcs-linux \
523         --disable-sjlj-exceptions \
524 %endif
525 %if "%{TARGET_ARCH}" == "armv7el" 
526         --with-arch=armv7-a \
527         --with-tune=cortex-a9 \
528         --with-float=soft \
529         --with-abi=softfp \
530         --with-fpu=vfpv3 \
531         --disable-sjlj-exceptions \
532 %endif
533 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
534         --with-arch=armv7-a \
535         --with-tune=cortex-a9 \
536         --with-float=hard \
537         --with-abi=aapcs-linux \
538         --with-fpu=vfpv3-d16 \
539         --disable-sjlj-exceptions \
540 %endif
541 %if "%{TARGET_ARCH}" == "i586"
542         --with-arch-32=i586 \
543         --with-tune=generic \
544 %endif
545 %if "%{TARGET_ARCH}" == "x86_64"
546         --with-arch-32=i586 \
547         --with-tune=generic \
548 %endif
549         --build=%{GCCDIST}
550
551 # COMMON-END
552
553 %if 0%{?building_libffi:1}
554 make stage1-bubble $PARALLEL
555 make all-target-libffi $PARALLEL
556 %else
557 # Only run profiled bootstrap on archs where it works
558 #%ifarch %ix86 x86_64 ppc ppc64 ia64
559 #make profiledbootstrap-lean STAGE1_CFLAGS="-O -g" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
560 #%else
561 %ifarch %arm
562 STAGE1_FLAGS="-O0"
563 %else
564 STAGE1_FLAGS="-O -g"
565 %endif
566 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
567 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
568 #%endif
569 #make -C gcc proto
570 make info
571 %if 0%{?run_tests:1}
572 echo "Run testsuite"
573 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
574 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
575 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
576 make -k check $PARALLEL || true
577 mkdir ../testresults
578 ../contrib/test_summary | tee ../testresults/test_summary.txt
579 %endif
580 %endif
581
582 %install
583 export NO_BRP_CHECK_BYTECODE_VERSION=true
584 cd obj-%{GCCDIST}
585 %if 0%{?run_tests:1} 
586 cp `find . -name "*.sum"` ../testresults/
587 cp `find . -name "*.log"  \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
588 chmod 644 ../testresults/*
589 %endif
590
591 %if 0%{?run_tests:1}
592 %files 
593 %defattr(-,root,root)
594 %doc testresults/test_summary.txt
595 %doc testresults/*.sum
596 %doc testresults/*.log
597 %endif
598
599
600 %changelog