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