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

97046b
# SAP HACK: Start custom scl information for SAP build.
97046b
%global scl 1
97046b
%global scl_prefix compat-sap-
97046b
%global _root_prefix /opt/rh/SAP
97046b
%global _root_infodir %{_root_prefix}/%{_infodir}
97046b
%global _root_mandir %{_root_prefix}/%{_mandir}
97046b
# END SAP HACK.
97046b
%{?scl:%global __strip strip}
97046b
%{?scl:%global __objdump objdump}
97046b
%global DATE 20170829
97046b
%global SVNREV 251415
97046b
%global gcc_version 7.2.1
97046b
%global gcc_major 7
97046b
# Note, gcc_release must be integer, if you want to add suffixes to
97046b
# %{release}, append them after %{gcc_release} on Release: line.
97046b
%global gcc_release 2
97046b
%global mpc_version 0.8.1
97046b
%global _unpackaged_files_terminate_build 0
97046b
%global multilib_64_archs sparc64 ppc64 s390x x86_64
97046b
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
97046b
%global attr_ifunc 1
97046b
%else
97046b
%global attr_ifunc 0
97046b
%endif
97046b
%ifarch x86_64
97046b
%global multilib_32_arch i686
97046b
%endif
97046b
Summary: C++ compatibility runtime library for SAP applications
97046b
Name: %{?scl_prefix}c++-7
97046b
ExclusiveArch: x86_64 ppc64le
97046b
Version: %{gcc_version}
97046b
Release: %{gcc_release}%{?dist}
97046b
# libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have
97046b
# GCC Runtime Exception.
97046b
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
97046b
Group: Development/Languages
97046b
# The source for this package was pulled from upstream's vcs.  Use the
97046b
# following commands to generate the tarball:
97046b
# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-7-branch@%{SVNREV} gcc-%{version}-%{DATE}
97046b
# tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2
97046b
Source0: gcc-%{version}-%{DATE}.tar.bz2
97046b
Source1: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
97046b
URL: http://gcc.gnu.org
97046b
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
97046b
# Need binutils with -pie support >= 2.14.90.0.4-4
97046b
# Need binutils which can omit dot symbols and overlap .opd on ppc64 >= 2.15.91.0.2-4
97046b
# Need binutils which handle -msecure-plt on ppc >= 2.16.91.0.2-2
97046b
# Need binutils which support .weakref >= 2.16.91.0.3-1
97046b
# Need binutils which support --hash-style=gnu >= 2.17.50.0.2-7
97046b
# Need binutils which support mffgpr and mftgpr >= 2.17.50.0.2-8
97046b
# Need binutils which support --build-id >= 2.17.50.0.17-3
97046b
# Need binutils which support %gnu_unique_object >= 2.19.51.0.14
97046b
# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
97046b
BuildRequires: binutils >= 2.19.51.0.14-33
97046b
# While gcc doesn't include statically linked binaries, during testing
97046b
# -static is used several times.
97046b
BuildRequires: glibc-static
97046b
BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, texinfo, sharutils
97046b
BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, texinfo, sharutils, gcc-gfortran
97046b
BuildRequires: /usr/bin/pod2man
97046b
%if 0%{?rhel} >= 7
97046b
BuildRequires: texinfo-tex
97046b
%endif
97046b
#BuildRequires: systemtap-sdt-devel >= 1.3
97046b
# For VTA guality testing
97046b
BuildRequires: gdb
97046b
# Make sure pthread.h doesn't contain __thread tokens
97046b
# Make sure glibc supports stack protector
97046b
# Make sure glibc supports DT_GNU_HASH
97046b
BuildRequires: glibc-devel >= 2.4.90-13
97046b
BuildRequires: elfutils-devel >= 0.147
97046b
BuildRequires: elfutils-libelf-devel >= 0.147
97046b
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
97046b
# Make sure glibc supports TFmode long double
97046b
BuildRequires: glibc >= 2.3.90-35
97046b
%endif
97046b
%ifarch %{multilib_64_archs} sparcv9 ppc
97046b
# Ensure glibc{,-devel} is installed for both multilib arches
97046b
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
97046b
%endif
97046b
%ifarch ia64
97046b
BuildRequires: libunwind >= 0.98
97046b
%endif
97046b
# Need .eh_frame ld optimizations
97046b
# Need proper visibility support
97046b
# Need -pie support
97046b
# Need --as-needed/--no-as-needed support
97046b
# On ppc64, need omit dot symbols support and --non-overlapping-opd
97046b
# Need binutils that owns /usr/bin/c++filt
97046b
# Need binutils that support .weakref
97046b
# Need binutils that supports --hash-style=gnu
97046b
# Need binutils that support mffgpr/mftgpr
97046b
# Need binutils which support --build-id >= 2.17.50.0.17-3
97046b
# Need binutils which support %gnu_unique_object >= 2.19.51.0.14
97046b
# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
97046b
# Don't require this for compat-sap-c++ (#1491573).
97046b
#Requires: binutils >= 2.19.51.0.14-33
97046b
# Make sure gdb will understand DW_FORM_strp
97046b
Conflicts: gdb < 5.1-2
97046b
# Don't require this for compat-sap-c++ (#1491573).
97046b
#Requires: glibc-devel >= 2.2.90-12
97046b
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
97046b
# Make sure glibc supports TFmode long double
97046b
Requires: glibc >= 2.3.90-35
97046b
%endif
97046b
Requires: libgcc >= 4.1.2-43
97046b
# Keep this for now.
97046b
Requires: libgomp >= 4.4.4-13
97046b
BuildRequires: gmp-devel >= 4.1.2-8
97046b
BuildRequires: mpfr-devel >= 2.2.1
97046b
%if 0%{?rhel} >= 7
97046b
BuildRequires: libmpc-devel >= 0.8.1
97046b
%endif
97046b
AutoReq: true
97046b
AutoProv: false
97046b
# Don't provide this for compat-sap-c++ (#1491573).
97046b
#%ifarch sparc64 ppc64 ppc64le s390x x86_64 ia64
97046b
#Provides: liblto_plugin.so.0()(64bit)
97046b
#%else
97046b
#Provides: liblto_plugin.so.0
97046b
#%endif
97046b
%global oformat %{nil}
97046b
%global oformat2 %{nil}
97046b
%ifarch %{ix86}
97046b
%global oformat OUTPUT_FORMAT(elf32-i386)
97046b
%endif
97046b
%ifarch x86_64
97046b
%global oformat OUTPUT_FORMAT(elf64-x86-64)
97046b
%global oformat2 OUTPUT_FORMAT(elf32-i386)
97046b
%endif
97046b
%ifarch ppc
97046b
%global oformat OUTPUT_FORMAT(elf32-powerpc)
97046b
%global oformat2 OUTPUT_FORMAT(elf64-powerpc)
97046b
%endif
97046b
%ifarch ppc64
97046b
%global oformat OUTPUT_FORMAT(elf64-powerpc)
97046b
%global oformat2 OUTPUT_FORMAT(elf32-powerpc)
97046b
%endif
97046b
%ifarch s390
97046b
%global oformat OUTPUT_FORMAT(elf32-s390)
97046b
%endif
97046b
%ifarch s390x
97046b
%global oformat OUTPUT_FORMAT(elf64-s390)
97046b
%global oformat2 OUTPUT_FORMAT(elf32-s390)
97046b
%endif
97046b
%ifarch ia64
97046b
%global oformat OUTPUT_FORMAT(elf64-ia64-little)
97046b
%endif
97046b
%ifarch ppc64le
97046b
%global oformat OUTPUT_FORMAT(elf64-powerpcle)
97046b
%endif
97046b
%ifarch aarch64
97046b
%global oformat OUTPUT_FORMAT(elf64-littleaarch64)
97046b
%endif
97046b
97046b
Patch0: gcc7-hack.patch
97046b
Patch1: gcc7-ppc32-retaddr.patch
97046b
Patch2: gcc7-i386-libgomp.patch
97046b
Patch3: gcc7-sparc-config-detection.patch
97046b
Patch4: gcc7-libgomp-omp_h-multilib.patch
97046b
Patch5: gcc7-libtool-no-rpath.patch
97046b
Patch6: gcc7-isl-dl.patch
97046b
Patch7: gcc7-libstdc++-docs.patch
97046b
Patch8: gcc7-no-add-needed.patch
97046b
Patch9: gcc7-aarch64-async-unw-tables.patch
97046b
Patch10: gcc7-foffload-default.patch
97046b
Patch11: gcc7-Wno-format-security.patch
97046b
97046b
Patch1000: gcc7-libstdc++-compat.patch
97046b
Patch1001: gcc7-alt-compat-test.patch
97046b
Patch1002: gcc7-libstdc++44-xfail.patch
97046b
Patch1003: gcc7-rh1118870.patch
97046b
Patch1004: gcc7-isl-dl2.patch
97046b
97046b
%if 0%{?rhel} >= 7
97046b
%global nonsharedver 48
97046b
%else
97046b
%global nonsharedver 44
97046b
%endif
97046b
97046b
%if 0%{?scl:1}
97046b
%global _gnu %{nil}
97046b
%else
97046b
%global _gnu 7E
97046b
%endif
97046b
%ifarch sparcv9
97046b
%global gcc_target_platform sparc64-%{_vendor}-%{_target_os}%{?_gnu}
97046b
%endif
97046b
%ifarch ppc
97046b
%global gcc_target_platform ppc64-%{_vendor}-%{_target_os}%{?_gnu}
97046b
%endif
97046b
%ifnarch sparcv9 ppc
97046b
%global gcc_target_platform %{_target_platform}
97046b
%endif
97046b
97046b
%description
97046b
This package provides runtime compatibility libraries for use by SAP
97046b
application binaries only.
97046b
97046b
%prep
97046b
%setup -q -n gcc-%{version}-%{DATE} -a 1
97046b
%patch0 -p0 -b .hack~
97046b
%patch1 -p0 -b .ppc32-retaddr~
97046b
%patch2 -p0 -b .i386-libgomp~
97046b
%patch3 -p0 -b .sparc-config-detection~
97046b
%patch4 -p0 -b .libgomp-omp_h-multilib~
97046b
%patch5 -p0 -b .libtool-no-rpath~
97046b
%patch8 -p0 -b .no-add-needed~
97046b
%patch9 -p0 -b .aarch64-async-unw-tables~
97046b
%patch10 -p0 -b .foffload-default~
97046b
%patch11 -p0 -b .Wno-format-security~
97046b
97046b
%patch1000 -p0 -b .libstdc++-compat~
97046b
%ifarch %{ix86} x86_64
97046b
%if 0%{?rhel} < 7
97046b
# On i?86/x86_64 there are some incompatibilities in _Decimal* as well as
97046b
# aggregates containing larger vector passing.
97046b
%patch1001 -p0 -b .alt-compat-test~
97046b
%endif
97046b
%endif
97046b
%if 0%{?rhel} == 6
97046b
# Fix this up
97046b
#%patch1002 -p0 -b .libstdc++44-xfail~
97046b
%endif
97046b
%patch1003 -p0 -b .rh1118870~
97046b
97046b
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
97046b
97046b
%if 0%{?rhel} == 6
97046b
# Default to -gdwarf-3 rather than -gdwarf-4
97046b
sed -i '/UInteger Var(dwarf_version)/s/Init(4)/Init(3)/' gcc/common.opt
97046b
sed -i 's/\(may be either 2, 3 or 4; the default version is \)4\./\13./' gcc/doc/invoke.texi
97046b
%endif
97046b
97046b
cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
97046b
cp -a libstdc++-v3/config/cpu/i{4,3}86/opt
97046b
97046b
./contrib/gcc_update --touch
97046b
97046b
LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
97046b
97046b
sed -i -e 's/Common Driver Var(flag_report_bug)/& Init(1)/' gcc/common.opt
97046b
97046b
%ifarch ppc
97046b
if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
97046b
  mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
97046b
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{,64/}baseline_symbols.txt
97046b
  mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{32/,}baseline_symbols.txt
97046b
  rm -rf libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32
97046b
fi
97046b
%endif
97046b
%ifarch sparc
97046b
if [ -d libstdc++-v3/config/abi/post/sparc64-linux-gnu ]; then
97046b
  mkdir -p libstdc++-v3/config/abi/post/sparc64-linux-gnu/64
97046b
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{,64/}baseline_symbols.txt
97046b
  mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{32/,}baseline_symbols.txt
97046b
  rm -rf libstdc++-v3/config/abi/post/sparc64-linux-gnu/32
97046b
fi
97046b
%endif
97046b
97046b
%build
97046b
97046b
# Undo the broken autoconf change in recent Fedora versions
97046b
export CONFIG_SITE=NONE
97046b
97046b
rm -fr obj-%{gcc_target_platform}
97046b
mkdir obj-%{gcc_target_platform}
97046b
cd obj-%{gcc_target_platform}
97046b
97046b
%if 0%{?rhel} < 7
97046b
mkdir mpc mpc-install
97046b
cd mpc
97046b
../../mpc-%{mpc_version}/configure --disable-shared \
97046b
  CFLAGS="${CFLAGS:-%optflags} -fPIC" CXXFLAGS="${CXXFLAGS:-%optflags} -fPIC" \
97046b
  --prefix=`cd ..; pwd`/mpc-install
97046b
make %{?_smp_mflags}
97046b
make install
97046b
cd ..
97046b
%endif
97046b
97046b
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
97046b
97046b
CC=gcc
97046b
CXX=g++
97046b
OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/-Wformat-security/g'`
97046b
%ifarch sparc
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
97046b
%endif
97046b
%ifarch %{ix86}
97046b
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
97046b
%endif
97046b
OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
97046b
CONFIGURE_OPTS="\
97046b
	--prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
97046b
	--with-bugurl=http://bugzilla.redhat.com/bugzilla \
97046b
	--enable-shared --enable-threads=posix --enable-checking=release \
97046b
%ifarch ppc64le
97046b
	--enable-targets=powerpcle-linux --disable-multilib \
97046b
%else
97046b
	--enable-multilib \
97046b
%endif
97046b
	--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
97046b
	--enable-gnu-unique-object \
97046b
	--enable-linker-build-id --with-gcc-major-version-only \
97046b
	--enable-plugin --with-linker-hash-style=gnu \
97046b
	--enable-initfini-array \
97046b
	--with-default-libstdcxx-abi=gcc4-compatible \
97046b
	--disable-libquadmath \
97046b
	--disable-libsanitizer \
97046b
	--disable-libvtv \
97046b
	--disable-libgomp \
97046b
	--disable-libitm \
97046b
	--disable-libssp \
97046b
	--disable-libatomic \
97046b
	--disable-libcilkrts \
97046b
	--without-isl \
97046b
	--disable-libmpx \
97046b
%if 0%{?rhel} < 7
97046b
	--with-mpc=`pwd`/mpc-install \
97046b
%endif
97046b
%if 0%{?rhel} >= 7
97046b
%if %{attr_ifunc}
97046b
        --enable-gnu-indirect-function \
97046b
%endif
97046b
%endif
97046b
%ifarch ppc ppc64 ppc64le ppc64p7
97046b
	--enable-secureplt \
97046b
%endif
97046b
%ifarch ppc ppc64 ppc64p7
97046b
%if 0%{?rhel} >= 7
97046b
	--with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7 --with-tune-64=power7 \
97046b
%else
97046b
	--with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 \
97046b
%endif
97046b
%endif
97046b
%ifarch ppc64le
97046b
%if 0%{?rhel} >= 7
97046b
	--with-cpu-32=power8 --with-tune-32=power8 --with-cpu-64=power8 --with-tune-64=power8 \
97046b
%endif
97046b
%endif
97046b
%ifarch ppc
97046b
	--build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=default32
97046b
%endif
97046b
%ifarch %{ix86} x86_64
97046b
	--with-tune=generic \
97046b
%endif
97046b
%ifarch %{ix86}
97046b
	--with-arch=i686 \
97046b
%endif
97046b
%ifarch x86_64
97046b
	--with-arch_32=i686 \
97046b
%endif
97046b
	--build=%{gcc_target_platform} \
97046b
	"
97046b
97046b
CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
97046b
	CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g'`" \
97046b
	XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
97046b
	GCJFLAGS="$OPT_FLAGS" \
97046b
	../configure --enable-bootstrap \
97046b
	--enable-languages=c,c++,lto \
97046b
	$CONFIGURE_OPTS
97046b
97046b
97046b
GCJFLAGS="$OPT_FLAGS" make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS"
97046b
97046b
%install
97046b
rm -fr %{buildroot}
97046b
97046b
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
97046b
mkdir -p %{buildroot}%{_root_prefix}/%{_lib}
97046b
cd obj-%{gcc_target_platform}
97046b
./gcc/xgcc -v 2> %{buildroot}%{_root_prefix}/%{_lib}/README
97046b
97046b
cp %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++.so.6.0.* %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
97046b
cd %{buildroot}%{_root_prefix}/%{_lib}/
97046b
ln -sf compat-sap-c++-%{gcc_version}.so %{buildroot}%{_root_prefix}/%{_lib}/compat-sap-c++-7.so
97046b
97046b
%check
97046b
cd obj-%{gcc_target_platform}
97046b
97046b
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
97046b
97046b
# run the tests.
97046b
make %{?_smp_mflags} -k check RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}'" || :
97046b
( LC_ALL=C ../contrib/test_summary -t || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}' > testresults
97046b
rm -rf gcc/testsuite.prev
97046b
mv gcc/testsuite{,.prev}
97046b
rm -f gcc/site.exp
97046b
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" || :
97046b
mv gcc/testsuite/gcc/gcc.sum{,.sent}
97046b
mv gcc/testsuite/g++/g++.sum{,.sent}
97046b
( 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
97046b
rm -rf gcc/testsuite.compat
97046b
mv gcc/testsuite{,.compat}
97046b
mv gcc/testsuite{.prev,}
97046b
echo ====================TESTING=========================
97046b
cat testresults
97046b
echo ===`gcc --version | head -1` compatibility tests====
97046b
cat testresults2
97046b
echo ====================TESTING END=====================
97046b
mkdir testlogs-%{_target_platform}-%{version}-%{release}
97046b
for i in `find . -name \*.log | grep -F testsuite/ | grep -v 'config.log\|acats.*/tests/'`; do
97046b
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/ || :
97046b
done
97046b
for i in `find gcc/testsuite.compat -name \*.log | grep -v 'config.log\|acats.*/tests/'`; do
97046b
  ln $i testlogs-%{_target_platform}-%{version}-%{release}/`basename $i`.compat || :
97046b
done
97046b
tar cf - testlogs-%{_target_platform}-%{version}-%{release} | bzip2 -9c \
97046b
  | uuencode testlogs-%{_target_platform}.tar.bz2 || :
97046b
rm -rf testlogs-%{_target_platform}-%{version}-%{release}
97046b
97046b
%clean
97046b
rm -rf %{buildroot}
97046b
97046b
%files
97046b
%defattr(-,root,root,-)
97046b
%dir %{_root_prefix}
97046b
%dir %{_root_prefix}/%{_lib}
97046b
%{_root_prefix}/%{_lib}/compat-sap-c++-%{gcc_version}.so
97046b
%{_root_prefix}/%{_lib}/compat-sap-c++-7.so
97046b
%{_root_prefix}/%{_lib}/README
97046b
97046b
%changelog
97046b
* Tue Nov 28 2017 Marek Polacek <polacek@redhat.com> 7.2.1-2
97046b
- clean up RPM dependencies (#1491573)
97046b
- include gcc -v output in the README file (#1491594)
97046b
97046b
* Wed Nov 22 2017 Marek Polacek <polacek@redhat.com> 7.2.1-1
97046b
- new package