aboutsummaryrefslogtreecommitdiffstats
path: root/main/valgrind/APKBUILD
blob: e3932ce16314eebf374b5a16d7c42594d6a71f31 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=valgrind
pkgver=3.21.0
pkgrel=4
pkgdesc="Tool to help find memory-management problems in programs"
url="https://valgrind.org/"
# armv6/riscv64 not supported upstream
arch="all !armhf !riscv64"
license="GPL-2.0-or-later"
# it seems like busybox sed works but the configure script requires GNU sed
makedepends="sed perl linux-headers"
# from README_PACKAGERS:
#   Don't strip the debug info off lib/valgrind/$platform/vgpreload*.so
#   in the installation tree.  Either Valgrind won't work at all, or it
#   will still work if you do, but will generate less helpful error
#   messages.
options="!strip"
subpackages="$pkgname-dev $pkgname-doc"
source="https://sourceware.org/pub/valgrind/valgrind-$pkgver.tar.bz2
	0001-memcheck-Handle-Err_ReallocSizeZero-in-MC_-eq_Error.patch
	perl-errors.patch
	"

# Valgrind 3.19.0 added support for compiling the tests on musl.
# However, it seems they haven't tested this on many architectures.
# Disable check on architectures where it doesn't work for now.
#
# TODO: Report upstream.
case "$CARCH" in
aarch64|s390x|armv7|x86) options="$options !check"
esac

build() {
	export CFLAGS="$CFLAGS -fno-stack-protector -no-pie"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--without-mpicc
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# we have options=!strip above so we strip the /usr/bin/* manually
	if [ -z "$DEBUG" ]; then
		scanelf -Ry "$pkgdir" \
			| awk '$1=="ET_DYN"{printf("%s%c",$2,0)}' \
			| xargs -0 strip
	fi
}

sha512sums="
3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd  valgrind-3.21.0.tar.bz2
54f497867a2c6724c38751bf6b9f356be38b03bc044104dbc1d05423e72ea68179516b158c77e2ede3e7dc96c5e3de35a683e54b5af85f71806d520b59aa442c  0001-memcheck-Handle-Err_ReallocSizeZero-in-MC_-eq_Error.patch
bb8620d5fc808ba61b5ba64a45f81f452f57ce520c17f0f5497b989fb91e4d6e95698b784938640adae63477e01e2554882cb413952e1718550c2a18fc533c2b  perl-errors.patch
"