aboutsummaryrefslogtreecommitdiffstats
path: root/main/valgrind/APKBUILD
blob: 0e5db19ca5e43e3e1f93ff54de5124595dfb643f (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=valgrind
pkgver=3.20.0
pkgrel=0
pkgdesc="A tool to help find memory-management problems in programs"
url="https://valgrind.org/"
# armv6 not supported upstream, broken with mips64 softfloat
arch="all !armhf !mips64 !riscv64"
license="GPL-2.0-or-later"
# it seems like busybox sed works but the configure script requires GNU sed
makedepends="sed perl bash autoconf automake libtool 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
	musl.supp
	uclibc.patch
	valgrind-3.13.0-malloc.patch
	"
builddir="$srcdir"/$pkgname-$pkgver

# 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

prepare() {
	default_prepare
	cd "$builddir"
	cp "$srcdir"/musl.supp .
	aclocal && autoconf && automake --add-missing
	echo '#include <linux/a.out.h>' > include/a.out.h
}

build() {
	cd "$builddir"
	# fails to build with ccache
	export CC="gcc"
	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() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	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="
d6bfb9284d0410134ee7e2a5975b13c01508dd5587b562947d8197b3c113b76fdfac88c4072948be68bbf0dbeb17b4d1acb1412ce898adaa83c30ae2c6a1c12b  valgrind-3.20.0.tar.bz2
49df485f158a7f4d354b2ed0d46dcc691f0490f50913c83dabfdd513b47ef1045f140fd59f54b560df05e4f3a4aba63de7124553b396189fa3ac89c908831e45  musl.supp
d59a10db9037e120df2ee94a103402ca95a79abee9d8be63e4e1bca29c82dca775cc402a79b854ec11a2160a4d2da202c237369418e221d1925267ea2613fd5d  uclibc.patch
57086a768f3876b26b0e507bc159a73f0955f03d5af8cc30e21103e348ca67f2e58b5555a5a97f299751c6602692ad43d8346bb68a80917d740fb4d65bba9665  valgrind-3.13.0-malloc.patch
"