mirror of
https://abf.rosa.ru/djam/llvm17.git
synced 2025-02-22 21:42:53 +00:00
Imported from SRPM
This commit is contained in:
commit
d0daa24270
4 changed files with 397 additions and 0 deletions
2
.abf.yml
Normal file
2
.abf.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
sources:
|
||||
llvm17-17.0.1.tar.gz: f7ad189f8833032ed572d5ca7fb315a9e561322e
|
137
clang-rosa.patch
Normal file
137
clang-rosa.patch
Normal file
|
@ -0,0 +1,137 @@
|
|||
.../include/clang/Driver/Distro.h | 9 +++++++++
|
||||
.../lib/Driver/Distro.cpp | 9 +++++++++
|
||||
.../lib/Driver/ToolChains/Gnu.cpp | 13 ++++++++++---
|
||||
.../lib/Driver/ToolChains/Linux.cpp | 5 +++--
|
||||
4 files changed, 31 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git clang-12.0.1.src/include/clang/Driver/Distro.h clang-12.0.1.src-diff/include/clang/Driver/Distro.h
|
||||
index 0e98d00..07d2097 100644
|
||||
--- clang-12.0.1.src/include/clang/Driver/Distro.h
|
||||
+++ clang-12.0.1.src-diff/include/clang/Driver/Distro.h
|
||||
@@ -41,8 +41,10 @@ public:
|
||||
RHEL5,
|
||||
RHEL6,
|
||||
RHEL7,
|
||||
+ ROSA,
|
||||
Fedora,
|
||||
Gentoo,
|
||||
+ OpenMandriva,
|
||||
OpenSUSE,
|
||||
UbuntuHardy,
|
||||
UbuntuIntrepid,
|
||||
@@ -115,6 +117,10 @@ public:
|
||||
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
|
||||
}
|
||||
|
||||
+ bool IsROSA() {
|
||||
+ return DistroVal == ROSA;
|
||||
+ }
|
||||
+
|
||||
bool IsOpenSUSE() const { return DistroVal == OpenSUSE; }
|
||||
|
||||
bool IsDebian() const {
|
||||
@@ -129,6 +135,9 @@ public:
|
||||
|
||||
bool IsGentoo() const { return DistroVal == Gentoo; }
|
||||
|
||||
+ bool IsMandriva() const {
|
||||
+ return DistroVal == OpenMandriva;
|
||||
+ }
|
||||
/// @}
|
||||
};
|
||||
|
||||
diff --git clang-12.0.1.src/lib/Driver/Distro.cpp clang-12.0.1.src-diff/lib/Driver/Distro.cpp
|
||||
index ee4fe84..1385c31 100644
|
||||
--- clang-12.0.1.src/lib/Driver/Distro.cpp
|
||||
+++ clang-12.0.1.src-diff/lib/Driver/Distro.cpp
|
||||
@@ -126,6 +126,15 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
|
||||
return Distro::UnknownDistro;
|
||||
}
|
||||
|
||||
+File = VFS.getBufferForFile("/etc/rosa-release");
|
||||
+if (File) {
|
||||
+ StringRef Data = File.get()->getBuffer();
|
||||
+ return Distro::ROSA;
|
||||
+
|
||||
+ return Distro::UnknownDistro;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
// ...for Debian
|
||||
File = VFS.getBufferForFile("/etc/debian_version");
|
||||
if (File) {
|
||||
diff --git clang-12.0.1.src/lib/Driver/ToolChains/Gnu.cpp clang-12.0.1.src-diff/lib/Driver/ToolChains/Gnu.cpp
|
||||
index 1d8a3cd..1abd2aa 100644
|
||||
--- clang-12.0.1.src/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ clang-12.0.1.src-diff/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -2075,7 +2075,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
|
||||
static const char *const AArch64Triples[] = {
|
||||
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
|
||||
- "aarch64-suse-linux", "aarch64-linux-android"};
|
||||
+ "aarch64-suse-linux", "aarch64-linux-android", "aarch64-mandriva-linux-gnu",
|
||||
+ "aarch64-openmandriva-linux-gnu", "aarch64-openmandriva-linux-musl",
|
||||
+ "aarch64-rosa-linux-gnu", "aarch64-rosa-linux-musl"};
|
||||
static const char *const AArch64beLibDirs[] = {"/lib"};
|
||||
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
|
||||
"aarch64_be-linux-gnu"};
|
||||
@@ -2085,6 +2087,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
"arm-linux-androideabi"};
|
||||
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
|
||||
"armv7hl-redhat-linux-gnueabi",
|
||||
+ "armv7hl-rosa-linux-gnueabi",
|
||||
+ "armv7hl-openmandriva-linux-gnueabihf",
|
||||
"armv6hl-suse-linux-gnueabi",
|
||||
"armv7hl-suse-linux-gnueabi"};
|
||||
static const char *const ARMebLibDirs[] = {"/lib"};
|
||||
@@ -2103,7 +2107,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
"x86_64-redhat-linux", "x86_64-suse-linux",
|
||||
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
|
||||
"x86_64-slackware-linux", "x86_64-unknown-linux",
|
||||
- "x86_64-amazon-linux", "x86_64-linux-android"};
|
||||
+ "x86_64-amazon-linux", "x86_64-linux-android",
|
||||
+ "x86_64-rosa-linux-gnu", "x86_64-openmandriva-linux-gnu"};
|
||||
static const char *const X32LibDirs[] = {"/libx32"};
|
||||
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
|
||||
static const char *const X86Triples[] = {
|
||||
@@ -2112,7 +2117,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
|
||||
"i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu",
|
||||
"i686-linux-android", "i386-gnu", "i486-gnu",
|
||||
- "i586-gnu", "i686-gnu"};
|
||||
+ "i586-gnu", "i686-gnu", "i586-unknown-linux-gnu",
|
||||
+ "i586-rosa-linux-gnu", "i686-rosa-linux-gnu", "i586-openmandriva-linux-gnu",
|
||||
+ "i686-openmandriva-linux-gnu"};
|
||||
|
||||
static const char *const MIPSLibDirs[] = {"/lib"};
|
||||
static const char *const MIPSTriples[] = {
|
||||
diff --git clang-12.0.1.src/lib/Driver/ToolChains/Linux.cpp clang-12.0.1.src-diff/lib/Driver/ToolChains/Linux.cpp
|
||||
index 9663a73..e2ca948 100644
|
||||
--- clang-12.0.1.src/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ clang-12.0.1.src-diff/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -231,7 +231,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
}
|
||||
|
||||
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
|
||||
- Triple.isAndroid()) {
|
||||
+ Distro.IsROSA() || Distro.IsMandriva() || Triple.isAndroid()) {
|
||||
ExtraOpts.push_back("-z");
|
||||
ExtraOpts.push_back("relro");
|
||||
}
|
||||
@@ -271,6 +271,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
// Hexagon linker/loader does not support .gnu.hash
|
||||
if (!IsMips && !IsHexagon) {
|
||||
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
|
||||
+ Distro.IsROSA() || Distro.IsMandriva() ||
|
||||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
|
||||
(IsAndroid && !Triple.isAndroidVersionLT(23)))
|
||||
ExtraOpts.push_back("--hash-style=gnu");
|
||||
@@ -286,7 +287,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
ExtraOpts.push_back("--build-id");
|
||||
#endif
|
||||
|
||||
- if (IsAndroid || Distro.IsOpenSUSE())
|
||||
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsMandriva() || Distro.IsROSA())
|
||||
ExtraOpts.push_back("--enable-new-dtags");
|
||||
|
||||
// The selection of paths to try here is designed to match the patterns which
|
14
llvm17.rpmlintrc
Normal file
14
llvm17.rpmlintrc
Normal file
|
@ -0,0 +1,14 @@
|
|||
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")
|
||||
# This is in llvm-doc
|
||||
addFilter("W: no-documentation")
|
||||
addFilter("E: explicit-lib-dependency")
|
||||
addFilter("E: devel-dependency")
|
||||
addFilter("E: debuginfo-without-sources")
|
||||
|
244
llvm17.spec
Normal file
244
llvm17.spec
Normal file
|
@ -0,0 +1,244 @@
|
|||
%global optflags %(echo %{optflags} | sed -e 's/-ffat-lto-objects//g' -e 's/-fvar-tracking-assignments//g' -e 's/-Wa,//g' -e 's/--compress-debug-sections//g' -e 's/-fno-devirtualize//g' )
|
||||
|
||||
%define oname llvm
|
||||
|
||||
%define _olibdir /usr/%{_lib}
|
||||
%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 _disable_ld_no_undefined 1
|
||||
%global optflags %{optflags} -fno-strict-aliasing
|
||||
%global ldflags %{ldflags} -Wl,-rpath,%{_libdir}
|
||||
|
||||
%define compile_apidox 1
|
||||
#{?_with_apidox: %{expand: %%global compile_apidox 1}}
|
||||
|
||||
%define maj_ver 17
|
||||
%define min_ver 1
|
||||
%define libname %mklibname llvm%{maj_ver}
|
||||
|
||||
%if %mdkversion == 201610
|
||||
%bcond_without lldb
|
||||
%else
|
||||
%bcond_with lldb
|
||||
%endif
|
||||
|
||||
%define _llvm_bs_ver 16
|
||||
|
||||
%define commit 434575c026c81319b393f64047025b54e69e24c2
|
||||
%define commit_short %(echo %{commit} | head -c 6)
|
||||
|
||||
Summary: LLVM and Clang in %{_prefix}
|
||||
# llvm16
|
||||
Name: llvm%{maj_ver}
|
||||
Version: %{maj_ver}.0.%{min_ver}
|
||||
Release: 1
|
||||
License: NCSA
|
||||
Group: Development/Other
|
||||
URL: https://llvm.org
|
||||
#Source0: https://github.com/llvm/llvm-project/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Source0: https://github.com/llvm/llvm-project/archive/llvmorg-%{version}/%{name}-%{version}.tar.gz
|
||||
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: gcc
|
||||
BuildRequires: stdc++-devel
|
||||
# gcc is too old in rosa2016.1, llvm12 was buildable with it but llvm13 is already not
|
||||
BuildRequires: llvm%{_llvm_bs_ver}
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: bison
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: cmake
|
||||
BuildRequires: ninja
|
||||
BuildRequires: flex
|
||||
BuildRequires: graphviz
|
||||
BuildRequires: groff
|
||||
BuildRequires: libstdc++-devel
|
||||
BuildRequires: stdc++-gcc10-devel
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkgconfig(libffi)
|
||||
BuildRequires: pkgconfig(libtirpc)
|
||||
# patchelf is for %%check
|
||||
BuildRequires: patchelf
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python38-devel
|
||||
BuildRequires: sed
|
||||
BuildRequires: tcl
|
||||
BuildRequires: zip
|
||||
%if %{compile_apidox}
|
||||
BuildRequires: doxygen
|
||||
%endif
|
||||
BuildRequires: clang
|
||||
|
||||
Requires: libstdc++-devel
|
||||
Requires: stdc++-gcc10-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
|
||||
# Require this manually instead of AutoReq
|
||||
%if %rpm4
|
||||
Requires: %(patchelf --print-soname /usr/%{_lib}/libffi.so || echo foo)%{_arch_tag_suffix}
|
||||
%else
|
||||
# _arch_tag_suffix in needed form does not exist in rpm5, make a more dirty hack
|
||||
Requires: %{_lib}ffi%(patchelf --print-soname /usr/%{_lib}/libffi.so | rev | cut -d. -f1 | rev)
|
||||
%endif
|
||||
|
||||
|
||||
%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
|
||||
%{_prefix}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: LLVM %{maj_ver} shared library
|
||||
Group: System/Libraries
|
||||
AutoReq: 1
|
||||
AutoProv: 1
|
||||
|
||||
%description -n %{libname}
|
||||
LLVM %{maj_ver} shared library
|
||||
|
||||
%files -n %{libname}
|
||||
%{_olibdir}/libLLVM-%{maj_ver}*.so
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%prep
|
||||
%setup -qn llvm-project-llvmorg-%{version}
|
||||
|
||||
|
||||
%build
|
||||
# gcc is too old in rosa2016.1
|
||||
#export CC=gcc
|
||||
#export CXX=g++
|
||||
export CC=/opt/llvm%{_llvm_bs_ver}/bin/clang
|
||||
export CXX=/opt/llvm%{_llvm_bs_ver}/bin/clang++
|
||||
export AR=/opt/llvm%{_llvm_bs_ver}/bin/llvm-ar
|
||||
export NM=/opt/llvm%{_llvm_bs_ver}/bin/llvm-nm
|
||||
|
||||
%setup_compile_flags
|
||||
|
||||
# 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"
|
||||
export CFLAGS="`echo %{optflags} | sed -e 's/-gdwarf-4//' -e 's/-fvar-tracking-assignments//' -e 's/-frecord-gcc-switches//' -e 's/-flto//g'`"
|
||||
%endif
|
||||
|
||||
%ifarch %ix86
|
||||
# Fix noexecstack
|
||||
for i in compiler-rt/lib/builtins/i386/*.S; do
|
||||
cat >>$i <<'EOF'
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
EOF
|
||||
done
|
||||
%endif
|
||||
|
||||
%if %{mdvver} == 201610
|
||||
export PYTHONPATH=/usr/bin
|
||||
export PATH=$PYTHONPATH:$PATH
|
||||
%endif
|
||||
|
||||
export CXXFLAGS="$CFLAGS"
|
||||
|
||||
export READELF=readelf
|
||||
|
||||
export LDFLAGS="-lstdc++-gcc10"
|
||||
|
||||
#clang_gcc_wrapper
|
||||
|
||||
|
||||
|
||||
mkdir -p build
|
||||
# We actually need only clang and lld to build chromium-browser-stable,
|
||||
# other subprojects fail to build when using /opt/llvm12/bin/clang++,
|
||||
# build OK when using gcc, but gcc is too old in rosa2016.1,
|
||||
# so let's build clang and lld only for now.
|
||||
# -DLLVM_ENABLE_PROJECTS='clang-tools-extra;libcxx;libcxxabi;%{!?with_lldb:lldb;}compiler-rt;lld;polly'
|
||||
cmake -S llvm -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_ENABLE_PROJECTS='clang;lld' \
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF \
|
||||
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
|
||||
-DLLVM_VERSION_SUFFIX="" \
|
||||
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
||||
-DLLVM_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
|
||||
-DCLANG_LIBDIR_SUFFIX=$(echo %{_lib} | sed -e 's,^lib,,') \
|
||||
-DCLANG_DEFAULT_CXX_STDLIB="libstdc++" \
|
||||
-DCLANG_DEFAULT_RTLIB="libgcc" \
|
||||
-DLLVM_ENABLE_FFI:BOOL=ON \
|
||||
-DLLVM_ENABLE_RTTI:BOOL=ON \
|
||||
-DOCAMLFIND=NOTFOUND \
|
||||
%if %{mdvver} <= 201610
|
||||
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN:BOOL=ON \
|
||||
%endif
|
||||
%if %{compile_apidox}
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=ON \
|
||||
-DLLVM_BUILD_DOCS:BOOL=ON \
|
||||
%endif
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=ON \
|
||||
-DCMAKE_CXX_FLAGS="-nostdinc++ -I/usr/include/libstdc++-gcc10 -I/usr/include/libstdc++-gcc10/%{_host} -Wc++11-narrowing " \
|
||||
-DCMAKE_C_FLAGS="-nostdinc++ -I/usr/include/libstdc++-gcc10 -I/usr/include/libstdc++-gcc10/%{_host} -Wc++11-narrowing "
|
||||
|
||||
cmake --build build
|
||||
|
||||
%install
|
||||
DESTDIR=%{buildroot} cmake --install 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}
|
||||
|
||||
# Will be used in Mesa
|
||||
mkdir -p %{buildroot}%{_olibdir}
|
||||
install -m0755 %{buildroot}%{_libdir}/libLLVM-%{maj_ver}.so %{buildroot}%{_olibdir}
|
||||
# RPATH to /opt/... is not needed here
|
||||
patchelf --remove-rpath %{buildroot}%{_olibdir}/*.so*
|
||||
|
||||
# Versionize shebangs python
|
||||
sed '1 s,^.*$,#!%{__python3},' -i %{buildroot}%{_bindir}/{hmaptool,scan-view}
|
||||
|
||||
%check
|
||||
#atchelf --print-rpath %{buildroot}%{_bindir}/clang | grep -q %{_libdir}
|
Loading…
Add table
Reference in a new issue