summaryrefslogtreecommitdiff
path: root/user/clang/APKBUILD
blob: d829f003209a8c14e60f4b2f68b3037b387c034d (plain) (blame)
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
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=clang
# Note: Update together with llvm.
pkgver=14.0.6
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
options="!dbg"
url="https://llvm.org/"
license="NCSA"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="cmake isl-dev libedit-dev libexecinfo-dev libxml2-dev libxml2-utils
	llvm${_llvmver}-dev llvm${_llvmver}-static llvm${_llvmver}-test-utils
	z3 z3-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
	$pkgname-analyzer::noarch"
source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/$pkgname-$pkgver.src.tar.xz
	https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-$pkgver.src.tar.xz
	0001-Add-support-for-Ad-lie-Linux.patch
	cfe-005-ppc64-dynamic-linker-path.patch
	ppc-dirwatcher.patch
	ppc-interp.patch
	ppc64-elfv2.patch
	use-llvm-lit.patch
	"
builddir="$srcdir/$pkgname-$pkgver.src"

prepare() {
	default_prepare

	#1054
	rm -fr \
		test/Coverage/html-diagnostics.c \
		test/Coverage/html-multifile-diagnostics.c \
		test/Modules/crash-vfs-path-emptydir-entries.m \
		test/Modules/crash-vfs-path-symlink-component.m \
		test/Modules/crash-vfs-path-symlink-topheader.m \
		test/Modules/crash-vfs-path-traversal.m \
		test/Modules/crash-vfs-relative-overlay.m \
		test/Modules/crash-vfs-umbrella-frameworks.m \
		test/Modules/load-module-with-errors.m \
		test/Modules/modules-with-same-name.m \
		test/Modules/prebuilt-implicit-modules.m \
		test/Modules/prune.m \
		test/Modules/signal.m \
		test/VFS/module-header-mismatches.m \
		test/VFS/module_missing_vfs.m \
		test/utils/update_cc_test_checks/basic-cplusplus.test \
		test/utils/update_cc_test_checks/check-globals.test \
		test/utils/update_cc_test_checks/check_attrs.test \
		test/utils/update_cc_test_checks/def-and-decl.test \
		test/utils/update_cc_test_checks/exec-all-runlines.test \
		test/utils/update_cc_test_checks/explicit-template-instantiation.test \
		test/utils/update_cc_test_checks/generated-funcs-regex.test \
		test/utils/update_cc_test_checks/generated-funcs.test \
		test/utils/update_cc_test_checks/global-hex-value-regex.test \
		test/utils/update_cc_test_checks/global-value-regex.test \
		test/utils/update_cc_test_checks/mangled_names.test \
		test/utils/update_cc_test_checks/on_the_fly_arg_change.test \
		test/utils/update_cc_test_checks/prefix-never-matches.test \
		test/utils/update_cc_test_checks/replace-value-regex-across-runs.test \
		test/utils/update_cc_test_checks/resolve-tmp-conflict.test \
		;
}

build() {
	CMAKE_PREFIX_PATH=/usr/lib/llvm$_llvmver/lib/cmake \
	cmake -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		-DCLANG_VENDOR=${DISTRO_SHORT_NAME:-Adélie} \
		-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_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src" \
		-DLLVM_EXTERNAL_LIT="$builddir/build/bin/llvm-lit" \
		-Bbuild \
		.

	make -C build clang-tblgen
	# too memory hungry
	if [ -z "$JOBS" ] || [ $JOBS -gt 32 ]; then
		make -C build -j32
	else
		make -C build
	fi
}

check() {
	[ -f build/bin/llvm-lit ] || ln -s /usr/bin/lit build/bin/llvm-lit
	make -C build check-clang
}

package() {
	make DESTDIR="$pkgdir" -C build install
	install -m 644 build/lib/libclang.a "$pkgdir"/usr/lib

	# mozilla will never be happy
	mkdir -p "$pkgdir"/usr/lib/llvm$_llvmver/bin
	mkdir -p "$pkgdir"/usr/lib/llvm$_llvmver/lib
	for _dir in bin lib; do
		cd "$pkgdir"/usr/$_dir
		for _file in *; do
			[ -f $_file ] || continue
			ln -s "../../../$_dir/$_file" \
				"$pkgdir"/usr/lib/llvm$_llvmver/$_dir/$_file
		done
		cd "$OLDPWD"
	done

	# needed for at least Qt Creator
	mkdir -p "$pkgdir"/usr/include/llvm$_llvmver
	ln -s ../clang "$pkgdir"/usr/include/llvm$_llvmver/clang
	ln -s ../clang-c "$pkgdir"/usr/include/llvm$_llvmver/clang-c
}

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

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

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="5f5497b57dd116225e90f321902f1015beb50c0b1bb90d0fc6c026f13aa748feabe44f98eb75e86f98f3b1785ad5e850210732f3eae75b942ecd520527dcd30b  clang-14.0.6.src.tar.xz
6461bdde27aac17fa44c3e99a85ec47ffb181d0d4e5c3ef1c4286a59583e3b0c51af3c8081a300f45b99524340773a3011380059e3b3a571c3b0a8733e96fc1d  llvm-14.0.6.src.tar.xz
7f422f671167498102789e8c0b3ab4e46d6a4433d89f0f6b2cf0736ad257146e5eeb04b6f1d9431cce4635c9691d0cc80e643f852269bf7119ce312ae9bb8068  0001-Add-support-for-Ad-lie-Linux.patch
b3c999ef1e380b02a25f1ebca4811f1c696b88309b73af0c19865e3b92084becc9529b910d24b4fb7133606c1e105860104017406d876f95e9260c716348bd1c  cfe-005-ppc64-dynamic-linker-path.patch
0032fdd3864870d345caff9c4ff44f58bebc802bddf06c4b3bf30276c89e237167e6dea03456d322d3f6e2ee5e3a2ecf9f649ed033f0ab078b80bda44371b3ce  ppc-dirwatcher.patch
0d8f77100cd8550be0dc251704081574b0cdc46169df1428ad8cc9f689cdaa47adcd9ff45a816e238ee279395036c7548bf1033307aabbb3a62cce9f360698eb  ppc-interp.patch
4f534e72cf3ec9134d9f77a1a787c84859a5ee84b52da529d47745eb7d75d383070573018588bfbf622e826fcb281fdf20fa79217024df5cb824e6ae1ea1d7bf  ppc64-elfv2.patch
1f93918d512849e8bf7eb4e71d2b623c0ae3361e4b6ed5b50b76b0fe78e3d70f8773061b1ea0f327950a4f7c2ffdcdaafcb224301732df2a7469c742e8f5883f  use-llvm-lit.patch"