aboutsummaryrefslogtreecommitdiffstats
path: root/main/compiler-rt/APKBUILD
blob: 3efbba44e05ea7bae23e71e7ca987857c68838d9 (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
# 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=14.0.6
pkgrel=1
_llvmver=${pkgver%%.*}
pkgdesc="LLVM compiler-rt runtime libraries"
arch="all"
url="https://llvm.org/"
license="Apache-2.0"
makedepends="
	clang
	cmake
	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

	sanitizer-supported-arch.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

	cd "$srcdir"

	# monorepo layout
	ln -sfv llvm-$pkgver.src llvm
}

build() {
	# compiler-rt uses llvm intrinsic types for testing
	# and therefore requires clang
	# It also needs LLVM source for testing purposes
	# GWP asan is broken
	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" \
		-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
		-DLLVM_EXTERNAL_LIT="/usr/bin/lit"
	cmake --build build
}

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

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

sha512sums="
c0e63071cb99bca837b83fd0e3597cf45cc635f73ab88a1ec48e863a1633f42bd402ea7c5130e8fa0f550b9574c1ecac1799b92b789565e4ead955cf60060907  compiler-rt-14.0.6.src.tar.xz
6461bdde27aac17fa44c3e99a85ec47ffb181d0d4e5c3ef1c4286a59583e3b0c51af3c8081a300f45b99524340773a3011380059e3b3a571c3b0a8733e96fc1d  llvm-14.0.6.src.tar.xz
8ed6746474f135ebf77a0888957126ef3a5ded97551632198cf15659104d792487920324b74569dfc46140d26f0a268e2378d6f8878c1c9013b8e6f199eeb3b7  xray-ppc64-musl.patch
9aaac8aa9217509cf377b44e20a8c8294b9972e03e9d4f7c1b0ac7c22bcdac6f6a0888ab16b7542e1d6b89a5ac9054c5d8ef8acd1ae1002cca2d0b3df86136a6  sanitizer-supported-arch.patch
aed5efa8a9c4f3bcb3b377d3c69c3fef387ef73d712bb58d60622d02d09f42b827cd810cd0648ca2a0ed6cca794f98a6176522e528488caf2f9ce08e0138c931  sanitizer-ppc64-musl.patch
"