Blame SPECS/compat-sap-c++-12.spec

56505a
%global __python /usr/bin/python3
56505a
%global scl 1
56505a
%global scl_prefix compat-sap-
56505a
%global _root_prefix /opt/rh/SAP
56505a
%global _root_infodir %{_root_prefix}/%{_infodir}
56505a
%global _root_mandir %{_root_prefix}/%{_mandir}
56505a
%{?scl:%global __strip strip}
56505a
%{?scl:%global __objdump objdump}
56505a
%global DATE 20220507
56505a
%global gitrev fa107326a13af9a7d7aa0df28fe364db0f6fb171
56505a
%global gcc_version 12.1.1
56505a
%global gcc_major 12
56505a
# Note, gcc_release must be integer, if you want to add suffixes to
56505a
# %%{release}, append them after %%{gcc_release} on Release: line.
56505a
%global gcc_release 1
56505a
%global _unpackaged_files_terminate_build 0
56505a
%undefine _annotated_build
56505a
%global multilib_64_archs sparc64 ppc64 x86_64
56505a
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
56505a
%global attr_ifunc 1
56505a
%else
56505a
%global attr_ifunc 0
56505a
%endif
56505a
%ifarch x86_64
56505a
%global multilib_32_arch i686
56505a
%endif
56505a
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10
56505a
%global build_annobin_plugin 1
56505a
%else
56505a
%global build_annobin_plugin 0
56505a
%endif
56505a
Summary: C++ compatibility runtime library for SAP applications
56505a
Name: %{?scl_prefix}c++-12
56505a
ExclusiveArch: x86_64 ppc64le s390x
56505a
Version: %{gcc_version}
56505a
Release: %{gcc_release}%{?dist}
56505a
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
56505a
# GCC Runtime Exception.
56505a
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
56505a
# The source for this package was pulled from upstream's vcs.
56505a
# %%{gitrev} is some commit from the
56505a
# https://gcc.gnu.org/git/?p=gcc.git;h=refs/vendors/redhat/heads/gcc-%%{gcc_major}-branch
56505a
# branch.  Use the following commands to generate the tarball:
56505a
# git clone --depth 1 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp
56505a
# git --git-dir=gcc-dir.tmp/.git fetch --depth 1 origin %%{gitrev}
56505a
# git --git-dir=gcc-dir.tmp/.git archive --prefix=%%{name}-%%{version}-%%{DATE}/ %%{gitrev} | xz -9e > %%{name}-%%{version}-%%{DATE}.tar.xz
56505a
# rm -rf gcc-dir.tmp
56505a
Source0: gcc-%{version}-%{DATE}.tar.xz
56505a
URL: http://gcc.gnu.org
56505a
# Need binutils with -pie support >= 2.14.90.0.4-4
56505a
# Need binutils which can omit dot symbols and overlap .opd on ppc64 >= 2.15.91.0.2-4
56505a
# Need binutils which handle -msecure-plt on ppc >= 2.16.91.0.2-2
56505a
# Need binutils which support .weakref >= 2.16.91.0.3-1
56505a
# Need binutils which support --hash-style=gnu >= 2.17.50.0.2-7
56505a
# Need binutils which support mffgpr and mftgpr >= 2.17.50.0.2-8
56505a
# Need binutils which support --build-id >= 2.17.50.0.17-3
56505a
# Need binutils which support %%gnu_unique_object >= 2.19.51.0.14
56505a
# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
56505a
# Need binutils which support --no-add-needed >= 2.20.51.0.2-12
56505a
# Need binutils which support -plugin
56505a
# Need binutils which support .loc view >= 2.30
56505a
# Need binutils which support --generate-missing-build-notes=yes >= 2.31
56505a
BuildRequires: binutils >= 2.19.51.0.14-33
56505a
# While gcc doesn't include statically linked binaries, during testing
56505a
# -static is used several times.
56505a
BuildRequires: glibc-static
56505a
BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, sharutils
56505a
BuildRequires: texinfo, texinfo-tex, /usr/bin/pod2man
56505a
BuildRequires: gcc, gcc-c++, make
56505a
# For VTA guality testing
56505a
BuildRequires: gdb
56505a
# Make sure pthread.h doesn't contain __thread tokens
56505a
# Make sure glibc supports stack protector
56505a
# Make sure glibc supports DT_GNU_HASH
56505a
BuildRequires: glibc-devel >= 2.4.90-13
56505a
BuildRequires: elfutils-devel >= 0.147
56505a
BuildRequires: elfutils-libelf-devel >= 0.147
56505a
%if 0%{?rhel} >= 8
56505a
BuildRequires: libzstd-devel
56505a
%endif
56505a
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
56505a
# Make sure glibc supports TFmode long double
56505a
BuildRequires: glibc >= 2.3.90-35
56505a
%endif
56505a
%ifarch %{multilib_64_archs} sparcv9 ppc
56505a
# Ensure glibc{,-devel} is installed for both multilib arches
56505a
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
56505a
%endif
56505a
%ifarch ia64
56505a
BuildRequires: libunwind >= 0.98
56505a
%endif
56505a
# Need .eh_frame ld optimizations
56505a
# Need proper visibility support
56505a
# Need -pie support
56505a
# Need --as-needed/--no-as-needed support
56505a
# On ppc64, need omit dot symbols support and --non-overlapping-opd
56505a
# Need binutils that owns /usr/bin/c++filt
56505a
# Need binutils that support .weakref
56505a
# Need binutils that supports --hash-style=gnu
56505a
# Need binutils that support mffgpr/mftgpr
56505a
# Need binutils that support --build-id
56505a
# Need binutils that support %%gnu_unique_object
56505a
# Need binutils that support .cfi_sections
56505a
# Need binutils that support --no-add-needed
56505a
# Need binutils that support -plugin
56505a
# Need binutils that support .loc view >= 2.30
56505a
# Need binutils which support --generate-missing-build-notes=yes >= 2.31
56505a
# Don't require this for compat-sap-c++ (#1491573).
56505a
#Requires: binutils >= 2.19.51.0.14-33
56505a
# Make sure gdb will understand DW_FORM_strp
56505a
Conflicts: gdb < 5.1-2
56505a
# Don't require this for compat-sap-c++ (#1491573).
56505a
#Requires: glibc-devel >= 2.2.90-12
56505a
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
56505a
# Make sure glibc supports TFmode long double
56505a
Requires: glibc >= 2.3.90-35
56505a
%endif
56505a
Requires: libgcc >= 4.1.2-43
56505a
# Keep this for now.
56505a
Requires: libgomp >= 4.4.4-13
56505a
BuildRequires: gmp-devel >= 4.1.2-8
56505a
BuildRequires: mpfr-devel >= 3.1.0
56505a
%if 0%{?rhel} >= 7
56505a
BuildRequires: libmpc-devel >= 0.8.1
56505a
%endif
56505a
56505a
%if 0%{?rhel} == 8
56505a
%ifarch ppc64le
1d6727
BuildRequires: gcc-toolset-12-runtime gcc-toolset-12-binutils
1d6727
BuildRequires: gcc-toolset-12-gcc gcc-toolset-12-gcc-c++
56505a
%endif
56505a
%endif
56505a
56505a
AutoReq: true
56505a
AutoProv: false
56505a
# Don't provide this for compat-sap-c++ (#1491573).
56505a
#%ifarch sparc64 ppc64 ppc64le s390x x86_64 ia64
56505a
#Provides: liblto_plugin.so.0()(64bit)
56505a
#%else
56505a
#Provides: liblto_plugin.so.0
56505a
#%endif
56505a
%global oformat %{nil}
56505a
%global oformat2 %{nil}
56505a
%ifarch %{ix86}
56505a
%global oformat OUTPUT_FORMAT(elf32-i386)
56505a
%endif
56505a
%ifarch x86_64
56505a
%global oformat OUTPUT_FORMAT(elf64-x86-64)
56505a
%global oformat2 OUTPUT_FORMAT(elf32-i386)
56505a
%endif
56505a
%ifarch ppc
56505a
%global oformat OUTPUT_FORMAT(elf32-powerpc)
56505a
%global oformat2 OUTPUT_FORMAT(elf64-powerpc)
56505a
%endif
56505a
%ifarch ppc64
56505a
%global oformat OUTPUT_FORMAT(elf64-powerpc)
56505a
%global oformat2 OUTPUT_FORMAT(elf32-powerpc)
56505a
%endif
56505a
%ifarch s390
56505a
%global oformat OUTPUT_FORMAT(elf32-s390)
56505a
%endif
56505a
%ifarch s390x
56505a
%global oformat OUTPUT_FORMAT(elf64-s390)
56505a
%global oformat2 OUTPUT_FORMAT(elf32-s390)
56505a
%endif
56505a
%ifarch ia64
56505a
%global oformat OUTPUT_FORMAT(elf64-ia64-little)
56505a
%endif
56505a
%ifarch ppc64le
56505a
%global oformat OUTPUT_FORMAT(elf64-powerpcle)
56505a
%endif
56505a
%ifarch aarch64
56505a
%global oformat OUTPUT_FORMAT(elf64-littleaarch64)
56505a
%endif
56505a
56505a
Patch0: gcc12-hack.patch
56505a
Patch2: gcc12-sparc-config-detection.patch
56505a
Patch3: gcc12-libgomp-omp_h-multilib.patch
56505a
Patch4: gcc12-libtool-no-rpath.patch
56505a
Patch5: gcc12-isl-dl.patch
56505a
Patch6: gcc12-isl-dl2.patch
56505a
Patch7: gcc12-libstdc++-docs.patch
56505a
Patch8: gcc12-no-add-needed.patch
56505a
Patch9: gcc12-Wno-format-security.patch
56505a
Patch10: gcc12-rh1574936.patch
56505a
Patch11: gcc12-d-shared-libphobos.patch
56505a
56505a
Patch3000: 0001-basic_string-reserve-n-semantics-are-not-available-i.patch
56505a
Patch3001: 0004-operator-istream-char-N-eofbit-fixes-are-not-availab.patch
56505a
Patch3002: 0005-Disable-tests-for-PR-libstdc-79820-and-PR-libstdc-81.patch
56505a
Patch3003: 0006-Don-t-assume-has_facet-codecvt_c16-when-run-against-.patch
56505a
Patch3004: 0008-testsuite-build-plugins-with-std-c-11.patch
56505a
Patch3005: 0009-Fix-22_locale-locale-cons-unicode.cc-when-run-under-.patch
56505a
Patch3006: 0010-Don-t-verify-exception-handling-in-basic_filebuf-clo.patch
56505a
Patch3007: 0011-Add-dts.exp-and-use-it-to-fix-22_locale-messages-136.patch
56505a
Patch3008: 0012-dts.exp-use-usr-bin-gcc.patch
56505a
Patch3009: 0013-Rename-__CXXSTDLIB_SO_VERSION__-to-__LIBSTDCXX_SO_VE.patch
56505a
Patch3010: 0014-Conditionalize-tests-for-PR-libstdc-98466-on-__LIBST.patch
56505a
Patch3011: 0015-Conditionalize-test-for-PR-libstdc-87135-on-__LIBSTD.patch
56505a
Patch3012: 0016-Conditionalize-test-for-hashtable-bucket-sizes-on-__.patch
56505a
Patch3013: 0017-Conditionalize-test-for-PR-libstdc-71181-on-__LIBSTD.patch
56505a
Patch3014: gcc12-dg-ice-fixes.patch
56505a
56505a
%if 0%{?rhel} == 9
56505a
%global nonsharedver 11
56505a
%endif
56505a
%if 0%{?rhel} == 8
56505a
%global nonsharedver 80
56505a
%endif
56505a
%if 0%{?rhel} == 7
56505a
%global nonsharedver 48
56505a
%endif
56505a
%if 0%{?rhel} == 6
56505a
%global nonsharedver 44
56505a
%endif
56505a
56505a
%if 0%{?scl:1}
56505a
%global _gnu %{nil}
56505a
%else
56505a
%global _gnu -gnueabi
56505a
%endif
56505a
%ifarch sparcv9
56505a
%global gcc_target_platform sparc64-%{_vendor}-%{_target_os}
56505a
%endif
56505a
%ifarch ppc ppc64p7
56505a
%global gcc_target_platform ppc64-%{_vendor}-%{_target_os}
56505a
%endif
56505a
%ifnarch sparcv9 ppc ppc64p7
56505a
%global gcc_target_platform %{_target_platform}
56505a
%endif
56505a
56505a
%description
56505a
This package provides runtime compatibility libraries for use by SAP
56505a
application binaries only.
56505a
56505a
%prep
56505a
%setup -q -n gcc-%{version}-%{DATE}
56505a
%patch0 -p0 -b .hack~
56505a
%patch2 -p0 -b .sparc-config-detection~
56505a
%patch3 -p0 -b .libgomp-omp_h-multilib~
56505a
%patch4 -p0 -b .libtool-no-rpath~
56505a
%patch8 -p0 -b .no-add-needed~
56505a
%patch9 -p0 -b .Wno-format-security~
56505a
%if 0%{?fedora} >= 29 || 0%{?rhel} > 7
56505a
%patch10 -p0 -b .rh1574936~
56505a
%endif
56505a
%patch11 -p0 -b .d-shared-libphobos~
56505a
56505a
# Apply DTS-specific testsuite patches.
56505a
%patch3000 -p1 -b .dts-test-0~
56505a
%patch3001 -p1 -b .dts-test-1~
56505a
%patch3002 -p1 -b .dts-test-2~
56505a
%patch3003 -p1 -b .dts-test-3~
56505a
%patch3004 -p1 -b .dts-test-4~
56505a
%patch3005 -p1 -b .dts-test-5~
56505a
%patch3006 -p1 -b .dts-test-6~
56505a
%patch3007 -p1 -b .dts-test-7~
56505a
%patch3008 -p1 -b .dts-test-8~
56505a
%patch3009 -p1 -b .dts-test-9~
56505a
%patch3010 -p1 -b .dts-test-10~
56505a
%patch3011 -p1 -b .dts-test-11~
56505a
%patch3012 -p1 -b .dts-test-12~
56505a
%patch3013 -p1 -b .dts-test-13~
56505a
%patch3014 -p1 -b .dts-test-14~
56505a
56505a
find gcc/testsuite -name \*.pr96939~ | xargs rm -f
56505a
56505a
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
56505a
56505a
%if 0%{?rhel} == 6
56505a
# Default to -gdwarf-3 rather than -gdwarf-5
56505a
sed -i '/UInteger Var(dwarf_version)/s/Init(5)/Init(3)/' gcc/common.opt
56505a
sed -i 's/\(version for most targets is \)5 /\13 /' gcc/doc/invoke.texi
56505a
%endif
56505a
%if 0%{?rhel} <= 8
56505a
# Default to -gdwarf-4 rather than -gdwarf-5
56505a
sed -i '/UInteger Var(dwarf_version)/s/Init(5)/Init(4)/' gcc/common.opt
56505a
sed -i 's/\(version for most targets is \)5 /\14 /' gcc/doc/invoke.texi
56505a
%endif
56505a
56505a
cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
56505a
cp -a libstdc++-v3/config/cpu/i{4,3}86/opt
56505a
echo 'TM_H += $(srcdir)/config/rs6000/rs6000-modes.h' >> gcc/config/rs6000/t-rs6000
56505a
56505a
./contrib/gcc_update --touch
56505a
56505a
LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
56505a
56505a
sed -i -e 's/Common Driver Var(flag_report_bug)/& Init(1)/' gcc/common.opt
56505a
sed -i -e 's/context->report_bug = false;/context->report_bug = true;/' gcc/diagnostic.cc
56505a
56505a
%ifarch ppc
56505a
if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
56505a
  mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
56505a
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{,64/}baseline_symbols.txt
56505a
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{32/,}baseline_symbols.txt
56505a
  rm -rf libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32
56505a
fi
56505a
%endif
56505a
%ifarch sparc
56505a
if [ -d libstdc++-v3/config/abi/post/sparc64-linux-gnu ]; then
56505a
  mkdir -p libstdc++-v3/config/abi/post/sparc64-linux-gnu/64
56505a
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{,64/}baseline_symbols.txt
56505a
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{32/,}baseline_symbols.txt
56505a
  rm -rf libstdc++-v3/config/abi/post/sparc64-linux-gnu/32
56505a
fi
56505a
%endif
56505a
56505a
# This test causes fork failures, because it spawns way too many threads
56505a
rm -f gcc/testsuite/go.test/test/chan/goroutines.go
56505a
56505a
# These tests get stuck and don't timeout.
56505a
%ifarch ppc ppc64 ppc64le
56505a
rm -f libgomp/testsuite/libgomp.c/target-*.c
56505a
rm -rf libgomp/testsuite/libgomp.oacc*
56505a
rm -rf libgomp/testsuite/libgomp.graphite*
56505a
%endif
56505a
# This test gets stuck.
56505a
%ifarch %{ix86} ppc64 s390x
56505a
rm -f libstdc++-v3/testsuite/30_threads/future/members/poll.cc
56505a
%endif
56505a
56505a
%build
56505a
56505a
# Undo the broken autoconf change in recent Fedora versions
56505a
export CONFIG_SITE=NONE
56505a
56505a
rm -rf obj-%{gcc_target_platform}
56505a
mkdir obj-%{gcc_target_platform}
56505a
cd obj-%{gcc_target_platform}
56505a
56505a
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
56505a
56505a
%if 0%{?rhel} == 8
56505a
%ifarch ppc64le
1d6727
export PATH=/opt/rh/gcc-toolset-12/root/usr/bin:${PATH:+:${PATH}}
56505a
%endif
56505a
%endif
56505a
56505a
CC=gcc
56505a
CXX=g++
56505a
OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto=auto//g;s/-flto//g;s/-ffat-lto-objects//g'`
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/-Wformat-security/g'`
56505a
%ifarch sparc
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
56505a
%endif
56505a
%ifarch %{ix86}
56505a
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
56505a
%endif
56505a
OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
56505a
# We're going to use the old long double format (double double) until RHEL10.
56505a
# Only -static-lib{stdc++,gfortran}/libgcc would work with IEEE double.
56505a
# Upstream also uses the old long double format, but Fedora uses the new
56505a
# format.  To make things clearer, --with-long-double-format=ibm is used
56505a
# explicitly.
56505a
CONFIGURE_OPTS="\
56505a
	--prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
56505a
	--with-bugurl=http://bugzilla.redhat.com/bugzilla \
56505a
	--enable-shared --enable-threads=posix --enable-checking=release \
56505a
%ifarch ppc64le
56505a
	--enable-targets=powerpcle-linux \
56505a
%endif
56505a
%ifarch ppc64le %{mips} s390x
56505a
	--disable-multilib \
56505a
%else
56505a
	--enable-multilib \
56505a
%endif
56505a
	--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
56505a
	--enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only \
56505a
	--enable-libstdcxx-backtrace \
56505a
	--with-linker-hash-style=gnu \
56505a
	--enable-plugin --enable-initfini-array \
56505a
	--disable-libquadmath \
56505a
	--disable-libsanitizer \
56505a
	--disable-libvtv \
56505a
	--disable-libgomp \
56505a
	--disable-libitm \
56505a
	--disable-libssp \
56505a
	--disable-libatomic \
56505a
	--disable-libcilkrts \
56505a
	--without-isl \
56505a
	--disable-libmpx \
56505a
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
56505a
%if %{attr_ifunc}
56505a
	--enable-gnu-indirect-function \
56505a
%endif
56505a
%endif
56505a
%ifarch ppc ppc64 ppc64le ppc64p7
56505a
	--enable-secureplt \
56505a
%endif
56505a
%ifarch sparc sparcv9 sparc64 ppc ppc64 ppc64le ppc64p7 s390 s390x alpha
56505a
	--with-long-double-128 \
56505a
%endif
56505a
%ifarch ppc64le
56505a
	--with-long-double-format=ibm \
56505a
%endif
56505a
%ifarch ppc ppc64 ppc64p7
56505a
%if 0%{?rhel} >= 7
56505a
	--with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7 --with-tune-64=power7 \
56505a
%endif
56505a
%if 0%{?rhel} == 6
56505a
	--with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 \
56505a
%endif
56505a
%endif
56505a
%ifarch ppc64le
56505a
%if 0%{?rhel} == 9
56505a
	--with-cpu-32=power9 --with-tune-32=power9 --with-cpu-64=power9 --with-tune-64=power9 \
56505a
%else
56505a
	--with-cpu-32=power8 --with-tune-32=power8 --with-cpu-64=power8 --with-tune-64=power8 \
56505a
%endif
56505a
%endif
56505a
%ifarch ppc
56505a
	--build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=default32
56505a
%endif
56505a
%ifarch %{ix86} x86_64
56505a
%if 0%{?rhel} >= 8
56505a
	--enable-cet \
56505a
%endif
56505a
	--with-tune=generic \
56505a
%endif
56505a
%if 0%{?rhel} >= 7
56505a
%ifarch %{ix86}
56505a
	--with-arch=x86-64 \
56505a
%endif
56505a
%ifarch x86_64
56505a
%if 0%{?rhel} > 8
56505a
	--with-arch_64=x86-64-v2 \
56505a
%endif
56505a
	--with-arch_32=x86-64 \
56505a
%endif
56505a
%else
56505a
%ifarch %{ix86}
56505a
	--with-arch=i686 \
56505a
%endif
56505a
%ifarch x86_64
56505a
	--with-arch_32=i686 \
56505a
%endif
56505a
%endif
56505a
%ifarch s390 s390x
56505a
%if 0%{?rhel} >= 7
56505a
%if 0%{?rhel} > 7
56505a
%if 0%{?rhel} > 8
56505a
%if 0%{?rhel} == 9
56505a
	--with-arch=z14 --with-tune=z15 \
56505a
%else
56505a
	--with-arch=z13 --with-tune=arch13 \
56505a
%endif
56505a
%else
56505a
	--with-arch=z13 --with-tune=z14 \
56505a
%endif
56505a
%else
56505a
	--with-arch=z196 --with-tune=zEC12 \
56505a
%endif
56505a
%else
56505a
%if 0%{?fedora} >= 26
56505a
	--with-arch=zEC12 --with-tune=z13 \
56505a
%else
56505a
	--with-arch=z9-109 --with-tune=z10 \
56505a
%endif
56505a
%endif
56505a
	--enable-decimal-float \
56505a
%endif
56505a
	--build=%{gcc_target_platform} \
56505a
	"
56505a
56505a
CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
56505a
	CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g' \
56505a
		  | sed 's/ -Wformat-security / -Wformat -Wformat-security /'`" \
56505a
	XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
56505a
	../configure --enable-bootstrap \
56505a
	--enable-languages=c,c++,lto \
56505a
	$CONFIGURE_OPTS
56505a
56505a
56505a
make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS"
56505a
56505a
%install
56505a
rm -fr %{buildroot}
56505a
56505a
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
56505a
mkdir -p %{buildroot}%{_root_prefix}/%{_lib}
56505a
cd obj-%{gcc_target_platform}
56505a
./gcc/xgcc -v 2> %{buildroot}%{_root_prefix}/%{_lib}/README%{gcc_major}
56505a
56505a
cp %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++.so.6.0.* %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
56505a
cd %{buildroot}%{_root_prefix}/%{_lib}/
56505a
ln -sf compat-sap-c++-%{gcc_version}.so %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_major}.so
56505a
56505a
%check
56505a
56505a
56505a
cd obj-%{gcc_target_platform}
56505a
56505a
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
56505a
56505a
56505a
# run the tests.
56505a
LC_ALL=C make %{?_smp_mflags} -k check ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ \
56505a
%if 0%{?fedora} >= 20 || 0%{?rhel} > 7
56505a
     RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector-strong}'" || :
56505a
%else
56505a
%ifnarch ppc ppc64 ppc64le s390x
56505a
     RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}'" || :
56505a
%else
56505a
    || :
56505a
%endif
56505a
%endif
56505a
( LC_ALL=C ../contrib/test_summary -t || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}' > testresults
56505a
rm -rf gcc/testsuite.prev
56505a
mv gcc/testsuite{,.prev}
56505a
rm -f gcc/site.exp
56505a
LC_ALL=C make %{?_smp_mflags} -C gcc -k check-gcc check-g++ ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}' compat.exp struct-layout-1.exp" || :
56505a
mv gcc/testsuite/gcc/gcc.sum{,.sent}
56505a
mv gcc/testsuite/g++/g++.sum{,.sent}
56505a
( LC_ALL=C ../contrib/test_summary -o -t || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}' > testresults2
56505a
rm -rf gcc/testsuite.compat
56505a
mv gcc/testsuite{,.compat}
56505a
mv gcc/testsuite{.prev,}
56505a
echo ====================TESTING=========================
56505a
cat testresults
56505a
echo ===`gcc --version | head -1` compatibility tests====
56505a
cat testresults2
56505a
echo ====================TESTING END=====================
56505a
mkdir testlogs-%{_target_platform}-%{version}-%{release}
56505a
for i in `find . -name \*.log | grep -F testsuite/ | grep -v 'config.log\|acats.*/tests/'`; do
56505a
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/ || :
56505a
done
56505a
for i in `find gcc/testsuite.compat -name \*.log | grep -v 'config.log\|acats.*/tests/'`; do
56505a
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/`basename $i`.compat || :
56505a
done
56505a
tar cf - testlogs-%{_target_platform}-%{version}-%{release} | bzip2 -9c \
56505a
  | uuencode testlogs-%{_target_platform}.tar.bz2 || :
56505a
rm -rf testlogs-%{_target_platform}-%{version}-%{release}
56505a
56505a
56505a
%files
56505a
%defattr(-,root,root,-)
56505a
%dir %{_root_prefix}
56505a
%dir %{_root_prefix}/%{_lib}
56505a
%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
56505a
%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_major}.so
56505a
%{_root_prefix}/%{_lib}/README%{gcc_major}
56505a
56505a
%changelog
56505a
* Mon May 16 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1
56505a
- update to GCC 12 (#2070133)
56505a
56505a
* Wed Jul 14 2021 Marek Polacek <polacek@redhat.com> 11.1.1-6
56505a
- update to GCC 11 (#1957766)
56505a
56505a
* Wed May 19 2021 Marek Polacek <polacek@redhat.com> 10.2.1-11
56505a
- update from Fedora gcc 10.2.1-11 (#1933097)
56505a
- apply gcc10-SIZE_MAX.patch
56505a
56505a
* Wed Jul 29 2020 Marek Polacek <polacek@redhat.com> 10.2.1-1
56505a
- GCC 10.2 release
56505a
- disable -flto in %%{optflags}, lto bootstrap will be enabled the GCC way
56505a
  later
56505a
- require MPFR Library version 3.1.0 (or later)
56505a
56505a
* Thu Jun  4 2020 Marek Polacek <polacek@redhat.com> 10.1.1-1
56505a
- new package