aboutsummaryrefslogtreecommitdiffstats
path: root/main/llvm/APKBUILD
blob: 63c0b4521c252b7d2f26a98b7dfbd062a668442f (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
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Travis Tilley <ttilley@gmail.com>
pkgname=llvm
pkgver=3.8.1
pkgrel=1
pkgdesc="Low Level Virtual Machine compiler system"
arch="all"
url="http://llvm.org/"
license="UOI-NCSA"
depends=""
depends_dev="perl"
makedepends="$depends_dev
	binutils-dev
	bison
	chrpath
	cmake
	file
	flex
	groff
	isl-dev
	libffi-dev
	make
	paxmark
	py-sphinx
	python
	python2-dev
	zlib-dev
	"
subpackages="$pkgname-static $pkgname-doc $pkgname-dev $pkgname-libs"
source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz
	llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch
	llvm-0002-Fix-build-with-musl-libc.patch
	llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch
	llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch
	llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch
	llvm-0006-clone-every-functions-debug-info.patch
	llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch
	llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch
	llvm-nm-workaround.patch
	llvm-exit-config-when-cbuild-set.patch
	"
builddir="$srcdir/$pkgname-$pkgver.src"

prepare() {
	cd "$builddir"

	update_config_sub || return 1
	default_prepare || return 1

	# Remove some tests that fails.
	rm test/tools/llvm-objdump/macho-compact-unwind-x86_64.test \
		test/tools/llvm-objdump/macho-compact-unwind-i386.test \
		test/Transforms/GlobalOpt/alias-used.ll \
		test/tools/llvm-symbolizer/print_context.c \
		|| return 1
}

build() {
	mkdir -p "$builddir"/build
	cd "$builddir"/build

	# auto-detect it by guessing either.
	_ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')"

	cmake -G "Unix Makefiles" -Wno-dev \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=NO \
		\
		-DFFI_INCLUDE_DIR="$_ffi_include_dir" \
		-DLLVM_BINUTILS_INCDIR=/usr/include \
		-DLLVM_BUILD_DOCS=YES \
		-DLLVM_BUILD_EXAMPLES=NO \
		-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
		-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
		-DLLVM_BUILD_TESTS=YES \
		-DLLVM_DEFAULT_TARGET_TRIPLE=$CBUILD \
		-DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \
		-DLLVM_ENABLE_ASSERTIONS=NO \
		-DLLVM_ENABLE_CXX1Y=YES \
		-DLLVM_ENABLE_FFI=YES \
		-DLLVM_ENABLE_LIBCXX=NO \
		-DLLVM_ENABLE_PIC=YES \
		-DLLVM_ENABLE_RTTI=YES \
		-DLLVM_ENABLE_SPHINX=YES \
		-DLLVM_ENABLE_TERMINFO=YES \
		-DLLVM_ENABLE_ZLIB=YES \
		-DLLVM_HOST_TRIPLE=$CHOST \
		-DLLVM_INCLUDE_EXAMPLES=NO \
		-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
		-DLLVM_TARGETS_TO_BUILD=all \
		\
		-DSPHINX_WARNINGS_AS_ERRORS=NO \
		"$builddir" || return 1

	make llvm-tblgen || return 1
	make || return 1

	paxmark m bin/llvm-rtdyld \
		bin/lli \
		bin/lli-child-target \
		unittests/ExecutionEngine/MCJIT/MCJITTests \
		unittests/Support/SupportTests || return 1

	case "$CARCH" in
	arm*)
		# ARM has few failures in test suite
		# that we don't care about currently.
		;;
	*)
		make check-llvm || return 1
		;;
	esac
}

package() {
	cd "$builddir"/build

	make DESTDIR="$pkgdir" install || return 1

	# Remove RPATHs
	file "$pkgdir"/lib/*.so "$pkgdir"/bin/* \
		| awk -F: '$2~/ELF/{print $1}' \
		| xargs -r chrpath -d
}

static() {
	pkgdesc="LLVM static libraries"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

dev() {
	default_dev || return 1

	mv "$pkgdir"/usr/lib/LLVMHello.so "$subpkgdir"/usr/lib/ || return 1
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/ || return 1
}

libs() {
	pkgdesc="LLVM runtime libraries"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libLLVM-[0-9]*.so* "$subpkgdir"/usr/lib/
}

md5sums="538467e6028bbc9259b1e6e015d25845  llvm-3.8.1.src.tar.xz
10904f363abd86c5c4729e5630ea319c  llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch
b0cd098117223159b76e96c3f884536b  llvm-0002-Fix-build-with-musl-libc.patch
9cc5050619f764ca9dc842a5ab122290  llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch
1485f62f8b26541a5308b082e9172de9  llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch
ade897d81b5ed522fa07bf045e779cbc  llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch
fc5ac9c103c97057526a0c98e965199d  llvm-0006-clone-every-functions-debug-info.patch
c06093bf71dba5edc87e3b1a2ea69b40  llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch
1646fff7966d8e727ff20e3891372e4f  llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch
785147afd8ab80fa95955a5637b6582f  llvm-nm-workaround.patch
79d98688de62404b6276e3aa2ea01b01  llvm-exit-config-when-cbuild-set.patch"
sha256sums="6e82ce4adb54ff3afc18053d6981b6aed1406751b8742582ed50f04b5ab475f9  llvm-3.8.1.src.tar.xz
708db2b21570e48e2c2e155a0c7b7969acecbb82393e306b5b69b0353ac108dd  llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch
e1b0fd5f6918d8c8404f3ec4b8d3ab8fbe8dadc2d6011792349b56e5e8ee51e2  llvm-0002-Fix-build-with-musl-libc.patch
fc28356bf0d5fcfe9b99e28f4abbc2f49f50d263b44e428e30f33bf5472747b4  llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch
a12615f51d4ebfc724bd6075dbab62b1632f42c9daed3f1e2d279e4985a7ccda  llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch
8c7571fddebd073f81efb11a489def1cfdfbd77ba202fec71d6955c4c52fffa1  llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch
1d109e00c6c904d0af5a4cc49b5fb0a5b895890ebdd3e3a1bc5d517e162afc1f  llvm-0006-clone-every-functions-debug-info.patch
18e00ea15872e672a17b4797a88cea0d3fb4d80c5557455cc1e8e8f5ddda13d6  llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch
4c27b11af5d6e2b0c5a2c4e5b3dd49ef1b2aea9f5d55af72f75582de13bffefa  llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch
1870f910a6f5f2ba6144bd079ec55ed879fe8fd8b1b1b384935f36da43e5f114  llvm-nm-workaround.patch
8dca08e97637ae1ce5c99d8a6f7fefec9869ea1cda22fe33fe8ebd0a489d0df3  llvm-exit-config-when-cbuild-set.patch"
sha512sums="99bbb2cc5f337fd5edf1621f8028c8cb74011aa4af2531018dc05409b27f7b8d0c2f76a00115f677f7c013029d5d9f55d085a5b40433409aac4e9161d53bd366  llvm-3.8.1.src.tar.xz
a97ad7a71ec4878f1a8a335dbc0c161323d957aeb95917b0c4837405c69b53b5f9718094e0e9fd7814c74f44aaa8cff3a9379202964b537c8162a53214621bc5  llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch
4cb3fabbb627b596ce398ed717c66ad20bbea7092ba30751520cc5a63d38e1ac53d23e98a6ad82121ddcf2434383ba5cadbc2990f99a4528e99c6e2160c2f725  llvm-0002-Fix-build-with-musl-libc.patch
19bfb9282455d39d07dbb2b1293b03a45c57d522fbb9c5e58dac034200669628b97e7a90cd4ff5d52d9bb79acfccbef653d8a1140a7f0589ecd6f9b7c4ba0eb6  llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch
f1cbbe0fc39151749ef5423619eb2855905535b2aaab5e6659bacfb14818e56c6b2205f258604db009dcfb1eebd51588a39fc76e1ec5421d68fde1fe65fab550  llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch
199565f088605e758d12fb17ba556463a3b6f523a0629949b3de2f5eb4a34775d7390ff3842f97f30a4828185c611ae8534b2f7beff17fa35bbd928478c2c069  llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch
3f4625dab896f27645a45f2fa75efb2b25ee249379b110e7510b8908e7f16edf14907d431bacd8c5dc2821fd5740f3091c881d31c2d44a6aa415e6d06cd5d7f0  llvm-0006-clone-every-functions-debug-info.patch
3e9de70c000dfbf0e405d85607e10f2c61c608df957c6195560b9f4b583ddf4be30538846d86bee02038b23f9deedd773dccd24c3fee89a942a3e5e1f3d0ad4a  llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch
6bb3e8e1b794737b1f411b5656f1a8e13e696c3c0cc8cb57297b371746713948f07c5c4fa93b57f90125f0da82550c1b6973e64575b636092d75fa05694610d2  llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch
11db6f3c5d697bc536c7d053530f7a5572756185e16399c32c31306861b58046ca9bc14b8d8097758c00a8c1a7026cbfb75636c0e697e59c53dda5848f93b006  llvm-nm-workaround.patch
7a162897c0014ca7c0415edf8e2ab477c964a451db63a4a9a5852ad58e238da003fca9e821bf3cc130e0684ce03e0f2eee7371f819d5282be82b1876d49c52e4  llvm-exit-config-when-cbuild-set.patch"