aboutsummaryrefslogtreecommitdiffstats
path: root/testing/clang6/APKBUILD
blob: ed48c13dda22f2e6289f736fb2eec3a53c2ede90 (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
# Contributor Travis Tilley <ttilley@gmail.com>
_pkgname=clang
# Note: Update together with llvm.
pkgver=6.0.1
_majorver=${pkgver%%.*}
pkgname=$_pkgname$_majorver
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="https://clang.llvm.org/"
license="UOI-NCSA"
options="!check" # tests need python lit
makedepends="
	cmake
	isl-dev
	libedit-dev
	libxml2-dev
	libxml2-utils
	llvm6-dev>=$_llvmver
	llvm6-static>=$_llvmver
	llvm6-test-utils>=$_llvmver
	python3
	"
depends_dev="$pkgname=$pkgver-r$pkgrel"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
	$pkgname-analyzer::noarch"
source="https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz
	0004-Add-musl-targets.patch
	0008-Fix-ClangConfig-cmake-LLVM-path.patch
	"
builddir="$srcdir/cfe-$pkgver.src"

prepare() {
	default_prepare
}

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

	cmake .. -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
		-DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="$CXXFLAGS" \
		-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT="$LDFLAGS" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		\
		-DCLANG_VENDOR=Alpine \
		-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 \
		-DLLVM_EXTERNAL_LIT=/usr/lib/llvm6/bin/lit \
		-DLLVM_CONFIG=/usr/bin/llvm6-config

	make clang-tblgen
	make
}

check() {
	cd "$builddir"/build

	make check-clang
}

package() {
	cd "$builddir"/build

	make DESTDIR="$pkgdir" install
	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 python3"

	cd "$pkgdir"

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

sha512sums="f64ba9290059f6e36fee41c8f32bf483609d31c291fcd2f77d41fecfdf3c8233a5e23b93a1c73fed03683823bd6e72757ed993dd32527de3d5f2b7a64bb031b9  cfe-6.0.1.src.tar.xz
3fc38a952999909bd6be608092102e11f9685e68241c7abea09ac5f12533896b3a4cd0741caaccfbeb29b1882769fe66fe654f3292005b2ae16a10ea015e42a8  0004-Add-musl-targets.patch
9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00  0008-Fix-ClangConfig-cmake-LLVM-path.patch"