1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Contributor: Dan McGee <dan@archlinux.org>
3 # Contributor: Allan McRae <allan@archlinux.org>
6 # this package requires glibc-debug to run the check() function
7 # as -debug packages are not available in [core], it has to be applied manually
8 # whenever the tests shall run
11 # $repo-x86_64-build -- -I ../../glibc/trunk/glibc-debug*.pkg.tar.zst
18 pkgdesc='Tool to help find memory-management problems in programs'
21 url='https://valgrind.org/'
22 depends=('glibc' 'perl' 'debuginfod')
23 makedepends=('gdb' 'lib32-glibc' 'lib32-gcc-libs' 'docbook-xml'
24 'docbook-xsl' 'docbook-sgml')
25 checkdepends=('procps-ng')
26 optdepends=('lib32-glibc: 32-bit ABI support')
27 provides=('valgrind-multilib')
28 replaces=('valgrind-multilib')
29 options=('!emptydirs' '!strip')
30 source=(https://sourceware.org/pub/valgrind/valgrind-${pkgver}.tar.bz2{,.asc}
31 valgrind-3.7.0-respect-flags.patch)
33 0E9FFD0C16A1856CF9C7C690BA0166E698FA6035 # Julian Seward <jseward@acm.org>
34 EC3CFE88F6CA0788774F5C1D1AA44BE649DE760A # Mark Wielaard <mjw@gnu.org>
36 sha512sums=('3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd'
38 'e0cec39381cefeca09ae4794cca309dfac7c8693e6315e137e64f5c33684598726d41cfbb4edf764fe985503b13ff596184ca5fc32b159d500ec092e4cf8838c')
39 b2sums=('1f7306d288eb5ecfb2b2f0b2dc68960ecd4a7213b96a2e4ecb9990a755e8c233b0e9d190c0f807019bde669f44a631c8dafe9eb521d739561e6f889f7bdaca5c'
41 'af556fdf3c02e37892bfe9afebc954cf2f1b2fa9b75c1caacfa9f3b456ebc02bf078475f9ee30079b3af5d150d41415a947c3d04235c1ea8412cf92b959c484a')
42 options=(!lto) # https://bugs.kde.org/show_bug.cgi?id=338252
46 patch -Np1 < ../valgrind-3.7.0-respect-flags.patch
47 sed -i 's|sgml/docbook/xsl-stylesheets|xml/docbook/xsl-stylesheets-1.79.2-nons|' docs/Makefile.am
53 # valgrind does not like some of our flags
54 CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
55 CFLAGS=${CFLAGS/-fno-plt/}
56 CXXFLAGS=${CXXFLAGS/-fno-plt/}
62 --localstatedir=/var \
63 --libexecdir=/usr/lib \
64 --mandir=/usr/share/man
66 make -C docs man-pages
70 # only run if glibc-debug is supplied manually
71 if ! pacman -Q glibc-debug; then echo -e "\033[1;31mcheck() not run, supply glibc-debug if unintended!\033[0m"; return 0; fi
75 # Make sure a basic binary runs. There should be no errors.
76 ./vg-in-place --error-exitcode=1 /bin/true
78 # Make sure no extra FLAGS leak through, the testsuite
79 # sets all flags necessary. See also configure above.
80 make check CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS=
82 # XXX: run full regtest but only report issues some tests fail duo
83 # current toolchain and expectations, take a manual look if its fine
84 #echo "===============TESTING==================="
87 # Make sure test failures show up in build.log
88 # Gather up the diffs (at most the first 20 lines for each one)
89 #local f max_lines=20 diff_files=()
90 #mapfile -d '' diff_files < <(find . -name '*.diff' -print0 | sort -z)
91 #if (( ${#diff_files[@]} == 0 )); then
92 #echo "Congratulations, all tests passed!"
94 #warning "Some tests failed!"
95 #for f in "${diff_files[@]}"; do
96 #echo "================================================="
98 #echo "================================================="
99 #if (( $(wc -l < "${f}") < ${max_lines} )); then
102 #head -n ${max_lines} "${f}"
103 #echo "<truncated beyond ${max_lines} lines>"
107 #echo "===============END TESTING==============="
111 cd valgrind-${pkgver}
112 make DESTDIR="${pkgdir}" install
114 install -Dm644 docs/*.1 -t "$pkgdir/usr/share/man/man1"
116 if check_option 'debug' n; then
117 find "${pkgdir}/usr/bin" -type f -executable -exec strip $STRIP_BINARIES {} + || :