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

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