aboutsummaryrefslogtreecommitdiffstats
path: root/main/clang/APKBUILD
blob: dcfeb937f3551e8218f3c484e9cc63e8833f6950 (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
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang
# Note: Update together with llvm.
pkgver=4.0.0
pkgrel=0
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="http://llvm.org/"
license="UOI-NCSA"
makedepends="
	cmake
	isl-dev
	libxml2-dev
	libxml2-utils
	llvm-dev
	llvm-static
	paxmark
	python2
	"
depends_dev="$pkgname=$pkgver-r$pkgrel"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
	$pkgname-analyzer::noarch"
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.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/cfe-$pkgver.src"

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

	cmake .. -G "Unix Makefiles" -Wno-dev \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		-DCLANG_BUILD_EXAMPLES=OFF \
		-DCLANG_INCLUDE_DOCS=ON \
		-DCLANG_INCLUDE_TESTS=ON \
		-DCLANG_PLUGIN_SUPPORT=ON \
		-DLIBCLANG_BUILD_STATIC=ON \
		-DLLVM_ENABLE_EH=ON \
		-DLLVM_ENABLE_RTTI=ON \
		|| return 1

	make clang-tblgen || return 1
	make
}

check() {
	cd "$builddir"/build

	./bin/clang --version
	./bin/clang-check --version
	./bin/clang-format --version
}

package() {
	cd "$builddir"/build

	make DESTDIR="$pkgdir" install || return 1
	install -m 644 lib/libclang.a "$pkgdir"/usr/lib
}

static() {
	pkgdesc="Static libraries for clang"

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

analyzer() {
	pkgdesc="Clang source code analysis framework"
	depends="$pkgname=$pkgver-r$pkgrel perl python2"

	cd "$pkgdir"

	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/libexec \
		"$subpkgdir"/usr/share/
	mv usr/bin/scan-* "$subpkgdir"/usr/bin/ || return 1
	mv usr/libexec/*-analyzer "$subpkgdir"/usr/libexec/ || return 1
	mv usr/share/scan-* "$subpkgdir"/usr/share/
}

sha512sums="a0d9972ec337a5c105fcbe7abc4076ba1e580f28908a3318f43bbfe59143f446ed5b78dad210f624145d7e5a3d56c15bfead78826c068422b60120fa1cfa482a  cfe-4.0.0.src.tar.xz
4014984a187e4d0331d8315727d1b831e573843cd8d113df43424524cb348bc73ce3d12783351d9a14f9fd14111d75ce71d8f2a85d82b6437a61b11d85796cfb  clang-0001-Add-Alpine-Linux-distro.patch
53741890ec3805dd0d5a930ed526cb5bac5f75c459c6910c9461017719186383cf54638af4eea7a38eb7f9f423b18086bd5584b11f7e4babf6cd0edf8b4f4f48  clang-0002-Use-z-relro-on-Alpine-Linux.patch
f06e351785d5755827459f17d3533415772ba84b4fbd4e49f418bafd20394e98d42b33a94aa34cff2a7b54c79cf06a6f5d382af5a55cba63a81116f0568d4b25  clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
2998ab2dfbc3d5629dd7e65e7e39dc0ab96f61e24733cb8d2d4faee50a89f0f159ad44d10182ed4c96f060180f4e22510881f4e9eb00ced01278bde99adf3389  clang-0004-Add-musl-targets.patch
6215080a796fa1fc6f7634781ef77fc245037880dbf075a656823aae5f9f4911294dc6d61172db399b063adbe445c38b73cec12fc66dbe16bd9d84dc58035846  clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
d151a6ecca470abb1f4dbc06910155db0688322475655e28cdcb9c0b21930c8bcaf166e9df9fc9dca1be654cf497587961e461d91ee2871fdf454bbd33c5fffe  clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
f8c46bb64202c9233595362eb54288c30fbd28309308cbcafe1802dc50ffd676c7a70e6cbdbfd73464f872b40a90acd2eb736dcc9622fd434dbd44a5b0005027  clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"