File gcc9.spec of Package gcc-9.2

%define major_version 9
%define lib_path     /usr/%{_lib}
%define include_path /usr/include
%define share_path   /usr/share

Name:           gcc%{major_version}
Version:        %{major_version}.2.0
Release:        0
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Summary:        GCC 9.2
Url:            https://gcc.gnu.org/gcc-9
BuildRequires:  gcc-c++ mpfr-devel gmp-devel
Source0:        gcc-%{version}.tar.gz
Source1:        mpc-1.0.3.tar.gz
BuildRoot:      %{_tmppath}
Provides:       gcc = %{version} gcc-c++ = %{version} gfortran = %{version}
Provides:       gcc-devel = %{version} gcc-c++-devel = %{version} gfortran-devel = %{version}

%package -n gcc%{major_version}-devel
Summary:        Headers of gcc
Requires:       gcc9 = %{version}

%description -n gcc%{major_version}-devel
A compiler system produced by the GNU Project supporting various programming languages. 

%description
A compiler system produced by the GNU Project supporting various programming languages. 

%prep
%setup -b 1 -q -n mpc-1.0.3
./configure --disable-shared --enable-static --prefix=/tmp/gcc --disable-multilib
make
make install
mkdir -p %{buildroot}%{include_path} %{buildroot}%{lib_path} %{buildroot}%{share_path}
%setup -q -n gcc-%{version}

%build
./configure \
  --disable-shared \
  --disable-bootstrap \
  --disable-libstdcxx-pch \
  --disable-multilib \
  --enable-languages=c,c++,fortran \
  --enable-libgomp \
  --enable-lto \
  --enable-threads=posix \
  --enable-tls \
  --with-mpc=/tmp/gcc \
  --libdir=%{lib_path} \
  --prefix=/usr
make

%install
%make_install
rm -rf %{buildroot}%{share_path}/info/dir #conflicts with info-5.1-5.el7.x86_64

%files
/usr/bin/*

%{lib_path}/libasan.a
%{lib_path}/libasan.la
%{lib_path}/libasan_preinit.o
%{lib_path}/libatomic.a
%{lib_path}/libatomic.la
%{lib_path}/libcc1.la
%{lib_path}/libcc1.so.0
%{lib_path}/libcc1.so.0.0.0
%{lib_path}/libgfortran.a
%{lib_path}/libgfortran.la
%{lib_path}/libgfortran.spec
%{lib_path}/libgomp.a
%{lib_path}/libgomp.la
%{lib_path}/libgomp.spec
%{lib_path}/libitm.a
%{lib_path}/libitm.la
%{lib_path}/libitm.spec
%{lib_path}/liblsan.a
%{lib_path}/liblsan.la
%{lib_path}/liblsan_preinit.o
%{lib_path}/libquadmath.a
%{lib_path}/libquadmath.la
%{lib_path}/libsanitizer.spec
%{lib_path}/libssp.a
%{lib_path}/libssp.la
%{lib_path}/libssp_nonshared.a
%{lib_path}/libssp_nonshared.la
%{lib_path}/libstdc++.a
%{lib_path}/libstdc++.a-gdb.py
%{lib_path}/libstdc++.la
%{lib_path}/libstdc++fs.a
%{lib_path}/libstdc++fs.la
%{lib_path}/libsupc++.a
%{lib_path}/libsupc++.la
%{lib_path}/libtsan.a
%{lib_path}/libtsan.la
%{lib_path}/libtsan_preinit.o
%{lib_path}/libubsan.a
%{lib_path}/libubsan.la
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtbeginS.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtbeginT.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtend.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtendS.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtfastmath.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtprec32.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtprec64.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtprec80.o
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/libcaf_single.a
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/libcaf_single.la
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/libgcc.a
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/libgcov.a
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/gtype.state
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcp1plugin.la
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcc1plugin.so.0
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcc1plugin.so.0.0.0
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcc1plugin.la
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcp1plugin.so.0
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcp1plugin.so.0.0.0
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/crtbegin.o
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/cc1
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/cc1plus
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/collect2
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/f951
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/install-tools/fixinc.sh
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/install-tools/fixincl
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/install-tools/mkheaders
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/install-tools/mkinstalldirs
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/liblto_plugin.la
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/liblto_plugin.so.0
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/liblto_plugin.so.0.0.0
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto1
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/gengtype

%{share_path}/*

%files -n gcc%{major_version}-devel
%{include_path}/c++/9.2.0/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/finclude/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/include-fixed/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/include/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/install-tools/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/include/*
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcp1plugin.so
%{lib_path}/gcc/x86_64-pc-linux-gnu/9.2.0/plugin/libcc1plugin.so
%{lib_path}/libcc1.so
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/liblto_plugin.so


%clean
rm -rf *

# after install
%post
/sbin/ldconfig   

%post -n gcc%{major_version}-devel
/sbin/ldconfig

# after uninstall
%postun
/sbin/ldconfig

%postun -n gcc%{major_version}-devel
/sbin/ldconfig

%changelog