2020-05-16 20:46:40 +03:00
|
|
|
# libLLVM-*.so are unversioned libraries
|
|
|
|
%global __requires_exclude ^devel\\(.*$
|
|
|
|
|
2019-04-29 18:42:02 +00:00
|
|
|
#%%define _disable_ld_no_undefined 0
|
2020-02-14 00:29:26 +03:00
|
|
|
%define debugcflags %%{nil}
|
|
|
|
%define debug_package %{nil}
|
2012-02-01 14:58:10 +04:00
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
# clang header paths are hard-coded at compile time
|
|
|
|
# and need adjustment whenever there's a new GCC version
|
|
|
|
%define gcc_version %(gcc -dumpversion)
|
|
|
|
|
2012-02-01 14:58:10 +04:00
|
|
|
%define compile_apidox 0
|
|
|
|
%{?_with_apidox: %{expand: %%global compile_apidox 1}}
|
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
%bcond_without clang
|
|
|
|
|
2022-05-02 01:41:05 +03:00
|
|
|
%define maj_ver 12
|
|
|
|
%define major_ver %{maj_ver}.0
|
|
|
|
%define minor_ver 1
|
2014-12-19 11:29:21 +03:00
|
|
|
|
2021-06-12 03:17:36 +03:00
|
|
|
%define major %{major_ver}
|
|
|
|
%define lto_major %{maj_ver}
|
2018-05-27 03:29:05 +10:00
|
|
|
%define libname %mklibname %{name} %{major}
|
|
|
|
%define liblto %mklibname lto %{lto_major}
|
|
|
|
%define devname %mklibname %{name} -d
|
|
|
|
|
2021-06-12 03:17:36 +03:00
|
|
|
%define clang_major %{major_ver}
|
2018-05-27 03:29:05 +10:00
|
|
|
%define libclang %mklibname clang %{clang_major}
|
|
|
|
%define devclang %mklibname clang -d
|
|
|
|
|
2020-02-13 21:16:19 +03:00
|
|
|
%bcond_without git
|
2019-09-23 01:17:18 +03:00
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
Summary: Low Level Virtual Machine (LLVM)
|
|
|
|
Name: llvm
|
2021-06-12 03:17:36 +03:00
|
|
|
Version: %{major_ver}.%{minor_ver}
|
2022-03-17 12:58:15 +03:00
|
|
|
Release: 1
|
2014-12-19 11:29:21 +03:00
|
|
|
License: NCSA
|
|
|
|
Group: Development/Other
|
2022-03-17 12:58:15 +03:00
|
|
|
URL: https://llvm.org
|
2016-09-11 17:18:35 +03:00
|
|
|
|
2019-09-23 01:17:18 +03:00
|
|
|
%if %{with git}
|
2019-08-12 15:33:29 +03:00
|
|
|
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz
|
2020-02-13 21:16:19 +03:00
|
|
|
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/clang-%{version}.src.tar.xz
|
2019-08-12 15:33:29 +03:00
|
|
|
Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/clang-tools-extra-%{version}.src.tar.xz
|
|
|
|
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/polly-%{version}.src.tar.xz
|
|
|
|
Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/compiler-rt-%{version}.src.tar.xz
|
2019-09-23 01:17:18 +03:00
|
|
|
%else
|
|
|
|
Source0: http://releases.llvm.org/%{version}/llvm-%{version}.src.tar.xz
|
2020-02-13 21:16:19 +03:00
|
|
|
Source1: http://releases.llvm.org/%{version}/clang-%{version}.src.tar.xz
|
2019-09-23 01:17:18 +03:00
|
|
|
Source2: http://releases.llvm.org/%{version}/clang-tools-extra-%{version}.src.tar.xz
|
|
|
|
Source3: http://releases.llvm.org/%{version}/polly-%{version}.src.tar.xz
|
|
|
|
Source4: http://releases.llvm.org/%{version}/compiler-rt-%{version}.src.tar.xz
|
|
|
|
%endif
|
2014-12-19 11:29:21 +03:00
|
|
|
Source1000: llvm.rpmlintrc
|
2018-12-11 20:33:16 +03:00
|
|
|
Source1010: clang-gcc-wrapper.macros
|
|
|
|
Source1011: clang-gcc-wrapper.sh
|
2016-09-11 17:18:35 +03:00
|
|
|
|
2020-08-14 11:56:39 +03:00
|
|
|
# Adjust the search paths to match the OS, adjust the default compiler flags
|
|
|
|
# as well.
|
|
|
|
Patch1: clang-rosa.patch
|
2016-05-15 22:43:52 +03:00
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: binutils-devel
|
2019-04-29 14:52:17 +03:00
|
|
|
BuildRequires: bison
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: chrpath
|
2019-04-29 14:52:17 +03:00
|
|
|
BuildRequires: cmake
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: flex
|
|
|
|
BuildRequires: graphviz
|
|
|
|
BuildRequires: groff
|
2019-04-29 14:52:17 +03:00
|
|
|
BuildRequires: libstdc++-devel
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: libtool
|
2019-04-29 14:52:17 +03:00
|
|
|
BuildRequires: pkgconfig(libffi)
|
|
|
|
BuildRequires: pkgconfig(libtirpc)
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: sed
|
|
|
|
BuildRequires: tcl
|
|
|
|
BuildRequires: zip
|
2022-05-02 01:19:32 +03:00
|
|
|
#if %{version} <= 11
|
2022-05-02 03:03:33 +03:00
|
|
|
BuildRequires: pkgconfig(python3)
|
2022-05-02 01:19:32 +03:00
|
|
|
#else
|
2022-05-02 03:03:33 +03:00
|
|
|
#BuildRequires: python38
|
2022-05-02 01:19:32 +03:00
|
|
|
#endif
|
|
|
|
|
2012-02-01 14:58:10 +04:00
|
|
|
%if %{compile_apidox}
|
2014-12-19 11:29:21 +03:00
|
|
|
BuildRequires: doxygen
|
2012-02-01 14:58:10 +04:00
|
|
|
%endif
|
2014-12-19 11:29:21 +03:00
|
|
|
Requires: libstdc++-devel
|
2021-11-01 13:55:44 +00:00
|
|
|
Requires: lld
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%description
|
|
|
|
LVM is a robust system, particularly well suited for developing new mid-level
|
|
|
|
language-independent analyses and optimizations of all sorts, including those
|
|
|
|
that require extensive interprocedural analysis. LLVM is also a great target
|
|
|
|
for front-end development for conventional or research programming languages,
|
2015-11-24 16:25:55 +03:00
|
|
|
including those which require compile-time, link-time, or run-time optimization
|
|
|
|
for effective implementation, proper tail calls or garbage collection.
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%files
|
|
|
|
%doc LICENSE.TXT
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/FileCheck
|
2012-02-01 14:58:10 +04:00
|
|
|
%{_bindir}/bugpoint
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/count
|
2019-03-22 12:55:58 +03:00
|
|
|
%{_bindir}/dsymutil
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_bindir}/find-all-symbols
|
2012-02-01 14:58:10 +04:00
|
|
|
%{_bindir}/llc
|
|
|
|
%{_bindir}/lli
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/lli-child-target
|
2018-04-23 15:41:27 +03:00
|
|
|
%{_bindir}/llvm*
|
|
|
|
%exclude %{_bindir}/llvm-config
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_bindir}/modularize
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/not
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_bindir}/obj2yaml
|
|
|
|
%{_bindir}/opt
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_bindir}/sancov
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_bindir}/sanstats
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/split-file
|
2015-11-24 16:25:55 +03:00
|
|
|
%{_bindir}/verify-uselistorder
|
2021-07-13 23:43:48 +03:00
|
|
|
%{_bindir}/yaml-bench
|
2015-11-24 16:25:55 +03:00
|
|
|
%{_bindir}/yaml2obj
|
2018-04-23 15:41:27 +03:00
|
|
|
%{_datadir}/opt-viewer
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
2016-06-07 22:37:40 +10:00
|
|
|
%define plugins %mklibname %{name}-plugins
|
|
|
|
|
|
|
|
%package -n %{plugins}
|
|
|
|
Summary: LLVM plugins
|
|
|
|
Group: System/Libraries
|
|
|
|
Provides: %{name}-plugins = %{EVRD}
|
|
|
|
Conflicts: %{_lib}llvm3.8 < 3.8.0-2
|
|
|
|
Conflicts: %{_lib}llvm-devel < 3.8.0-2
|
|
|
|
|
|
|
|
%description -n %{plugins}
|
|
|
|
LLVM plugins.
|
|
|
|
|
|
|
|
%files -n %{plugins}
|
2019-04-29 21:37:07 +03:00
|
|
|
%{_libdir}/BugpointPasses.so
|
|
|
|
%{_libdir}/LLVMHello.so
|
2016-06-07 22:37:40 +10:00
|
|
|
%{_libdir}/LLVMgold.so
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
%package -n %{libname}
|
|
|
|
Summary: LLVM shared libraries
|
|
|
|
Group: System/Libraries
|
2016-06-07 22:37:40 +10:00
|
|
|
Requires: %{plugins}
|
2014-12-19 11:29:21 +03:00
|
|
|
Conflicts: llvm < 3.0-4
|
|
|
|
|
|
|
|
%description -n %{libname}
|
|
|
|
Shared libraries for the LLVM compiler infrastructure. This is needed by
|
|
|
|
programs that are dynamically linked against libLLVM.
|
|
|
|
|
|
|
|
%files -n %{libname}
|
2021-06-12 03:17:36 +03:00
|
|
|
%{_libdir}/libLLVM-%{maj_ver}.so
|
2016-01-18 16:34:31 +03:00
|
|
|
%{_libdir}/libLLVM-%{major}.%{minor_ver}.so
|
2012-02-01 14:58:10 +04:00
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
2018-05-27 00:06:25 +10:00
|
|
|
%package -n %{liblto}
|
|
|
|
Summary: LLVM shared library
|
|
|
|
Group: System/Libraries
|
|
|
|
Conflicts: %{_lib}llvm-plugins < 6.0.0-3
|
|
|
|
|
|
|
|
%description -n %{liblto}
|
|
|
|
Shared library for the LLVM compiler infrastructure.
|
|
|
|
|
|
|
|
%files -n %{liblto}
|
2018-05-27 03:29:05 +10:00
|
|
|
%{_libdir}/libLTO.so.%{lto_major}*
|
2018-05-27 00:06:25 +10:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
%package -n %{devname}
|
|
|
|
Summary: Development files for LLVM
|
|
|
|
Group: Development/Other
|
|
|
|
Provides: llvm-devel = %{EVRD}
|
|
|
|
Requires: %{libname} = %{EVRD}
|
2018-05-27 00:06:25 +10:00
|
|
|
Requires: %{liblto} = %{EVRD}
|
2014-12-19 11:29:21 +03:00
|
|
|
Requires: %{name} = %{EVRD}
|
2016-10-31 17:18:07 +03:00
|
|
|
Requires: llvm-polly = %{EVRD}
|
2016-10-31 16:50:51 +03:00
|
|
|
|
|
|
|
Obsoletes: llvm-polly-devel < %{EVRD}
|
|
|
|
Provides: llvm-polly-devel = %{EVRD}
|
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
Conflicts: llvm < 3.0-7
|
|
|
|
Conflicts: %{_lib}llvm3.0 < 3.0-9
|
2018-05-27 00:06:25 +10:00
|
|
|
Conflicts: %{_lib}llvm-plugins < 6.0.0-3
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
%description -n %{devname}
|
|
|
|
This package contains the development files for LLVM.
|
|
|
|
|
|
|
|
%files -n %{devname}
|
|
|
|
%{_bindir}/%{name}-config
|
|
|
|
%{_includedir}/%{name}
|
|
|
|
%{_includedir}/%{name}-c
|
2016-10-31 16:50:51 +03:00
|
|
|
%{_includedir}/polly
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_libdir}/cmake/%{name}/*
|
|
|
|
%{_libdir}/cmake/polly/*.cmake
|
|
|
|
%{_libdir}/libLLVM*.a
|
|
|
|
%{_libdir}/libLLVM.so
|
|
|
|
%{_libdir}/libLTO.so
|
2019-09-23 01:17:18 +03:00
|
|
|
%{_libdir}/libRemarks.so*
|
2016-10-31 16:50:51 +03:00
|
|
|
%{_libdir}/libPolly*.a
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_libdir}/libfindAllSymbols.a
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%package doc
|
2014-12-19 11:29:21 +03:00
|
|
|
Summary: Documentation for LLVM
|
|
|
|
Group: Books/Computer books
|
|
|
|
Requires: %{name} = %{EVRD}
|
|
|
|
BuildArch: noarch
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%description doc
|
|
|
|
Documentation for the LLVM compiler infrastructure.
|
|
|
|
|
|
|
|
%files doc
|
2022-03-17 12:58:15 +03:00
|
|
|
%doc README.txt docs/tutorial examples
|
2012-02-01 14:58:10 +04:00
|
|
|
%if %{compile_apidox}
|
|
|
|
%doc docs/doxygen
|
|
|
|
%endif
|
|
|
|
|
2014-12-19 11:29:21 +03:00
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
%package polly
|
|
|
|
Summary: Polyhedral optimizations for LLVM
|
|
|
|
License: MIT
|
|
|
|
Group: Development/Other
|
|
|
|
|
|
|
|
%description polly
|
|
|
|
Polly is a polyhedral optimizer for LLVM.
|
|
|
|
|
|
|
|
Using an abstract mathematical representation it analyzes and optimizes
|
|
|
|
the memory access pattern of a program. This includes data-locality
|
|
|
|
optimizations for cache locality as well as automatic parallelization
|
|
|
|
for thread-level and SIMD parallelism.
|
|
|
|
|
|
|
|
Our overall goal is an integrated optimizer for data-locality and
|
|
|
|
parallelism that takes advantage of multi-cores, cache hierarchies,
|
|
|
|
short vector instructions as well as dedicated accelerators.
|
|
|
|
|
|
|
|
%files polly
|
|
|
|
%{_bindir}/pollycc
|
|
|
|
%{_bindir}/pollyc++
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_libdir}/LLVMPolly.so
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
%if %{with clang}
|
2018-04-23 15:41:27 +03:00
|
|
|
# TODO: %%{_bindir}/clang is linked against static libclang.a, could it be
|
2014-12-19 11:29:21 +03:00
|
|
|
# linked against libclang.so instead, like llvm-* are against livLLVM.so?
|
|
|
|
|
|
|
|
%package -n clang
|
|
|
|
Summary: A C language family front-end for LLVM
|
|
|
|
License: NCSA
|
|
|
|
Group: Development/Other
|
|
|
|
# TODO: is this requires:llvm needed, or just legacy from fedora pkg layout?
|
|
|
|
Requires: llvm = %{EVRD}
|
|
|
|
# clang requires gcc, clang++ requires libstdc++-devel
|
|
|
|
Requires: gcc
|
|
|
|
Requires: libstdc++-devel >= %{gcc_version}
|
|
|
|
|
|
|
|
%description -n clang
|
|
|
|
clang: noun
|
|
|
|
1. A loud, resonant, metallic sound.
|
|
|
|
2. The strident call of a crane or goose.
|
|
|
|
3. C-language family front-end toolkit.
|
|
|
|
|
|
|
|
The goal of the Clang project is to create a new C, C++, Objective C
|
|
|
|
and Objective C++ front-end for the LLVM compiler. Its tools are built
|
|
|
|
as libraries and designed to be loosely-coupled and extensible.
|
|
|
|
|
|
|
|
%files -n clang
|
|
|
|
%{_bindir}/c-index-test
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_bindir}/clang*
|
2019-03-22 12:55:58 +03:00
|
|
|
%{_bindir}/diagtool
|
|
|
|
%{_bindir}/hmaptool
|
2020-03-27 04:57:05 +03:00
|
|
|
%{_bindir}/pp-trace
|
2021-10-13 15:50:09 +09:00
|
|
|
%{_datadir}/clang
|
2020-01-09 23:48:27 +00:00
|
|
|
%{_rpmmacrodir}/*clang-gcc-wrapper*
|
2014-12-19 11:29:21 +03:00
|
|
|
%endif
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
%if %{with clang}
|
|
|
|
%package -n %{libclang}
|
|
|
|
Summary: Shared library for clang
|
|
|
|
Group: System/Libraries
|
|
|
|
|
|
|
|
%description -n %{libclang}
|
|
|
|
Shared libraries for the clang compiler. This is needed by
|
|
|
|
programs that are dynamically linked against libclang.
|
|
|
|
|
|
|
|
%files -n %{libclang}
|
2019-09-23 01:17:18 +03:00
|
|
|
%{_libdir}/clang/
|
2021-06-12 03:17:36 +03:00
|
|
|
%{_libdir}/libclang*.so.%{maj_ver}
|
2014-12-19 11:29:21 +03:00
|
|
|
%endif
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
%if %{with clang}
|
|
|
|
%package -n %{devclang}
|
|
|
|
Summary: Development files for clang
|
|
|
|
Group: Development/Other
|
|
|
|
Requires: %{libclang} = %{EVRD}
|
2020-08-14 12:22:00 +00:00
|
|
|
Requires: clang = %{EVRD}
|
2014-12-19 11:29:21 +03:00
|
|
|
Provides: clang-devel = %{EVRD}
|
|
|
|
Conflicts: llvm-devel < 3.1
|
|
|
|
Obsoletes: clang-devel < 3.1
|
|
|
|
|
|
|
|
%description -n %{devclang}
|
|
|
|
This package contains header files and libraries needed for using
|
|
|
|
libclang.
|
|
|
|
|
|
|
|
%files -n %{devclang}
|
2019-04-29 14:52:17 +03:00
|
|
|
%dir %{_datadir}/clang/
|
2014-12-19 11:29:21 +03:00
|
|
|
%{_includedir}/clang
|
|
|
|
%{_includedir}/clang-c
|
2020-10-13 06:55:55 +00:00
|
|
|
%{_includedir}/clang-tidy
|
2016-09-11 17:18:35 +03:00
|
|
|
%{_libdir}/cmake/clang/ClangConfig.cmake
|
|
|
|
%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake
|
|
|
|
%{_libdir}/cmake/clang/ClangTargets.cmake
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_libdir}/libclang*.a
|
2019-09-23 01:17:18 +03:00
|
|
|
%{_libdir}/libclang*.so
|
2014-12-19 11:29:21 +03:00
|
|
|
%endif
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
%if %{with clang}
|
|
|
|
%package -n clang-analyzer
|
|
|
|
Summary: A source code analysis framework
|
|
|
|
License: NCSA
|
|
|
|
Group: Development/Other
|
|
|
|
Requires: clang = %{EVRD}
|
|
|
|
# not picked up automatically since files are currently not instaled
|
|
|
|
# in standard Python hierarchies yet
|
2020-02-13 18:35:57 +03:00
|
|
|
Requires: python3
|
2014-12-19 11:29:21 +03:00
|
|
|
|
|
|
|
%description -n clang-analyzer
|
|
|
|
The Clang Static Analyzer consists of both a source code analysis
|
|
|
|
framework and a standalone tool that finds bugs in C and Objective-C
|
|
|
|
programs. The standalone tool is invoked from the command-line, and is
|
|
|
|
intended to run in tandem with a build of a project or code base.
|
|
|
|
|
|
|
|
%files -n clang-analyzer
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_bindir}/scan-build
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_bindir}/scan-view
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_datadir}/scan-build/
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_datadir}/scan-view/
|
2016-05-15 22:03:38 +03:00
|
|
|
%{_mandir}/man1/scan-build.1.*
|
2019-04-29 14:52:17 +03:00
|
|
|
%{_prefix}/libexec/c++-analyzer
|
|
|
|
%{_prefix}/libexec/ccc-analyzer
|
2014-12-19 11:29:21 +03:00
|
|
|
%endif
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%prep
|
2014-12-19 11:29:21 +03:00
|
|
|
%setup -qn %{name}-%{version}.src %{?with_clang:-a1 -a2 -a3 -a4}
|
|
|
|
rm -rf tools/clang
|
|
|
|
%if %{with clang}
|
2020-02-13 21:27:44 +03:00
|
|
|
mv clang-%{version}.src tools/clang
|
2014-12-19 11:29:21 +03:00
|
|
|
mv polly-%{version}.src tools/polly
|
|
|
|
mv clang-tools-extra-%{version}.src tools/clang/tools/extra
|
|
|
|
mv compiler-rt-%{version}.src projects/compiler-rt
|
2020-08-14 11:56:39 +03:00
|
|
|
cd tools/clang
|
2022-04-30 09:30:58 +03:00
|
|
|
#patch1 -p1 -b .rosa~
|
2020-08-14 11:56:39 +03:00
|
|
|
cd -
|
2014-12-19 11:29:21 +03:00
|
|
|
%endif
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%build
|
2020-02-13 18:35:57 +03:00
|
|
|
%global optflags %{optflags} -fno-strict-aliasing
|
2014-12-19 11:29:21 +03:00
|
|
|
# Build with gcc/g++, not clang if it happens to be installed
|
2015-11-23 18:58:46 +03:00
|
|
|
export CC=gcc
|
|
|
|
export CXX=g++
|
|
|
|
|
2016-05-15 17:17:53 +03:00
|
|
|
# A couple more fixes from OMV + a workaround for a bug (?) in GCC 4.9:
|
|
|
|
# https://llvm.org/bugs/show_bug.cgi?id=20080 and
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
|
|
|
|
# (-fno-devirtualize)
|
|
|
|
#
|
|
|
|
# compiler-rt assumes off_t is 64 bits -- make sure this is true even on
|
|
|
|
# 32 bit OSes
|
2015-11-24 16:25:55 +03:00
|
|
|
%ifarch %ix86
|
|
|
|
# compiler-rt doesn't support ix86 with x<6 either
|
2020-02-13 18:25:55 +03:00
|
|
|
export CFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -g1"
|
2020-02-13 18:35:57 +03:00
|
|
|
export CXXFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-devirtualize -g1 -Wno-redundant-move"
|
2016-05-15 17:17:53 +03:00
|
|
|
%else
|
2020-02-13 18:35:57 +03:00
|
|
|
export CXXFLAGS="%{optflags} -fno-devirtualize -g1 -Wno-redundant-move"
|
2015-11-24 16:25:55 +03:00
|
|
|
%endif
|
|
|
|
|
2016-05-15 17:17:53 +03:00
|
|
|
|
2015-11-24 16:25:55 +03:00
|
|
|
%ifarch %ix86
|
|
|
|
# Fix noexecstack
|
|
|
|
for i in projects/compiler-rt/lib/builtins/i386/*.S; do
|
|
|
|
cat >>$i <<'EOF'
|
|
|
|
#if defined(__linux__) && defined(__ELF__)
|
|
|
|
.section .note.GNU-stack,"",%progbits
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
done
|
|
|
|
%endif
|
2016-05-13 22:45:22 +03:00
|
|
|
|
|
|
|
%cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
2016-05-15 11:48:18 +03:00
|
|
|
-DBUILD_SHARED_LIBS:BOOL=OFF \
|
2016-05-13 22:45:22 +03:00
|
|
|
-DLLVM_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
|
2019-03-22 12:55:58 +03:00
|
|
|
%if %{with clang}
|
2016-05-13 22:45:22 +03:00
|
|
|
-DCLANG_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
|
2019-03-22 12:55:58 +03:00
|
|
|
-DWITH_POLLY:BOOL=ON \
|
|
|
|
-DLINK_POLLY_INTO_TOOLS:BOOL=ON \
|
|
|
|
%endif
|
2016-05-13 22:45:22 +03:00
|
|
|
-DLLVM_ENABLE_FFI:BOOL=ON \
|
|
|
|
-DLLVM_ENABLE_RTTI:BOOL=ON \
|
|
|
|
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
|
|
|
|
-DLLVM_INCLUDE_UTILS:BOOL=ON \
|
2016-05-15 11:48:18 +03:00
|
|
|
-DLLVM_BUILD_LLVM_DYLIB=ON \
|
|
|
|
-DLLVM_LINK_LLVM_DYLIB=ON \
|
2019-03-22 12:55:58 +03:00
|
|
|
-DOCAMLFIND=NOTFOUND \
|
2021-07-13 23:43:48 +03:00
|
|
|
-DLLVM_INSTALL_UTILS:BOOL=ON \
|
|
|
|
-DLLVM_UTILS_INSTALL_DIR:PATH=%{_bindir} \
|
2012-02-01 14:58:10 +04:00
|
|
|
%if %{compile_apidox}
|
2016-05-13 22:45:22 +03:00
|
|
|
-DLLVM_INCLUDE_DOCS:BOOL=ON \
|
|
|
|
-DLLVM_BUILD_DOCS:BOOL=ON \
|
2012-02-01 14:58:10 +04:00
|
|
|
%endif
|
2019-03-22 12:55:58 +03:00
|
|
|
-DLLVM_OPTIMIZED_TABLEGEN=ON
|
2016-05-15 11:48:18 +03:00
|
|
|
|
2020-01-13 15:58:08 +03:00
|
|
|
%make -s
|
2012-02-01 14:58:10 +04:00
|
|
|
|
|
|
|
%install
|
|
|
|
|
2020-01-13 15:58:08 +03:00
|
|
|
%makeinstall_std -C build
|
2014-12-19 11:29:21 +03:00
|
|
|
|
2019-03-22 12:55:58 +03:00
|
|
|
%if %{with clang}
|
2016-05-13 22:45:22 +03:00
|
|
|
# [From OMV]
|
2014-12-19 11:29:21 +03:00
|
|
|
# Polly bits as described on
|
|
|
|
# http://polly.llvm.org/example_load_Polly_into_clang.html
|
|
|
|
cat >%{buildroot}%{_bindir}/pollycc <<'EOF'
|
|
|
|
#!/bin/sh
|
2016-05-13 22:45:22 +03:00
|
|
|
exec %{_bindir}/clang -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@"
|
2014-12-19 11:29:21 +03:00
|
|
|
EOF
|
|
|
|
cat >%{buildroot}%{_bindir}/pollyc++ <<'EOF'
|
|
|
|
#!/bin/sh
|
2016-05-13 22:45:22 +03:00
|
|
|
exec %{_bindir}/clang++ -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@"
|
2014-12-19 11:29:21 +03:00
|
|
|
EOF
|
|
|
|
chmod 0755 %{buildroot}%{_bindir}/pollycc %{buildroot}%{_bindir}/pollyc++
|
2012-02-01 14:58:10 +04:00
|
|
|
|
2019-03-22 12:55:58 +03:00
|
|
|
|
2016-05-15 22:03:38 +03:00
|
|
|
# Clang - Git integration. Not needed.
|
|
|
|
rm -f %{buildroot}%{_bindir}/git-clang-format
|
|
|
|
|
|
|
|
# Remove editor integration files
|
|
|
|
rm -f %{buildroot}%{_datadir}/clang/clang-format*
|
|
|
|
|
2018-12-11 20:33:16 +03:00
|
|
|
# install clang-gcc-wrapper
|
|
|
|
install -D -m 0644 %{SOURCE1011} %{buildroot}%{_datadir}/clang/
|
2020-01-09 23:48:27 +00:00
|
|
|
%install_macro clang-gcc-wrapper %{SOURCE1010}
|
2019-03-22 12:55:58 +03:00
|
|
|
%endif
|
2019-04-29 21:37:07 +03:00
|
|
|
|
|
|
|
# Install libraries used for testing
|
|
|
|
cp -a build/%{_lib}/BugpointPasses.so %{buildroot}%{_libdir}
|
|
|
|
cp -a build/%{_lib}/LLVMHello.so %{buildroot}%{_libdir}
|
2020-02-13 17:28:45 +03:00
|
|
|
|
|
|
|
# Versionize shebangs python
|
|
|
|
sed '1 s,^.*$,#!%{__python3},' -i %{buildroot}%{_bindir}/{hmaptool,scan-view}
|