aboutsummaryrefslogtreecommitdiffstats
path: root/testing/clang6
diff options
context:
space:
mode:
authorJ0WI <J0WI@users.noreply.github.com>2019-03-20 13:49:57 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2019-04-23 16:45:45 +0000
commita6a68682a7bd30935288484bfc2114e138222839 (patch)
treeb583ae5eb03c0f5b51db917d4d3be4e055427ea6 /testing/clang6
parent18a355feef818f1fdfa581067d5b846e2ddc7888 (diff)
downloadaports-a6a68682a7bd30935288484bfc2114e138222839.tar.bz2
aports-a6a68682a7bd30935288484bfc2114e138222839.tar.xz
testing/clang6: new aport
Diffstat (limited to 'testing/clang6')
-rw-r--r--testing/clang6/0004-Add-musl-targets.patch84
-rw-r--r--testing/clang6/0008-Fix-ClangConfig-cmake-LLVM-path.patch25
-rw-r--r--testing/clang6/APKBUILD100
3 files changed, 209 insertions, 0 deletions
diff --git a/testing/clang6/0004-Add-musl-targets.patch b/testing/clang6/0004-Add-musl-targets.patch
new file mode 100644
index 0000000000..04a370892a
--- /dev/null
+++ b/testing/clang6/0004-Add-musl-targets.patch
@@ -0,0 +1,84 @@
+From 8f14313cb2ee5221e481e292bcd066a473b1edb8 Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sun, 16 Apr 2017 16:49:00 +0100
+Subject: [PATCH 4/7] Add musl targets
+
+---
+ lib/Driver/ToolChains/Gnu.cpp | 6 ++++--
+ lib/Driver/ToolChains/Linux.cpp | 15 ++++++++++++---
+ 2 files changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
+index 72a9f85..40ad3f5 100644
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1917,7 +1917,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
+- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
++ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
++ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+ TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
+ } else {
+ TripleAliases.append(begin(ARMTriples), end(ARMTriples));
+@@ -1926,7 +1927,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
+ case llvm::Triple::armeb:
+ case llvm::Triple::thumbeb:
+ LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs));
+- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
++ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
++ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+ TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples));
+ } else {
+ TripleAliases.append(begin(ARMebTriples), end(ARMebTriples));
+diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
+index 1201df6..9eea3f0 100644
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -54,7 +54,8 @@ static std::string getMultiarchTriple(const Driver &D,
+ // regardless of what the actual target triple is.
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+- if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
++ if (TargetEnvironment == llvm::Triple::GNUEABIHF ||
++ TargetEnvironment == llvm::Triple::MuslEABIHF) {
+ if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf"))
+ return "arm-linux-gnueabihf";
+ } else {
+@@ -64,7 +65,8 @@ static std::string getMultiarchTriple(const Driver &D,
+ break;
+ case llvm::Triple::armeb:
+ case llvm::Triple::thumbeb:
+- if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
++ if (TargetEnvironment == llvm::Triple::GNUEABIHF ||
++ TargetEnvironment == llvm::Triple::MuslEABIHF) {
+ if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf"))
+ return "armeb-linux-gnueabihf";
+ } else {
+@@ -434,6 +436,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ ArchName = "armeb";
+ IsArm = true;
+ break;
++ case llvm::Triple::ppc:
++ ArchName = "powerpc";
++ break;
++ case llvm::Triple::x86:
++ ArchName = "i386";
++ break;
+ default:
+ ArchName = Triple.getArchName().str();
+ }
+@@ -644,7 +652,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+ break;
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+- if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
++ if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
++ getTriple().getEnvironment() == llvm::Triple::MuslEABIHF)
+ MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
+ else
+ MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
+--
+2.14.1
+
diff --git a/testing/clang6/0008-Fix-ClangConfig-cmake-LLVM-path.patch b/testing/clang6/0008-Fix-ClangConfig-cmake-LLVM-path.patch
new file mode 100644
index 0000000000..f1c1c24499
--- /dev/null
+++ b/testing/clang6/0008-Fix-ClangConfig-cmake-LLVM-path.patch
@@ -0,0 +1,25 @@
+From: Adeel <adeelbm@outlook.com>
+Date: Sun, 6 May 2018 10:22:00 +0200
+Subject: [PATCH] Fix ClangConfig.cmake to look for LLVM-Config.cmake in correct location
+
+This results in the following change in the generated ClangConfig.cmake:
+
+ find_package(LLVM REQUIRED CONFIG
+ - HINTS "${CLANG_INSTALL_PREFIX}/lib/cmake/llvm")
+ + HINTS "/usr/lib/llvm5/lib/cmake/llvm")
+
+This is needed e.g. for building lldb.
+
+See https://github.com/alpinelinux/aports/pull/2342 for more information.
+
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -39,7 +39,7 @@ foreach(p ${_count})
+ get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+ set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}")
+-set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
++set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
+ set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake")
+ set(CLANG_CONFIG_INCLUDE_DIRS
+ "\${CLANG_INSTALL_PREFIX}/include"
diff --git a/testing/clang6/APKBUILD b/testing/clang6/APKBUILD
new file mode 100644
index 0000000000..52c8d18151
--- /dev/null
+++ b/testing/clang6/APKBUILD
@@ -0,0 +1,100 @@
+# Contributor Travis Tilley <ttilley@gmail.com>
+_pkgname=clang
+# Note: Update together with llvm.
+pkgver=6.0.1
+_majorver=${pkgver%%.*}
+pkgname=$_pkgname$_majorver
+pkgrel=0
+_llvmver=${pkgver%%.*}
+pkgdesc="A C language family front-end for LLVM"
+arch="all"
+url="https://clang.llvm.org/"
+license="UOI-NCSA"
+makedepends="
+ cmake
+ isl-dev
+ libedit-dev
+ libxml2-dev
+ libxml2-utils
+ llvm6-dev>=$_llvmver
+ llvm6-static>=$_llvmver
+ llvm6-test-utils>=$_llvmver
+ python3
+ "
+depends_dev="$pkgname=$pkgver-r$pkgrel"
+subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
+ $pkgname-analyzer::noarch"
+source="https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz
+ 0004-Add-musl-targets.patch
+ 0008-Fix-ClangConfig-cmake-LLVM-path.patch
+ "
+builddir="$srcdir/cfe-$pkgver.src"
+
+prepare() {
+ default_prepare
+}
+
+build() {
+ mkdir -p "$builddir"/build
+ cd "$builddir"/build
+
+ cmake .. -Wno-dev \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
+ -DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="$CXXFLAGS" \
+ -DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT="$LDFLAGS" \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_VERBOSE_MAKEFILE=OFF \
+ \
+ -DCLANG_VENDOR=Alpine \
+ -DCLANG_BUILD_EXAMPLES=OFF \
+ -DCLANG_INCLUDE_DOCS=ON \
+ -DCLANG_INCLUDE_TESTS=ON \
+ -DCLANG_PLUGIN_SUPPORT=ON \
+ -DLIBCLANG_BUILD_STATIC=ON \
+ -DLLVM_ENABLE_EH=ON \
+ -DLLVM_ENABLE_RTTI=ON \
+ -DLLVM_EXTERNAL_LIT=/usr/lib/llvm6/bin/lit \
+ -DLLVM_CONFIG=/usr/bin/llvm6-config
+
+ make clang-tblgen
+ make
+}
+
+check() {
+ cd "$builddir"/build
+
+ make check-clang
+}
+
+package() {
+ cd "$builddir"/build
+
+ make DESTDIR="$pkgdir" install
+ install -m 644 lib/libclang.a "$pkgdir"/usr/lib
+}
+
+static() {
+ pkgdesc="Static libraries for clang"
+
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
+}
+
+analyzer() {
+ pkgdesc="Clang source code analysis framework"
+ depends="$pkgname=$pkgver-r$pkgrel perl python3"
+
+ cd "$pkgdir"
+
+ mkdir -p "$subpkgdir"/usr/bin \
+ "$subpkgdir"/usr/libexec \
+ "$subpkgdir"/usr/share/
+ mv usr/bin/scan-* "$subpkgdir"/usr/bin/
+ mv usr/libexec/*-analyzer "$subpkgdir"/usr/libexec/
+ mv usr/share/scan-* "$subpkgdir"/usr/share/
+}
+
+sha512sums="f64ba9290059f6e36fee41c8f32bf483609d31c291fcd2f77d41fecfdf3c8233a5e23b93a1c73fed03683823bd6e72757ed993dd32527de3d5f2b7a64bb031b9 cfe-6.0.1.src.tar.xz
+3fc38a952999909bd6be608092102e11f9685e68241c7abea09ac5f12533896b3a4cd0741caaccfbeb29b1882769fe66fe654f3292005b2ae16a10ea015e42a8 0004-Add-musl-targets.patch
+9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00 0008-Fix-ClangConfig-cmake-LLVM-path.patch"