aboutsummaryrefslogtreecommitdiffstats
path: root/main/compiler-rt/APKBUILD
blob: aff2d9f2c157803a6a6ef3816138efe7591a831e (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
# Contributor: Eric Molitor <eric@molitor.org>
# Contributor: Travis Tilley <ttilley@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=compiler-rt
# Note: Update together with llvm.
pkgver=13.0.1
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="LLVM compiler-rt runtime libraries"
arch="all"
url="https://llvm.org/"
license="Apache-2.0"
makedepends="
	clang
	cmake
	libexecinfo-dev
	linux-headers
	llvm-dev~$_llvmver
	llvm-static~$_llvmver
	llvm-test-utils~$_llvmver
	python3
	samurai
	"
checkdepends="gtest-dev"
provides="$pkgname-static=$pkgver-r$pkgrel"  # for backward compatibility (Alpine <3.16)
source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/compiler-rt-$pkgver.src.tar.xz
	https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-$pkgver.src.tar.xz
	xray-ppc64-musl.patch

	link-execinfo.patch
	sanitizer-supported-arch.patch
	aarch64-ucontext.patch
	sanitizer-ppc64-musl.patch
	"
builddir="$srcdir/$pkgname-$pkgver.src"
options="!check"  # tests fail to build

case "$CARCH" in
	# Sanitizers are broken on other arches.
	# Keep in sync with sanitizer-supported-arch.patch.
	aarch64 | ppc64le | x86_64) _build_sanitizers='ON';;
	*) _build_sanitizers='OFF';;
esac

prepare() {
	default_prepare

	sed -i 's|/usr/bin/env python$|/usr/bin/python3|' \
		lib/hwasan/scripts/hwasan_symbolize
}

build() {
	# compiler-rt uses llvm intrinsic types for testing
	# and therefore requires clang
	# It also needs LLVM source for testing purposes
	cmake -G Ninja -B build -Wno-dev \
		-DCMAKE_C_COMPILER=clang \
		-DCMAKE_CXX_COMPILER=clang++ \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCOMPILER_RT_INCLUDE_TESTS="$(want_check && echo ON || echo OFF)" \
		-DCOMPILER_RT_BUILD_SANITIZERS=$_build_sanitizers \
		-DCOMPILER_RT_BUILD_XRAY=ON \
		-DCOMPILER_RT_INSTALL_PATH="/usr/lib/clang/$pkgver" \
		-DLLVM_EXTERNAL_LIT="/usr/bin/lit" \
		-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
	cmake --build build
}

check() {
	ninja -C build check-compiler-rt
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2cdc3d5cfe5fcf7eba497912ccaadcf33dbd2dd029840fbd54c861b24927e5f4dd494b1ecee1c6c8abbd21e1adf08c217448f408d75346147bac15000fe9ec29  compiler-rt-13.0.1.src.tar.xz
05fbe8708ac3d0dfef3a9135ee88185a95ed492095429a97d33b8aadb0187e59ad42d1a7184f02b5c84fdd31f3d7227c65bd292ed0aa039b29522e59cf90a965  llvm-13.0.1.src.tar.xz
8ed6746474f135ebf77a0888957126ef3a5ded97551632198cf15659104d792487920324b74569dfc46140d26f0a268e2378d6f8878c1c9013b8e6f199eeb3b7  xray-ppc64-musl.patch
50c68838f79c948b3a0bff6cb120f8c68cac9ad2254d6409b1cddf79cc8a776d1142b29678445d92b62fadc66f353fe89e14dac7aa6c3b4f08d883a06615d7e3  link-execinfo.patch
014951fa69792814f41cc5b3b412c2d3dcd9d1396d98a2b44eb304b13f238246fad94eb7ecd7c159788b7d3e4a1119f25a4dc2c33bc9330dd8800c6e1a586b43  sanitizer-supported-arch.patch
cc109c684f30842043a2e4991ef0bea626bd0ea8108bbe41cd3fc8610fec70e2ae0b17763a7ba1868c97fe2b1d32d6042ed19a833a3444908d601f0c26cedb67  aarch64-ucontext.patch
24064718e4bd48e2b57c9de94c2fe975f4ec9ae9bd635d542c06bc5d4c59e25a9bdaabbaf5cb5a5f3c9819d01c7a15b2e70aa7679d5bc1e7a52033e6f0bb107e  sanitizer-ppc64-musl.patch
"