diff --git a/common/shlibs b/common/shlibs index 437d56c4d4b..4c487cb8449 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1016,6 +1016,9 @@ liblldb.so.7 lldb-7.0.0_1 libclang.so.7 clang-7.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 libisofs.so.6 libisofs-0.6.24_1 libmpack.so.0 libmpack-1.0.5_1 libGeoIP.so.1 libgeoip-1.4.8_1 diff --git a/srcpkgs/clang b/srcpkgs/clang index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/clang +++ b/srcpkgs/clang @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/clang-analyzer +++ b/srcpkgs/clang-analyzer @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/clang-tools-extra +++ b/srcpkgs/clang-tools-extra @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/lld b/srcpkgs/lld index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/lld +++ b/srcpkgs/lld @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/lld-devel +++ b/srcpkgs/lld-devel @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/lldb b/srcpkgs/lldb index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/lldb +++ b/srcpkgs/lldb @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel index 8c9f4d992de..8ec3476f9c1 120000 --- a/srcpkgs/lldb-devel +++ b/srcpkgs/lldb-devel @@ -1 +1 @@ -llvm7 \ No newline at end of file +llvm8 \ No newline at end of file diff --git a/srcpkgs/llvm8/files/llvm-Config-config.h b/srcpkgs/llvm8/files/llvm-Config-config.h new file mode 100644 index 00000000000..c369b4551f7 --- /dev/null +++ b/srcpkgs/llvm8/files/llvm-Config-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "config-32.h" +#elif __WORDSIZE == 64 +#include "config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm8/files/llvm-Config-llvm-config.h b/srcpkgs/llvm8/files/llvm-Config-llvm-config.h new file mode 100644 index 00000000000..2fa08c9be69 --- /dev/null +++ b/srcpkgs/llvm8/files/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm8/files/patches/cfe/cfe-001-fix-stdint.patch b/srcpkgs/llvm8/files/patches/cfe/cfe-001-fix-stdint.patch new file mode 100644 index 00000000000..17c6989dc8f --- /dev/null +++ b/srcpkgs/llvm8/files/patches/cfe/cfe-001-fix-stdint.patch @@ -0,0 +1,41 @@ +From fd3bcfddcdb11757e95bc3a625017cbf234b67ed Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:32 +0200 +Subject: [PATCH 1/7] fix stdint + +--- + lib/Headers/stdint.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h +index 0303db9..8ca28df 100644 +--- a/lib/Headers/stdint.h ++++ b/lib/Headers/stdint.h +@@ -22,8 +22,6 @@ + * + \*===----------------------------------------------------------------------===*/ + +-#ifndef __CLANG_STDINT_H +-#define __CLANG_STDINT_H + + /* If we're hosted, fall back to the system's stdint.h, which might have + * additional definitions. +@@ -72,6 +70,8 @@ + # endif + + #else ++#ifndef __CLANG_STDINT_H ++#define __CLANG_STDINT_H + + /* C99 7.18.1.1 Exact-width integer types. + * C99 7.18.1.2 Minimum-width integer types. +@@ -703,5 +703,5 @@ typedef __UINTMAX_TYPE__ uintmax_t; + #define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v) + #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v) + +-#endif /* __STDC_HOSTED__ */ + #endif /* __CLANG_STDINT_H */ ++#endif /* __STDC_HOSTED__ */ +-- +2.5.1 + diff --git a/srcpkgs/llvm8/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm8/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch new file mode 100644 index 00000000000..a399ac17a0c --- /dev/null +++ b/srcpkgs/llvm8/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch @@ -0,0 +1,45 @@ +From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +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 +@@ -23,9 +23,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() + /* 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, +@@ -53,6 +50,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include + + #ifdef __cplusplus +@@ -277,6 +277,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ +-- +2.5.1 + diff --git a/srcpkgs/llvm8/files/patches/cfe/cfe-004-add-musl-triples.patch b/srcpkgs/llvm8/files/patches/cfe/cfe-004-add-musl-triples.patch new file mode 100644 index 00000000000..04b3764dbc9 --- /dev/null +++ b/srcpkgs/llvm8/files/patches/cfe/cfe-004-add-musl-triples.patch @@ -0,0 +1,57 @@ +--- clang/lib/Driver/ToolChains/Gnu.cpp ++++ clang/lib/Driver/ToolChains/Gnu.cpp +@@ -1812,7 +1812,7 @@ + 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-suse-linux","aarch64-linux-musl"}; + static const char *const AArch64beLibDirs[] = {"/lib"}; + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", + "aarch64_be-linux-gnu"}; +@@ -1882,7 +1882,10 @@ 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", ++ "arm-linux-musleabihf", ++ "armv7l-linux-musleabihf", ++ "armv7l-linux-gnueabihf"}; + static const char *const ARMebLibDirs[] = {"/lib"}; + static const char *const ARMebTriples[] = {"armeb-linux-gnueabi"}; + static const char *const ARMebHFTriples[] = { +@@ -1835,14 +1837,15 @@ + "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-amazon-linux", "x86_64-linux-musl"}; + static const char *const X32LibDirs[] = {"/libx32"}; + static const char *const X86LibDirs[] = {"/lib32", "/lib"}; + static const char *const X86Triples[] = { + "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", + "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux", + "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", +- "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu"}; ++ "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu", ++ "i686-linux-musl"}; + + static const char *const MIPSLibDirs[] = {"/lib"}; + static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux", +@@ -1869,11 +1872,13 @@ + static const char *const PPC64LibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64Triples[] = { + "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu", +- "powerpc64-suse-linux", "ppc64-redhat-linux"}; ++ "powerpc64-suse-linux", "ppc64-redhat-linux", ++ "powerpc64-linux-musl"}; + static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64LETriples[] = { + "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu", +- "powerpc64le-suse-linux", "ppc64le-redhat-linux"}; ++ "powerpc64le-suse-linux", "ppc64le-redhat-linux", ++ "powerpc64le-linux-musl"}; + + static const char *const RISCV32LibDirs[] = {"/lib", "/lib32"}; + static const char *const RISCVTriples[] = {"riscv32-unknown-linux-gnu", diff --git a/srcpkgs/llvm8/files/patches/cfe/cfe-005-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm8/files/patches/cfe/cfe-005-ppc64-dynamic-linker-path.patch new file mode 100644 index 00000000000..d268ddc42d7 --- /dev/null +++ b/srcpkgs/llvm8/files/patches/cfe/cfe-005-ppc64-dynamic-linker-path.patch @@ -0,0 +1,17 @@ +--- clang/lib/Driver/ToolChains/Linux.cpp 2018-12-16 23:52:16.174867512 +0100 ++++ clang/lib/Driver/ToolChains/Linux.cpp 2018-12-16 23:56:25.040531791 +0100 +@@ -502,12 +502,12 @@ + 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"; + break; + case llvm::Triple::ppc64le: +- LibDir = "lib64"; ++ LibDir = "lib"; + Loader = + (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; + break; diff --git a/srcpkgs/llvm8/files/patches/cfe/cfe-006-ppc64-musl-elfv2.patch b/srcpkgs/llvm8/files/patches/cfe/cfe-006-ppc64-musl-elfv2.patch new file mode 100644 index 00000000000..b307b7aa8cc --- /dev/null +++ b/srcpkgs/llvm8/files/patches/cfe/cfe-006-ppc64-musl-elfv2.patch @@ -0,0 +1,30 @@ +--- clang/lib/Basic/Targets/PPC.h ++++ clang/lib/Basic/Targets/PPC.h +@@ -358,7 +358,10 @@ public: + ABI = "elfv2"; + } else { + resetDataLayout("E-m:e-i64:64-n32:64"); +- ABI = "elfv1"; ++ if (Triple.getEnvironment() == llvm::Triple::Musl) ++ ABI = "elfv2"; ++ else ++ ABI = "elfv1"; + } + + switch (getTriple().getOS()) { +diff --git a/tools/clang/lib/Driver/ToolChains/Clang.cpp b/tools/clang/lib/Driver/ToolChains/Clang.cpp +index 8e9c4c6a..40817ec3 100644 +--- clang/lib/Driver/ToolChains/Clang.cpp ++++ clang/lib/Driver/ToolChains/Clang.cpp +@@ -1618,7 +1618,10 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, + break; + } + +- ABIName = "elfv1"; ++ if (getToolChain().getTriple().getEnvironment() == llvm::Triple::Musl) ++ ABIName = "elfv2"; ++ else ++ ABIName = "elfv1"; + break; + } + case llvm::Triple::ppc64le: diff --git a/srcpkgs/llvm8/files/patches/lldb/zzz-aarch64.patch b/srcpkgs/llvm8/files/patches/lldb/zzz-aarch64.patch new file mode 100644 index 00000000000..5bacbf47296 --- /dev/null +++ b/srcpkgs/llvm8/files/patches/lldb/zzz-aarch64.patch @@ -0,0 +1,25 @@ +--- lldb/source/Plugins/Process/Linux/Procfs.h.orig ++++ lldb/source/Plugins/Process/Linux/Procfs.h +@@ -11,21 +11,6 @@ + // sys/procfs.h on Android/Linux for all supported architectures. + + #include ++#include + +-#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__ + #include +-#endif // __ANDROID__ diff --git a/srcpkgs/llvm8/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm8/files/patches/llvm/llvm-001-musl.patch new file mode 100644 index 00000000000..05afc89be30 --- /dev/null +++ b/srcpkgs/llvm8/files/patches/llvm/llvm-001-musl.patch @@ -0,0 +1,58 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +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/Module.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + /// VecDesc - Describes a possible vectorization of a function. + /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized +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 +@@ -120,6 +120,7 @@ + + #if GTEST_CAN_STREAM_RESULTS_ + # include // NOLINT ++# include // NOLINT + # include // NOLINT + #endif + +-- +2.5.1 + +--- llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc.orig ++++ llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc +@@ -103,7 +103,7 @@ + + // 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 diff --git a/srcpkgs/llvm8/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm8/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch new file mode 100644 index 00000000000..016be5dadb4 --- /dev/null +++ b/srcpkgs/llvm8/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch @@ -0,0 +1,43 @@ +From 750d323a6060ad92c3d247f85d6555041f55b4a5 Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" +Date: Thu, 4 Oct 2018 15:26:59 -0500 +Subject: [PATCH] Add support for powerpc64-*-linux-musl targets + +This patch ensures that 64-bit PowerPC musl targets use ELFv2 ABI on both +endians. It additionally adds a test that big endian PPC64 uses ELFv2 on +musl. +--- + lib/Target/PowerPC/PPCTargetMachine.cpp | 4 ++++ + test/CodeGen/PowerPC/ppc64-elf-abi.ll | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp +index 34410393ef6..c583fba8cab 100644 +--- a/lib/Target/PowerPC/PPCTargetMachine.cpp ++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp +@@ -199,6 +199,10 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, + case Triple::ppc64le: + return PPCTargetMachine::PPC_ABI_ELFv2; + case Triple::ppc64: ++ // musl uses ELFv2 ABI on both endians. ++ if (TT.getEnvironment() == Triple::Musl) ++ return PPCTargetMachine::PPC_ABI_ELFv2; ++ + return PPCTargetMachine::PPC_ABI_ELFv1; + default: + return PPCTargetMachine::PPC_ABI_UNKNOWN; +diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll +index 1e17930304b..aa594b37b47 100644 +--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll ++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll +@@ -1,6 +1,7 @@ + ; 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 -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=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2 +-- +2.18.0 + diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template new file mode 100644 index 00000000000..a2851488ce4 --- /dev/null +++ b/srcpkgs/llvm8/template @@ -0,0 +1,263 @@ +# Template file for 'llvm8' +pkgname=llvm8 +version=8.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 python zlib-devel libffi-devel swig" +makedepends="python-devel zlib-devel libffi-devel libedit-devel + libxml2-devel binutils-devel libatomic-devel" +depends="libllvm8" +short_desc="Low Level Virtual Machine" +maintainer="Rasmus Thomsen " +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="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c + 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373 + 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37 + 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b + 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b + b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1" +disable_parallel_builds=yes +lib32disabled=yes + +subpackages="clang-tools-extra clang clang-analyzer libllvm8" +if [ -z "$CROSS_BUILD" ]; 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_extract() { + # 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 [ -z "$CROSS_BUILD" ]; 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 [ -z "$CROSS_BUILD" -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} + + 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() { + noarch=yes + pycompile_dirs="usr/share/scan-view" + depends="clang-${version}_${revision} python" + 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} python" + 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/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+=" python-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 python-six instead of conflicting + rm "${PKGDESTDIR}/usr/lib/python2.7/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*.a" + vmove "usr/lib/liblldb*.so" + } +} + +libllvm8_package() { + short_desc+=" - runtime library" + pkg_install() { + vmove "usr/lib/libLLVM-*.so*" + } +} diff --git a/srcpkgs/llvm8/update b/srcpkgs/llvm8/update new file mode 100644 index 00000000000..3d09eaff373 --- /dev/null +++ b/srcpkgs/llvm8/update @@ -0,0 +1,2 @@ +site=https://releases.llvm.org/ +pattern="'\K[\d\.]*(?=')"