1 %define building_testsuite 1
4 # spec file for package gcc48
6 # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
8 # All modifications and additions to the file contributed by third parties
9 # remain the property of their copyright owners, unless otherwise agreed
10 # upon. The license for this file, and modifications and additions to the
11 # file, is the same license as for the pristine package itself (unless the
12 # license for the pristine package is not an Open Source License, in which
13 # case the license is the MIT License). An "Open Source License" is a
14 # license that conforms to the Open Source Definition (Version 1.9)
15 # published by the Open Source Initiative.
17 # Please submit bugfixes or comments via http://bugs.opensuse.org/
26 %define quadmath_arch %ix86 x86_64 ia64
27 %define tsan_arch x86_64
28 %define asan_arch x86_64 %ix86 ppc ppc64
29 %define itm_arch x86_64 %ix86 %arm ppc ppc64
30 %define atomic_arch x86_64 %ix86 %arm ppc ppc64 s390 s390x
32 # We don't want to build java
34 %define build_libjava 0
37 %define build_fortran !0%{?building_libjava:1}%{?building_libffi:1}
38 %define build_objc !0%{?building_libjava:1}%{?building_libffi:1}
39 %define build_objcp !0%{?building_libjava:1}%{?building_libffi:1}
40 %define build_with_mudflap 0
51 # For optional compilers only build C, C++ and Fortran
52 %if 0%{?build_optional_compiler_languages:1}
55 %define build_libjava 0
60 # Shared library SONAME versions
62 %define libgcj_sover %{nil}
63 %define libgcj_bc_sover %{nil}
64 %define libffi_sover %{nil}
65 %define libmudflap_sover %{nil}
66 %define libgomp_sover %{nil}
67 %define libstdcxx_sover %{nil}
68 %define libobjc_sover %{nil}
69 %define libgfortran_sover %{nil}
70 %define libquadmath_sover %{nil}
71 %define libasan_sover %{nil}
72 %define libtsan_sover %{nil}
73 %define libatomic_sover %{nil}
74 %define libitm_sover %{nil}
76 # Shared library package suffix
77 # This is used for the "non-standard" set of libraries, the standard
78 # being defined by %product_libs_gcc_ver, the GCC version that should
79 # provide un-suffixed shared library packages following the shared-library
80 # policy. Even suffixed variants should provide the shared-library policy
81 # mandated names and ensure they conflict with each other.
82 # Note that on SONAME changes of any library the %product_libs_gcc_ver
83 # define needs to be either split or the newest GCC version still providing
84 # the old SONAME needs to unconditionally produce an un-suffixed library
85 # if %product_libs_gcc_ver is newer than it. Similar the _oldest_ GCC
86 # version first providing a new SONAME needs to unconditionally produce
87 # an un-suffixed library if %product_libs_gcc_ver is lower that it.
88 %if %{!?product_libs_gcc_ver:48}%{?product_libs_gcc_ver} != 48
91 %define libgcc_s_suffix %{?pne:-gcc48}
92 # libgcj SONAME changes with every GCC version
93 %define libgcj_suffix %nil
94 %define libgcj_bc_suffix %{?pne:-gcc48}
95 %define libffi_suffix %{?pne:-gcc48}
96 %define libmudflap_suffix %{?pne:-gcc48}
97 %define libgomp_suffix %{?pne:-gcc48}
98 %define libstdcxx_suffix %{?pne:-gcc48}
99 %define libobjc_suffix %{?pne:-gcc48}
100 %define libgfortran_suffix %{?pne:-gcc48}
101 %define libquadmath_suffix %{?pne:-gcc48}
102 %define libasan_suffix %{?pne:-gcc48}
103 %define libtsan_suffix %{?pne:-gcc48}
104 %define libatomic_suffix %{?pne:-gcc48}
105 %define libitm_suffix %{?pne:-gcc48}
110 Name: gcc48-testresults
111 BuildRequires: gcc-c++
114 BuildRequires: glibc-devel-32bit
115 BuildRequires: mpc-devel
116 BuildRequires: mpfr-devel
118 BuildRequires: makeinfo
119 BuildRequires: zlib-devel
120 %ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc hppa %arm
121 BuildRequires: cloog-isl-devel
122 BuildRequires: isl-devel
125 %define hostsuffix -4.7
126 BuildRequires: gcc47-ada
128 %if 0%{?building_libjava:1}%{?building_testsuite:1}
129 BuildRequires: fastjar
131 %if 0%{?building_libffi:1}
132 BuildRequires: pkg-config
135 BuildRequires: libunwind-devel
138 BuildRequires: dejagnu
139 BuildRequires: expect
143 %define separate_bi32 0
144 %define separate_bi64 0
146 # Beware, this does _not_ separate libgcj, as for that one multilibing
147 # is inactive for the time being
148 %define separate_bi64 1
150 %ifarch x86_64 s390x ppc64 sparc64
151 %define separate_bi32 1
154 # Define two macros to trigger -32bit or -64bit package variants
155 %define separate_biarch 0
157 %define separate_biarch 1
158 %define separate_biarch_suffix -32bit
161 %define separate_biarch 1
162 %define separate_biarch_suffix -64bit
165 %ifarch x86_64 ia64 s390x alpha ppc64 sparc64
166 # 64-bit is primary build target
167 %define build_primary_64bit 1
169 %define build_primary_64bit 0
172 %define biarch_libjava 0
174 %define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
176 URL: http://gcc.gnu.org/
179 %define gcc_version %(echo %version | sed 's/_.*//')
180 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
181 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
182 %define binsuffix -4.8
184 %if !0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
185 Requires: binutils glibc-devel
186 Requires: cpp48 = %{version}-%{release}
187 Requires: libgcc_s%{libgcc_s} >= %{version}-%{release}
188 Requires: libgomp%{libgomp_sover} >= %{version}-%{release}
189 %if %{build_with_mudflap}
190 Requires: libmudflap%{libmudflap_sover} >= %{version}-%{release}
191 Requires: libmudflapth%{libmudflap_sover} >= %{version}-%{release}
194 Requires: libasan%{libasan_sover} >= %{version}-%{release}
197 Requires: libtsan%{libtsan_sover} >= %{version}-%{release}
200 Requires: libatomic%{libatomic_sover} >= %{version}-%{release}
203 Requires: libitm%{libitm_sover} >= %{version}-%{release}
205 Suggests: gcc48-info gcc48-locale
208 BuildRoot: %{_tmppath}/%{name}-%{version}-build
209 Source: gcc-%{gcc_version}%{snapshot_date}.tar.bz2
211 Source3: gcc48-rpmlintrc
213 Source6: baselibs.conf
216 Summary: Testsuite results
217 License: SUSE-Public-Domain
218 Group: Development/Languages/C and C++
221 Results from running the gcc and target library testsuites.
225 # Define the canonical target and host architecture
226 # %gcc_target_arch is supposed to be the full target triple
227 # %TARGET_ARCH is the canonicalized CPU part
228 # %CONFIGURE_TARGET is the target triple used for --target=
229 %if 0%{?gcc_target_arch:1}
230 %define CONFIGURE_TARGET %{gcc_target_arch}
231 %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/;")
232 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
233 %define CONFIGURE_TARGET powerpc64-tizen-linux
235 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
236 %define CONFIGURE_TARGET powerpc64-tizen-linux
238 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
239 %define CONFIGURE_TARGET i586-tizen-linux
241 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
242 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
244 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
245 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
247 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
248 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
251 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
253 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
255 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
258 %define GCCDIST powerpc64-tizen-linux
261 %define GCCDIST sparc64-tizen-linux
264 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
266 %define GCCDIST %{HOST_ARCH}-tizen-linux
271 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
272 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
275 # Versionspecific directories
276 %define versmainlibdir %{libsubdir}
277 %define versmainlibdirbi32 %{libsubdir}/32
278 %define versmainlibdirbi64 %{libsubdir}/64
280 %define versmainlibdirbi32 %{libsubdir}
281 %define versmainlibdirbi64 %{libsubdir}/64
283 %if %{build_primary_64bit}
284 %define versmainlibdirbi %{versmainlibdirbi32}
286 %define versmainlibdirbi %{versmainlibdirbi64}
289 %define mainlibdir %{_libdir}
290 %define mainlibdirbi32 %{_prefix}/lib
291 %define mainlibdirbi64 %{_prefix}/lib64
292 %if %{build_primary_64bit}
293 %define mainlibdirbi %{mainlibdirbi32}
295 %define mainlibdirbi %{mainlibdirbi64}
299 # Now define a few macros that make it easy to package libs and
300 # related files just to the right package, without caring for the
301 # exact path the files are in.
302 # %mainlib package X from all dirs that belong to the main package
303 # %biarchlib package X from all dirs that belong to the -32/64bit package
304 %define mainlib() %{mainlibdir}/%1\
306 %define biarchlib() %{nil}
308 %if !%{separate_biarch}
309 %define mainlib() %{mainlibdir}/%1\
313 %define biarchlib() %{mainlibdirbi}/%1\
318 %define versmainlib() %{versmainlibdir}/%1\
320 %define versbiarchlib() %{nil}
322 %if !%{separate_biarch}
323 %define versmainlib() %{versmainlibdir}/%1\
324 %{versmainlibdirbi}/%1\
327 %define versbiarchlib() %{versmainlibdirbi}/%1\
335 %setup -q -n gcc-%{gcc_version}%{snapshot_date}
338 # We are configuring ppc as ppc64 but with switched multilibs. Adjust
339 # the libstdc++ abi testsuite baseline files accordingly
341 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
342 mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
343 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
344 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
345 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
346 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
351 # Avoid rebuilding of generated files
352 contrib/gcc_update --touch
353 # Avoid fucking up testsuite results with Java and indirect dispatch
354 export LD_AS_NEEDED=0
355 # Split version file into version used for directories (X.Y) and
356 # version to report with --version (X.Y.Z).
357 # See also gcc-dir-version.patch.
358 # Also decrement the patchlevel version by one
359 if test `cat gcc/DEV-PHASE` == "prerelease"; then
360 ( 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
362 mv gcc/BASE-VER gcc/FULL-VER
364 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
366 rm -rf obj-%{GCCDIST}
369 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
370 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'`
372 # -mcpu is superceded by -mtune but -mtune is not supported by
373 # our bootstrap compiler. -mcpu gives a warning that stops
374 # the build process, so remove it for now. Also remove all other
375 # -march and -mtune flags. They are superseeded by proper
376 # default compiler settings now.
377 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'`
380 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
381 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
383 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
384 # Kill all -march/tune/cpu because that screws building the target libs
385 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
387 # Replace 2 spaces by one finally
388 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
392 languages=$languages,c++
395 languages=$languages,objc
398 languages=$languages,fortran
401 languages=$languages,obj-c++
404 languages=$languages,java
407 languages=$languages,ada
411 if test -z "$J"; then
412 J=$(getconf _NPROCESSORS_CONF)
415 test 1 -gt "$J" && J=1
416 JL=$(($(getconf _NPROCESSORS_CONF)*2))
418 if test "$J" == "0"; then
421 if test "$JL" == "0"; then
424 PARALLEL="-j$J -l$JL"
426 # we don't want some miscompiles in the testsuite, or some fault in
427 # the compiler to kill the machine. Hence we limit the amount of memory
428 # by the physical RAM plus half of swap
429 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
430 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
431 #ulimit -v $(((MEM + SWAP/2)*1024))
433 # In general we want to ship release checking enabled compilers
434 # and run BETA with checking enabled.
435 #ENABLE_CHECKING="--enable-checking=yes"
436 ENABLE_CHECKING="--enable-checking=release"
438 # Work around tail/head -1 changes
439 export _POSIX2_VERSION=199209
441 # configure tries to parse include/features.h to detect
442 # if glibc supports SSP. When cross compiling we would need
443 # to install a cross glibc, which we don't, or make the whole
444 # thing point to the native glibc, which is in /, hence the
445 # --with-build-sysroot=/
448 # Using the host gnatmake like
449 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
450 # GNATMAKE="gnatmake%{hostsuffix}"
451 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
453 mkdir -p host-tools/bin
454 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
455 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
456 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
457 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
458 ln -sf /usr/%{_lib} host-tools/%{_lib}
459 export PATH="`pwd`/host-tools/bin:$PATH"
461 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
463 # --enable-threads=posix \
466 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
467 # temporary workaround for a miscompilation of hash functions in java code
468 GCJ_EXTRA_FLAGS="-marm"
470 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
471 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
473 --prefix=%{_prefix} \
474 --infodir=%{_infodir} \
475 --mandir=%{_mandir} \
476 --libdir=%{_libdir} \
477 --libexecdir=%{_libdir} \
478 --disable-bootstrap \
479 --enable-languages=$languages \
481 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
485 --with-bugurl="http://bugs.tizen.org/" \
486 --with-pkgversion="Tizen" \
487 %if !%{build_libjava}
490 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
491 --with-ecj-jar=%{libsubdir}/ecj.jar \
493 %if !%{biarch_libjava}
494 --disable-libjava-multilib \
497 %if !%{build_with_mudflap}
498 --disable-libmudflap \
500 --with-slibdir=/%{_lib} \
502 --enable-__cxa_atexit \
503 --enable-libstdcxx-allocator=new \
504 --disable-libstdcxx-pch \
505 --enable-version-specific-runtime-libs \
506 --enable-linker-build-id \
507 %if 0%{?gcc_target_arch:1}
508 %if 0%{?gcc_icecream:1}
509 --with-build-sysroot=/ \
510 --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
511 --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
512 --enable-linux-futex \
514 %if 0%{?canonical_target:1}
515 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
518 --with-sysroot=%sysroot \
520 %if 0%{?build_static:1}
523 %if "%{TARGET_ARCH}" == "spu"
524 --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
528 --target=%{CONFIGURE_TARGET} \
530 --program-suffix=%{binsuffix} \
531 --enable-linux-futex \
533 --with-system-libunwind \
535 --without-system-libunwind \
538 %if "%{TARGET_ARCH}" == "armv5tel"
539 --with-arch=armv5te \
542 --with-abi=aapcs-linux \
543 --disable-sjlj-exceptions \
545 %if "%{TARGET_ARCH}" == "armv7l"
546 --with-arch=armv7-a \
547 --with-tune=cortex-a9 \
549 --with-abi=aapcs-linux \
550 --with-fpu=vfpv3-d16 \
551 --disable-sjlj-exceptions \
553 %if "%{TARGET_ARCH}" == "armv7hl"
554 --with-arch=armv7-a \
555 --with-tune=cortex-a9 \
557 --with-abi=aapcs-linux \
558 --with-fpu=vfpv3-d16 \
559 --disable-sjlj-exceptions \
561 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
562 %if "%{TARGET_ARCH}" == "powerpc"
563 --with-cpu=default32 \
565 --with-cpu-64=power4 \
567 --with-long-double-128 \
569 %if "%{TARGET_ARCH}" == "sparc64"
570 --with-cpu=ultrasparc \
571 --with-long-double-128 \
573 %if "%{TARGET_ARCH}" == "sparc"
575 --with-long-double-128 \
577 %if "%{TARGET_ARCH}" == "i586"
578 --with-arch-32=i586 \
579 --with-tune=generic \
581 %if "%{TARGET_ARCH}" == "x86_64"
582 --with-arch-32=i586 \
583 --with-tune=generic \
585 %if "%{TARGET_ARCH}" == "s390"
586 --with-tune=z196 --with-arch=z10 \
587 --with-long-double-128 \
588 --enable-decimal-float \
590 %if "%{TARGET_ARCH}" == "s390x"
591 --with-tune=z196 --with-arch=z10 \
592 --with-long-double-128 \
593 --enable-decimal-float \
598 %if 0%{?building_libffi:1}
599 make stage1-bubble $PARALLEL
600 make all-target-libffi $PARALLEL
603 # Only run profiled bootstrap on archs where it works
604 #%ifarch %ix86 x86_64 ppc ppc64 ia64
605 #make profiledbootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
607 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
608 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
614 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
615 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
616 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
617 # asan needs a whole shadow address space
618 ulimit -v unlimited || true
619 make -k check $PARALLEL || true
621 ../contrib/test_summary | tee ../testresults/test_summary.txt
626 export NO_BRP_CHECK_BYTECODE_VERSION=true
629 cp `find . -name "*.sum"` ../testresults/
630 cp `find . -name "*.log" \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
631 chmod 644 ../testresults/*
636 %defattr(-,root,root)
637 %doc testresults/test_summary.txt
638 %doc testresults/*.sum
639 %doc testresults/*.log