mirror of
https://abf.rosa.ru/djam/llvm12.git
synced 2025-02-23 15:22:50 +00:00
Build inside /opt/llvm11 for platforms where main LLVM version is older
Macros are not needed here, use them from the main package + update from 11.0.0 to 11.0.1
This commit is contained in:
parent
68521efe89
commit
26209c435c
6 changed files with 238 additions and 517 deletions
10
.abf.yml
10
.abf.yml
|
@ -1,6 +1,6 @@
|
|||
sources:
|
||||
clang-11.0.0.src.tar.xz: 02c87f5e07f2a1c1e2dbb8ce8328f0106d70b10d
|
||||
clang-tools-extra-11.0.0.src.tar.xz: b77dc0494894b997c8f4012debbf0bf469462386
|
||||
compiler-rt-11.0.0.src.tar.xz: be3e79fb93cd99135643a191f27c49449bf9c0ee
|
||||
llvm-11.0.0.src.tar.xz: 5723ae20d1e6e9ccfda208cb9a8cf2f87c3a6107
|
||||
polly-11.0.0.src.tar.xz: 455be0af2ffbc1db71e61c463398549ff553c198
|
||||
clang-11.0.1.src.tar.xz: 10516c6d177dc3d893e640c75d891ee3d6c1edcf
|
||||
clang-tools-extra-11.0.1.src.tar.xz: f5698eb81569a5dea2496c4934401be653eeb031
|
||||
compiler-rt-11.0.1.src.tar.xz: c492a0142887efbe667f6b3994b43a48f53d4832
|
||||
llvm-11.0.1.src.tar.xz: 1a911295260d4e41116b72788eb602702b4bb252
|
||||
polly-11.0.1.src.tar.xz: 1489870c457e7a6396bf4793b62dd264faf844b7
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# CFLAGS that are known to be not suppported by clang
|
||||
%noclang_optflags -fvar-tracking-assignments -frecord-gcc-switches -ffat-lto-objects
|
||||
|
||||
%clang_gcc_wrapper() \
|
||||
# clang wrapper to remove compiler flags that clang does not know \
|
||||
# how-to in Russian: https://nixtux.ru/768 \
|
||||
BIN_DIR="${BIN_DIR:-$(pwd)/local_bin}" \
|
||||
mkdir -p "$BIN_DIR" \
|
||||
install -m 0755 %{_datadir}/clang/clang-gcc-wrapper.sh "${BIN_DIR}/clang++" \
|
||||
sed -e "s,_CLANG_,$(command -v clang++),g" -i "${BIN_DIR}/clang++" \
|
||||
install -m 0755 %{_datadir}/clang/clang-gcc-wrapper.sh "${BIN_DIR}/clang" \
|
||||
sed -e "s,_CLANG_,$(command -v clang),g" -i "${BIN_DIR}/clang" \
|
||||
export PATH="${BIN_DIR}:${PATH}" \
|
||||
# set variables \
|
||||
CLANG="$(command -v clang)" \
|
||||
CLANGXX="$(command -v clang++)" \
|
||||
CC="clang" \
|
||||
CXX="clang++" \
|
||||
CPP="clang-cpp" \
|
||||
# validate that clang wrapper is in PATH \
|
||||
echo "$CLANG" | grep -q "$BIN_DIR" \
|
||||
echo "$CLANGXX" | grep -q "$BIN_DIR" \
|
||||
export CLANG CLANGXX CC CXX CPP \
|
||||
export NOCLANG_OPTFLAGS="%{noclang_optflags}" \
|
||||
%{nil}
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Author: mikhailnov
|
||||
# Remove flags that clang does not know but which cannot be removed properly
|
||||
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9567
|
||||
|
||||
set -efu
|
||||
|
||||
echo_err() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
# %noclang_optflags
|
||||
NOCLANG_OPTFLAGS="${NOCLANG_OPTFLAGS:-}"
|
||||
# which flags to remove in addition to %noclang_optflags,
|
||||
# set custom REMOVE_CFLAGS in %build or redefine %noclang_optflags
|
||||
REMOVE_CFLAGS="${REMOVE_CFLAGS:-}"
|
||||
# convert flags list to regexp
|
||||
REMOVE="$(echo "$NOCLANG_OPTFLAGS $REMOVE_CFLAGS" | sed -e 's, ,|,g' -e 's,|$,,g')"
|
||||
|
||||
# _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper
|
||||
if echo "$@" | grep -qE -- "${REMOVE}"
|
||||
then
|
||||
echo_err "DEBUG: clang-wrapper: arguements will be cut-out!"
|
||||
echo_err "DEBUG: arguements were: "
|
||||
echo_err "========================="
|
||||
echo_err "$@"
|
||||
echo_err "========================="
|
||||
new_args="$(echo "$@" | sed -r -e "s,${REMOVE},,g")"
|
||||
echo_err "DEBUG: new arguements are: "
|
||||
echo_err "========================="
|
||||
echo_err ${new_args}
|
||||
# https://stackoverflow.com/a/37141139 (??)
|
||||
_CLANG_ ${new_args}
|
||||
else
|
||||
_CLANG_ "$@"
|
||||
fi
|
451
llvm.spec
451
llvm.spec
|
@ -1,451 +0,0 @@
|
|||
# libLLVM-*.so are unversioned libraries
|
||||
%global __requires_exclude ^devel\\(.*$
|
||||
|
||||
#%%define _disable_ld_no_undefined 0
|
||||
%define debugcflags %%{nil}
|
||||
%define debug_package %{nil}
|
||||
|
||||
# clang header paths are hard-coded at compile time
|
||||
# and need adjustment whenever there's a new GCC version
|
||||
%define gcc_version %(gcc -dumpversion)
|
||||
|
||||
%define compile_apidox 0
|
||||
%{?_with_apidox: %{expand: %%global compile_apidox 1}}
|
||||
|
||||
%bcond_without clang
|
||||
|
||||
%define maj_ver 11
|
||||
%define major_ver %{maj_ver}.0
|
||||
%define minor_ver 0
|
||||
|
||||
%define major %{major_ver}
|
||||
%define lto_major %{maj_ver}
|
||||
%define libname %mklibname %{name} %{major}
|
||||
%define liblto %mklibname lto %{lto_major}
|
||||
%define devname %mklibname %{name} -d
|
||||
|
||||
%define clang_major %{major_ver}
|
||||
%define libclang %mklibname clang %{clang_major}
|
||||
%define devclang %mklibname clang -d
|
||||
|
||||
%bcond_without git
|
||||
|
||||
Summary: Low Level Virtual Machine (LLVM)
|
||||
Name: llvm
|
||||
Version: %{major_ver}.%{minor_ver}
|
||||
Release: 3
|
||||
License: NCSA
|
||||
Group: Development/Other
|
||||
Url: http://llvm.org
|
||||
|
||||
%if %{with git}
|
||||
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz
|
||||
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/clang-%{version}.src.tar.xz
|
||||
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
|
||||
%else
|
||||
Source0: http://releases.llvm.org/%{version}/llvm-%{version}.src.tar.xz
|
||||
Source1: http://releases.llvm.org/%{version}/clang-%{version}.src.tar.xz
|
||||
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
|
||||
Source1000: llvm.rpmlintrc
|
||||
Source1010: clang-gcc-wrapper.macros
|
||||
Source1011: clang-gcc-wrapper.sh
|
||||
|
||||
# Adjust the search paths to match the OS, adjust the default compiler flags
|
||||
# as well.
|
||||
Patch1: clang-rosa.patch
|
||||
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: bison
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: cmake
|
||||
BuildRequires: flex
|
||||
BuildRequires: graphviz
|
||||
BuildRequires: groff
|
||||
BuildRequires: libstdc++-devel
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkgconfig(libffi)
|
||||
BuildRequires: pkgconfig(libtirpc)
|
||||
BuildRequires: sed
|
||||
BuildRequires: tcl
|
||||
BuildRequires: zip
|
||||
%if %{compile_apidox}
|
||||
BuildRequires: doxygen
|
||||
%endif
|
||||
Requires: libstdc++-devel
|
||||
|
||||
%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.
|
||||
|
||||
%files
|
||||
%doc LICENSE.TXT
|
||||
%{_bindir}/bugpoint
|
||||
%{_bindir}/dsymutil
|
||||
%{_bindir}/find-all-symbols
|
||||
%{_bindir}/llc
|
||||
%{_bindir}/lli
|
||||
%{_bindir}/llvm*
|
||||
%exclude %{_bindir}/llvm-config
|
||||
%{_bindir}/modularize
|
||||
%{_bindir}/obj2yaml
|
||||
%{_bindir}/opt
|
||||
%{_bindir}/sancov
|
||||
%{_bindir}/sanstats
|
||||
%{_bindir}/verify-uselistorder
|
||||
%{_bindir}/yaml2obj
|
||||
%{_datadir}/opt-viewer
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%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}/LLVMHello.so
|
||||
%{_libdir}/LLVMgold.so
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: LLVM shared libraries
|
||||
Group: System/Libraries
|
||||
Requires: %{plugins}
|
||||
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-%{maj_ver}.so
|
||||
%{_libdir}/libLLVM-%{major}.%{minor_ver}.so
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%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.%{lto_major}*
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%package -n %{devname}
|
||||
Summary: Development files for LLVM
|
||||
Group: Development/Other
|
||||
Provides: llvm-devel = %{EVRD}
|
||||
Requires: %{libname} = %{EVRD}
|
||||
Requires: %{liblto} = %{EVRD}
|
||||
Requires: %{name} = %{EVRD}
|
||||
Requires: llvm-polly = %{EVRD}
|
||||
|
||||
Obsoletes: llvm-polly-devel < %{EVRD}
|
||||
Provides: llvm-polly-devel = %{EVRD}
|
||||
|
||||
Conflicts: llvm < 3.0-7
|
||||
Conflicts: %{_lib}llvm3.0 < 3.0-9
|
||||
Conflicts: %{_lib}llvm-plugins < 6.0.0-3
|
||||
|
||||
%description -n %{devname}
|
||||
This package contains the development files for LLVM.
|
||||
|
||||
%files -n %{devname}
|
||||
%{_bindir}/%{name}-config
|
||||
%{_includedir}/%{name}
|
||||
%{_includedir}/%{name}-c
|
||||
%{_includedir}/polly
|
||||
%{_libdir}/cmake/%{name}/*
|
||||
%{_libdir}/cmake/polly/*.cmake
|
||||
%{_libdir}/libLLVM*.a
|
||||
%{_libdir}/libLLVM.so
|
||||
%{_libdir}/libLTO.so
|
||||
%{_libdir}/libRemarks.so*
|
||||
%{_libdir}/libPolly*.a
|
||||
%{_libdir}/libfindAllSymbols.a
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for LLVM
|
||||
Group: Books/Computer books
|
||||
Requires: %{name} = %{EVRD}
|
||||
BuildArch: noarch
|
||||
|
||||
%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
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%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
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%if %{with clang}
|
||||
# TODO: %%{_bindir}/clang is linked against static libclang.a, could it be
|
||||
# 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
|
||||
%{_bindir}/clang*
|
||||
%{_bindir}/diagtool
|
||||
%{_bindir}/hmaptool
|
||||
%{_bindir}/pp-trace
|
||||
%{_datadir}/clang/
|
||||
%if %{mdvver} >= 201910
|
||||
%{_datadir}/clang/__pycache__/
|
||||
%endif
|
||||
%{_rpmmacrodir}/*clang-gcc-wrapper*
|
||||
%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}/clang/
|
||||
%{_libdir}/libclang*.so.%{maj_ver}
|
||||
%endif
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%if %{with clang}
|
||||
%package -n %{devclang}
|
||||
Summary: Development files for clang
|
||||
Group: Development/Other
|
||||
Requires: %{libclang} = %{EVRD}
|
||||
Requires: clang = %{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}
|
||||
%dir %{_datadir}/clang/
|
||||
%{_includedir}/clang
|
||||
%{_includedir}/clang-c
|
||||
%{_includedir}/clang-tidy
|
||||
%{_libdir}/cmake/clang/ClangConfig.cmake
|
||||
%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake
|
||||
%{_libdir}/cmake/clang/ClangTargets.cmake
|
||||
%{_libdir}/libclang*.a
|
||||
%{_libdir}/libclang*.so
|
||||
%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: python3
|
||||
|
||||
%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-build
|
||||
%{_bindir}/scan-view
|
||||
%{_datadir}/scan-build/
|
||||
%{_datadir}/scan-view/
|
||||
%{_mandir}/man1/scan-build.1.*
|
||||
%{_prefix}/libexec/c++-analyzer
|
||||
%{_prefix}/libexec/ccc-analyzer
|
||||
%endif
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%prep
|
||||
%setup -qn %{name}-%{version}.src %{?with_clang:-a1 -a2 -a3 -a4}
|
||||
rm -rf tools/clang
|
||||
%if %{with clang}
|
||||
mv clang-%{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
|
||||
%patch1 -p1 -b .rosa~
|
||||
cd -
|
||||
%endif
|
||||
|
||||
%build
|
||||
%global optflags %{optflags} -fno-strict-aliasing
|
||||
# Build with gcc/g++, not clang if it happens to be installed
|
||||
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 -g1"
|
||||
export CXXFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-devirtualize -g1 -Wno-redundant-move"
|
||||
%else
|
||||
export CXXFLAGS="%{optflags} -fno-devirtualize -g1 -Wno-redundant-move"
|
||||
%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,,') \
|
||||
%if %{with clang}
|
||||
-DCLANG_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
|
||||
-DWITH_POLLY:BOOL=ON \
|
||||
-DLINK_POLLY_INTO_TOOLS:BOOL=ON \
|
||||
%endif
|
||||
-DLLVM_ENABLE_FFI:BOOL=ON \
|
||||
-DLLVM_ENABLE_RTTI:BOOL=ON \
|
||||
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
|
||||
-DLLVM_INCLUDE_UTILS:BOOL=ON \
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON \
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON \
|
||||
-DOCAMLFIND=NOTFOUND \
|
||||
%if %{compile_apidox}
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=ON \
|
||||
-DLLVM_BUILD_DOCS:BOOL=ON \
|
||||
%endif
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=ON
|
||||
|
||||
%make -s
|
||||
|
||||
%install
|
||||
|
||||
%makeinstall_std -C build
|
||||
|
||||
%if %{with clang}
|
||||
# [From OMV]
|
||||
# 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 "$@"
|
||||
EOF
|
||||
cat >%{buildroot}%{_bindir}/pollyc++ <<'EOF'
|
||||
#!/bin/sh
|
||||
exec %{_bindir}/clang++ -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@"
|
||||
EOF
|
||||
chmod 0755 %{buildroot}%{_bindir}/pollycc %{buildroot}%{_bindir}/pollyc++
|
||||
|
||||
|
||||
# Clang - Git integration. Not needed.
|
||||
rm -f %{buildroot}%{_bindir}/git-clang-format
|
||||
|
||||
# Remove editor integration files
|
||||
rm -f %{buildroot}%{_datadir}/clang/clang-format*
|
||||
|
||||
# install clang-gcc-wrapper
|
||||
install -D -m 0644 %{SOURCE1011} %{buildroot}%{_datadir}/clang/
|
||||
%install_macro clang-gcc-wrapper %{SOURCE1010}
|
||||
%endif
|
||||
|
||||
# Install libraries used for testing
|
||||
cp -a build/%{_lib}/BugpointPasses.so %{buildroot}%{_libdir}
|
||||
cp -a build/%{_lib}/LLVMHello.so %{buildroot}%{_libdir}
|
||||
|
||||
# Versionize shebangs python
|
||||
sed '1 s,^.*$,#!%{__python3},' -i %{buildroot}%{_bindir}/{hmaptool,scan-view}
|
|
@ -1,6 +1,8 @@
|
|||
addFilter("E: hardcoded-library-path")
|
||||
addFilter("E: incoherent-version-in-name")
|
||||
addFilter("E: non-versioned-file-in-library-package")
|
||||
addFilter("E: unexpanded-macro.*Summary")
|
||||
addFilter("E: dir-or-file-in-opt")
|
||||
# 202 warnings
|
||||
addFilter("W: devel-file-in-non-devel-package")
|
||||
addFilter("W: invalid-license")
|
231
llvm11.spec
Normal file
231
llvm11.spec
Normal file
|
@ -0,0 +1,231 @@
|
|||
%define oname llvm
|
||||
|
||||
%define _prefix /opt/%{name}
|
||||
%define _bindir %{_prefix}/bin
|
||||
%define _datadir %{_prefix}/share
|
||||
%define _includedir %{_prefix}/include
|
||||
%define _libdir %{_prefix}/%{_lib}
|
||||
%define _libexecdir %{_prefix}/libexec
|
||||
%define _mandir %{_prefix}/share/man
|
||||
%define __cmake /usr/bin/cmake
|
||||
|
||||
%define debugcflags %{nil}
|
||||
%define debug_package %{nil}
|
||||
|
||||
# clang header paths are hard-coded at compile time
|
||||
# and need adjustment whenever there's a new GCC version
|
||||
%define gcc_version %(gcc -dumpversion)
|
||||
|
||||
%define compile_apidox 0
|
||||
%{?_with_apidox: %{expand: %%global compile_apidox 1}}
|
||||
|
||||
%define maj_ver 11
|
||||
|
||||
Summary: LLVM and Clang in %{_prefix}
|
||||
# llvm11
|
||||
Name: llvm%{maj_ver}
|
||||
Version: %{maj_ver}.0.1
|
||||
Release: 1
|
||||
License: NCSA
|
||||
Group: Development/Other
|
||||
Url: http://llvm.org
|
||||
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz
|
||||
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/clang-%{version}.src.tar.xz
|
||||
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
|
||||
Source1000: llvm%{maj_ver}.rpmlintrc
|
||||
# Adjust the search paths to match the OS, adjust the default compiler flags
|
||||
# as well.
|
||||
Patch1: clang-rosa.patch
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: bison
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: cmake
|
||||
BuildRequires: flex
|
||||
BuildRequires: graphviz
|
||||
BuildRequires: groff
|
||||
BuildRequires: libstdc++-devel
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkgconfig(libffi)
|
||||
BuildRequires: pkgconfig(libtirpc)
|
||||
BuildRequires: sed
|
||||
BuildRequires: tcl
|
||||
BuildRequires: zip
|
||||
%if %{compile_apidox}
|
||||
BuildRequires: doxygen
|
||||
%endif
|
||||
Requires: libstdc++-devel
|
||||
# Do not provide libraries rom /opt and do not try to depend from them
|
||||
# ! Nothing must be linked with libllvm etc. from here!
|
||||
AutoReq: 0
|
||||
AutoProv: 0
|
||||
|
||||
%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.
|
||||
|
||||
This package contains LLVM and Clang in %{_prefix}.
|
||||
|
||||
%files
|
||||
%doc LICENSE.TXT
|
||||
%doc README.txt
|
||||
%doc docs/tutorial
|
||||
%doc examples
|
||||
%if %{compile_apidox}
|
||||
%doc docs/doxygen
|
||||
%endif
|
||||
%{_bindir}/bugpoint
|
||||
%{_bindir}/c-index-test
|
||||
%{_bindir}/clang*
|
||||
%{_bindir}/diagtool
|
||||
%{_bindir}/dsymutil
|
||||
%{_bindir}/find-all-symbols
|
||||
%{_bindir}/git-clang-format
|
||||
%{_bindir}/hmaptool
|
||||
%{_bindir}/llc
|
||||
%{_bindir}/lli
|
||||
%{_bindir}/llvm*
|
||||
%{_bindir}/modularize
|
||||
%{_bindir}/obj2yaml
|
||||
%{_bindir}/%{oname}-config
|
||||
%{_bindir}/opt
|
||||
%{_bindir}/pollyc++
|
||||
%{_bindir}/pollycc
|
||||
%{_bindir}/pp-trace
|
||||
%{_bindir}/sancov
|
||||
%{_bindir}/sanstats
|
||||
%{_bindir}/scan-build
|
||||
%{_bindir}/scan-view
|
||||
%{_bindir}/verify-uselistorder
|
||||
%{_bindir}/yaml2obj
|
||||
%{_datadir}/clang
|
||||
%{_datadir}/opt-viewer
|
||||
%{_datadir}/scan-build/
|
||||
%{_datadir}/scan-view/
|
||||
%{_includedir}/clang
|
||||
%{_includedir}/clang-c
|
||||
%{_includedir}/clang-tidy
|
||||
%{_includedir}/%{oname}
|
||||
%{_includedir}/%{oname}-c
|
||||
%{_includedir}/polly
|
||||
%{_libdir}/BugpointPasses.so
|
||||
%{_libdir}/clang/
|
||||
%{_libdir}/cmake/clang/ClangConfig.cmake
|
||||
%{_libdir}/cmake/clang/ClangTargets.cmake
|
||||
%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake
|
||||
%{_libdir}/cmake/%{oname}/*
|
||||
%{_libdir}/cmake/polly/*.cmake
|
||||
%{_libdir}/libclang*.a
|
||||
%{_libdir}/libclang*.so
|
||||
%{_libdir}/libclang*.so.%{maj_ver}
|
||||
%{_libdir}/libfindAllSymbols.a
|
||||
%{_libdir}/libLLVM*.a
|
||||
%{_libdir}/libLLVM-*.so
|
||||
%{_libdir}/libLLVM.so
|
||||
%{_libdir}/libLTO.so
|
||||
%{_libdir}/libLTO.so*
|
||||
%{_libdir}/libPolly*.a
|
||||
%{_libdir}/libRemarks.so*
|
||||
%{_libdir}/LLVMgold.so
|
||||
%{_libdir}/LLVMHello.so
|
||||
%{_libdir}/LLVMPolly.so
|
||||
%{_libexecdir}/c++-analyzer
|
||||
%{_libexecdir}/ccc-analyzer
|
||||
%{_mandir}/man1/scan-build.1
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%prep
|
||||
%setup -qn %{oname}-%{version}.src -a1 -a2 -a3 -a4
|
||||
rm -rf tools/clang
|
||||
mv clang-%{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
|
||||
%patch1 -p1 -b .rosa~
|
||||
cd -
|
||||
|
||||
%build
|
||||
%global optflags %{optflags} -fno-strict-aliasing
|
||||
# Build with gcc/g++, not clang if it happens to be installed
|
||||
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 -g1"
|
||||
export CXXFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-devirtualize -g1 -Wno-redundant-move"
|
||||
%else
|
||||
export CXXFLAGS="%{optflags} -fno-devirtualize -g1 -Wno-redundant-move"
|
||||
%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,,') \
|
||||
-DWITH_POLLY:BOOL=ON \
|
||||
-DLINK_POLLY_INTO_TOOLS:BOOL=ON \
|
||||
-DLLVM_ENABLE_FFI:BOOL=ON \
|
||||
-DLLVM_ENABLE_RTTI:BOOL=ON \
|
||||
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
|
||||
-DLLVM_INCLUDE_UTILS:BOOL=ON \
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON \
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON \
|
||||
-DOCAMLFIND=NOTFOUND \
|
||||
%if %{compile_apidox}
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=ON \
|
||||
-DLLVM_BUILD_DOCS:BOOL=ON \
|
||||
%endif
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=ON
|
||||
|
||||
%make -s
|
||||
|
||||
%install
|
||||
|
||||
%makeinstall_std -C build
|
||||
|
||||
# [From OMV]
|
||||
# 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 "$@"
|
||||
EOF
|
||||
cat >%{buildroot}%{_bindir}/pollyc++ <<'EOF'
|
||||
#!/bin/sh
|
||||
exec %{_bindir}/clang++ -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@"
|
||||
EOF
|
||||
chmod 0755 %{buildroot}%{_bindir}/pollycc %{buildroot}%{_bindir}/pollyc++
|
||||
|
||||
# Install libraries used for testing
|
||||
cp -a build/%{_lib}/BugpointPasses.so %{buildroot}%{_libdir}
|
||||
cp -a build/%{_lib}/LLVMHello.so %{buildroot}%{_libdir}
|
||||
|
||||
# Versionize shebangs python
|
||||
sed '1 s,^.*$,#!%{__python3},' -i %{buildroot}%{_bindir}/{hmaptool,scan-view}
|
Loading…
Add table
Reference in a new issue