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
66 %define libgcj_sover 14
67 %define libgcj_bc_sover 1
68 %define libffi_sover 4
69 %define libmudflap_sover 0
70 %define libgomp_sover 1
71 %define libstdcxx_sover 6
72 %define libobjc_sover 4
73 %define libgfortran_sover 3
74 %define libquadmath_sover 0
75 %define libasan_sover 0
76 %define libtsan_sover 0
77 %define libatomic_sover 1
78 %define libitm_sover 1
80 # Shared library package suffix
81 # This is used for the "non-standard" set of libraries, the standard
82 # being defined by %product_libs_gcc_ver, the GCC version that should
83 # provide un-suffixed shared library packages following the shared-library
84 # policy. Even suffixed variants should provide the shared-library policy
85 # mandated names and ensure they conflict with each other.
86 # Note that on SONAME changes of any library the %product_libs_gcc_ver
87 # define needs to be either split or the newest GCC version still providing
88 # the old SONAME needs to unconditionally produce an un-suffixed library
89 # if %product_libs_gcc_ver is newer than it. Similar the _oldest_ GCC
90 # version first providing a new SONAME needs to unconditionally produce
91 # an un-suffixed library if %product_libs_gcc_ver is lower that it.
92 %if %{!?product_libs_gcc_ver:48}%{?product_libs_gcc_ver} != 48
95 %define libgcc_s_suffix %{?pne:-gcc48}
96 # libgcj SONAME changes with every GCC version
97 %define libgcj_suffix %nil
98 %define libgcj_bc_suffix %{?pne:-gcc48}
99 %define libffi_suffix %{?pne:-gcc48}
100 %define libmudflap_suffix %{?pne:-gcc48}
101 %define libgomp_suffix %{?pne:-gcc48}
102 %define libstdcxx_suffix %{?pne:-gcc48}
103 %define libobjc_suffix %{?pne:-gcc48}
104 %define libgfortran_suffix %{?pne:-gcc48}
105 %define libquadmath_suffix %{?pne:-gcc48}
106 %define libasan_suffix %{?pne:-gcc48}
107 %define libtsan_suffix %{?pne:-gcc48}
108 %define libatomic_suffix %{?pne:-gcc48}
109 %define libitm_suffix %{?pne:-gcc48}
114 Name: gcc48-testresults
115 BuildRequires: gcc-c++
118 BuildRequires: glibc-devel-32bit
119 BuildRequires: mpc-devel
120 BuildRequires: mpfr-devel
122 BuildRequires: makeinfo
123 BuildRequires: zlib-devel
124 %ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc hppa %arm
125 BuildRequires: cloog-isl-devel
126 BuildRequires: isl-devel
129 %define hostsuffix -4.7
130 BuildRequires: gcc47-ada
132 %if 0%{?building_libjava:1}%{?building_testsuite:1}
133 BuildRequires: fastjar
135 %if 0%{?building_libffi:1}
136 BuildRequires: pkg-config
139 BuildRequires: libunwind-devel
142 BuildRequires: dejagnu
143 BuildRequires: expect
147 %define separate_bi32 0
148 %define separate_bi64 0
150 # Beware, this does _not_ separate libgcj, as for that one multilibing
151 # is inactive for the time being
152 %define separate_bi64 1
154 %ifarch x86_64 s390x ppc64 sparc64
155 %define separate_bi32 1
158 # Define two macros to trigger -32bit or -64bit package variants
159 %define separate_biarch 0
161 %define separate_biarch 1
162 %define separate_biarch_suffix -32bit
165 %define separate_biarch 1
166 %define separate_biarch_suffix -64bit
169 %ifarch x86_64 ia64 s390x alpha ppc64 sparc64
170 # 64-bit is primary build target
171 %define build_primary_64bit 1
173 %define build_primary_64bit 0
176 %define biarch_libjava 0
178 %define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
180 URL: http://gcc.gnu.org/
183 %define gcc_version %(echo %version | sed 's/_.*//')
184 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
185 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
186 %define binsuffix -4.8
188 %if !0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
189 Requires: binutils glibc-devel
190 Requires: cpp48 = %{version}-%{release}
191 Requires: libgcc_s%{libgcc_s} >= %{version}-%{release}
192 Requires: libgomp%{libgomp_sover} >= %{version}-%{release}
193 %if %{build_with_mudflap}
194 Requires: libmudflap%{libmudflap_sover} >= %{version}-%{release}
195 Requires: libmudflapth%{libmudflap_sover} >= %{version}-%{release}
198 Requires: libasan%{libasan_sover} >= %{version}-%{release}
201 Requires: libtsan%{libtsan_sover} >= %{version}-%{release}
204 Requires: libatomic%{libatomic_sover} >= %{version}-%{release}
207 Requires: libitm%{libitm_sover} >= %{version}-%{release}
209 Suggests: gcc48-info gcc48-locale
212 BuildRoot: %{_tmppath}/%{name}-%{version}-build
213 Source: gcc-%{gcc_version}%{snapshot_date}.tar.bz2
215 Source3: gcc48-rpmlintrc
217 Source6: baselibs.conf
220 Summary: Testsuite results
221 License: SUSE-Public-Domain
222 Group: Development/Languages/C and C++
225 Results from running the gcc and target library testsuites.
229 # Define the canonical target and host architecture
230 # %gcc_target_arch is supposed to be the full target triple
231 # %TARGET_ARCH is the canonicalized CPU part
232 # %CONFIGURE_TARGET is the target triple used for --target=
233 %if 0%{?gcc_target_arch:1}
234 %define CONFIGURE_TARGET %{gcc_target_arch}
235 %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/;")
236 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
237 %define CONFIGURE_TARGET powerpc64-tizen-linux
239 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
240 %define CONFIGURE_TARGET powerpc64-tizen-linux
242 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
243 %define CONFIGURE_TARGET i586-tizen-linux
245 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
246 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
248 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
249 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
251 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
252 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
255 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
257 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
259 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
262 %define GCCDIST powerpc64-tizen-linux
265 %define GCCDIST sparc64-tizen-linux
268 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
270 %define GCCDIST %{HOST_ARCH}-tizen-linux
275 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
276 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
279 # Versionspecific directories
280 %define versmainlibdir %{libsubdir}
281 %define versmainlibdirbi32 %{libsubdir}/32
282 %define versmainlibdirbi64 %{libsubdir}/64
284 %define versmainlibdirbi32 %{libsubdir}
285 %define versmainlibdirbi64 %{libsubdir}/64
287 %if %{build_primary_64bit}
288 %define versmainlibdirbi %{versmainlibdirbi32}
290 %define versmainlibdirbi %{versmainlibdirbi64}
293 %define mainlibdir %{_libdir}
294 %define mainlibdirbi32 %{_prefix}/lib
295 %define mainlibdirbi64 %{_prefix}/lib64
296 %if %{build_primary_64bit}
297 %define mainlibdirbi %{mainlibdirbi32}
299 %define mainlibdirbi %{mainlibdirbi64}
303 # Now define a few macros that make it easy to package libs and
304 # related files just to the right package, without caring for the
305 # exact path the files are in.
306 # %mainlib package X from all dirs that belong to the main package
307 # %biarchlib package X from all dirs that belong to the -32/64bit package
308 %define mainlib() %{mainlibdir}/%1\
310 %define biarchlib() %{nil}
312 %if !%{separate_biarch}
313 %define mainlib() %{mainlibdir}/%1\
317 %define biarchlib() %{mainlibdirbi}/%1\
322 %define versmainlib() %{versmainlibdir}/%1\
324 %define versbiarchlib() %{nil}
326 %if !%{separate_biarch}
327 %define versmainlib() %{versmainlibdir}/%1\
328 %{versmainlibdirbi}/%1\
331 %define versbiarchlib() %{versmainlibdirbi}/%1\
339 %setup -q -n gcc-%{gcc_version}%{snapshot_date}
342 # We are configuring ppc as ppc64 but with switched multilibs. Adjust
343 # the libstdc++ abi testsuite baseline files accordingly
345 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
346 mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
347 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
348 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
349 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
350 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
355 # Avoid rebuilding of generated files
356 contrib/gcc_update --touch
357 # Avoid fucking up testsuite results with Java and indirect dispatch
358 export LD_AS_NEEDED=0
359 # Split version file into version used for directories (X.Y) and
360 # version to report with --version (X.Y.Z).
361 # See also gcc-dir-version.patch.
362 # Also decrement the patchlevel version by one
363 if test `cat gcc/DEV-PHASE` == "prerelease"; then
364 ( 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
366 mv gcc/BASE-VER gcc/FULL-VER
368 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
370 rm -rf obj-%{GCCDIST}
373 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
374 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'`
376 # -mcpu is superceded by -mtune but -mtune is not supported by
377 # our bootstrap compiler. -mcpu gives a warning that stops
378 # the build process, so remove it for now. Also remove all other
379 # -march and -mtune flags. They are superseeded by proper
380 # default compiler settings now.
381 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'`
384 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
385 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
387 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
388 # Kill all -march/tune/cpu because that screws building the target libs
389 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
391 # Replace 2 spaces by one finally
392 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
396 languages=$languages,c++
399 languages=$languages,objc
402 languages=$languages,fortran
405 languages=$languages,obj-c++
408 languages=$languages,java
411 languages=$languages,ada
415 if test -z "$J"; then
416 J=$(getconf _NPROCESSORS_CONF)
419 test 1 -gt "$J" && J=1
420 JL=$(($(getconf _NPROCESSORS_CONF)*2))
422 if test "$J" == "0"; then
425 if test "$JL" == "0"; then
428 PARALLEL="-j$J -l$JL"
430 # we don't want some miscompiles in the testsuite, or some fault in
431 # the compiler to kill the machine. Hence we limit the amount of memory
432 # by the physical RAM plus half of swap
433 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
434 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
435 #ulimit -v $(((MEM + SWAP/2)*1024))
437 # In general we want to ship release checking enabled compilers
438 # and run BETA with checking enabled.
439 #ENABLE_CHECKING="--enable-checking=yes"
440 ENABLE_CHECKING="--enable-checking=release"
442 # Work around tail/head -1 changes
443 export _POSIX2_VERSION=199209
445 # configure tries to parse include/features.h to detect
446 # if glibc supports SSP. When cross compiling we would need
447 # to install a cross glibc, which we don't, or make the whole
448 # thing point to the native glibc, which is in /, hence the
449 # --with-build-sysroot=/
452 # Using the host gnatmake like
453 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
454 # GNATMAKE="gnatmake%{hostsuffix}"
455 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
457 mkdir -p host-tools/bin
458 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
459 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
460 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
461 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
462 ln -sf /usr/%{_lib} host-tools/%{_lib}
463 export PATH="`pwd`/host-tools/bin:$PATH"
465 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
467 # --enable-threads=posix \
470 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
471 # temporary workaround for a miscompilation of hash functions in java code
472 GCJ_EXTRA_FLAGS="-marm"
474 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
475 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
477 --prefix=%{_prefix} \
478 --infodir=%{_infodir} \
479 --mandir=%{_mandir} \
480 --libdir=%{_libdir} \
481 --libexecdir=%{_libdir} \
482 --disable-bootstrap \
483 --enable-languages=$languages \
485 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
489 --with-bugurl="http://bugs.tizen.org/" \
490 --with-pkgversion="Tizen" \
491 %if !%{build_libjava}
494 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
495 --with-ecj-jar=%{libsubdir}/ecj.jar \
497 %if !%{biarch_libjava}
498 --disable-libjava-multilib \
501 %if !%{build_with_mudflap}
502 --disable-libmudflap \
504 --with-slibdir=/%{_lib} \
506 --enable-__cxa_atexit \
507 --enable-libstdcxx-allocator=new \
508 --disable-libstdcxx-pch \
509 --enable-version-specific-runtime-libs \
510 --enable-linker-build-id \
511 %if 0%{?gcc_target_arch:1}
512 %if 0%{?gcc_icecream:1}
513 --with-build-sysroot=/ \
514 --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
515 --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
516 --enable-linux-futex \
518 %if 0%{?canonical_target:1}
519 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
522 --with-sysroot=%sysroot \
524 %if 0%{?build_static:1}
527 %if "%{TARGET_ARCH}" == "spu"
528 --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
532 --target=%{CONFIGURE_TARGET} \
534 --program-suffix=%{binsuffix} \
535 --enable-linux-futex \
537 --with-system-libunwind \
539 --without-system-libunwind \
542 %if "%{TARGET_ARCH}" == "armv5tel"
543 --with-arch=armv5te \
546 --with-abi=aapcs-linux \
547 --disable-sjlj-exceptions \
549 %if "%{TARGET_ARCH}" == "armv7l"
550 --with-arch=armv7-a \
551 --with-tune=cortex-a9 \
553 --with-abi=aapcs-linux \
554 --with-fpu=vfpv3-d16 \
555 --disable-sjlj-exceptions \
557 %if "%{TARGET_ARCH}" == "armv7hl"
558 --with-arch=armv7-a \
559 --with-tune=cortex-a9 \
561 --with-abi=aapcs-linux \
562 --with-fpu=vfpv3-d16 \
563 --disable-sjlj-exceptions \
565 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
566 %if "%{TARGET_ARCH}" == "powerpc"
567 --with-cpu=default32 \
569 --with-cpu-64=power4 \
571 --with-long-double-128 \
573 %if "%{TARGET_ARCH}" == "sparc64"
574 --with-cpu=ultrasparc \
575 --with-long-double-128 \
577 %if "%{TARGET_ARCH}" == "sparc"
579 --with-long-double-128 \
581 %if "%{TARGET_ARCH}" == "i586"
582 --with-arch-32=i586 \
583 --with-tune=generic \
585 %if "%{TARGET_ARCH}" == "x86_64"
586 --with-arch-32=i586 \
587 --with-tune=generic \
589 %if "%{TARGET_ARCH}" == "s390"
590 --with-tune=z196 --with-arch=z10 \
591 --with-long-double-128 \
592 --enable-decimal-float \
594 %if "%{TARGET_ARCH}" == "s390x"
595 --with-tune=z196 --with-arch=z10 \
596 --with-long-double-128 \
597 --enable-decimal-float \
602 %if 0%{?building_libffi:1}
603 make stage1-bubble $PARALLEL
604 make all-target-libffi $PARALLEL
607 # Only run profiled bootstrap on archs where it works
608 #%ifarch %ix86 x86_64 ppc ppc64 ia64
609 #make profiledbootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
611 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
612 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
618 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
619 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
620 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
621 # asan needs a whole shadow address space
622 ulimit -v unlimited || true
623 make -k check $PARALLEL || true
625 ../contrib/test_summary | tee ../testresults/test_summary.txt
630 export NO_BRP_CHECK_BYTECODE_VERSION=true
633 cp `find . -name "*.sum"` ../testresults/
634 cp `find . -name "*.log" \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
635 chmod 644 ../testresults/*
640 %defattr(-,root,root)
641 %doc testresults/test_summary.txt
642 %doc testresults/*.sum
643 %doc testresults/*.log