Пакет liblfortran7: Specfile

%global _unpackaged_files_terminate_build 1

# I'm putting here the GCC version this lib is based on
# (and the corresponding lcc is claimed to be compatible with;
# as printed by gcc --version):
%global compat_gcc_branch 7
%global compat_gcc_version 7.3

%global lcc_branch 1.25
%global sover 3

Name:     liblfortran%compat_gcc_branch
Version:  %{lcc_branch}.09
Release:  alt2

Summary:  The GNU Fortran runtime library for lcc
License:  GPL-3.0-or-later with GCC-exception-3.1
Group:    System/Libraries
Url:      http://www.mcst.ru/
Packager: Andrew Savchenko <bircoph@altlinux.org>

Source0:  liblfortran.tar
Source1:  libgfortran.so
Source2:  libgfortran.a

ExclusiveArch: %e2k

BuildRequires: gcc-fortran libquadmath-devel >= 1.24.07
BuildRequires: rpm-build >= 4.0.4-alt139.E2K.2

%package -n liblfortran%sover
Summary:  The GNU Fortran runtime library for lcc
Group:    System/Libraries
Requires: liblfortran%sover
Provides: libgfortran%sover
Obsoletes: libfcc2

%package -n liblfortran%compat_gcc_branch-devel
Summary:  The GNU Fortran runtime library for lcc devel files
Group:    System/Libraries
Requires: liblfortran%sover libquadmath-devel
Provides: libgfortran%compat_gcc_branch-devel
Obsoletes: libfcc-devel

%package -n liblfortran%compat_gcc_branch-devel-static
Summary:  The GNU Fortran runtime library for lcc static library
Group:    System/Libraries
Requires: liblfortran%compat_gcc_branch-devel libquadmath-devel-static
Provides: libgfortran%compat_gcc_branch-devel-static
Obsoletes: libfcc-devel-static

%global liblfortran_desc the GNU Fortran runtime library \
for the lcc on e2k architecture.

# Doesn't produce a binary rpm, only for the src.rpm:
%description
This package contains %liblfortran_desc

%description -n liblfortran%sover
This package contains  %liblfortran_desc

%description -n liblfortran%compat_gcc_branch-devel
This package contains devel files of %liblfortran_desc

%description -n liblfortran%compat_gcc_branch-devel-static
This package contains static version of %liblfortran_desc

%prep
%setup -n liblfortran

%build
# К CFLAGS принудительно добавляем -fvisibility=protected (см. bug #81005)
%add_optflags -fvisibility=protected
# См. bug #61640
# Для lfortran'а принудительно взведён режим с контролем выравнивания,
# а потому библиотеку можно собирать в режиме -faligned
%add_optflags -faligned
export LDFLAGS="%optflags"

%configure \
  --includedir=%_includedir/finclude \
  --enable-shared

%make_build

%install
%makeinstall_std
# fix installation symlink to point to soname instead of sofull
rm %buildroot%_libdir/liblfortran.so
ln -s liblfortran.so.%sover %buildroot%_libdir/liblfortran.so

cp %SOURCE1 %SOURCE2 %buildroot%_libdir/

%files -n liblfortran%sover
%_libdir/*.so.%{sover}*

%files -n liblfortran%compat_gcc_branch-devel
%_includedir/*
%_libdir/*.so
%_libdir/*.spec
%_libdir/libcaf_single.a

%files -n liblfortran%compat_gcc_branch-devel-static
%_libdir/liblfortran.a
%_libdir/libgfortran.a

%changelog
* Sat May 01 2021 Andrew Savchenko <bircoph@altlinux.org> 1.25.09-alt2
- Add Obsoletes for gcc compat branch 5.

* Tue Oct 06 2020 Andrew Savchenko <bircoph@altlinux.org> 1.25.09-alt1
- Update to MCST version 1.25.09.

* Wed Sep 09 2020 Andrew Savchenko <bircoph@altlinux.org> 1.25.08-alt1
- Update to MCST version 1.25.08:
  - Support MCST_E2K_SUPPORT_FFE_EXCEPTIONS env var which must be
    set for ieee_exceptions Fortran module to work correctly.

* Tue Jul 28 2020 Andrew Savchenko <bircoph@altlinux.org> 1.25.06-alt1
- Update to MCST version 1.25.06.

* Tue Jun 23 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.11-alt2
- Fix package description.

* Wed Jun 17 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.11-alt1
- Update to MCST version 1.24.11

* Wed Jun 17 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt7
- Debootstrap: add libfcc2 obsoletion.

* Fri Jun 05 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt6
- Remove libfcc2 obsoletion for Fortran bootstrap.

* Fri May 29 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt5
- Remove FCFLAGS cludge as rpm-build is fixed now.

* Thu May 28 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt4
- Properly export Fortran flags.

* Tue May 26 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt3
- Source build.

* Mon May 18 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt2
- Debootstrap libquadmath-devel* deps: depend on meta packages.

* Thu May 14 2020 Andrew Savchenko <bircoph@altlinux.org> 1.24.07-alt1
- Initial version for lcc-1.24.07.