blob: 07222c4a18a6681f060a7a61f1e4a2c73adb598e (
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
# Contributor Eric Molitor <eric@molitor.org>
# Contributor Patrick Gansterer <paroga@paroga.com>
# Contributor Travis Tilley <ttilley@gmail.com>
# Contributor omni <omni+alpine@hack.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang15
pkgver=15.0.5
pkgrel=1
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="https://llvm.org/"
license="Apache-2.0"
options="!check" # fail to build
makedepends="
cmake
help2man
libxml2-dev
llvm$_llvmver-dev
llvm$_llvmver-static
llvm$_llvmver-test-utils
samurai
python3
"
checkdepends="diffutils bash gtest-dev"
depends_dev="$pkgname=$pkgver-r$pkgrel"
subpackages="
$pkgname-static
$pkgname-doc
$pkgname-libclang
$pkgname-libs
$pkgname-bash-completion:bash:noarch
$pkgname-analyzer::noarch
$pkgname-dev
$pkgname-extra-tools:extra
py3-$pkgname:python:noarch
"
source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/clang-$pkgver.src.tar.xz
https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/clang-tools-extra-$pkgver.src.tar.xz
https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/cmake-$pkgver.src.tar.xz
10-add-musl-triples.patch
30-Enable-stack-protector-by-default-for-Alpine-Linux.patch
"
builddir="$srcdir/clang-$pkgver.src"
prepare() {
mv "$srcdir/clang-tools-extra-$pkgver.src" "$builddir/tools/extra"
default_prepare
}
# Whether is this package the default (latest) clang version.
_default_clang="yes"
if [ "$_default_clang" = yes ]; then
provides="clang=$pkgver-r$pkgrel"
replaces="clang"
depends_dev="$depends_dev $pkgname-extra-tools=$pkgver-r$pkgrel"
fi
build() {
local python_version=$(python3 -V | sed 's/.*\([0-9]\{1,\}\.[0-9]\{1,\}\)\..*/\1/')
if [ $_default_clang = yes ]; then
local extras=ON
else
local extras=OFF
fi
cmake -B build -G Ninja -Wno-dev \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_MODULE_PATH="$srcdir/cmake-$pkgver.src/Modules" \
-DCLANG_BUILT_STANDALONE=ON \
-DCLANG_ENABLE_ARCMT=$extras \
-DCLANG_ENABLE_STATIC_ANALYZER=$extras \
-DCLANG_INCLUDE_TESTS="$(want_check && echo ON || echo OFF)" \
-DCLANG_LINK_CLANG_DYLIB=ON \
-DCLANG_PLUGIN_SUPPORT=ON \
-DCLANG_PYTHON_BINDINGS_VERSIONS="$python_version" \
-DCLANG_VENDOR=Alpine \
-DENABLE_LINKER_BUILD_ID=ON \
-DLIBCLANG_BUILD_STATIC=ON
ninja -C build clang-tblgen
ninja -C build
help2man --no-info \
--source "Alpine" \
--name "Alpine Clang $pkgver-r$pkgrel" \
--version-string "$pkgver-r$pkgrel" \
--help-option "--help-hidden" \
./build/bin/clang > clang.1
}
check() {
ninja -C build check-all
}
package() {
# the libraries should always exactly match, not just by soname
depends="$pkgname-libs=$pkgver-r$pkgrel libstdc++-dev"
DESTDIR="$pkgdir" ninja -C build install
install -Dm644 build/lib/libclang.a -t "$pkgdir"/usr/lib/
if [ $_default_clang = "yes" ]; then
rm "$pkgdir"/usr/share/clang/clang-format-bbedit.applescript \
"$pkgdir"/usr/share/clang/clang-doc-default-stylesheet.css \
"$pkgdir"/usr/share/clang/index.js
install -Dm644 "$builddir"/clang.1 -t "$pkgdir"/usr/share/man/man1/
mkdir -p "$pkgdir"/usr/share/bash-completion/completions
mv "$pkgdir"/usr//share/clang/bash-autocomplete.sh \
"$pkgdir"/usr/share/bash-completion/completions/clang
mkdir -p "$pkgdir"/usr/share/emacs/site-lisp
mv "$pkgdir"/usr/share/clang/clang-*.el \
"$pkgdir"/usr/share/emacs/site-lisp
rmdir -p usr/share/clang || true
else
# only has things we want to put in the main version
rm -rf "$pkgdir"/usr/share
fi
}
dev() {
default_dev
_default_replace
# move back usr/lib/clang/x.y.z/include with files such as altivec.h, msa.h etc
# these are needed to build programs *with* clang, not *against* it.
mv "$subpkgdir"/usr/lib/clang "$pkgdir"/usr/lib/
}
static() {
default_static
_default_replace
}
bash() {
default_bashcomp
_default_replace
}
libs() {
default_libs
_default_replace
}
libclang() {
_default_replace
replaces="$replaces clang-libs"
# we add an extra subpackage for this so things that link to libclang don't
# have to pull libclang-cpp too (separate)
amove usr/lib/libclang.so.*
}
analyzer() {
pkgdesc="Clang source code analysis framework"
depends="$pkgname=$pkgver-r$pkgrel py3-$pkgname=$pkgver-r$pkgrel perl python3"
_default_replace
amove \
usr/bin/scan* \
usr/bin/analyze-build* \
usr/bin/intercept-build* \
usr/libexec/*-analyzer* \
usr/libexec/analyze-* \
usr/libexec/intercept-* \
usr/share/scan-* \
usr/lib/libear*
}
extra() {
pkgdesc="Extra tools built using Clang’s tooling APIs"
_default_replace
amove \
usr/bin/clang-apply-replacements* \
usr/bin/clang-change-namespace* \
usr/bin/clang-check* \
usr/bin/clang-doc* \
usr/bin/clang-extdef-mapping* \
usr/bin/clang-format* \
usr/bin/clang-include-fixer* \
usr/bin/clang-move* \
usr/bin/clang-offload-bundler* \
usr/bin/clang-offload-wrapper* \
usr/bin/clang-query* \
usr/bin/clang-refactor* \
usr/bin/clang-rename* \
usr/bin/clang-reorder-fields* \
usr/bin/clang-repl* \
usr/bin/clang-scan-deps* \
usr/bin/clang-tidy* \
usr/bin/clangd* \
usr/bin/c-index-test* \
usr/bin/diagtool* \
usr/bin/find-all-symbols* \
usr/bin/git-clang-format* \
usr/bin/hmaptool* \
usr/bin/modularize* \
usr/bin/pp-trace* \
usr/bin/run-clang-tidy* \
usr/share/clang/clang-include-fixer* \
usr/share/clang/clang-format*.py \
usr/share/clang/*clang-tidy* \
usr/share/clang/run-find-all-symbols.py
amove usr/share/emacs
}
python() {
pkgdesc="Clang Python Bindings"
depends="$pkgname-libs=$pkgver-r$pkgrel python3"
provides="py3-clang=$pkgver-r$pkgrel"
replaces="py3-clang"
local sitedir=$(python3 -c "import site; print(site.getsitepackages()[0])")
amove usr/lib/python*
amove usr/share/clang/clang-rename.py
# actually a python module..
mv "$pkgdir"/usr/lib/libscanbuild "$subpkgdir"/"$sitedir"
}
_default_replace() {
if [ "$_default_clang" = yes ]; then
replaces="clang${subpkgname#"$pkgname"}"
provides="$replaces=$pkgver-r$pkgrel"
fi
}
sha512sums="
62b2be15b0e8c1fcfa8c35384e794a89ae13ab195454ce8409f255087abd9cfebea6c70658c794f4daaadfa3f6ecbb046ce6f7ba146afe6e0fc0d7d57471b432 clang-15.0.5.src.tar.xz
f6b64b48408f456922136ac75b42fd55ea05294381e40120d3716bed919b85948f9274af1e334926fbb04957c5339de1c0807b5549f2a750d9d07b62574421ac clang-tools-extra-15.0.5.src.tar.xz
493825f1b64abef6d56502d28e30056320bdda5a46a478fc85eec3a631c541da2d318fb9c3e3d3e6234f538121b7a1c60d34cba498fd6b7938d3558d24684fed cmake-15.0.5.src.tar.xz
5809d931656cac13b91bc91aac63df072b0403708ac718bf01546d9d520ff2c4163ee11411439dce5bb683a3bfa044b62443b6f66a1419c9086d20e79a018071 10-add-musl-triples.patch
b9b5529bcf460767796ddbc6f7d8c479b62d63c74d39297b3c7c79a2f6898272ac52a2f2d1ea2bd601e869cecf23c0cd69fbcd613b8c6299b14a1be8203fd089 30-Enable-stack-protector-by-default-for-Alpine-Linux.patch
"
|