llvm/llvm.spec

440 lines
12 KiB
RPMSpec
Raw Normal View History

2012-02-01 14:58:10 +04:00
%define _disable_ld_no_undefined 0
%define debug_package %{nil}
%define debugcflags %{nil}
2012-02-01 14:58:10 +04:00
2018-05-27 00:06:25 +10:00
%define major %{major_ver}
%define libname %mklibname %{name} %{major}
%define liblto %mklibname lto %{major}
%define devname %mklibname %{name} -d
%define clang_major %{major_ver}
%define libclang %mklibname clang %{clang_major}
%define devclang %mklibname clang -d
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
2018-04-23 15:41:27 +03:00
%define maj_ver 6
%define major_ver %{maj_ver}.0
%define minor_ver 0
2014-12-19 11:29:21 +03:00
Summary: Low Level Virtual Machine (LLVM)
Name: llvm
Version: %{major_ver}.%{minor_ver}
2018-05-27 00:06:25 +10:00
Release: 3
2014-12-19 11:29:21 +03:00
License: NCSA
Group: Development/Other
Url: http://llvm.org/
2014-12-19 11:29:21 +03:00
Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz
Source1: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz
Source2: http://llvm.org/releases/%{version}/clang-tools-extra-%{version}.src.tar.xz
Source3: http://llvm.org/releases/%{version}/polly-%{version}.src.tar.xz
Source4: http://llvm.org/releases/%{version}/compiler-rt-%{version}.src.tar.xz
Source1000: llvm.rpmlintrc
# Adjust the search paths to match the OS, adjust the default compiler flags
# as well.
2018-04-23 15:41:27 +03:00
#Patch1: clang-rosa.patch
#
Patch2: cfe-6.0.0-i586-unknown-linux-gnu.patch
2014-12-19 11:29:21 +03:00
# Claim compatibility with gcc 4.9.1 rather than 4.2.1, it's
# much much closer in terms of standards supported etc.
Patch7: clang-gcc-compat.patch
2016-05-13 22:55:26 +03:00
BuildRequires: cmake
2014-12-19 11:29:21 +03:00
BuildRequires: bison
BuildRequires: binutils-devel
BuildRequires: chrpath
BuildRequires: flex
BuildRequires: graphviz
BuildRequires: groff
BuildRequires: libtool
BuildRequires: sed
BuildRequires: tcl
BuildRequires: zip
BuildRequires: libstdc++-devel
2015-11-23 18:58:46 +03:00
#BuildRequires: pkgconfig(cloog-isl)
#BuildRequires: pkgconfig(isl) >= 0.13
2014-12-19 11:29:21 +03:00
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libtirpc)
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
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,
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
%{_bindir}/bugpoint
%{_bindir}/llc
%{_bindir}/lli
2018-04-23 15:41:27 +03:00
%{_bindir}/llvm*
%exclude %{_bindir}/llvm-config
2012-02-01 14:58:10 +04:00
%{_bindir}/opt
%{_bindir}/modularize
%{_bindir}/sancov
%{_bindir}/verify-uselistorder
%{_bindir}/obj2yaml
%{_bindir}/yaml2obj
%{_bindir}/find-all-symbols
%{_bindir}/sanstats
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}
%{_libdir}/BugpointPasses.so
%{_libdir}/LLVMgold.so
%{_libdir}/LLVMHello.so
2016-06-07 22:37:40 +10:00
#----------------------------------------------------------------------------
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}
%{_libdir}/libLLVM-%{major}.so
%{_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}
%{_libdir}/libLTO.so.%{major}
#----------------------------------------------------------------------------
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}
Requires: llvm-polly = %{EVRD}
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
%{_libdir}/libLLVM.so
%{_libdir}/libLLVM*.a
2018-05-27 00:06:25 +10:00
%{_libdir}/libLTO.so
%{_libdir}/libfindAllSymbols.a
%{_libdir}/cmake/%{name}/*
2018-04-23 15:41:27 +03:00
%{_libdir}/cmake/polly/*.cmake
2014-12-19 11:29:21 +03:00
%{_includedir}/%{name}
%{_includedir}/%{name}-c
%{_includedir}/polly
%{_libdir}/libPolly*.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
%doc README.txt
%doc docs/tutorial
%doc examples
%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++
%{_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}
# We do not build clang-doc anymore
Obsoletes: clang-doc < %{EVRD}
2014-12-19 11:29:21 +03:00
%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}/clang*
%{_bindir}/c-index-test
%{_libdir}/clang/
2016-01-14 09:45:55 +03:00
%{_datadir}/clang/clang-tidy-diff.py
%{_datadir}/clang/run-clang-tidy.py
%{_datadir}/clang/clang-include-fixer.py
%{_datadir}/clang/run-find-all-symbols.py
2018-04-23 15:41:27 +03:00
%{_datadir}/clang/bash-autocomplete.sh
%{_datadir}/clang/clang-include-fixer.el
%{_datadir}/clang/clang-rename.el
%{_datadir}/clang/clang-rename.py
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}
%{_libdir}/libclang.so.%{clang_major}
2018-04-23 15:41:27 +03:00
%{_libdir}/libclang.so.%{maj_ver}
2014-12-19 11:29:21 +03:00
%{_libdir}/libclang-%{clang_major}.so
%{_libdir}/libclang-%{clang_major}.%{minor_ver}.so
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}
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}
%{_includedir}/clang
%{_includedir}/clang-c
%{_libdir}/libclang.so
%{_libdir}/libclang*.a
%{_libdir}/cmake/clang/ClangConfig.cmake
%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake
%{_libdir}/cmake/clang/ClangTargets.cmake
%dir %{_datadir}/clang/
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
Requires: python
%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
%{_bindir}/scan-view
%{_bindir}/scan-build
%{_prefix}/libexec/ccc-analyzer
%{_prefix}/libexec/c++-analyzer
%{_datadir}/scan-view/
%{_datadir}/scan-build/
%{_mandir}/man1/scan-build.1.*
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}
mv cfe-%{version}.src tools/clang
mv polly-%{version}.src tools/polly
mv clang-tools-extra-%{version}.src tools/clang/tools/extra
mv compiler-rt-%{version}.src projects/compiler-rt
cd tools/clang
2018-04-23 15:41:27 +03:00
#%patch1 -p1 -b .rosa~
%patch2 -p1 -b .gnu~
2014-12-19 11:29:21 +03:00
cd -
%endif
2018-04-23 15:41:27 +03:00
#%patch7 -p1 -b .gcc49~
2012-02-01 14:58:10 +04:00
%build
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++
# 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
%ifarch %ix86
# compiler-rt doesn't support ix86 with x<6 either
export CFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64"
export CXXFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-devirtualize"
%else
export CXXFLAGS="%{optflags} -fno-devirtualize"
%endif
%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
%cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DLLVM_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
-DCLANG_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
-DLLVM_ENABLE_FFI:BOOL=ON \
-DLLVM_ENABLE_RTTI:BOOL=ON \
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
-DOCAMLFIND=NOTFOUND \
-DLLVM_INCLUDE_UTILS:BOOL=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
2012-02-01 14:58:10 +04:00
%if %{compile_apidox}
-DLLVM_INCLUDE_DOCS:BOOL=ON \
-DLLVM_BUILD_DOCS:BOOL=ON \
2012-02-01 14:58:10 +04:00
%endif
-DWITH_POLLY:BOOL=ON \
-DLINK_POLLY_INTO_TOOLS:BOOL=ON
2018-04-23 15:41:27 +03:00
%make -s
2012-02-01 14:58:10 +04:00
%install
%makeinstall_std -C build
2014-12-19 11:29:21 +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
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
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
%if %{with clang}
# Clang - Git integration. Not needed.
rm -f %{buildroot}%{_bindir}/git-clang-format
# Remove editor integration files
rm -f %{buildroot}%{_datadir}/clang/clang-format*
# Symlinks for libclang to maintain compatibility with the older releases.
ln -s %{_libdir}/libclang.so.%{clang_major} %{buildroot}%{_libdir}/libclang-%{clang_major}.so
ln -s %{_libdir}/libclang.so.%{clang_major} %{buildroot}%{_libdir}/libclang-%{clang_major}.%{minor_ver}.so
%endif
2018-04-23 15:41:27 +03:00
%changelog