summaryrefslogtreecommitdiff
path: root/user/clang
diff options
context:
space:
mode:
Diffstat (limited to 'user/clang')
-rw-r--r--user/clang/0001-Add-support-for-Ad-lie-Linux.patch78
-rw-r--r--user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch25
-rw-r--r--user/clang/APKBUILD88
-rw-r--r--user/clang/use-llvm-lit.patch11
4 files changed, 202 insertions, 0 deletions
diff --git a/user/clang/0001-Add-support-for-Ad-lie-Linux.patch b/user/clang/0001-Add-support-for-Ad-lie-Linux.patch
new file mode 100644
index 000000000..f12adf513
--- /dev/null
+++ b/user/clang/0001-Add-support-for-Ad-lie-Linux.patch
@@ -0,0 +1,78 @@
+From 085ba75b10376fa55bb94cb6fa6c54526957732f Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Thu, 13 Sep 2018 11:42:28 -0500
+Subject: [PATCH] =?UTF-8?q?Add=20support=20for=20Ad=C3=A9lie=20Linux?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ include/clang/Driver/Distro.h | 5 +++++
+ lib/Driver/Distro.cpp | 3 +++
+ lib/Driver/ToolChains/Linux.cpp | 6 ++++--
+ 3 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/include/clang/Driver/Distro.h b/include/clang/Driver/Distro.h
+index 7b34a09256..7a3774a4f1 100644
+--- a/include/clang/Driver/Distro.h
++++ b/include/clang/Driver/Distro.h
+@@ -26,6 +26,7 @@ public:
+ // NB: Releases of a particular Linux distro should be kept together
+ // in this enum, because some tests are done by integer comparison against
+ // the first and last known member in the family, e.g. IsRedHat().
++ AdelieLinux,
+ AlpineLinux,
+ ArchLinux,
+ DebianLenny,
+@@ -118,6 +119,10 @@ public:
+ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuCosmic;
+ }
+
++ bool IsAdelieLinux() const {
++ return DistroVal == AdelieLinux;
++ }
++
+ bool IsAlpineLinux() const {
+ return DistroVal == AlpineLinux;
+ }
+diff --git a/lib/Driver/Distro.cpp b/lib/Driver/Distro.cpp
+index 2c4d44faf8..7ef35ab379 100644
+--- a/lib/Driver/Distro.cpp
++++ b/lib/Driver/Distro.cpp
+@@ -130,6 +130,9 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
+ if (VFS.exists("/etc/exherbo-release"))
+ return Distro::Exherbo;
+
++ if (VFS.exists("/etc/adelie-release"))
++ return Distro::AdelieLinux;
++
+ if (VFS.exists("/etc/alpine-release"))
+ return Distro::AlpineLinux;
+
+diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
+index 2a87cb077c..85bcd8ed47 100644
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -234,7 +234,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ ExtraOpts.push_back("now");
+ }
+
+- if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
++ if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
++ Distro.IsAdelieLinux()) {
+ ExtraOpts.push_back("-z");
+ ExtraOpts.push_back("relro");
+ }
+@@ -268,7 +269,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ // Hexagon linker/loader does not support .gnu.hash
+ if (!IsMips && !IsAndroid && !IsHexagon) {
+ if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
+- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
++ Distro.IsAdelieLinux() ||
++ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
+ ExtraOpts.push_back("--hash-style=gnu");
+
+ if (Distro.IsDebian() || Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
+--
+2.18.0
+
diff --git a/user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch b/user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch
new file mode 100644
index 000000000..f1c1c2449
--- /dev/null
+++ b/user/clang/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/user/clang/APKBUILD b/user/clang/APKBUILD
new file mode 100644
index 000000000..7508bcc82
--- /dev/null
+++ b/user/clang/APKBUILD
@@ -0,0 +1,88 @@
+# Contributor Travis Tilley <ttilley@gmail.com>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=clang
+# Note: Update together with llvm.
+pkgver=6.0.1
+pkgrel=0
+_llvmver=${pkgver%%.*}
+pkgdesc="A C language family front-end for LLVM"
+arch="all"
+options="!dbg"
+url="https://llvm.org/"
+license="NCSA"
+depends_dev="$pkgname=$pkgver-r$pkgrel"
+makedepends="cmake isl-dev libedit-dev libxml2-dev libxml2-utils
+ llvm-dev>=$_llvmver llvm-static>=$_llvmver llvm-test-utils>=$_llvmver"
+subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
+ $pkgname-analyzer::noarch"
+source="https://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
+ 0001-Add-support-for-Ad-lie-Linux.patch
+ 0008-Fix-ClangConfig-cmake-LLVM-path.patch
+ use-llvm-lit.patch
+ "
+builddir="$srcdir/cfe-$pkgver.src"
+
+build() {
+ mkdir -p "$builddir"/build
+ cd "$builddir"/build
+
+ cmake .. -Wno-dev \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_VERBOSE_MAKEFILE=OFF \
+ -DCLANG_VENDOR=${DISTRO_SHORT_NAME:-Adélie} \
+ -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
+
+ make clang-tblgen
+ # too memory hungry
+ if [ -z "$JOBS" -o $JOBS -gt 32 ]; then
+ make -j32
+ else
+ make
+ fi
+}
+
+check() {
+ cd "$builddir"/build
+ ln -s /usr/bin/lit bin/llvm-lit
+ 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
+44aa152d50822a9e1a223b9e07e150ffa830c55deb4c4ca29e6218a0103eb263a00b41fd1ca84390e65fa08005901a0a0f88cf529bff8764220e99d06adef5fc 0001-Add-support-for-Ad-lie-Linux.patch
+9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00 0008-Fix-ClangConfig-cmake-LLVM-path.patch
+8a596e7369b5791e7e9c3278320aa5bac30d91f27d9a0df335ea862c359623869353d12145c3b64730f721600522f3acc5abe706428091482e0209e4ff308175 use-llvm-lit.patch"
diff --git a/user/clang/use-llvm-lit.patch b/user/clang/use-llvm-lit.patch
new file mode 100644
index 000000000..0cbb84835
--- /dev/null
+++ b/user/clang/use-llvm-lit.patch
@@ -0,0 +1,11 @@
+--- cfe-6.0.1.src/test/CMakeLists.txt.old 2017-12-12 19:47:40.000000000 +0000
++++ cfe-6.0.1.src/test/CMakeLists.txt 2018-09-13 17:01:03.690000000 +0000
+@@ -115,7 +115,7 @@
+
+ add_lit_testsuite(check-clang "Running the Clang regression tests"
+ ${CMAKE_CURRENT_BINARY_DIR}
+- #LIT ${LLVM_LIT}
++ LIT ${LLVM_LIT}
+ PARAMS ${CLANG_TEST_PARAMS}
+ DEPENDS ${CLANG_TEST_DEPS}
+ ARGS ${CLANG_TEST_EXTRA_ARGS}