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

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