Commit fcc33438 authored by Natanael Copa's avatar Natanael Copa
Browse files

main/llvm: make it compile

- make it find dynamic linker
- set the target to i486-alpine-linux-uclibc

fixes #1798
parent c074070d
......@@ -2,7 +2,7 @@
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=llvm
pkgver=3.2
pkgrel=1
pkgrel=2
pkgdesc="low level virtual machine compiler system"
arch="x86 x86_64"
url="http://llvm.org/"
......@@ -14,6 +14,7 @@ install=
subpackages="clang $pkgname-dev $pkgname-doc $pkgname-libs"
source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.gz
http://llvm.org/releases/$pkgver/clang-$pkgver.src.tar.gz
llvm-3.2-alpine-linux.patch
"
_builddir="$srcdir"/build
......@@ -42,6 +43,14 @@ prepare() {
build() {
cd "$_builddir"
export CBUILD
sed -i -e '/case "\${UNAME_MACHINE}:\${UNAME_SYSTEM}:\${UNAME_RELEASE}:\${UNAME_VERSION}" in/i \' \
-e 'if [ x != "x$CBUILD" ]; then echo "$CBUILD"; exit; fi' \
../$pkgname-$pkgver.src/autoconf/config.guess \
../$pkgname-$pkgver.src/projects/sample/autoconf/config.guess \
|| return 1
../$pkgname-$pkgver.src/configure \
--prefix=/usr \
--sysconfdir=/etc \
......@@ -50,6 +59,7 @@ build() {
--enable-ffi \
--enable-shared \
|| return 1
# --build="$CBUILD" --host="$CHOST" --target="$CTARGET" \
# configure gets it wrong. We do have error_t
sed -i -e 's/.*undef HAVE_ERROR_T.*/#define HAVE_ERROR_T 1/' \
......@@ -89,4 +99,11 @@ libs() {
}
md5sums="71610289bbc819e3e15fdd562809a2d7 llvm-3.2.src.tar.gz
3896ef4334df08563b05d0848ba80582 clang-3.2.src.tar.gz"
3896ef4334df08563b05d0848ba80582 clang-3.2.src.tar.gz
7c35c098d3f18bdf48d19ec889e22140 llvm-3.2-alpine-linux.patch"
sha256sums="125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 llvm-3.2.src.tar.gz
2aaaf03f7c0f6b16fe97ecc81247dc2bf2d4bec7620a77cc74670b7e07ff5658 clang-3.2.src.tar.gz
5a16f907107781b4942714cf9d5e6ffcd21024f9f601f7b7dfb17108a62080d0 llvm-3.2-alpine-linux.patch"
sha512sums="cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc llvm-3.2.src.tar.gz
99fc57d19b76c42af9821eaaa762056a926eb68178f6b7dd5e8bf092c9ee201a554b91d760d5a30a57f38102eae340e080ef8c6a39327f6881eda391b20b108d clang-3.2.src.tar.gz
b0982466670b63abde7787e4f1166c357ed2736ff23ce23511788441853bc14e5e9d25763d729dc33706200c39406138356d2cacee72057dc2b2852ea2b78174 llvm-3.2-alpine-linux.patch"
--- ./tools/clang/lib/Driver/ToolChains.cpp.orig
+++ ./tools/clang/lib/Driver/ToolChains.cpp
@@ -1198,7 +1198,8 @@
"x86_64-suse-linux",
"x86_64-manbo-linux-gnu",
"x86_64-linux-gnu",
- "x86_64-slackware-linux"
+ "x86_64-slackware-linux",
+ "x86_64-alpine-linux-uclibc"
};
static const char *const X86LibDirs[] = { "/lib32", "/lib" };
static const char *const X86Triples[] = {
@@ -1210,7 +1211,8 @@
"i586-redhat-linux",
"i386-redhat-linux",
"i586-suse-linux",
- "i486-slackware-linux"
+ "i486-slackware-linux",
+ "i486-alpine-linux-uclibc"
};
static const char *const MIPSLibDirs[] = { "/lib" };
@@ -1814,6 +1816,7 @@
/// Linux toolchain (very bare-bones at the moment).
enum LinuxDistro {
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -1935,6 +1938,9 @@
if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
return ArchLinux;
+
+ if (!llvm::sys::fs::exists("/etc/alpine-release", Exists) && Exists)
+ return AlpineLinux;
return UnknownDistro;
}
diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
index 6151e88..d811789 100644
--- a/tools/clang/lib/Driver/Tools.cpp
+++ b/tools/clang/lib/Driver/Tools.cpp
@@ -4308,7 +4308,7 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
!Args.hasArg(options::OPT_shared))) {
CmdArgs.push_back("-dynamic-linker");
if (ToolChain.getArch() == llvm::Triple::x86)
- CmdArgs.push_back("/lib/ld-linux.so.2");
+ CmdArgs.push_back("/lib/ld-uClibc.so.0.9.32");
else if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back("/lib/ld-linux.so.3");
@@ -4317,7 +4317,7 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
else if (ToolChain.getArch() == llvm::Triple::ppc64)
CmdArgs.push_back("/lib64/ld64.so.1");
else
- CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
+ CmdArgs.push_back("/lib/ld64-uClibc.so.0.9.32");
}
CmdArgs.push_back("-o");
diff -urp llvm-3.2.src.orig/include/llvm/ADT/Triple.h llvm-3.2.src.new/include/llvm/ADT/Triple.h
--- llvm-3.2.src.orig/include/llvm/ADT/Triple.h 2012-11-15 16:24:48.000000000 -0500
+++ llvm-3.2.src.new/include/llvm/ADT/Triple.h 2013-04-22 04:02:00.691571066 -0400
@@ -115,7 +115,8 @@ public:
EABI,
MachO,
Android,
- ELF
+ ELF,
+ UClibc
};
private:
diff -urp llvm-3.2.src.orig/lib/Support/Triple.cpp llvm-3.2.src.new/lib/Support/Triple.cpp
--- llvm-3.2.src.orig/lib/Support/Triple.cpp 2012-11-15 16:24:48.000000000 -0500
+++ llvm-3.2.src.new/lib/Support/Triple.cpp 2013-04-22 04:02:04.568319294 -0400
@@ -147,6 +147,7 @@ const char *Triple::getEnvironmentTypeNa
case MachO: return "macho";
case Android: return "android";
case ELF: return "elf";
+ case UClibc: return "uclibc";
}
llvm_unreachable("Invalid EnvironmentType!");
@@ -293,6 +294,7 @@ static Triple::EnvironmentType parseEnvi
.StartsWith("macho", Triple::MachO)
.StartsWith("android", Triple::Android)
.StartsWith("elf", Triple::ELF)
+ .StartsWith("uclibc", Triple::UClibc)
.Default(Triple::UnknownEnvironment);
}
diff -urp llvm-3.2.src.orig/tools/clang/lib/Driver/ToolChains.cpp llvm-3.2.src.new/tools/clang/lib/Driver/ToolChains.cpp
--- llvm-3.2.src.orig/tools/clang/lib/Driver/ToolChains.cpp 2012-12-16 10:59:27.000000000 -0500
+++ llvm-3.2.src.new/tools/clang/lib/Driver/ToolChains.cpp 2013-04-22 04:02:08.788408080 -0400
@@ -1070,7 +1070,8 @@ Generic_GCC::GCCInstallationDetector::GC
"x86_64-suse-linux",
"x86_64-manbo-linux-gnu",
"x86_64-linux-gnu",
- "x86_64-slackware-linux"
+ "x86_64-slackware-linux",
+ "x86_64-alpine-linux-uclibc"
};
static const char *const X86LibDirs[] = { "/lib32", "/lib" };
static const char *const X86Triples[] = {
@@ -1083,7 +1084,8 @@ Generic_GCC::GCCInstallationDetector::GC
"i386-redhat-linux",
"i586-suse-linux",
"i486-slackware-linux",
- "i686-montavista-linux"
+ "i686-montavista-linux",
+ "i486-alpine-linux-uclibc"
};
static const char *const MIPSLibDirs[] = { "/lib" };
@@ -1829,6 +1831,7 @@ Tool &Solaris::SelectTool(const Compilat
/// Linux toolchain (very bare-bones at the moment).
enum LinuxDistro {
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -1955,6 +1958,9 @@ static LinuxDistro DetectLinuxDistro(llv
if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
return ArchLinux;
+ if (!llvm::sys::fs::exists("/etc/alpine-release", Exists) && Exists)
+ return AlpineLinux;
+
return UnknownDistro;
}
diff -urp llvm-3.2.src.orig/tools/clang/lib/Driver/Tools.cpp llvm-3.2.src.new/tools/clang/lib/Driver/Tools.cpp
--- llvm-3.2.src.orig/tools/clang/lib/Driver/Tools.cpp 2012-11-21 02:56:23.000000000 -0500
+++ llvm-3.2.src.new/tools/clang/lib/Driver/Tools.cpp 2013-04-22 04:09:34.657814569 -0400
@@ -5975,9 +5975,12 @@ void linuxtools::Link::ConstructJob(Comp
CmdArgs.push_back("-dynamic-linker");
if (isAndroid)
CmdArgs.push_back("/system/bin/linker");
- else if (ToolChain.getArch() == llvm::Triple::x86)
- CmdArgs.push_back("/lib/ld-linux.so.2");
- else if (ToolChain.getArch() == llvm::Triple::arm ||
+ else if (ToolChain.getArch() == llvm::Triple::x86) {
+ if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc)
+ CmdArgs.push_back("/lib/ld-uClibc.so.0.9.32");
+ else
+ CmdArgs.push_back("/lib/ld-linux.so.2");
+ } else if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb) {
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
CmdArgs.push_back("/lib/ld-linux-armhf.so.3");
@@ -5998,6 +6001,8 @@ void linuxtools::Link::ConstructJob(Comp
CmdArgs.push_back("/lib/ld.so.1");
else if (ToolChain.getArch() == llvm::Triple::ppc64)
CmdArgs.push_back("/lib64/ld64.so.1");
+ else if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc)
+ CmdArgs.push_back("/lib64/ld64-uClibc.so.0.9.32");
else
CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
}
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