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

12fb06
%global __python /usr/bin/python3
12fb06
%global scl 1
12fb06
%global scl_prefix compat-sap-
12fb06
%global _root_prefix /opt/rh/SAP
12fb06
%global _root_infodir %{_root_prefix}/%{_infodir}
12fb06
%global _root_mandir %{_root_prefix}/%{_mandir}
12fb06
%{?scl:%global __strip strip}
12fb06
%{?scl:%global __objdump objdump}
ef9562
%global DATE 20200723
ef9562
%global gitrev 3fc88aa16f1bf661db4518d6d62869f081981981
ef9562
%global gcc_version 10.2.1
12fb06
%global gcc_major 10
12fb06
# Note, gcc_release must be integer, if you want to add suffixes to
12fb06
# %%{release}, append them after %%{gcc_release} on Release: line.
12fb06
%global gcc_release 1
12fb06
%global _unpackaged_files_terminate_build 0
12fb06
%undefine _annotated_build
c10164
%global multilib_64_archs sparc64 ppc64 x86_64
12fb06
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
12fb06
%global attr_ifunc 1
12fb06
%else
12fb06
%global attr_ifunc 0
12fb06
%endif
12fb06
%ifarch x86_64
12fb06
%global multilib_32_arch i686
12fb06
%endif
12fb06
Summary: C++ compatibility runtime library for SAP applications
12fb06
Name: %{?scl_prefix}c++-10
c10164
ExclusiveArch: x86_64 ppc64le s390x
12fb06
Version: %{gcc_version}
c10164
Release: %{gcc_release}.1%{?dist}
12fb06
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
12fb06
# GCC Runtime Exception.
12fb06
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
12fb06
# The source for this package was pulled from upstream's vcs.  Use the
12fb06
# following commands to generate the tarball:
12fb06
# git clone --depth 1 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp
12fb06
# git --git-dir=gcc-dir.tmp/.git fetch --depth 1 origin %%{gitrev}
12fb06
# git --git-dir=gcc-dir.tmp/.git archive --prefix=%%{name}-%%{version}-%%{DATE}/ %%{gitrev} | xz -9e > %%{name}-%%{version}-%%{DATE}.tar.xz
12fb06
# rm -rf gcc-dir.tmp
12fb06
Source0: gcc-%{version}-%{DATE}.tar.xz
12fb06
URL: http://gcc.gnu.org
12fb06
# Need binutils with -pie support >= 2.14.90.0.4-4
12fb06
# Need binutils which can omit dot symbols and overlap .opd on ppc64 >= 2.15.91.0.2-4
12fb06
# Need binutils which handle -msecure-plt on ppc >= 2.16.91.0.2-2
12fb06
# Need binutils which support .weakref >= 2.16.91.0.3-1
12fb06
# Need binutils which support --hash-style=gnu >= 2.17.50.0.2-7
12fb06
# Need binutils which support mffgpr and mftgpr >= 2.17.50.0.2-8
12fb06
# Need binutils which support --build-id >= 2.17.50.0.17-3
12fb06
# Need binutils which support %%gnu_unique_object >= 2.19.51.0.14
12fb06
# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
12fb06
# Need binutils which support --no-add-needed >= 2.20.51.0.2-12
12fb06
# Need binutils which support -plugin
12fb06
# Need binutils which support .loc view >= 2.30
12fb06
# Need binutils which support --generate-missing-build-notes=yes >= 2.31
12fb06
BuildRequires: binutils >= 2.19.51.0.14-33
12fb06
# While gcc doesn't include statically linked binaries, during testing
12fb06
# -static is used several times.
12fb06
BuildRequires: glibc-static
12fb06
BuildRequires: gcc, gcc-c++
12fb06
BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, texinfo, sharutils, gcc-gfortran
12fb06
BuildRequires: /usr/bin/pod2man
12fb06
# For VTA guality testing
12fb06
BuildRequires: gdb
12fb06
# Make sure pthread.h doesn't contain __thread tokens
12fb06
# Make sure glibc supports stack protector
12fb06
# Make sure glibc supports DT_GNU_HASH
12fb06
BuildRequires: glibc-devel >= 2.4.90-13
12fb06
BuildRequires: elfutils-devel >= 0.147
12fb06
BuildRequires: elfutils-libelf-devel >= 0.147
12fb06
%if 0%{?rhel} >= 8
12fb06
BuildRequires: libzstd-devel
12fb06
%endif
12fb06
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
12fb06
# Make sure glibc supports TFmode long double
12fb06
BuildRequires: glibc >= 2.3.90-35
12fb06
%endif
12fb06
%ifarch %{multilib_64_archs} sparcv9 ppc
12fb06
# Ensure glibc{,-devel} is installed for both multilib arches
12fb06
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
12fb06
%endif
12fb06
%ifarch ia64
12fb06
BuildRequires: libunwind >= 0.98
12fb06
%endif
12fb06
# Need .eh_frame ld optimizations
12fb06
# Need proper visibility support
12fb06
# Need -pie support
12fb06
# Need --as-needed/--no-as-needed support
12fb06
# On ppc64, need omit dot symbols support and --non-overlapping-opd
12fb06
# Need binutils that owns /usr/bin/c++filt
12fb06
# Need binutils that support .weakref
12fb06
# Need binutils that supports --hash-style=gnu
12fb06
# Need binutils that support mffgpr/mftgpr
12fb06
# Need binutils that support --build-id
12fb06
# Need binutils that support %%gnu_unique_object
12fb06
# Need binutils that support .cfi_sections
12fb06
# Need binutils that support --no-add-needed
12fb06
# Need binutils that support -plugin
12fb06
# Need binutils that support .loc view >= 2.30
12fb06
# Need binutils which support --generate-missing-build-notes=yes >= 2.31
12fb06
# Don't require this for compat-sap-c++ (#1491573).
12fb06
#Requires: binutils >= 2.19.51.0.14-33
12fb06
# Make sure gdb will understand DW_FORM_strp
12fb06
Conflicts: gdb < 5.1-2
12fb06
# Don't require this for compat-sap-c++ (#1491573).
12fb06
#Requires: glibc-devel >= 2.2.90-12
12fb06
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
12fb06
# Make sure glibc supports TFmode long double
12fb06
Requires: glibc >= 2.3.90-35
12fb06
%endif
12fb06
Requires: libgcc >= 4.1.2-43
12fb06
# Keep this for now.
12fb06
Requires: libgomp >= 4.4.4-13
12fb06
BuildRequires: gmp-devel >= 4.1.2-8
ef9562
BuildRequires: mpfr-devel >= 3.1.0
12fb06
%if 0%{?rhel} >= 7
12fb06
BuildRequires: libmpc-devel >= 0.8.1
12fb06
%endif
12fb06
AutoReq: true
12fb06
AutoProv: false
12fb06
# Don't provide this for compat-sap-c++ (#1491573).
12fb06
#%ifarch sparc64 ppc64 ppc64le s390x x86_64 ia64
12fb06
#Provides: liblto_plugin.so.0()(64bit)
12fb06
#%else
12fb06
#Provides: liblto_plugin.so.0
12fb06
#%endif
12fb06
%global oformat %{nil}
12fb06
%global oformat2 %{nil}
12fb06
%ifarch %{ix86}
12fb06
%global oformat OUTPUT_FORMAT(elf32-i386)
12fb06
%endif
12fb06
%ifarch x86_64
12fb06
%global oformat OUTPUT_FORMAT(elf64-x86-64)
12fb06
%global oformat2 OUTPUT_FORMAT(elf32-i386)
12fb06
%endif
12fb06
%ifarch ppc
12fb06
%global oformat OUTPUT_FORMAT(elf32-powerpc)
12fb06
%global oformat2 OUTPUT_FORMAT(elf64-powerpc)
12fb06
%endif
12fb06
%ifarch ppc64
12fb06
%global oformat OUTPUT_FORMAT(elf64-powerpc)
12fb06
%global oformat2 OUTPUT_FORMAT(elf32-powerpc)
12fb06
%endif
12fb06
%ifarch s390
12fb06
%global oformat OUTPUT_FORMAT(elf32-s390)
12fb06
%endif
12fb06
%ifarch s390x
12fb06
%global oformat OUTPUT_FORMAT(elf64-s390)
12fb06
%global oformat2 OUTPUT_FORMAT(elf32-s390)
12fb06
%endif
12fb06
%ifarch ia64
12fb06
%global oformat OUTPUT_FORMAT(elf64-ia64-little)
12fb06
%endif
12fb06
%ifarch ppc64le
12fb06
%global oformat OUTPUT_FORMAT(elf64-powerpcle)
12fb06
%endif
12fb06
%ifarch aarch64
12fb06
%global oformat OUTPUT_FORMAT(elf64-littleaarch64)
12fb06
%endif
12fb06
12fb06
Patch0: gcc10-hack.patch
12fb06
Patch1: gcc10-i386-libgomp.patch
12fb06
Patch2: gcc10-sparc-config-detection.patch
12fb06
Patch3: gcc10-libgomp-omp_h-multilib.patch
12fb06
Patch4: gcc10-libtool-no-rpath.patch
12fb06
Patch7: gcc10-no-add-needed.patch
12fb06
Patch8: gcc10-foffload-default.patch
12fb06
Patch9: gcc10-Wno-format-security.patch
12fb06
Patch10: gcc10-rh1574936.patch
12fb06
Patch11: gcc10-d-shared-libphobos.patch
12fb06
12fb06
%if 0%{?rhel} > 7
12fb06
%global nonsharedver 80
12fb06
%else
12fb06
%if 0%{?rhel} == 7
12fb06
%global nonsharedver 48
12fb06
%else
12fb06
%global nonsharedver 44
12fb06
%endif
12fb06
%endif
12fb06
12fb06
%if 0%{?scl:1}
12fb06
%global _gnu %{nil}
12fb06
%else
12fb06
%global _gnu -gnueabi
12fb06
%endif
12fb06
%ifarch sparcv9
12fb06
%global gcc_target_platform sparc64-%{_vendor}-%{_target_os}
12fb06
%endif
12fb06
%ifarch ppc ppc64p7
12fb06
%global gcc_target_platform ppc64-%{_vendor}-%{_target_os}
12fb06
%endif
12fb06
%ifnarch sparcv9 ppc ppc64p7
12fb06
%global gcc_target_platform %{_target_platform}
12fb06
%endif
12fb06
12fb06
%description
12fb06
This package provides runtime compatibility libraries for use by SAP
12fb06
application binaries only.
12fb06
12fb06
%prep
12fb06
%setup -q -n gcc-%{version}-%{DATE}
12fb06
%patch0 -p0 -b .hack~
12fb06
%patch1 -p0 -b .i386-libgomp~
12fb06
%patch2 -p0 -b .sparc-config-detection~
12fb06
%patch3 -p0 -b .libgomp-omp_h-multilib~
12fb06
%patch4 -p0 -b .libtool-no-rpath~
12fb06
%patch7 -p0 -b .no-add-needed~
12fb06
%patch8 -p0 -b .foffload-default~
12fb06
%patch9 -p0 -b .Wno-format-security~
12fb06
%if 0%{?fedora} >= 29 || 0%{?rhel} > 7
12fb06
%patch10 -p0 -b .rh1574936~
12fb06
%endif
12fb06
%patch11 -p0 -b .d-shared-libphobos~
12fb06
12fb06
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
12fb06
12fb06
cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
12fb06
cp -a libstdc++-v3/config/cpu/i{4,3}86/opt
12fb06
echo 'TM_H += $(srcdir)/config/rs6000/rs6000-modes.h' >> gcc/config/rs6000/t-rs6000
12fb06
12fb06
./contrib/gcc_update --touch
12fb06
12fb06
LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
12fb06
12fb06
sed -i -e 's/Common Driver Var(flag_report_bug)/& Init(1)/' gcc/common.opt
12fb06
12fb06
%ifarch ppc
12fb06
if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
12fb06
  mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
12fb06
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{,64/}baseline_symbols.txt
12fb06
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{32/,}baseline_symbols.txt
12fb06
  rm -rf libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32
12fb06
fi
12fb06
%endif
12fb06
%ifarch sparc
12fb06
if [ -d libstdc++-v3/config/abi/post/sparc64-linux-gnu ]; then
12fb06
  mkdir -p libstdc++-v3/config/abi/post/sparc64-linux-gnu/64
12fb06
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{,64/}baseline_symbols.txt
12fb06
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{32/,}baseline_symbols.txt
12fb06
  rm -rf libstdc++-v3/config/abi/post/sparc64-linux-gnu/32
12fb06
fi
12fb06
%endif
12fb06
12fb06
%build
12fb06
12fb06
# Undo the broken autoconf change in recent Fedora versions
12fb06
export CONFIG_SITE=NONE
12fb06
12fb06
rm -rf obj-%{gcc_target_platform}
12fb06
mkdir obj-%{gcc_target_platform}
12fb06
cd obj-%{gcc_target_platform}
12fb06
12fb06
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
12fb06
12fb06
CC=gcc
12fb06
CXX=g++
12fb06
OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
ef9562
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto//g;s/-ffat-lto-objects//g'`
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/-Wformat-security/g'`
12fb06
%ifarch sparc
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
12fb06
%endif
12fb06
%ifarch %{ix86}
12fb06
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
12fb06
%endif
12fb06
OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
12fb06
CONFIGURE_OPTS="\
12fb06
	--prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
12fb06
	--with-bugurl=http://bugzilla.redhat.com/bugzilla \
12fb06
	--enable-shared --enable-threads=posix --enable-checking=release \
c10164
	--disable-multilib \
12fb06
%ifarch ppc64le
c10164
	--enable-targets=powerpcle-linux \
12fb06
%endif
12fb06
	--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
12fb06
	--enable-gnu-unique-object \
12fb06
	--enable-linker-build-id --with-gcc-major-version-only \
12fb06
	--enable-plugin --with-linker-hash-style=gnu \
12fb06
	--enable-initfini-array \
12fb06
	--disable-libquadmath \
12fb06
	--disable-libsanitizer \
12fb06
	--disable-libvtv \
12fb06
	--disable-libgomp \
12fb06
	--disable-libitm \
12fb06
	--disable-libssp \
12fb06
	--disable-libatomic \
12fb06
	--disable-libcilkrts \
12fb06
	--without-isl \
12fb06
	--disable-libmpx \
12fb06
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
12fb06
%if %{attr_ifunc}
12fb06
	--enable-gnu-indirect-function \
12fb06
%endif
12fb06
%endif
12fb06
%ifarch ppc ppc64 ppc64le ppc64p7
12fb06
	--enable-secureplt \
12fb06
%endif
12fb06
%ifarch ppc ppc64 ppc64p7
12fb06
%if 0%{?rhel} >= 7
12fb06
	--with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7 --with-tune-64=power7 \
12fb06
%else
12fb06
	--with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 \
12fb06
%endif
12fb06
%endif
12fb06
%ifarch ppc64le
12fb06
	--with-cpu-32=power8 --with-tune-32=power8 --with-cpu-64=power8 --with-tune-64=power8 \
12fb06
%endif
12fb06
%ifarch ppc
12fb06
	--build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=default32
12fb06
%endif
12fb06
%ifarch %{ix86} x86_64
12fb06
	--with-tune=generic \
12fb06
%endif
12fb06
%if 0%{?rhel} >= 7
12fb06
%ifarch %{ix86}
12fb06
	--with-arch=x86-64 \
12fb06
%endif
12fb06
%ifarch x86_64
12fb06
	--with-arch_32=x86-64 \
12fb06
%endif
12fb06
%else
12fb06
%ifarch %{ix86}
12fb06
	--with-arch=i686 \
12fb06
%endif
12fb06
%ifarch x86_64
12fb06
	--with-arch_32=i686 \
12fb06
%endif
12fb06
%endif
12fb06
	--build=%{gcc_target_platform} \
12fb06
	"
12fb06
12fb06
CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
12fb06
	CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g' \
12fb06
		  | sed 's/ -Wformat-security / -Wformat -Wformat-security /'`" \
12fb06
	XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
12fb06
	../configure --enable-bootstrap \
12fb06
	--enable-languages=c,c++,lto \
12fb06
	$CONFIGURE_OPTS
12fb06
12fb06
12fb06
make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS"
12fb06
12fb06
%install
12fb06
rm -fr %{buildroot}
12fb06
12fb06
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
12fb06
mkdir -p %{buildroot}%{_root_prefix}/%{_lib}
12fb06
cd obj-%{gcc_target_platform}
12fb06
./gcc/xgcc -v 2> %{buildroot}%{_root_prefix}/%{_lib}/README%{gcc_major}
12fb06
12fb06
cp %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++.so.6.0.* %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
12fb06
cd %{buildroot}%{_root_prefix}/%{_lib}/
12fb06
ln -sf compat-sap-c++-%{gcc_version}.so %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_major}.so
12fb06
12fb06
%check
12fb06
cd obj-%{gcc_target_platform}
12fb06
12fb06
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
12fb06
12fb06
# run the tests.
12fb06
make %{?_smp_mflags} -k check RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}'" || :
12fb06
( LC_ALL=C ../contrib/test_summary -t || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}' > testresults
12fb06
rm -rf gcc/testsuite.prev
12fb06
mv gcc/testsuite{,.prev}
12fb06
rm -f gcc/site.exp
12fb06
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" || :
12fb06
mv gcc/testsuite/gcc/gcc.sum{,.sent}
12fb06
mv gcc/testsuite/g++/g++.sum{,.sent}
12fb06
( 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
12fb06
rm -rf gcc/testsuite.compat
12fb06
mv gcc/testsuite{,.compat}
12fb06
mv gcc/testsuite{.prev,}
12fb06
echo ====================TESTING=========================
12fb06
cat testresults
12fb06
echo ===`gcc --version | head -1` compatibility tests====
12fb06
cat testresults2
12fb06
echo ====================TESTING END=====================
12fb06
mkdir testlogs-%{_target_platform}-%{version}-%{release}
12fb06
for i in `find . -name \*.log | grep -F testsuite/ | grep -v 'config.log\|acats.*/tests/'`; do
12fb06
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/ || :
12fb06
done
12fb06
for i in `find gcc/testsuite.compat -name \*.log | grep -v 'config.log\|acats.*/tests/'`; do
12fb06
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/`basename $i`.compat || :
12fb06
done
12fb06
tar cf - testlogs-%{_target_platform}-%{version}-%{release} | bzip2 -9c \
12fb06
  | uuencode testlogs-%{_target_platform}.tar.bz2 || :
12fb06
rm -rf testlogs-%{_target_platform}-%{version}-%{release}
12fb06
12fb06
%clean
12fb06
rm -rf %{buildroot}
12fb06
12fb06
%files
12fb06
%defattr(-,root,root,-)
12fb06
%dir %{_root_prefix}
12fb06
%dir %{_root_prefix}/%{_lib}
12fb06
%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
12fb06
%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_major}.so
12fb06
%{_root_prefix}/%{_lib}/README%{gcc_major}
12fb06
12fb06
%changelog
c10164
* Thu May 26 2022 Marek Polacek <polacek@redhat.com> 10.2.1-1.1
c10164
- build on s390x too (#2065777)
c10164
- disable multilib
c10164
ef9562
* Wed Jul 29 2020 Marek Polacek <polacek@redhat.com> 10.2.1-1
ef9562
- GCC 10.2 release
ef9562
- disable -flto in %%{optflags}, lto bootstrap will be enabled the GCC way
ef9562
  later
ef9562
- require MPFR Library version 3.1.0 (or later)
ef9562
12fb06
* Thu Jun  4 2020 Marek Polacek <polacek@redhat.com> 10.1.1-1
12fb06
- new package