Commit 09ed5f79 authored by Eric Molitor's avatar Eric Molitor Committed by Natanael Copa

main/clang: upgrade to 7.0.1

parent 97b9b33c
From 73460524593da572f34f2994a75d1d946613e54a Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 1/7] Add Alpine Linux distro
---
include/clang/Driver/Distro.h | 5 +++++
lib/Driver/Distro.cpp | 3 +++
2 files changed, 8 insertions(+)
diff --git a/include/clang/Driver/Distro.h b/include/clang/Driver/Distro.h
index fab4986..17775bf 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().
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -98,6 +99,10 @@ public:
/// @name Convenience Predicates
/// @{
+ bool IsAlpineLinux() const {
+ return DistroVal == AlpineLinux;
+ }
+
bool IsRedhat() const {
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
}
diff --git a/lib/Driver/Distro.cpp b/lib/Driver/Distro.cpp
index 2df297f..4cf2c2e 100644
--- a/lib/Driver/Distro.cpp
+++ b/lib/Driver/Distro.cpp
@@ -129,6 +129,9 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
if (VFS.exists("/etc/arch-release"))
return Distro::ArchLinux;
+ if (VFS.exists("/etc/alpine-release"))
+ return Distro::AlpineLinux;
+
return Distro::UnknownDistro;
}
--
2.14.1
From 00ca60386046258f55b11313e9e63e6551698ee0 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 2/7] Use "-z relro" on Alpine Linux
---
lib/Driver/ToolChains/Linux.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 08a27fa..9dbf9bd 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -210,7 +210,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Distro Distro(D.getVFS());
- if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) {
+ if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
--
2.14.1
From 54f4c1daac9e4489b48c477758217cd01c6c8f0a Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 3/7] Use --hash-style=gnu for Alpine Linux
---
lib/Driver/ToolChains/Linux.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 9dbf9bd..1201df6 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -232,7 +232,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// Android loader does not support .gnu.hash.
// Hexagon linker/loader does not support .gnu.hash
if (!IsMips && !IsAndroid && !IsHexagon) {
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
+ if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
--
2.14.1
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
From bb174d2f1fd3b936c1c8b75b83c6fb15b3dece2c Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 5/7] Enable PIE by default for Alpine Linux
Alpine Linux uses PIE by default.
---
lib/Driver/ToolChains/Gnu.cpp | 4 +++-
lib/Driver/ToolChains/Linux.cpp | 5 ++++-
test/Driver/pic.c | 12 ++++++++++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index 40ad3f5..842afb9 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -443,7 +443,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (!D.SysRoot.empty())
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
- if (IsPIE)
+ if (Args.hasArg(options::OPT_nopie))
+ CmdArgs.push_back("-nopie");
+ else if (IsPIE)
CmdArgs.push_back("-pie");
if (Args.hasArg(options::OPT_rdynamic))
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 9eea3f0..ce9cf35 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -819,7 +819,10 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
}
}
-bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }
+bool Linux::isPIEDefault() const {
+ return getSanitizerArgs().requiresPIE() ||
+ Linux::getTriple().getVendorName().compare("alpine") == 0;
+}
SanitizerMask Linux::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
diff --git a/test/Driver/pic.c b/test/Driver/pic.c
index 6b01c58..0643edd 100644
--- a/test/Driver/pic.c
+++ b/test/Driver/pic.c
@@ -251,6 +251,18 @@
// RUN: %clang %s -target i386-pc-openbsd -no-pie -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD
//
+// On Alpine Linux, we want similar PIE-by-default behavior
+// RUN: %clang -c %s -target x86_64-alpine-linux-musl -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target i686-alpine-linux-musl -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target armv6-alpine-linux-musleabihf -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target armv7-alpine-linux-musleabihf -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang %s -target x86_64-alpine-linux-musl -nopie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD
+//
// On Android PIC is enabled by default
// RUN: %clang -c %s -target i686-linux-android -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
--
2.14.1
From 2c6ae087cddd8a53e264814e404db8f3c29e4e53 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 6/7] Link with -z now by default for Alpine Linux
---
lib/Driver/ToolChains/Linux.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index ce9cf35..1583c9d 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -212,6 +212,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Distro Distro(D.getVFS());
+ if (Distro.IsAlpineLinux()) {
+ ExtraOpts.push_back("-z");
+ ExtraOpts.push_back("now");
+ }
+
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
--
2.14.1
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"
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -1813,7 +1814,9 @@
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"};
static const char *const ARMebLibDirs[] = {"/lib"};
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
"armeb-linux-androideabi"};
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/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"};
@@ -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-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",
From b329713c3249d237d1827c326c1fc065104002a6 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH 7/7] Enable stack protector by default for Alpine Linux
Based on original patchset from Jakub Jirutka <jakub@jirutka.cz>
Updated by Eric Molitor <eric@molitor.org>
---
lib/Driver/ToolChains/Linux.cpp | 7 +++++++
lib/Driver/ToolChains/Linux.h | 1 +
test/Driver/fsanitize.c | 10 ++++++----
test/Driver/stack-protector.c | 14 ++++++++++++++
4 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 1583c9d..981f9ae 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -829,6 +829,13 @@ bool Linux::isPIEDefault() const {
Linux::getTriple().getVendorName().compare("alpine") == 0;
@@ -907,6 +907,13 @@
getTriple().isMusl() || getSanitizerArgs().requiresPIE();
}
+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
......@@ -28,11 +17,9 @@ index 1583c9d..981f9ae 100644
SanitizerMask Linux::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
index 9778c18..ddd46a1 100644
--- a/lib/Driver/ToolChains/Linux.h
+++ b/lib/Driver/ToolChains/Linux.h
@@ -36,6 +36,7 @@ public:
@@ -38,6 +38,7 @@
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
bool isPIEDefault() const override;
......@@ -40,18 +27,15 @@ index 9778c18..ddd46a1 100644
SanitizerMask getSupportedSanitizers() const override;
void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
index 0752ef6..263485f 100644
--- a/test/Driver/fsanitize.c
+++ b/test/Driver/fsanitize.c
@@ -491,12 +491,12 @@
@@ -585,12 +585,12 @@
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
// NOSP-NOT: "-fsanitize=safe-stack"
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
// RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
......@@ -61,17 +45,6 @@ index 0752ef6..263485f 100644
// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
// NO-SP-NOT: stack-protector
// NO-SP: "-fsanitize=safe-stack"
@@ -506,6 +506,8 @@
// NO-SP-ASAN-NOT: stack-protector
// NO-SP-ASAN: "-fsanitize=address,safe-stack"
+// SP-ASAN: "-fsanitize=address,safe-stack"
+// SP-ASAN: -stack-protector
// NO-SP-ASAN-NOT: stack-protector
// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
index 6769b65..553c189 100644
--- a/test/Driver/stack-protector.c
+++ b/test/Driver/stack-protector.c
@@ -24,6 +24,20 @@
......@@ -95,6 +68,3 @@ index 6769b65..553c189 100644
// RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
// RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
// SSP-PS4: "-stack-protector" "2"
--
2.14.1
# Contributor Eric Molitor <eric@molitor.org>
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang
# Note: Update together with llvm.
pkgver=5.0.2
pkgver=7.0.1
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="https://llvm.org/"
url="http://llvm.org/"
license="UOI-NCSA"
makedepends="
cmake
......@@ -18,42 +19,33 @@ makedepends="
llvm-dev>=$_llvmver
llvm-static>=$_llvmver
llvm-test-utils>=$_llvmver
ninja
python2
"
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
0001-Add-Alpine-Linux-distro.patch
0002-Use-z-relro-on-Alpine-Linux.patch
0003-Use-hash-style-gnu-for-Alpine-Linux.patch
0004-Add-musl-targets.patch
0005-Enable-PIE-by-default-for-Alpine-Linux.patch
0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch
0008-Fix-ClangConfig-cmake-LLVM-path.patch
"
source="https://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
10-add-musl-triples.patch
20-Enable-stack-protector-by-default-for-Alpine-Linux.patch"
builddir="$srcdir/cfe-$pkgver.src"
prepare() {
default_prepare
# FIXME: fails on 5.0.0
rm "$builddir/test/OpenMP/task_firstprivate_codegen.cpp"
}
build() {
mkdir -p "$builddir"/build
cd "$builddir"/build
cmake .. -Wno-dev \
cmake .. -G Ninja -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 \
......@@ -63,20 +55,20 @@ build() {
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON
make clang-tblgen
make
ninja clang-tblgen
ninja
}
check() {
cd "$builddir"/build
make check-clang
lit -sv --param clang_site_config=$builddir/build/test/lib.site.cfg $builddir/build/test
}
package() {
cd "$builddir"/build
make DESTDIR="$pkgdir" install
DESTDIR="$pkgdir" ninja install
install -m 644 lib/libclang.a "$pkgdir"/usr/lib
}
......@@ -101,12 +93,6 @@ analyzer() {
mv usr/share/scan-* "$subpkgdir"/usr/share/
}
sha512sums="9931afceb5569ad6caec85d506180c810f7fea94af8c997143b0a37cbf413fcea0d92520478610627eeee1efb65fde684066ace0dfcbbf7b61ecd709d22dd0b1 cfe-5.0.2.src.tar.xz
98ae759832b2f4c41152f8d16c909044c8d5afb1f4ef3ec10fdc8c3419b2ce8a14a21be989d3919f98869a46ee21f702651d59becb1c87b258846e0d81398358 0001-Add-Alpine-Linux-distro.patch
a45d766005500736a270204424e3b3ea6e2334f4807c431cfcb79563d34ac8d6f1519291b3b1422152e2888ee243a060733a09120c17c706d310f5e04a7daae9 0002-Use-z-relro-on-Alpine-Linux.patch
ca551fb4e8a844424c63e381c4e1e1239ee95548c7561d46d4e8ae01c65b5e46ece7c51021f152ad4aa10dcdd40c0638728b29aed93ddd65d9aeff2af2e878e8 0003-Use-hash-style-gnu-for-Alpine-Linux.patch
0ba4e6cb6d6854ef627f7f6d60f9f6843490e6c8f91dba7e238742574aecf3c07b1f5928850ce755fca9eac07ef3ce814728da58aa1ed9afb03a397ce4c30562 0004-Add-musl-targets.patch
08486325536871346b190b4af3a7b80b58a0066028e6268b06714eb00b29925b3b414ea62fa5ec4ff908763aeec4257536e04275b40c3d55e0a6c5b433625b5c 0005-Enable-PIE-by-default-for-Alpine-Linux.patch
fe5927b7851a97a5223d5b698c5dd01a47ef2fa23d9556cfee976aa7bda639af922785cbe34169e121aab79b38bbb1704aebaf11b1f4f41bcd448947f6e9562b 0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
609ebc1c6cbccd43f8b08e6b653e6da996a09cdcf008744a56af7d8846f1e7a9fc6945d3cc68fba0d06071b6f8de796747606a34d1d5008e0dc620dc0812e3e0 0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch
9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00 0008-Fix-ClangConfig-cmake-LLVM-path.patch"
sha512sums="df2f38153ebdc261bcfa6a569567f759bbb1a803192882a9d4eca55a47878166ac9057151a94ad341dc1281136547e4faa783a68070dfde2307b48cacd4b9194 cfe-7.0.1.src.tar.xz
b52cb7d74636d39d12dd6c94a2b2a9c01e4d6a535d151aa8ca49b691eb20e1b4ea08481f1517ef81f4501ebc305a32d7951638cc0385fee134131e827bb0b2f3 10-add-musl-triples.patch
2bb0e356eb8e4c12162f90dd4589e4f35d62f230697ee74dd61fe81fcbe898923721be20a098f4cb547cde5e20dd71de534f18d46d304368446b4718c48a4a2e 20-Enable-stack-protector-by-default-for-Alpine-Linux.patch"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment