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