summaryrefslogtreecommitdiffstats
path: root/main/llvm/APKBUILD
blob: c54b37064bf69ac3f4e9b6bf0be7b056e40015e4 (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
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=llvm
pkgver=3.2
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/clang-$pkgver.src.tar.gz
	"

_builddir="$srcdir"/build

prepare() {
	mkdir "$_builddir"

	msg "Preparing CLANG sources..."

	mv "$srcdir"/clang-$pkgver.src \
		"$srcdir"/$pkgname-$pkgver.src/tools/clang || return 1

	msg "Patching LLVM core..."

	cd "$srcdir"/$pkgname-$pkgver.src || 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
}

build() {
	cd "$_builddir"
	../$pkgname-$pkgver.src/configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-ffi  \
		--enable-shared \
		|| 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
	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
	
}

libs() {
	pkgdesc="LLVM shared libraries"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/
}

md5sums="71610289bbc819e3e15fdd562809a2d7  llvm-3.2.src.tar.gz
3896ef4334df08563b05d0848ba80582  clang-3.2.src.tar.gz"