Initial version.

This commit is contained in:
serge-sans-paille 2020-09-14 11:59:22 +00:00
parent 19ea3955f7
commit 755558b0b6
7 changed files with 254 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/flang-11.0.0rc2.src.tar.xz
/flang-11.0.0rc2.src.tar.xz.sig

173
flang.spec Normal file
View File

@ -0,0 +1,173 @@
%global rc_ver 2
%global baserelease 0.1
%global flang_srcdir flang-%{version}%{?rc_ver:rc%{rc_ver}}.src
%global maj_ver 11
%global min_ver 0
%global patch_ver 0
Name: flang
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
Summary: a Fortran language front-end designed for integration with LLVM
License: ASL 2.0 with exceptions
URL: https://github.com/llvm/llvm-project/tree/master/flang
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{flang_srcdir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{flang_srcdir}.tar.xz.sig
Source2: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc
# Otherwise fails when compiling with _GLIBCXX_DEBUG is defined.
Patch0: token-sequence.patch
# Needed to compile in shared libs mode.
Patch1: shared.patch
# Needed for llvm-googletest compatibility
Patch2: gtest.patch
# because mlir doesn't build on arm (yet)
ExcludeArch: armv7hl
# Avoid gcc reaching 4GB of memory
%ifarch %{ix86} s390x
%global _lto_cflags %{nil}
%global _smp_mflags -j1
%endif
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
BuildRequires: python3-sphinx
# 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} -p1
%build
%cmake -GNinja \
-DMLIR_TABLEGEN_EXE=%{_bindir}/mlir-tblgen \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_RPATH=";" \
-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' %{_builddir}/%{flang_srcdir}/%{_build}/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/
chmod 0755 %{buildroot}%{_bindir}/flang
%check
# these tests fail on all or specific arches
rm test/Semantics/resolve63.f90
%ifarch s390x
rm test/Evaluate/folding07.f90
%endif
%ifarch %{ix86}
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
%endif
export LD_LIBRARY_PATH=%{_builddir}/%{flang_srcdir}/%{_build}/lib
%cmake_build --target check-flang
%files
%license LICENSE.txt
%{_bindir}/f18
%{_bindir}/tco
%{_bindir}/flang
%{_libdir}/libFortranLower.so.%{maj_ver}
%{_libdir}/libFIROptimizer.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}
%files devel
%{_libdir}/libFortranLower.so
%{_libdir}/libFortranParser.so
%{_libdir}/libFortranCommon.so
%{_libdir}/libFortranSemantics.so
%{_libdir}/libFIROptimizer.so
%{_libdir}/libFortranDecimal.so
%{_libdir}/libFortranRuntime.so
%{_libdir}/libFortranEvaluate.so
%{_includedir}/flang
%{_libdir}/cmake/
%files doc
%dir %{_pkgdocdir}
%doc %{_pkgdocdir}/html/
%changelog
* Tue Sep 01 2020 sguelton@redhat.com - 11.0.0-0.1.rc2
- Initial version.

BIN
gtest.patch Normal file

Binary file not shown.

52
hans-gpg-key.asc Normal file
View File

@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFS+1SABEACnmkESkY7eZq0GhDjbkWpKmURGk9+ycsfAhA44NqUvf4tk1GPM
5SkJ/fYedYZJaDVhIp98fHgucD0O+vjOzghtgwtITusYjiPHPFBd/MN+MQqSEAP+
LUa/kjHLjgyXxKhFUIDGVaDWL5tKOA7/AQKl1TyJ8lz89NHQoUHFsF/hu10+qhJe
V65d32MXFehIUSvegh8DrPuExrliSiORO4HOhuc6151dWA4YBWVg4rX5kfKrGMMT
pTWnSS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ZT
eXFPogYkF2j3VWg8s9UmAs4sg/4a+9KLSantXjX+JFsRv0lQe5Gr/Vl8VQ4LKEXB
fiGmSivjIZ7eopdd3YP2w6G5T3SA4d2CQfsg4rnJPnXIjzKNiSOi368ybnt9fL0Y
2r2aqLTmP6Y7issDUO+J1TW1XHm349JPR0Hl4cTuNnWm4JuX2m2CJEc5XBlDAha9
pUVs+J5C2D0UFFkyeOzeJPwy6x5ApWHm84n8AjhQSpu1qRKxKXdwei6tkQWWMHui
+TgSY/zCkmD9/oY15Ei5avJ4WgIbTLJUoZMi70riPmU8ThjpzA7S+Nk0g7rMPq+X
l1whjKU/u0udlsrIJjzkh6ftqKUmIkbxYTpjhnEujNrEr5m2S6Z6x3y9E5QagBMR
dxRhfk+HbyACcP/p9rXOzl4M291DoKeAAH70GHniGxyNs9rAoMr/hD5XW/Wrz3dc
KMc2s555E6MZILE2ZiolcRn+bYOMPZtWlbx98t8uqMf49gY4FGQBZAwPglMrx7mr
m7HTIiXahThQGOJg6izJDAD5RwSEGlAcL28T8KAuM6CLLkhlBfQwiKsUBNnh9r8w
V3lB+pV0GhL+3i077gTYfZBRwLzjFdhm9xUKEaZ6rN1BX9lzix4eSNK5nln0jUq1
67H2IH//2sf8dw==
=ADVe
-----END PGP PUBLIC KEY BLOCK-----

12
shared.patch Normal file
View File

@ -0,0 +1,12 @@
diff -Naur flang-11.0.0rc2.src/CMakeLists.txt flang-11.0.0rc2.src.cmake/CMakeLists.txt
--- flang-11.0.0rc2.src/CMakeLists.txt 2020-08-20 16:24:59.000000000 +0000
+++ flang-11.0.0rc2.src.cmake/CMakeLists.txt 2020-09-03 13:44:24.226776260 +0000
@@ -199,8 +199,6 @@
# Always build tco tool
set(LLVM_BUILD_TOOLS ON)
message(STATUS "Linking driver with FIR and LLVM")
- llvm_map_components_to_libnames(LLVM_COMMON_LIBS support)
- message(STATUS "LLVM libraries: ${LLVM_COMMON_LIBS}")
endif()
# Add Flang-centric modules to cmake path.

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (flang-11.0.0rc2.src.tar.xz) = ec5aaafe51bf4e0844cbd70320770c583a505c5e00b109fd5c87a04f16ea01341d4b48fc775ba911483bc3effebdda20852be70a9f61b9fed58f3f5421fdf15f
SHA512 (flang-11.0.0rc2.src.tar.xz.sig) = e02e397ce84ed1c0879b128d9f478f828c2d640fa4bdd41855b58373edf76baf906ef3ea17f2c4bb69c2e4d444ed6cddaf86f4a416e10490bf2adfc1dcf0bc16

13
token-sequence.patch Normal file
View File

@ -0,0 +1,13 @@
diff -Naur flang-11.0.0rc2.src.orig/lib/Parser/token-sequence.cpp flang-11.0.0rc2.src/lib/Parser/token-sequence.cpp
--- flang-11.0.0rc2.src.orig/lib/Parser/token-sequence.cpp 2020-09-03 12:01:15.278223312 +0000
+++ flang-11.0.0rc2.src/lib/Parser/token-sequence.cpp 2020-09-03 12:51:40.082870848 +0000
@@ -134,7 +134,8 @@
std::size_t atToken{0};
for (std::size_t j{0}; j < chars;) {
std::size_t nextStart{atToken + 1 < tokens ? start_[++atToken] : chars};
- char *p{&char_[j]}, *limit{&char_[nextStart]};
+ char *p{&char_[j]};
+ char const* limit{char_.data() + nextStart};
j = nextStart;
if (IsDecimalDigit(*p)) {
while (p < limit && IsDecimalDigit(*p)) {