blob: 19923dbc14a2929b18fad5080f8a3f4c179e7506 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=llvm
pkgver=3.3
pkgrel=1
pkgdesc="low level virtual machine compiler system"
arch="x86 x86_64"
url="http://llvm.org/"
license="UOI-NCSA"
depends=
depends_dev="perl"
makedepends="$depends_dev groff libffi-dev python chrpath"
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/cfe-$pkgver.src.tar.gz
llvm-3.3-alpine-linux.patch
llvm-musl.patch
"
# clang hardcodes linker paths; and don't know of a fix like the --with-dynamic-linker
# patch we use for gcc. So llvm-3.2-alpine-linux.patch needs to be updated if/when the
# uClibc ABI version (as of uClibc 0.9.33.2, this is 0.9.32) increases.
_builddir="$srcdir"/build
_srcdir="$srcdir"/"$pkgname-$pkgver.src"
prepare() {
msg "Preparing CLANG sources..."
mv "$srcdir"/cfe-$pkgver.src \
"$srcdir"/$pkgname-$pkgver.src/tools/clang || return 1
msg "Patching LLVM core..."
cd "$srcdir"/$pkgname-$pkgver.src || return 1
update_config_sub || return 1
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
patch -s -p1 -N -i "$srcdir"/$i || return 1
;;
esac
done
# fails to link
rm ./unittests/Support/formatted_raw_ostream_test.cpp
}
build() {
mkdir "$_builddir"
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
$_srcdir/configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-ffi \
--enable-shared \
--enable-optimized \
|| return 1
# configure gets it wrong. We do have error_t
sed -i -e 's/.*undef HAVE_ERROR_T.*/#define HAVE_ERROR_T 1/' \
-e '/define error_t/d' \
./include/llvm/Config/config.h || return 1
make || return 1
}
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install
#relocate docs
mkdir -p "$pkgdir"/usr/share/doc
mv "$pkgdir"/usr/docs/llvm "$pkgdir"/usr/share/doc/ || return 1
rmdir "$pkgdir"/usr/docs || return 1
chrpath -d "$pkgdir"/usr/bin/* "$pkgdir"/usr/lib/*.so
}
clang() {
pkgdesc="A C language family front-end for LLVM"
mkdir -p "$subpkgdir"/usr/bin \
"$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang
mv "$pkgdir"/usr/bin/clang* "$pkgdir"/usr/bin/c-index-test \
"$subpkgdir"/usr/bin/ || return 1
mv "$pkgdir"/usr/lib/clang \
"$pkgdir"/usr/lib/libclang.so \
"$subpkgdir"/usr/lib/ || return 1
cp -r "$_srcdir"/tools/clang/tools/scan-build "$subpkgdir"/usr/share/clang/scan-build
cp -r "$_srcdir"/tools/clang/tools/scan-view "$subpkgdir"/usr/share/clang/scan-view
ln -s /usr/share/clang/scan-build/scan-build "$subpkgdir"/usr/bin/scan-build
ln -s /usr/share/clang/scan-view/scan-view "$subpkgdir"/usr/bin/scan-view
}
libs() {
pkgdesc="LLVM shared libraries"
mkdir -p "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/
}
md5sums="40564e1dc390f9844f1711c08b08e391 llvm-3.3.src.tar.gz
8284891e3e311829b8e44ac813d0c9ef cfe-3.3.src.tar.gz
18f9165003a5b86101547d40ec5d3036 llvm-3.3-alpine-linux.patch
517019fb4907cf5944c84315c681f905 llvm-musl.patch"
sha256sums="68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 llvm-3.3.src.tar.gz
b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 cfe-3.3.src.tar.gz
5a6e40c7ffe280534ce964eaca5bc8ec325cb747f8de1390f534be2944c72361 llvm-3.3-alpine-linux.patch
3b653520e79933058e9b4ab0943a364a87babe8e5e6b520ac15660c146302c74 llvm-musl.patch"
sha512sums="1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 llvm-3.3.src.tar.gz
06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc cfe-3.3.src.tar.gz
d240f0fbef611b9863cbe1a79c10b4383dabf8be2ee49fd0f853d23fb0b4c935a41f3d50456a05815102834f2a4b1ac3c9334b444ed3868b7f3fb24e14ff14eb llvm-3.3-alpine-linux.patch
52f9791a11c103ff8d1a35e0fd94a9d8e1379fd6f8046e346f52686bb256ca969ead77059271931ac1fff5581146dd7e3862a3a14d85b96555b8823e807f2d70 llvm-musl.patch"
|