aboutsummaryrefslogtreecommitdiffstats
path: root/main/llvm/APKBUILD
blob: 5f2cccae94c8e238503c11e63f008a20313886f2 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# Contributor: Travis Tilley <ttilley@gmail.com>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=llvm
pkgver=3.6.0
pkgrel=1
pkgdesc="low level virtual machine compiler system"
arch="x86_64 armhf"
url="http://llvm.org/"
license="UOI-NCSA"
depends=""
depends_dev="perl"
makedepends="$depends_dev make flex bison groff libffi-dev zlib-dev ncurses-dev libedit-dev python chrpath"
install=
subpackages="clang-libs:clang_libs clang
	$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs"
source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz
	http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
	http://llvm.org/releases/$pkgver/compiler-rt-$pkgver.src.tar.xz
	llvm-3.5-gcc-4.9.patch
	llvm-3.6-musl-triple.patch
	llvm-3.6-musl.patch
	compiler-rt-3.6-musl-disable-sanitizers.patch
	compiler-rt-3.6-musl-no-dlvsym.patch
  clang-3.5-fix-stdint.patch
	clang-3.6-fix-unwind-chain-inclusion.patch
	clang-3.6-remove-lgcc-when-using-compiler-rt.patch
  clang-3.6-add-alpine-distro.patch
  clang-3.6-alpine-use-z-relro.patch
	clang-3.6-alpine-hash-style-gnu.patch
	clang-3.6-default-runtime-compiler-rt.patch
  clang-3.6-musl-alpine-triple.patch
  clang-3.6-musl-fix-dynamic-linker-paths.patch
  clang-3.6-musl-use-init-array.patch
	clang-3.6-musl-no-use-cxa-atexit.patch
	"

_builddir="$srcdir"/build

_srcdir="$srcdir"/"$pkgname-$pkgver.src"
_srcdir_clang="$_srcdir"/tools/clang
_srcdir_compiler_rt="$_srcdir"/projects/compiler-rt
# _srcdir_clang_extra="$_srcdir_clang"/tools/extra
# _srcdir_lld="$_srcdir"/tools/lld

prepare() {
	msg "Preparing LLVM/CLANG sources..."
	mv "$srcdir"/cfe-$pkgver.src \
	  "$_srcdir_clang" || return 1
	mv "$srcdir"/compiler-rt-$pkgver.src \
	  "$_srcdir_compiler_rt" || return 1
	# mv "$srcdir"/clang-tools-extra-$pkgver.src \
	#   "$_srcdir_clang_extra" || return 1
	# mv "$srcdir"/lld-$pkgver.src \
	#   "$_srcdir_lld" || return 1

	msg "Patching LLVM core..."
	cd "$_srcdir" || return 1
	update_config_sub || return 1
	for i in $source; do
		case $i in
		llvm*.patch)
			msg "Applying $i..."
			patch -s -p1 -N -i "$srcdir"/$i || return 1
			;;
		esac
	done

  msg "Patching compiler-rt..."
	cd "$_srcdir_compiler_rt" || return 1
	for i in $source; do
		case $i in
		compiler-rt*.patch)
		  msg "Applying $i..."
			patch -s -p1 -N -i "$srcdir"/$i || return 1
			;;
		esac
	done

	msg "Patching clang..."
	cd "$_srcdir_clang" || return 1
	for i in $source; do
		case $i in
		clang-*.patch)
		  msg "Applying $i..."
			patch -s -p1 -N -i "$srcdir"/$i || return 1
			;;
		esac
	done
}

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 \
		|| return 1

	export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags-only-I libffi) $(pkg-config --cflags-only-I libedit)"

	$_srcdir/configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared \
		--enable-optimized \
		--enable-keep-symbols \
		--enable-libedit \
		--enable-terminfo \
		--enable-libffi \
		--enable-clang-plugin-support \
		--enable-clang-static-analyzer \
		--enable-docs \
		--enable-threads \
		--enable-zlib \
		--enable-pic \
		--enable-targets=x86,x86_64,arm,arm64,cpp,r600 \
		--enable-bindings=none \
		--disable-timestamps \
		--disable-assertions \
		--disable-expensive-checks \
		--disable-libcpp \
		--disable-werror \
		|| 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 || return 1

	# remove erroneously installed example
	rm "$pkgdir"/usr/lib/*LLVMHello.* || return 1

	# remove executable bit from static libc
	chmod -x "$pkgdir"/usr/lib/*.a
}

clang_libs() {
	pkgdesc="Runtime library for clang"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclang.so "$subpkgdir"/usr/lib/
}

clang() {
	pkgdesc="A C language family front-end for LLVM"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang "$subpkgdir"/usr/include
	mv "$pkgdir"/usr/bin/clang* "$pkgdir"/usr/bin/c-index-test \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/lib/clang \
		"$subpkgdir"/usr/lib/ || return 1
	mv "$pkgdir"/usr/include/clang "$pkgdir"/usr/include/clang-c \
		"$subpkgdir"/usr/include/ || 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
}

static() {
	pkgdesc="LLVM static libraries"
	depends=
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

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

md5sums="f1e14e949f8df3047c59816c55278cec  llvm-3.6.0.src.tar.xz
e3012065543dc6ab8a9842b09616b78d  cfe-3.6.0.src.tar.xz
cc36dbcafe43406083e98bc9e74f8054  compiler-rt-3.6.0.src.tar.xz
178eecb7554f893198716e35245fc3c9  llvm-3.5-gcc-4.9.patch
74f92f6719995be866f461a29a7c8112  llvm-3.6-musl-triple.patch
3068c2bc0dd0f694d002d992743401ac  llvm-3.6-musl.patch
b1732677fb7641c13300a98bdd47d467  compiler-rt-3.6-musl-disable-sanitizers.patch
a56d3a3da587b5936e338d85947bd16f  compiler-rt-3.6-musl-no-dlvsym.patch
be9b343bacbd220a154b0a773bcd3bd3  clang-3.5-fix-stdint.patch
02df7f41728ceb3b401dd3972531d4ec  clang-3.6-fix-unwind-chain-inclusion.patch
9790d1131f498f5957e0107727489704  clang-3.6-remove-lgcc-when-using-compiler-rt.patch
74612f41b5bda8f05be5cf2e59eebd26  clang-3.6-add-alpine-distro.patch
dbf4e6686137d097768e971c0efd4a0b  clang-3.6-alpine-use-z-relro.patch
7495743d3c85ad48fd7ab9ca1f674884  clang-3.6-alpine-hash-style-gnu.patch
a26e050907fae3f8ac51375826f9767c  clang-3.6-default-runtime-compiler-rt.patch
bf66b2ce06519085484776e40290118a  clang-3.6-musl-alpine-triple.patch
28266841c807bd3835186ad32942ac11  clang-3.6-musl-fix-dynamic-linker-paths.patch
b7e213b69c848ad1bcb98a798a2f9d1d  clang-3.6-musl-use-init-array.patch
01eb6923bfa059e36ab39f44b2b6f03f  clang-3.6-musl-no-use-cxa-atexit.patch"
sha256sums="b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce  llvm-3.6.0.src.tar.xz
be0e69378119fe26f0f2f74cffe82b7c26da840c9733fe522ed3c1b66b11082d  cfe-3.6.0.src.tar.xz
7f49fb79e5adcdce7dddaf973f1db130228dfb19e37a99a7f5365a6948b26b11  compiler-rt-3.6.0.src.tar.xz
96851b9d89647276f4611ea7db59f84240a727b199925ee6c9599f959fc7bd05  llvm-3.5-gcc-4.9.patch
fbe1bab0aa5eb8c54ac1ed0f7d27212efd597c8eaa889599549d0defe82bc7c9  llvm-3.6-musl-triple.patch
f1ca24437533c5022d591b8b9a5ea7f0494e984a5c24ef1e5dcf71dbee0df240  llvm-3.6-musl.patch
d5aa68e35fe3fe0cb2393d3abecd80987c4876f332ca03b55f03bcd82b2b720d  compiler-rt-3.6-musl-disable-sanitizers.patch
90a582ef8561ed4953feae7f19f3a30856da845174ae93e7acdb4bc088be5b78  compiler-rt-3.6-musl-no-dlvsym.patch
a41aa73b9edcf0588d61e17e9d53738e9e16209eac9c5488eaef7770ab1517d1  clang-3.5-fix-stdint.patch
2c73e2c6f3e90e2535e0662714645fc4d1189b4b1beb5a0ebb6ba1af62580d23  clang-3.6-fix-unwind-chain-inclusion.patch
dea41fd9eb16d2c3b9b73ad1ee3af2923b26f806185494835c899700ec6830f4  clang-3.6-remove-lgcc-when-using-compiler-rt.patch
4f68d475947eb35515231fdf23dc5a92f656038ca21b0d3d0ea110129b07d313  clang-3.6-add-alpine-distro.patch
ba0dd990424699b92b79c8511143cbf33766e8d2009a979928e9b8229fa3cfba  clang-3.6-alpine-use-z-relro.patch
46f4c3c08bee21cc9051181108776f37acc7e9589c85f62dbd6a842b842f5a43  clang-3.6-alpine-hash-style-gnu.patch
8c8295e10453e89d8ae70d709a91f186ea5e279494ab538e28339d9d2efa3ae8  clang-3.6-default-runtime-compiler-rt.patch
da420dda54b0058140a4ade99de49e617c2533857ccb327d95bf51027bb0bcf8  clang-3.6-musl-alpine-triple.patch
03c392733933198adbb3e6cb2eb9ed95e8d01f7d013e3fe2d12a8f1001b73893  clang-3.6-musl-fix-dynamic-linker-paths.patch
03709cff62464ef2afdaa2bfaccf4dffd5d3e20eee561fb94e486a2912d8a6e6  clang-3.6-musl-use-init-array.patch
3d5c097ab1a4e4cfadeeb11aef66a90daaff11095dd3349f25832bedc317cac8  clang-3.6-musl-no-use-cxa-atexit.patch"
sha512sums="ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357  llvm-3.6.0.src.tar.xz
dc137bdf9c2c5adb25498c995f0b944016699267156a595cc1fe6127f6961d45162275023d194db42691d80fa8fc74f56abad9c145ef1ff492881f547ca76cfe  cfe-3.6.0.src.tar.xz
2758bc2b78dcfb9b6509b83ebc4ebc86907ca3dc2a5f151f580771c674b934432cae055e342ed73096a08331b2f7b129ff65629b27932458b1877aeb554b6328  compiler-rt-3.6.0.src.tar.xz
a16f175c75893ac58350e0573012a66c1e8908e94a03197ca50b147eb492402e706e4816b80428ccdf92a112673ec8552a0d5dc699dc95250e756c161328d9f2  llvm-3.5-gcc-4.9.patch
a084b995b2ea65c19da5e000459c993d5a3396f0eb4f6d6ec29299d98f3df8ee6f23723f8d19e93ef906861bb83dbba5c05b8cf7801f92c8748b8687247e25d2  llvm-3.6-musl-triple.patch
e3f4203679c978cbf359200de0cd60c0adcc58c92611ec70b4b991c6612e0b41b67c19c9994769302284edb953e258d3717ec32d90abbd9bdeff3739aa5ffb18  llvm-3.6-musl.patch
e9cf172aac82b5e4680d4c6fb25f11e04d1db75ad4e99f7117c08631ca8a7955677fc046f58b6eef05f9e98ef0374eb9248b5674aa26b08d9f7efd30525740be  compiler-rt-3.6-musl-disable-sanitizers.patch
8cde42c93a1eda14d31f8e51ffd00d031f10071e9a4ee91fa9b08ef5b8e7bf9ec32ccd102b652e35e6f75d1339d934daa68185529ca6dba74e61f979a27498f3  compiler-rt-3.6-musl-no-dlvsym.patch
764382fc79598ca85c9c500d16e02a2710025416dc9bd8a7407aad38e663dee9539e47a1ae763b45c36cd86c4ff5853c4799835cd7363a3a208191ae7a703321  clang-3.5-fix-stdint.patch
4cbabce34b7352bf5a043db3abe8931f58adce4fda80846c39b63399a025cbbac572052d3f0f598466bc9dca23b8ff88e655b10bf54b3870bc4e6f4225b6f558  clang-3.6-fix-unwind-chain-inclusion.patch
d50aa3271e9247896bd3df5a55c987da81a01892af8afbd0483cff4c0467b2dc438fa9166d1aaeaf5165555c30d4a2af68c3bdbfa8fba798c2ca124172cf2642  clang-3.6-remove-lgcc-when-using-compiler-rt.patch
f5fa5aa1b2a559215792a98806b18b32ce6b82e57afb09aa3886b22f71420c8377b784f55610b4948185e115b39aeeaf1f27625d0d91dbd3b146e4986eb29c54  clang-3.6-add-alpine-distro.patch
61d0113e2287b82d27b4d08ed98e8f2dad864a36a295f9d8a28d54b6b8516ecda2986d402ba04146976e25e35198e12d567df80979c88081369ac386fa213a0f  clang-3.6-alpine-use-z-relro.patch
1982e8b84415fa314b040cbecac38640d754105b5af2c26d5aa7ca74d7ef14cc074bf7a5537dc492a7051d8f94035a1d69de2e913eabee7fcd1b50d6f6f126f7  clang-3.6-alpine-hash-style-gnu.patch
b906ff5a59c83e553d67b2574bcd3c22e7975b487ad928f9e0db0a07ffb54c5e412d4527401db63f1de94884410709b4fe637e12d36fa0c0661f69fd88f09c25  clang-3.6-default-runtime-compiler-rt.patch
d2192b615307a762d324a1643dae33bc8a97e22e6a9dd712f9a243c6d3f728c9f9f036ce34d4137c8537651d78332ad8b98fd7f325648ac68e1bda54f5f58348  clang-3.6-musl-alpine-triple.patch
d3f6c97bdfccdab056aef149413108eb1fdf68d10782cdb1a50695a8e2e53432555a73c640ae635c697d41330c7869acc864b9f0fedbb1a4cba6d13785168564  clang-3.6-musl-fix-dynamic-linker-paths.patch
4ae8409f3d03e8b30cbe33be507a43194ff6f3e6ce6467d3341ff08f08b12a22517a4c4b012f1b1029d956f8c486412353d937f316a7648a5be14549555aecae  clang-3.6-musl-use-init-array.patch
20cddcf4289bb50bedac2636d32824860252617545d85c5cdc13f630a6f8be2be2a7e018401de4cec0a78bafc1f940ed8d565c2cda518b73290cf3ced4d0807e  clang-3.6-musl-no-use-cxa-atexit.patch"