New package: llvm9-9.0.0

This commit is contained in:
q66 2019-09-23 00:25:26 +02:00 committed by Helmut Pozimski
parent 63c168928d
commit a3ff698c92
23 changed files with 698 additions and 4 deletions

View file

@ -1021,13 +1021,13 @@ libuchardet.so.0 uchardet-0.0.6_1
libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
libyajl.so.2 yajl-2.0.1_1
libconfuse.so.2 confuse-3.2.1_1
liblldb.so.8 lldb-8.0.0_1
libclang.so.8 clang-8.0.0_1
liblldb.so.9 lldb-9.0.0_1
libclang.so.9 clang-9.0.0_1
libclang-cpp.so.9 clang-9.0.0_1
libLLVM-6.0.so libllvm6.0-6.0.0_1
libLLVM-7.so libllvm7-7.0.0_1
libLLVM-8.so libllvm8-8.0.0_1
libOptRemarks.so.8 libllvm8-8.0.0_1
libLTO.so.8 libllvm8-8.0.0_1
libLLVM-9.so libllvm9-9.0.0_1
libisofs.so.6 libisofs-0.6.24_1
libmpack.so.0 libmpack-1.0.5_1
libGeoIP.so.1 libgeoip-1.4.8_1

1
srcpkgs/clang Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/clang-analyzer Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/clang-tools-extra Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/libllvm9 Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/lld Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/lld-devel Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/lldb Symbolic link
View file

@ -0,0 +1 @@
llvm9

1
srcpkgs/lldb-devel Symbolic link
View file

@ -0,0 +1 @@
llvm9

View file

@ -0,0 +1,9 @@
#include <bits/wordsize.h>
#if __WORDSIZE == 32
#include "config-32.h"
#elif __WORDSIZE == 64
#include "config-64.h"
#else
#error "Unknown word size"
#endif

View file

@ -0,0 +1,9 @@
#include <bits/wordsize.h>
#if __WORDSIZE == 32
#include "llvm-config-32.h"
#elif __WORDSIZE == 64
#include "llvm-config-64.h"
#else
#error "Unknown word size"
#endif

View file

@ -0,0 +1,44 @@
From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Tue, 8 Sep 2015 22:14:57 +0200
Subject: [PATCH 2/7] fix unwind chain inclusion
---
lib/Headers/unwind.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
index 303d792..44e10cc 100644
--- a/lib/Headers/unwind.h
+++ b/lib/Headers/unwind.h
@@ -9,9 +9,6 @@
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
-#ifndef __CLANG_UNWIND_H
-#define __CLANG_UNWIND_H
-
#if defined(__APPLE__) && __has_include_next(<unwind.h>)
/* Darwin (from 11.x on) provide an unwind.h. If that's available,
* use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
@@ -39,6 +36,9 @@
# endif
#else
+#ifndef __CLANG_UNWIND_H
+#define __CLANG_UNWIND_H
+
#include <stdint.h>
#ifdef __cplusplus
@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
}
#endif
+#endif /* __CLANG_UNWIND_H */
+
#endif
-#endif /* __CLANG_UNWIND_H */
--
2.5.1

View file

@ -0,0 +1,91 @@
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
"armv7hl-redhat-linux-gnueabi",
"armv6hl-suse-linux-gnueabi",
- "armv7hl-suse-linux-gnueabi"};
+ "armv7hl-suse-linux-gnueabi",
+ "armv7l-linux-gnueabihf"};
static const char *const ARMebLibDirs[] = {"/lib"};
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
"armeb-linux-androideabi"};
@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
return;
}
+ if (TargetTriple.isMusl()) {
+ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
+ static const char *const ARMHFMuslTriples[] = {
+ "arm-linux-musleabihf", "armv7l-linux-musleabihf"
+ };
+ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
+ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
+ static const char *const X86MuslTriples[] = {"i686-linux-musl"};
+ static const char *const MIPSMuslTriples[] = {
+ "mips-linux-musl", "mipsel-linux-musl",
+ "mipsel-linux-muslhf", "mips-linux-muslhf"
+ };
+ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
+ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
+ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
+
+ switch (TargetTriple.getArch()) {
+ case llvm::Triple::aarch64:
+ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
+ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
+ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
+ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
+ break;
+ case llvm::Triple::arm:
+ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
+ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
+ } else {
+ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
+ }
+ break;
+ case llvm::Triple::x86_64:
+ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
+ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
+ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
+ break;
+ case llvm::Triple::x86:
+ LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
+ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
+ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
+ break;
+ case llvm::Triple::mips:
+ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
+ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
+ break;
+ case llvm::Triple::ppc:
+ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
+ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
+ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
+ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
+ break;
+ case llvm::Triple::ppc64:
+ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
+ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
+ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
+ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
+ break;
+ case llvm::Triple::ppc64le:
+ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
+ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
+ break;
+ default:
+ break;
+ }
+ TripleAliases.push_back(TargetTriple.str());
+ if (TargetTriple.str() != BiarchTriple.str())
+ BiarchTripleAliases.push_back(BiarchTriple.str());
+ return;
+ }
+
// Android targets should not use GNU/Linux tools or libraries.
if (TargetTriple.isAndroid()) {
static const char *const AArch64AndroidTriples[] = {

View file

@ -0,0 +1,18 @@
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
Loader = "ld.so.1";
break;
case llvm::Triple::ppc64:
- LibDir = "lib64";
+ LibDir = "lib";
Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
+ (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
break;
case llvm::Triple::ppc64le:
- LibDir = "lib64";
+ LibDir = "lib";
Loader =
(tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
break;

View file

@ -0,0 +1,27 @@
--- a/lib/Basic/Targets/PPC.h
+++ b/lib/Basic/Targets/PPC.h
@@ -376,11 +376,11 @@ public:
if ((Triple.getArch() == llvm::Triple::ppc64le)) {
resetDataLayout("e-m:e-i64:64-n32:64");
- ABI = "elfv2";
} else {
resetDataLayout("E-m:e-i64:64-n32:64");
- ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
}
+ /* default to elfv2 always, ignore llvm's elfv2 triples */
+ ABI = "elfv2";
if (Triple.getOS() == llvm::Triple::AIX)
SuitableAlign = 64;
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
break;
}
- ABIName = "elfv1";
+ ABIName = "elfv2";
break;
}
case llvm::Triple::ppc64le:

View file

@ -0,0 +1,40 @@
From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
From: Serge Guelton <sguelton@redhat.com>
Date: Thu, 19 Sep 2019 00:54:40 +0000
Subject: [PATCH] Initialize all fields in ABIArgInfo.
Due to usage of an uninitialized fields, we end up with
a Conditional jump or move depends on uninitialised value
Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
Commited on behalf of Martin Liska <mliska@suse.cz>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
---
include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
index 1f81072e23d0..5069d9af42a3 100644
--- a/include/clang/CodeGen/CGFunctionInfo.h
+++ b/include/clang/CodeGen/CGFunctionInfo.h
@@ -109,14 +109,12 @@ class ABIArgInfo {
UnpaddedCoerceAndExpandType = T;
}
- ABIArgInfo(Kind K)
- : TheKind(K), PaddingInReg(false), InReg(false) {
- }
-
public:
- ABIArgInfo()
+ ABIArgInfo(Kind K = Direct)
: TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
- TheKind(Direct), PaddingInReg(false), InReg(false) {}
+ TheKind(K), PaddingInReg(false), InAllocaSRet(false),
+ IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
+ InReg(false), CanBeFlattened(false), SignExt(false) {}
static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
llvm::Type *Padding = nullptr,

View file

@ -0,0 +1,31 @@
--- a/source/Plugins/Process/Linux/Procfs.h
+++ b/source/Plugins/Process/Linux/Procfs.h
@@ -10,21 +10,12 @@
// sys/procfs.h on Android/Linux for all supported architectures.
#include <sys/ptrace.h>
+#include <asm/ptrace.h>
-#ifdef __ANDROID__
-#if defined(__arm64__) || defined(__aarch64__)
-typedef unsigned long elf_greg_t;
-typedef elf_greg_t
- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
-typedef struct user_fpsimd_state elf_fpregset_t;
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#elif defined(__mips__)
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#endif
-#else // __ANDROID__
+#if !defined(__GLIBC__) && defined(__powerpc__)
+#define pt_regs musl_pt_regs
+#include <sys/procfs.h>
+#undef pt_regs
+#else
#include <sys/procfs.h>
-#endif // __ANDROID__
+#endif

View file

@ -0,0 +1,58 @@
From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Tue, 8 Sep 2015 22:03:02 +0200
Subject: [PATCH 3/3] musl
---
include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
lib/Support/DynamicLibrary.cpp | 2 +-
lib/Support/Unix/Signals.inc | 6 +++---
utils/unittest/googletest/src/gtest.cc | 1 +
5 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
index e0a1ee3..465b65a 100644
--- a/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/include/llvm/Analysis/TargetLibraryInfo.h
@@ -18,6 +18,15 @@
#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
+#undef fopen64
+#undef fseeko64
+#undef fstat64
+#undef fstatvfs64
+#undef ftello64
+#undef lstat64
+#undef stat64
+#undef tmpfile64
+
namespace llvm {
template <typename T> class ArrayRef;
diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
index 5780764..1d548c1 100644
--- a/utils/unittest/googletest/src/gtest.cc
+++ b/utils/unittest/googletest/src/gtest.cc
@@ -128,6 +128,7 @@
#if GTEST_CAN_STREAM_RESULTS_
# include <arpa/inet.h> // NOLINT
+# include <sys/socket.h> // NOLINT
# include <netdb.h> // NOLINT
# include <sys/socket.h> // NOLINT
# include <sys/types.h> // NOLINT
--
2.5.1
--- a/lib/Support/Unix/DynamicLibrary.inc
+++ b/lib/Support/Unix/DynamicLibrary.inc
@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
// This macro returns the address of a well-known, explicit symbol
#define EXPLICIT_SYMBOL(SYM) \
- if (!strcmp(SymbolName, #SYM)) return &SYM
+ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
// Under glibc we have a weird situation. The stderr/out/in symbols are both
// macros and global variables because of standards requirements. So, we

View file

@ -0,0 +1,31 @@
This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
need this because unlike most distros we use ELFv2 for both glibc and musl
on big endian ppc64.
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
switch (TT.getArch()) {
case Triple::ppc64le:
- return PPCTargetMachine::PPC_ABI_ELFv2;
case Triple::ppc64:
- if (TT.getEnvironment() == llvm::Triple::ELFv2)
- return PPCTargetMachine::PPC_ABI_ELFv2;
- return PPCTargetMachine::PPC_ABI_ELFv1;
+ /* default to ELFv2 always, don't care about llvm's stupid broken suffix
+ * triples; people can override the default properly via -mabi like gcc
+ */
+ return PPCTargetMachine::PPC_ABI_ELFv2;
default:
return PPCTargetMachine::PPC_ABI_UNKNOWN;
}
--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
@@ -1,4 +1,5 @@
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2

View file

@ -0,0 +1,25 @@
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
if (isDarwin())
HasLazyResolverStubs = true;
- if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
- TargetTriple.isMusl())
+ if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
SecurePlt = true;
if (HasSPE && IsPPC64)
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
if (TT.getArch() == Triple::ppc64)
return Reloc::PIC_;
+ // We force SecurePlt on 32-bit ppc linux which requires PIC
+ if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
+ return Reloc::PIC_;
+
// Rest are static by default.
return Reloc::Static;
}

View file

@ -0,0 +1,18 @@
This allows us to override the optimization level as not all platforms can
deal with -O3.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
endif()
+set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
+
+if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
+ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
+endif()
+
# Put this before tblgen. Else we have a circular dependence.
add_subdirectory(lib/Demangle)
add_subdirectory(lib/Support)

283
srcpkgs/llvm9/template Normal file
View file

@ -0,0 +1,283 @@
# Template file for 'llvm9'
pkgname=llvm9
version=9.0.0
revision=1
wrksrc="llvm-${version}.src"
build_style=cmake
configure_args="
-DCMAKE_BUILD_TYPE=Release
-DLLVM_INSTALL_UTILS=ON
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_LINK_LLVM_DYLIB=ON
-DLLVM_ENABLE_RTTI=ON
-DLLVM_ENABLE_FFI=ON
-DLLVM_BINUTILS_INCDIR=/usr/include"
hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
makedepends="python3-devel zlib-devel libffi-devel libedit-devel
libxml2-devel binutils-devel libatomic-devel"
depends="libllvm9"
short_desc="Low Level Virtual Machine"
maintainer="q66 <daniel@octaforge.org>"
license="NCSA"
homepage="https://www.llvm.org"
distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
disable_parallel_builds=yes
lib32disabled=yes
# necessary to override auto default
python_version=3
_lldb_enable=yes
if [ "$CROSS_BUILD" ]; then
_lldb_enable=no
fi
case "$XBPS_TARGET_MACHINE" in
ppc64le*) ;;
ppc*) _lldb_enable=no ;;
esac
subpackages="clang-tools-extra clang clang-analyzer libllvm9"
if [ "$_lldb_enable" = "yes" ]; then
# XXX fails to cross compile due to python
subpackages+=" lldb lldb-devel"
fi
subpackages+=" lld lld-devel"
case "$XBPS_TARGET_MACHINE" in
armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
esac
post_patch() {
# patches
cd ${XBPS_BUILDDIR}/llvm-${version}.src
for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
msg_normal "Applying $i to llvm\n"
patch -sNp1 -i ${i}
done
cd ${XBPS_BUILDDIR}/cfe-${version}.src
for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
msg_normal "Applying $i to cfe\n"
patch -sNp1 -i ${i}
done
if [ "$_lldb_enable" = "yes" ]; then
cd ${XBPS_BUILDDIR}/lldb-${version}.src
for i in ${FILESDIR}/patches/lldb/*.patch; do
msg_normal "Applying $i to lldb\n"
patch -sNp1 -i ${i}
done
case "$XBPS_TARGET_MACHINE" in
*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
esac
fi
# Move clang files into the llvm source.
if [ -d ${XBPS_BUILDDIR}/cfe-${version}.src ]; then
mv ${XBPS_BUILDDIR}/cfe-${version}.src ${wrksrc}/tools/clang
fi
# Move clang-tools-extra files into llvm source.
if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
fi
# Move lld files into the llvm source.
if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
fi
# Move lldb files into the llvm source.
if [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
fi
# Move compiler-rt files into the llvm source.
if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
fi
case "$XBPS_TARGET_MACHINE" in
*-musl)
# Disable sanitizers
sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
;;
esac
}
pre_configure() {
# Vastly reduce size of debugging symbols:
CFLAGS=${CFLAGS/ -g/ -g1}
CXXFLAGS=${CXXFLAGS/ -g/ -g1}
# since gcc9, the build likes to blow up for ppc32 apparently because
# of clang being too large for a 24-bit relative call to the PLT, so
# optimize for size instead
case "$XBPS_TARGET_MACHINE" in
ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
esac
if [ "$CROSS_BUILD" ]; then
msg_normal "Building host tblgen\n"
mkdir -p build/HOST
cd build/HOST
CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
cmake ../.. -DCMAKE_BUILD_TYPE=Release
make ${makejobs} -C utils/TableGen
make ${makejobs} -C tools/clang/utils/TableGen
configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
cd ../..
fi
case "$XBPS_TARGET_MACHINE" in
i686*) _arch="X86";;
x86_64*) _arch="X86";;
armv5*) _arch="Armv5te";;
armv6*) _arch="Armv6";;
armv7*) _arch="Armv7";;
aarch64*) _arch="AArch64";;
mips*) _arch="Mips";;
ppc*) _arch="PowerPC";;
esac
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
}
do_install() {
vlicense LICENSE.TXT
cd build
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
# Fix permissions of static libs
chmod -x ${DESTDIR}/usr/lib/*.a
# Required for multilib.
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
for _header in llvm-config; do
mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
usr/include/llvm/Config ${_header}.h
done
fi
# Remove llvm-config-host in cross builds.
if [ "$CROSS_BUILD" ]; then
rm -f ${DESTDIR}/usr/bin/llvm-config-host
fi
}
clang-analyzer_package() {
archs=noarch
pycompile_dirs="usr/share/scan-view"
depends="clang-${version}_${revision} python3"
short_desc+=" - A source code analysis framework"
homepage="https://clang-analyzer.llvm.org/"
pkg_install() {
vmove usr/share/man/man1/scan-build.1
vmove "/usr/bin/scan-*"
vmove "/usr/share/scan-*"
vmove "/usr/libexec/*analyzer"
}
}
clang-tools-extra_package() {
depends="clang-${version}_${revision} python3"
short_desc+=" - Extra Clang tools"
homepage="https://clang.llvm.org/extra/"
pkg_install() {
vmove usr/bin/clang-apply-replacements
vmove usr/bin/clang-query
vmove usr/bin/clang-rename
vmove usr/bin/clang-tidy
vmove usr/bin/modularize
vmove "usr/lib/libclangApplyReplacements*"
vmove "usr/lib/libclangQuery*"
vmove "usr/lib/libclangTidy*"
vmove "usr/share/clang/*tidy*"
}
}
clang_package() {
lib32disabled=yes
depends="libstdc++-devel libgcc-devel binutils"
case "$XBPS_TARGET_MACHINE" in
*-musl) depends+=" musl-devel";;
*) depends+=" glibc-devel";;
esac
short_desc+=" - C language family frontend"
alternatives="cc:cc:/usr/bin/clang"
homepage="https://clang.llvm.org/"
pkg_install() {
vmove usr/include/clang
vmove usr/include/clang-c
vmove "usr/bin/*clang*"
vmove usr/bin/c-index-test
vmove usr/lib/clang
vmove usr/lib/cmake/clang
vmove "usr/lib/libclang*"
vmove "usr/share/clang"
}
}
lld_package() {
lib32disabled=yes
short_desc+=" - linker"
homepage="https://lld.llvm.org"
pkg_install() {
vmove usr/bin/lld*
vmove usr/bin/wasm-ld
vmove usr/bin/ld.lld*
}
}
lld-devel_package() {
lib32disabled=yes
short_desc+=" - linker - development files"
homepage="https://lld.llvm.org"
pkg_install() {
vmove usr/include/lld
vmove "usr/lib/liblld*a"
}
}
lldb_package() {
lib32disabled=yes
depends+=" python3-six"
short_desc+=" - LLDB debugger"
homepage="https://lldb.llvm.org/"
pkg_install() {
vmove usr/bin/*lldb*
vmove usr/lib/liblldb*so.*
vman tools/lldb/docs/lldb.1
vmove /usr/lib/python*
# Depend on python3-six instead of conflicting
rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
}
}
lldb-devel_package() {
depends="lldb>=${version}_${revision}"
short_desc+=" - LLDB debugger - development files"
pkg_install() {
vmove usr/include/lldb
vmove "usr/lib/liblldb*.so"
}
}
libllvm9_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove "usr/lib/libLLVM-*.so*"
}
}

2
srcpkgs/llvm9/update Normal file
View file

@ -0,0 +1,2 @@
site=https://releases.llvm.org/
pattern="'\K[\d\.]*(?=')"