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

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