55424c84486bb4554cbcd74e17daf4abcf73fe0b
[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 Source1:        change_spec
158 Source2:        libgcj47-rpmlintrc
159 Source3:        gcc47-rpmlintrc
160 Source4:        ecj.jar
161 Source5:        README.First-for.SuSE.packagers
162 Source6:        baselibs.conf
163
164 Summary:      Testsuite results
165 License:        SUSE-Public-Domain
166 Group:        Development/Languages/C and C++
167
168 %description 
169 Results from running the gcc and target library testsuites.
170
171
172 # COMMON-BEGIN
173
174 # Define the canonical target and host architecture
175 #   %gcc_target_arch  is supposed to be the full target triple
176 #   %TARGET_ARCH      is the canonicalized CPU part
177 #   %CONFIGURE_TARGET is the target triple used for --target=
178 %if 0%{?gcc_target_arch:1}
179 %define CONFIGURE_TARGET %{gcc_target_arch}
180 %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/;")
181 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
182 %define CONFIGURE_TARGET i586-tizen-linux
183 %endif
184 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
185 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
186 %endif
187 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
188 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
189 %endif
190 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
191 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
192 %endif
193 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
194 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
195 %endif
196 %else
197 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
198 %endif
199 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
200
201 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
202
203 %ifarch %arm
204 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
205 %else
206 %define GCCDIST %{HOST_ARCH}-tizen-linux
207 %endif
208
209 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
210 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
211
212 # COMMON-END
213
214 # Versionspecific directories
215 %define versmainlibdir %{libsubdir}
216 %define versmainlibdirbi32 %{libsubdir}/32
217 %define versmainlibdirbi64 %{libsubdir}/64
218 %if %{build_primary_64bit}
219 %define versmainlibdirbi %{versmainlibdirbi32}
220 %else
221 %define versmainlibdirbi %{versmainlibdirbi64}
222 %endif
223
224 %if 0%{?build_optional_compiler:1}
225 %define mainlibdir %{versmainlibdir}
226 %define mainlibdirbi32 %{versmainlibdirbi32}
227 %define mainlibdirbi64 %{versmainlibdirbi64}
228 %define noflibdir %{versnoflibdir}
229 %define mainlibdirbi %{versmainlibdirbi}
230 %else
231 %define mainlibdir %{_libdir}
232 %define mainlibdirbi32 %{_prefix}/lib
233 %define mainlibdirbi64 %{_prefix}/lib64
234 %define noflibdir %{_prefix}/lib/nof
235 %if %{build_primary_64bit}
236 %define mainlibdirbi %{mainlibdirbi32}
237 %else
238 %define mainlibdirbi %{mainlibdirbi64}
239 %endif
240 %endif
241
242
243 # Now define a few macros that make it easy to package libs and
244 # related files just to the right package, without caring for the
245 # exact path the files are in.
246 #   %mainlib  package X from all dirs that belong to the main package
247 #   %biarchlib   package X from all dirs that belong to the -32/64bit package
248 # by default, nof libs go where the 32bit libs go.
249 %if %{build_nof}
250 %define mainlib() %{mainlibdir}/%1\
251 %{noflibdir}/%1\
252 %{nil}
253 %else
254 %define mainlib() %{mainlibdir}/%1\
255 %{nil}
256 %endif
257 %define biarchlib() %{nil}
258 %if %{biarch}
259 %if !%{separate_biarch}
260 %if %{build_nof}
261 %define mainlib() %{mainlibdir}/%1\
262 %{mainlibdirbi}/%1\
263 %{noflibdir}/%1\
264 %{nil}
265 %else
266 %define mainlib() %{mainlibdir}/%1\
267 %{mainlibdirbi}/%1\
268 %{nil}
269 %endif
270 %else
271 %if %{build_nof}
272 %define biarchlib() %{mainlibdirbi}/%1\
273 %{noflibdir}/%1\
274 %{nil}
275 %define mainlib() %{mainlibdir}/%1\
276 %{nil}
277 %else
278 %define biarchlib() %{mainlibdirbi}/%1\
279 %{nil}
280 %endif
281 %endif
282 %endif
283
284 %if %{build_nof}
285 %define versmainlib() %{versmainlibdir}/%1\
286 %{versnoflibdir}/%1\
287 %{nil}
288 %else
289 %define versmainlib() %{versmainlibdir}/%1\
290 %{nil}
291 %endif
292 %define versbiarchlib() %{nil}
293 %if %{biarch}
294 %if !%{separate_biarch}
295 %if %{build_nof}
296 %define versmainlib() %{versmainlibdir}/%1\
297 %{versmainlibdirbi}/%1\
298 %{versnoflibdir}/%1\
299 %{nil}
300 %else
301 %define versmainlib() %{versmainlibdir}/%1\
302 %{versmainlibdirbi}/%1\
303 %{nil}
304 %endif
305 %else
306 %if %{build_nof}
307 %define versbiarchlib() %{versmainlibdirbi}/%1\
308 %{versnoflibdir}/%1\
309 %{nil}
310 %define versmainlib() %{versmainlibdir}/%1\
311 %{nil}
312 %else
313 %define versbiarchlib() %{versmainlibdirbi}/%1\
314 %{nil}
315 %endif
316 %endif
317 %endif
318
319
320 # COMMON-BEGIN
321
322 %prep
323 %setup -q -n gcc-%{gcc_version}%{snapshot_date}
324
325 %build
326 # Avoid rebuilding of generated files
327 contrib/gcc_update --touch
328 # Avoid fucking up testsuite results with Java and indirect dispatch
329 export LD_AS_NEEDED=0
330 # Split version file into version used for directories (X.Y) and
331 # version to report with --version (X.Y.Z).
332 # See also gcc-dir-version.patch.
333 # Also decrement the patchlevel version by one
334 if test `cat gcc/DEV-PHASE` == "prerelease"; then
335   ( 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
336 else
337   mv gcc/BASE-VER gcc/FULL-VER
338 fi
339 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
340
341 rm -rf obj-%{GCCDIST}
342 mkdir obj-%{GCCDIST}
343 cd obj-%{GCCDIST}
344 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
345 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'`
346 %ifarch %ix86
347 # -mcpu is superceded by -mtune but -mtune is not supported by
348 # our bootstrap compiler.  -mcpu gives a warning that stops
349 # the build process, so remove it for now.  Also remove all other
350 # -march and -mtune flags.  They are superseeded by proper
351 # default compiler settings now.
352 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'`
353 %endif
354 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
355 # Kill all -march/tune/cpu because that screws building the target libs
356 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
357 %endif
358 # Replace 2 spaces by one finally
359 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
360
361 languages=c
362 %if %{build_cp}
363 languages=$languages,c++
364 %endif
365 %if %{build_objc}
366 languages=$languages,objc
367 %endif
368 %if %{build_fortran}
369 languages=$languages,fortran
370 %endif
371 %if %{build_objcp}
372 languages=$languages,obj-c++
373 %endif
374 %if %{build_java}
375 languages=$languages,java
376 %endif
377 %if %{build_ada}
378 languages=$languages,ada
379 %endif
380
381 J=%{?jobs:%jobs}
382 if test -z "$J"; then
383   J=$(getconf _NPROCESSORS_CONF)
384   JL=$(($J * 2))
385 else
386   test 1 -gt "$J" && J=1
387   JL=$(($(getconf _NPROCESSORS_CONF)*2))
388 fi
389 if test "$J" == "0"; then
390   J=1
391 fi
392 if test "$JL" == "0"; then
393   JL=1
394 fi
395 PARALLEL="-j$J -l$JL"
396
397 # we don't want some miscompiles in the testsuite, or some fault in
398 # the compiler to kill the machine.  Hence we limit the amount of memory
399 # by the physical RAM plus half of swap
400 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
401 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
402 #ulimit -v $(((MEM + SWAP/2)*1024))
403
404 # In general we want to ship release checking enabled compilers
405 # and run BETA with checking enabled.
406 #ENABLE_CHECKING="--enable-checking=yes"
407 ENABLE_CHECKING="--enable-checking=release"
408
409 # Work around tail/head -1 changes
410 export _POSIX2_VERSION=199209
411
412 # configure tries to parse include/features.h to detect
413 # if glibc supports SSP.  When cross compiling we would need
414 # to install a cross glibc, which we don't, or make the whole
415 # thing point to the native glibc, which is in /, hence the
416 # --with-sysroot=/
417
418 %if %{build_ada}
419 # Using the host gnatmake like
420 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
421 #   GNATMAKE="gnatmake%{hostsuffix}"
422 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
423 # available
424 mkdir -p host-tools/bin
425 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
426 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
427 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
428 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
429 ln -sf /usr/%{_lib} host-tools/%{_lib}
430 export PATH="`pwd`/host-tools/bin:$PATH"
431 %endif
432 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
433 #%else
434 #       --enable-threads=posix \
435 #%endif
436 #       --enable-shared \
437 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
438 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
439 ../configure \
440         --prefix=%{_prefix} \
441         --infodir=%{_infodir} \
442         --mandir=%{_mandir} \
443         --libdir=%{_libdir} \
444         --libexecdir=%{_libdir} \
445         --enable-languages=$languages \
446         $ENABLE_CHECKING \
447         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
448         --enable-ssp \
449         --disable-libssp \
450         --disable-libitm \
451 %if 0%{?fast_build}
452         --disable-bootstrap \
453 %endif
454         --disable-plugin \
455         --with-bugurl="http://bugs.tizen.org/" \
456         --with-pkgversion="Tizen Linux" \
457 %if !%{build_libjava}
458         --disable-libgcj \
459 %else
460         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
461         --with-ecj-jar=%{libsubdir}/ecj.jar \
462         --disable-java-awt \
463 %if !%{biarch_libjava}
464         --disable-libjava-multilib \
465 %endif
466 %endif
467 %if !%{build_with_mudflap}
468         --disable-libmudflap \
469 %endif
470         --with-slibdir=/%{_lib} \
471         --with-system-zlib \
472         --enable-__cxa_atexit \
473         --enable-libstdcxx-allocator=new \
474         --disable-libstdcxx-pch \
475         --enable-version-specific-runtime-libs \
476         --enable-linker-build-id \
477 %if 0%{?gcc_target_arch:1}
478 %if 0%{?gcc_icecream:1}
479         --with-build-sysroot=/ \
480         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
481         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
482         --enable-linux-futex \
483 %endif
484 %if 0%{?canonical_target:1}
485         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
486 %endif
487 %if 0%{?build_static:1}
488         --disable-shared \
489 %endif
490 %if "%{TARGET_ARCH}" == "spu"
491         --with-sysroot=/usr/spu \
492         --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
493         --with-newlib \
494 %endif
495         --disable-nls \
496         --target=%{CONFIGURE_TARGET} \
497 %else
498         --program-suffix=%{binsuffix} \
499         --enable-linux-futex \
500 %ifarch ia64
501         --with-system-libunwind \
502 %else
503         --without-system-libunwind \
504 %endif
505 %endif
506 %if "%{TARGET_ARCH}" == "armv5tel"
507         --with-arch=armv5te \
508         --with-float=soft \
509         --with-mode=arm \
510         --with-abi=aapcs-linux \
511         --disable-sjlj-exceptions \
512 %endif
513 %if "%{TARGET_ARCH}" == "armv7el" 
514         --with-arch=armv7-a \
515         --with-tune=cortex-a9 \
516         --with-float=soft \
517         --with-abi=softfp \
518         --with-fpu=vfpv3 \
519         --disable-sjlj-exceptions \
520 %endif
521 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
522         --with-arch=armv7-a \
523         --with-tune=cortex-a9 \
524         --with-float=hard \
525         --with-abi=aapcs-linux \
526         --with-fpu=vfpv3-d16 \
527         --disable-sjlj-exceptions \
528 %endif
529 %if "%{TARGET_ARCH}" == "i586"
530         --with-arch-32=i586 \
531         --with-tune=generic \
532 %endif
533 %if "%{TARGET_ARCH}" == "x86_64"
534         --with-arch-32=i586 \
535         --with-tune=generic \
536 %endif
537         --build=%{GCCDIST}
538
539 # COMMON-END
540
541 %if 0%{?building_libffi:1}
542 make stage1-bubble $PARALLEL
543 make all-target-libffi $PARALLEL
544 %else
545 # Only run profiled bootstrap on archs where it works
546 #%ifarch %ix86 x86_64 ppc ppc64 ia64
547 #make profiledbootstrap-lean STAGE1_CFLAGS="-O -g" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
548 #%else
549 %ifarch %arm
550 STAGE1_FLAGS="-O0"
551 %else
552 STAGE1_FLAGS="-O -g"
553 %endif
554 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
555 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
556 #%endif
557 #make -C gcc proto
558 make info
559 %if 0%{?run_tests:1}
560 echo "Run testsuite"
561 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
562 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
563 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
564 make -k check $PARALLEL || true
565 mkdir ../testresults
566 ../contrib/test_summary | tee ../testresults/test_summary.txt
567 %endif
568 %endif
569
570 %install
571 export NO_BRP_CHECK_BYTECODE_VERSION=true
572 cd obj-%{GCCDIST}
573 %if 0%{?run_tests:1} 
574 cp `find . -name "*.sum"` ../testresults/
575 cp `find . -name "*.log"  \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
576 chmod 644 ../testresults/*
577 %endif
578
579 %if 0%{?run_tests:1}
580 %files 
581 %defattr(-,root,root)
582 %doc testresults/test_summary.txt
583 %doc testresults/*.sum
584 %doc testresults/*.log
585 %endif
586
587
588 %changelog