aboutsummaryrefslogtreecommitdiffstats
path: root/main/compiler-rt/APKBUILD
blob: cd986224107c29967f47174b937ffc9220a2273e (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
# Contributor Eric Molitor <eric@molitor.org>
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=compiler-rt
# Note: Update together with llvm.
pkgver=11.1.0
pkgrel=1
_llvmver=${pkgver%%.*}
pkgdesc="LLVM compiler-rt runtime libraries"
arch="aarch64 armv7 x86 x86_64"
url="https://llvm.org/"
license="Apache-2.0"
makedepends="
	cmake
	linux-headers
	clang
	llvm-dev>=$_llvmver
	llvm-static>=$_llvmver
	samurai
	python3
	"
checkdepends="gtest-dev llvm-test-utils>=$_llvmver"
subpackages="$pkgname-static"
options="!check" # Doesn't seem to work with linux ld: /lib/ld-musl-x86_64.so.1: cannot load --version: No such file or directory
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"
builddir="$srcdir/$pkgname-$pkgver.src"

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

	# compiler-rt uses llvm intrinsic types for testing
	# and therefore requires clang
	# It also needs LLVM source for testing purposes
	cmake .. \
		-DCMAKE_C_COMPILER=clang \
		-DCMAKE_CXX_COMPILER=clang++ \
		-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 \
		-DCOMPILER_RT_INCLUDE_TESTS=ON \
		-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
		-DCOMPILER_RT_BUILD_XRAY=OFF \
		-DLLVM_EXTERNAL_LIT="/usr/bin/lit" \
		-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src" \
		-G Ninja
	ninja
}

check() {
	cd "$builddir"/build
	# remove test that does not work with PaX kernel
	rm ../test/builtins/Unit/enable_execute_stack_test.c \
		../test/builtins/Unit/clear_cache_test.c
	ninja check-compiler-rt
}

package() {
	cd "$builddir"/build

	DESTDIR="$pkgdir" ninja install

	cd "$pkgdir"

	mkdir -p usr/lib/clang/$pkgver/lib
	case "$CARCH" in
		ppc64le | s390x) ;;
		*) mv usr/lib/linux usr/lib/clang/$pkgver/lib;;
	esac
}

sha512sums="9b0b259cc43d5e4d20200676be153de81b485b3fdf065623ff71c7e1894ec5c8ed9d99c1416f70246ab0f417cbba6d1d4af9f3769e2e6577400681a791346231  compiler-rt-11.1.0.src.tar.xz
07bf9973384151a18d5cc2892103e5f28a88c632e8e49662fde56d123632f2ed1b3710fa7a87b6b821955d0ec44160ff36f2aa4f233e389e14d628e9bf8dc764  llvm-11.1.0.src.tar.xz"