flang/flang.spec
2022-09-09 09:48:45 +02:00

321 lines
9.5 KiB
RPMSpec

%global maj_ver 15
%global min_ver 0
%global patch_ver 0
#global rc_ver 3
%global flang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global flang_srcdir flang-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src
Name: flang
Version: %{flang_version}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Summary: a Fortran language front-end designed for integration with LLVM
License: ASL 2.0 with exceptions
URL: https://flang.llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/%{flang_srcdir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/%{flang_srcdir}.tar.xz.sig
Source2: release-keys.asc
# flang depends on one internal clang tablegen file for documentation generation.
Source3: https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/clang/include/clang/Driver/Options.td
# Needed for documentation generation
Patch1: 0001-PATCH-flang-Disable-use-of-sphinx_markdown_tables.patch
Patch2: link-against-libclang-cpp.patch
# TODO: Can be dropped for LLVM 16. The first one is a plain backport, and the second
# one has been upstreamed as https://reviews.llvm.org/D131475.
Patch3: 0001-flang-docs-nfc-Refine-FlangOptionsDocs.td.patch
Patch4: 0001-Use-find_program-for-clang-tblgen.patch
# Avoid gcc reaching 4GB of memory on 32-bit targets and also running out of
# memory on builders with many CPUs.
%global _lto_cflags %{nil}
%global _smp_mflags -j1
# We don't produce debug info on ARM to avoid OOM during the build.
%ifarch %{arm}
%global debug_package %{nil}
%endif
# Link error on that target
ExcludeArch: i686
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: zlib-devel
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-test = %{version}
BuildRequires: llvm-googletest = %{version}
BuildRequires: mlir-devel = %{version}
BuildRequires: ninja-build
BuildRequires: python3-lit >= 12.0.0
BuildRequires: python3-sphinx
BuildRequires: python3-recommonmark
# The new flang drive requires clang-devel
BuildRequires: clang-devel = %{version}
# For origin certification
BuildRequires: gnupg2
%description
Flang is a ground-up implementation of a Fortran front end written in modern
C++.
%package devel
Summary: Flang header files
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Flang header files.
%package doc
Summary: Documentation for Flang
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description doc
Documentation for Flang
%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup -n %{flang_srcdir} -p2
# Copy Options.td for docs generation
mkdir -p ../clang/include/clang/Driver
cp %{SOURCE3} ../clang/include/clang/Driver
%build
%cmake -GNinja \
-DMLIR_TABLEGEN_EXE=%{_bindir}/mlir-tblgen \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_RPATH=";" \
-DCLANG_DIR=%{_libdir}/cmake/clang \
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
-DCMAKE_PREFIX_PATH=%{_libdir}/cmake/llvm/ \
\
-DFLANG_INCLUDE_DOCS:BOOL=ON \
-DLLVM_ENABLE_SPHINX:BOOL=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \
\
%if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64
%else
-DLLVM_LIBDIR_SUFFIX=
%endif
# Avoid gcc reaching 4GB of memory
%ifarch %{ix86} s390x
sed -i -e 's/-g /-g1 /g' -e 's/-O2/-O1/g' %{__cmake_builddir}/build.ninja
%endif
# On ARM, disable debuginfo entirely to avoid OOM.
%ifarch %{arm}
sed -i -e 's/-g /-g0 /g' -e 's/-O2/-O1/g' %{__cmake_builddir}/build.ninja
%endif
export LD_LIBRARY_PATH=%{_builddir}/%{flang_srcdir}/%{_build}/lib
%cmake_build
%cmake_build --target docs-flang-html
%install
%cmake_install
# this is a test binary
rm -f %{buildroot}%{_bindir}/f18-parse-demo
install -d %{buildroot}%{_pkgdocdir}/html
cp -r %{_vpath_builddir}/docs/html/* %{buildroot}%{_pkgdocdir}/html/
%check
# Assertion failure: lib/Semantics/canonicalize-acc.cpp:93
# /usr/include/c++/11/optional:447: constexpr const _Tp& std::_Optional_base_impl<_Tp, _Dp>::_M_get() const [with _Tp = Fortran::parser::DoConstruct; _Dp = std::_Optional_base<Fortran::parser::DoConstruct, false, false>]: Assertion 'this->_M_is_engaged()' failed.
rm test/Semantics/OpenACC/acc-canonicalization-validity.f90
%ifarch s390x
rm test/Evaluate/folding07.f90
rm test/Evaluate/fold-nearest.f90
# s390x is not yet supported as a lowering target, so remove all related tests.
rm -rf test/Driver/
rm -rf test/Fir/
rm -rf test/Lower/
%endif
# These tests fail on 32-bit targets.
%ifarch %{ix86} %{arm}
rm -f test/Fir/fir-ops.fir
rm -f test/Semantics/assign03.f90
rm -f test/Semantics/data05.f90
rm -f test/Semantics/offsets01.f90
rm -f test/Semantics/offsets02.f90
rm -f test/Semantics/typeinfo01.f90
rm -f test/Semantics/spec-expr.f90
rm -f test/Evaluate/folding19.f90
%endif
export LD_LIBRARY_PATH=%{_builddir}/%{flang_srcdir}/%{_build}/lib
%cmake_build --target check-flang
%files
%license LICENSE.TXT
%{_bindir}/tco
%{_bindir}/bbc
%{_bindir}/flang-to-external-fc
%{_bindir}/fir-opt
%{_bindir}/flang-new
%{_libdir}/libFortranLower.so.%{maj_ver}*
%{_libdir}/libFortranSemantics.so.%{maj_ver}*
%{_libdir}/libFortranCommon.so.%{maj_ver}*
%{_libdir}/libFortranRuntime.so.%{maj_ver}*
%{_libdir}/libFortranDecimal.so.%{maj_ver}*
%{_libdir}/libFortranEvaluate.so.%{maj_ver}*
%{_libdir}/libFortranParser.so.%{maj_ver}*
%{_libdir}/libflangFrontend.so.%{maj_ver}*
%{_libdir}/libflangFrontendTool.so.%{maj_ver}*
%{_libdir}/libFIRBuilder.so.%{maj_ver}
%{_libdir}/libFIRCodeGen.so.%{maj_ver}
%{_libdir}/libFIRDialect.so.%{maj_ver}
%{_libdir}/libFIRSupport.so.%{maj_ver}
%{_libdir}/libFIRTransforms.so.%{maj_ver}
%files devel
%{_libdir}/libFortranLower.so
%{_libdir}/libFortranParser.so
%{_libdir}/libFortranCommon.so
%{_libdir}/libFortranSemantics.so
%{_libdir}/libFortran_main.a
%{_libdir}/libFIRBuilder.so
%{_libdir}/libFIRCodeGen.so
%{_libdir}/libFIRDialect.so
%{_libdir}/libFIRSupport.so
%{_libdir}/libFIRTransforms.so
%{_libdir}/libFortranDecimal.so
%{_libdir}/libFortranRuntime.so
%{_libdir}/libFortranEvaluate.so
%{_libdir}/libflangFrontend.so
%{_libdir}/libflangFrontendTool.so
%{_includedir}/flang
%{_libdir}/cmake/
%files doc
%dir %{_pkgdocdir}
%doc %{_pkgdocdir}/html/
%changelog
* Tue Sep 06 2022 Nikita Popov <npopov@redhat.com> - 15.0.0-1
- Update to LLVM 15.0.0
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 14.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 20 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.5-1
- Update to 14.0.5
* Thu Mar 24 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.0-1
- Update to 14.0.0
* Tue Feb 08 2022 Nikita Popov <npopov@redhat.com> - 13.0.1-2
- Enable arm build, now that mlir supports arm
* Thu Feb 03 2022 Nikita Popov <npopov@redhat.com> - 13.0.1-1
- Update to LLVM 13.0.1 final
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 13.0.1~rc2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jan 14 2022 Nikita Popov <npopov@redhat.com> - 13.0.1~rc2-1
- Update to LLVM 13.0.1rc2
* Wed Jan 12 2022 Nikita Popov <npopov@redhat.com> - 13.0.1~rc1-1
- Update to LLVM 13.0.1rc1
* Fri Oct 01 2021 Tom Stellard <tstellar@rehat.com> - 13.0.0-1
- 13.0.0 Release
* Tue Sep 21 2021 Tom Stellard <tstlelar@redhat.com> - 13.0.1~rc3-1
- 13.0.0-rc3 Release
* Mon Aug 09 2021 Tom Stellard <tstellar@redhat.com> - 13.0.1~rc1-1
- 13.0.0-rc1 Release
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 12.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jul 14 2021 Tom Stellard <tstellar@redhat.com> - 12.0.1-1
- 12.0.1 Release
* Wed Jun 30 2021 Tom Stellard <tstellar@redhat.com> - 12.0.1~rc3-1
- 12.0.1-rc3 Release
* Thu Jun 03 2021 Tom Stellard <tstellar@redhat.com> - 12.0.1~rc1-1
- 12.0.1-rc1 Release
* Fri Apr 16 2021 Tom Stellard <tstellar@redhat.com> - 12.0.0-1
- 12.0.0 Release
* Thu Apr 08 2021 sguelton@redhat.com - 12.0.0-0.6.rc5
- New upstream release candidate
* Fri Apr 02 2021 sguelton@redhat.com - 12.0.0-0.5.rc4
- New upstream release candidate
* Thu Mar 11 2021 sguelton@redhat.com - 12.0.0-0.4.rc3
- LLVM 12.0.0 rc3
* Wed Mar 10 2021 sguelton@redhat.com - 12.0.0-0.3.rc2
- rebuilt
* Wed Feb 24 2021 sguelton@redhat.com - 12.0.0-0.2.rc2
- 12.0.0-rc2 Release
* Fri Feb 19 2021 Tom Stellard <tsellar@redhat.com> - 12.0.0-0.1.rc1
- 12.0.0-rc1 Release
* Wed Feb 10 2021 Jeff Law <law@redhat.com> - 11.1.0-0.3.rc1
- Fix missing #include for gcc-11
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 11.1.0-0.2.rc1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 14 2021 Serge Guelton - 11.1.0-0.1.rc1
- 11.1.0-rc1 release
* Wed Jan 06 2021 Serge Guelton - 11.0.1-3
- LLVM 11.0.1 final
* Tue Dec 22 2020 sguelton@redhat.com - 11.0.1-2.rc2
- llvm 11.0.1-rc2
* Tue Dec 01 2020 sguelton@redhat.com - 11.0.1-1.rc1
- llvm 11.0.1-rc1
* Thu Oct 15 2020 sguelton@redhat.com - 11.0.0-1
- Fix NVR
* Mon Oct 12 2020 sguelton@redhat.com - 11.0.0-0.5
- llvm 11.0.0 - final release
* Thu Oct 08 2020 sguelton@redhat.com - 11.0.0-0.4.rc6
- 11.0.0-rc6
* Fri Oct 02 2020 sguelton@redhat.com - 11.0.0-0.3.rc5
- 11.0.0-rc5 Release
* Sun Sep 27 2020 sguelton@redhat.com - 11.0.0-0.2.rc3
- Fix NVR
* Thu Sep 24 2020 sguelton@redhat.com - 11.0.0-0.1.rc3
- 11.0.0-rc3 Release
* Tue Sep 01 2020 sguelton@redhat.com - 11.0.0-0.1.rc2
- Initial version.