aboutsummaryrefslogtreecommitdiffstats
path: root/main/valgrind/APKBUILD
blob: f55b92c52f0a720148d9cea0442dd480648828ef (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=valgrind
pkgver=3.10.1
pkgrel=0
pkgdesc="A tool to help find memory-management problems in programs"
url="http://valgrind.org/"
arch="x86 x86_64"
license="GPL2+"
depends=""
# it seems like busybox sed works but the configure script requires GNU sed
makedepends="sed paxctl pax-utils perl bash
	autoconf automake libtool"
# 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="http://$pkgname.org/downloads/$pkgname-$pkgver.tar.bz2
	uclibc.patch
	musl-fixes.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	aclocal && autoconf && automake --add-missing || return 1
	update_config_sub || return 1
	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"
	export GCC_SPECS="hardenednopie.specs"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--without-mpicc \
		--mandir=/usr/share/man \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1

	# we have options=!strip above so we strip the /usr/bin/* manually
	if [ -z "$DEBUG" ]; then
		strip "$pkgdir"/usr/bin/valgrind \
			"$pkgdir"/usr/bin/no_op_client_for_valgrind \
			"$pkgdir"/usr/bin/valgrind-listener \
			"$pkgdir"/usr/bin/cg_merge
	fi

	# pax causes some issues
	# http://marc.info/?l=gentoo-hardened&m=119512627126298&w=2
	# http://bugs.alpinelinux.org/issues/999
	paxctl -c -m "$pkgdir"/usr/lib/valgrind/*-*-linux
}

md5sums="60ddae962bc79e7c95cfc4667245707f  valgrind-3.10.1.tar.bz2
c29b4572a070eb0d3a6a977be586c771  uclibc.patch
88867c2d838d10023fefe541cf7bd3f0  musl-fixes.patch"
sha256sums="fa253dc26ddb661b6269df58144eff607ea3f76a9bcfe574b0c7726e1dfcb997  valgrind-3.10.1.tar.bz2
fab5afea5cb7abec79ff68088d97ccc188613c733b4dfc8ede029cb818ec397f  uclibc.patch
9f94b5a8674f5f3c1dead32cff036ae5a513158e14c89cf230cd6f3d47e77feb  musl-fixes.patch"
sha512sums="8f3d27637c13b06381b3dd44088244e0cf2f7008f40e46f34322f2a5bfa6373d29ce68ff49f19c48f1a5f139d8be5838b9606206e0ce2599c5f74c0db8ce2642  valgrind-3.10.1.tar.bz2
d59a10db9037e120df2ee94a103402ca95a79abee9d8be63e4e1bca29c82dca775cc402a79b854ec11a2160a4d2da202c237369418e221d1925267ea2613fd5d  uclibc.patch
5a8ce93abd83a66983f0b47acce4e375dd6b8c57d6772d42f51aea0ec0f0c233cef88230d10e54c06446a84c772810d382fd1861019ad9b28578b0e0bd8ff57c  musl-fixes.patch"