llvm: update to 7.0.1.

* version latest version too -> llvm7

Co-authored-by: maxice8 <thinkabit.ukim@gmail.com>

[ci skip]
This commit is contained in:
Rasmus Thomsen 2018-09-19 23:13:57 +02:00 committed by maxice8
parent fb2b56e1c2
commit 282f980cf9
No known key found for this signature in database
GPG key ID: 543B9D4F4299F06B
24 changed files with 346 additions and 314 deletions

View file

@ -1001,10 +1001,11 @@ 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.6 lldb-6.0.0_1
libclang.so.6 clang-6.0.0_1
liblldb.so.7 lldb-7.0.0_1
libclang.so.7 clang-7.0.0_1
libLLVM-3.9.so libllvm3.9-3.9.0_1
libLLVM-6.0.so libllvm6.0-6.0.0_1
libLLVM-7.so libllvm7-7.0.0_1
libisofs.so.6 libisofs-0.6.24_1
libmpack.so.0 libmpack-1.0.5_1
libv8.so.3.24 libv8-3.24.35.22_1

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +0,0 @@
llvm

1
srcpkgs/libllvm7 Symbolic link
View file

@ -0,0 +1 @@
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1 +1 @@
llvm
llvm7

View file

@ -1,11 +0,0 @@
--- lldb-5.0.0.src/include/lldb/Host/Editline.h.orig
+++ lldb-5.0.0.src/include/lldb/Host/Editline.h
@@ -44,7 +44,7 @@
// used in cases where this is true. This is a compile time dependecy, for now
// selected per target Platform
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
- defined(__OpenBSD__)
+ defined(__OpenBSD__) || defined(__linux__)
#define LLDB_EDITLINE_USE_WCHAR 1
#include <codecvt>
#else

View file

@ -1,256 +1,10 @@
# Template file for 'llvm'
pkgname=llvm
version=6.0.1
revision=3
wrksrc="llvm-${version}.src"
lib32disabled=yes
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"
short_desc="Low Level Virtual Machine"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.llvm.org"
license="NCSA"
distfiles="
http://www.llvm.org/releases/${version}/llvm-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/lldb-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/lld-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/cfe-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/clang-tools-extra-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/compiler-rt-${version}.src.tar.xz"
checksum="b6d6c324f9c71494c0ccaf3dac1f16236d970002b42bb24a6c9e1634f7d0f4e2
6b8573841f2f7b60ffab9715c55dceff4f2a44e5a6d590ac189d20e8e7472714
e706745806921cea5c45700e13ebe16d834b5e3c0b7ad83bf6da1f28b0634e11
7c243f1485bddfdfedada3cd402ff4792ea82362ff91fbdac2dae67c6026b667
0d2e3727786437574835b75135f9e36f861932a958d8547ced7e13ebdda115f1
f4cd1e15e7d5cb708f9931d4844524e4904867240c306b06a4287b22ac1c99b9"
# XXX Investigate ocaml bindings.
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="libllvm6.0"
subpackages="clang-tools-extra clang clang-analyzer libllvm6.0"
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";;
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="http://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="http://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="http://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="http://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="http://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="http://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"
}
}
libllvm6.0_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove "usr/lib/libLLVM-*.so*"
}
}
version=7.0.1
revision=1
build_style=meta
depends="llvm7"
short_desc="The LLVM meta package"
maintainer="Rasmus Thomsen <rasmus.thomsen@protonmail.com>"
license="Public Domain"
homepage="https://www.voidlinux.eu/"

View file

@ -1,15 +1,5 @@
--- clang/lib/Driver/ToolChains/Gnu.cpp.orig
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1802,7 +1802,8 @@
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-linux-android",
- "aarch64-redhat-linux", "aarch64-suse-linux"};
+ "aarch64-redhat-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"};
@@ -1813,7 +1814,9 @@
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
"armv7hl-redhat-linux-gnueabi",
@ -21,19 +11,32 @@
static const char *const ARMebLibDirs[] = {"/lib"};
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
"armeb-linux-androideabi"};
@@ -1827,6 +1830,7 @@
--- clang/lib/Driver/ToolChains/Gnu.cpp.orig 2018-09-19 11:56:30.981980945 -0300
+++ clang/lib/Driver/ToolChains/Gnu.cpp 2018-09-19 11:58:26.467979348 -0300
@@ -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"};
@@ -1837,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-linux-android",
+ "x86_64-linux-musl",
"x86_64-unknown-linux"};
"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"};
@@ -1835,6 +1839,7 @@
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", "i686-linux-android",
+ "i686-linux-musl",
"i586-linux-gnu"};
- "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",

View file

@ -5,7 +5,6 @@ Subject: [PATCH 3/3] musl
---
include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
lib/Analysis/TargetLibraryInfo.cpp | 5 +++--
lib/Support/DynamicLibrary.cpp | 2 +-
lib/Support/Unix/Signals.inc | 6 +++---
utils/unittest/googletest/src/gtest.cc | 1 +
@ -46,26 +45,6 @@ index 5780764..1d548c1 100644
--
2.5.1
--- llvm-5.0.0.src/lib/Analysis/TargetLibraryInfo.cpp.orig
+++ llvm-5.0.0.src/lib/Analysis/TargetLibraryInfo.cpp
@@ -439,14 +439,15 @@
}
// The following functions are available on at least Linux:
- if (!T.isOSLinux()) {
+ if (!T.isOSLinux())
+ TLI.setUnavailable(LibFunc_memalign);
+ if (1 /*!T.isGlibc()*/) {
TLI.setUnavailable(LibFunc_dunder_strdup);
TLI.setUnavailable(LibFunc_dunder_strtok_r);
TLI.setUnavailable(LibFunc_dunder_isoc99_scanf);
TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf);
TLI.setUnavailable(LibFunc_under_IO_getc);
TLI.setUnavailable(LibFunc_under_IO_putc);
- TLI.setUnavailable(LibFunc_memalign);
TLI.setUnavailable(LibFunc_fopen64);
TLI.setUnavailable(LibFunc_fseeko64);
TLI.setUnavailable(LibFunc_fstat64);
--- 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 @@

View file

@ -0,0 +1,43 @@
From 750d323a6060ad92c3d247f85d6555041f55b4a5 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
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

263
srcpkgs/llvm7/template Normal file
View file

@ -0,0 +1,263 @@
# Template file for 'llvm7'
pkgname=llvm7
version=7.0.1
revision=1
wrksrc="llvm-${version}.src"
lib32disabled=yes
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"
short_desc="Low Level Virtual Machine"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://www.llvm.org"
license="NCSA"
distfiles="
https://www.llvm.org/releases/${version}/llvm-${version}.src.tar.xz
https://www.llvm.org/releases/${version}/lldb-${version}.src.tar.xz
https://www.llvm.org/releases/${version}/lld-${version}.src.tar.xz
https://www.llvm.org/releases/${version}/cfe-${version}.src.tar.xz
https://www.llvm.org/releases/${version}/clang-tools-extra-${version}.src.tar.xz
https://www.llvm.org/releases/${version}/compiler-rt-${version}.src.tar.xz"
checksum="a38dfc4db47102ec79dcc2aa61e93722c5f6f06f0a961073bd84b78fb949419b
76b46be75b412a3d22f0d26279306ae7e274fe4d7988a2184c529c38a6a76982
8869aab2dd2d8e00d69943352d3166d159d7eae2615f66a684f4a0999fc74031
a45b62dde5d7d5fdcdfa876b0af92f164d434b06e9e89b5d0b1cbc65dfe3f418
4c93c7d2bb07923a8b272da3ef7914438080aeb693725f4fc5c19cd0e2613bed
782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18"
# XXX Investigate ocaml bindings.
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="libllvm7"
subpackages="clang-tools-extra clang clang-analyzer libllvm7"
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";;
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"
}
}
libllvm7_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove "usr/lib/libLLVM-*.so*"
}
}