aboutsummaryrefslogtreecommitdiffstats
path: root/main/clang/APKBUILD
blob: 484c9c6f1b39d1041d19673c1e98db978c919be8 (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
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang
pkgver=3.8.1
pkgrel=1
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="http://llvm.org/"
license="UOI-NCSA"
depends=""
depends_dev=""
makedepends="$depends_dev
	cmake
	isl-dev
	libxml2-dev
	libxml2-utils
	llvm-dev llvm llvm-static
	make
	paxmark
	python
	"
install=
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-analyzer"
source="
	http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz

	clang-0001-Add-Alpine-Linux-distro.patch
	clang-0002-Use-z-relro-on-Alpine-Linux.patch
	clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
	clang-0004-Add-musl-targets-and-dynamic-linker.patch
	clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
	clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
	clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch
	"


_builddir="$srcdir"/build
#	-DLINK_POLLY_INTO_TOOLS=YES \
#	-DPOLLY_ENABLE_GPGPU_CODEGEN=NO \
#	-DWITH_POLLY=YES \


_builddir="$srcdir"/build
_srcdir="$srcdir"/cfe-$pkgver.src

prepare() {
	msg "Patching clang..."
	cd "$_srcdir" || 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() {
	mkdir -p "$_builddir"
	cd "$_builddir"
	cmake -G "Unix Makefiles" -Wno-dev \
		-DCLANG_PLUGIN_SUPPORT=YES \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=NO \
		-DCLANG_INCLUDE_DOCS:BOOL=ON \
		-DCLANG_INCLUDE_TESTS:BOOL=ON \
		-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
		-DLIBCLANG_BUILD_STATIC:BOOL=ON \
		"${_srcdir}" || return 1
#		-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \

	make clang-tblgen || return 1
	make || return 1

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

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	install lib/libclang.a "$pkgdir"/usr/lib || return 1
}

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

#clang_libs() {
#	pkgdesc="Runtime library for clang"
#	mkdir -p "$subpkgdir"/usr/lib/
#	mv "$pkgdir"/usr/lib/libclang*.so.* \
#		"$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 \
		"$subpkgdir"/usr/include \
		|| return 1
	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* \
		"$subpkgdir"/usr/lib/ || return 1
	mv "$pkgdir"/usr/include/clang "$pkgdir"/usr/include/clang-c \
		"$subpkgdir"/usr/include/ || return 1
	mv "$pkgdir"/usr/share/clang "$subpkgdir"/usr/share/ || return 1
}

analyzer() {
	pkgdesc="clang source code analysis framework"
	depends="python"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/libexec \
		"$subpkgdir"/usr/share/ \
		|| return 1
	mv "$pkgdir"/usr/bin/scan-* \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/libexec/*-analyzer \
		"$subpkgdir"/usr/libexec/ || return 1
	mv "$pkgdir"/usr/share/scan-* \
		"$subpkgdir"/usr/share/ || return 1
}

md5sums="4ff2f8844a786edb0220f490f7896080  cfe-3.8.1.src.tar.xz
4f1454992cf8aab70ac5eff62e6ea883  clang-0001-Add-Alpine-Linux-distro.patch
4c6531bed2dbfa945b761aa371e86b9a  clang-0002-Use-z-relro-on-Alpine-Linux.patch
8e866582b4ee7f7d282e49ab43d2b511  clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
31084621d11fe722acc41d4e0d7e340f  clang-0004-Add-musl-targets-and-dynamic-linker.patch
636b294bc8af983f1fd5084df48dad00  clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
227884842639a3862aff22d9a7af1740  clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
6daf6d90da9561818098922101af09f4  clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"
sha256sums="4cd3836dfb4b88b597e075341cae86d61c63ce3963e45c7fe6a8bf59bb382cdf  cfe-3.8.1.src.tar.xz
d2c0666ecf8640ff85ea418ed8c0286b112962139a5ad5644019e69b1214a3dd  clang-0001-Add-Alpine-Linux-distro.patch
3f7f3c7d185420707dc7572603b963ca5ec5a0425d1f7f53473948d9fb7f149b  clang-0002-Use-z-relro-on-Alpine-Linux.patch
5bb41e118184aee03ef3dec47d2ada38516040f903c630283617399db21dc27e  clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
15d9a0c6422b426f790e496fe43223d0f36cf7dbe32d30272a1208616245db4c  clang-0004-Add-musl-targets-and-dynamic-linker.patch
3603e6008dfc63cea1da6ee82a624710ba82683347207b4f39f2fcb5e67c43c9  clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
8b5f95c981379967972db9a3b607b05687ce0c5e0067f6cc1ea52fde6f5a3005  clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
ffeb06bc8042f8715a3413a7556a113645835a7bc6332f725ce1b7b952846930  clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"
sha512sums="72d23a410271b50f97371b13dd7a6c6c5c0a993e35df436ab716ece8521d83406aa3d4bf8fdecd8154139f39fd5e011e480d405225d8c3ff152d0a2ac4573e04  cfe-3.8.1.src.tar.xz
ed19cb50fe96a5b05754887b055d75f0c0466f77e07e4d4f69b9cea17a3fa88e449d54bd47a791780bee095716cf6b6d8bf16352317192b0ce88d09c603af657  clang-0001-Add-Alpine-Linux-distro.patch
22ad0e449c633f3d5a849207c5e2ed048998e03820c743ad90242d4637c23ba3d2dc8f3c51b923fdfa1891d08d10e934f65dd7b6a90adeb3ce35c3ab923370d3  clang-0002-Use-z-relro-on-Alpine-Linux.patch
c6c1f8693085c375f7039baa64f209834f8fdb8be4c597301e882b3fe099bb91e427beaf6555664e46a4e0aae7dbb4b6e0662a1390c4eaacfdbb138345feb478  clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
29e92198d164572ac32d43da40c5d01070d45073cbda2338ff1e3949f6807db722ca9d40a4ef03b21de7e9e9d7b0a61e273b760cf8f302d3ec77d1b0027accc2  clang-0004-Add-musl-targets-and-dynamic-linker.patch
c38f973d9ad8f3e535476cf2b617a2a569a15db8e28c2df0d70252cf69ccbdb29ab18d3aa979b4e66d52128ad0fa654fd0ae503e0cd14b0c265addff1ee35268  clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
af79bb12a75866151edb257377dc5c5f47fa69b03c860ffd0d5d569f18385d642a1cf394c1d375f0fa0a2226637b000bb15f9bf3cacd95972bd465dd8fdbed0c  clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
a2a9b307d764fed977299b1b9d130d63a60e65889638b1aadcc082ef021170c8c0c38b4107ceef7b85b057ef2a72bc19a84297f5179afaf697983c19b20cab7b  clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"