summaryrefslogtreecommitdiffstats
path: root/abs/extra/valgrind/PKGBUILD
blob: 2151db8c679de331e948f1316461f7a2dc17b46a (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>

pkgname=valgrind
_commit=d772e25995c3400eecf2b6070e0bf3411447c3d1
pkgver=3.15.0+269+gd772e2599
pkgrel=1
pkgdesc='Tool to help find memory-management problems in programs'
arch=('x86_64')
license=('GPL')
url='http://valgrind.org/'
depends=('glibc' 'perl')
makedepends=('gdb' 'lib32-glibc' 'lib32-gcc-libs' 'git' 'docbook-xml'
             'docbook-xsl' 'docbook-sgml')
checkdepends=('procps-ng')
optdepends=('lib32-glibc: 32-bit ABI support')
provides=('valgrind-multilib')
replaces=('valgrind-multilib')
options=('!emptydirs' '!strip')
source=("git+https://repo.or.cz/valgrind.git#commit=$_commit"
        valgrind-3.7.0-respect-flags.patch)
md5sums=('SKIP'
         '470d9881870aacc210b7a6efb64cc9a9')
sha512sums=('SKIP'
            'e0cec39381cefeca09ae4794cca309dfac7c8693e6315e137e64f5c33684598726d41cfbb4edf764fe985503b13ff596184ca5fc32b159d500ec092e4cf8838c')

pkgver() {
  cd valgrind
  git describe --tags --always|sed -e 's|-|+|g' -e 's|VALGRIND_||g' -e 's|_|.|g'
}

prepare() {
  cd valgrind
  patch -Np1 < ../valgrind-3.7.0-respect-flags.patch
  sed -i 's|sgml/docbook/xsl-stylesheets|xml/docbook/xsl-stylesheets-1.79.2|' docs/Makefile.am

  autoreconf -ifv
}

build() {
  # valgrind does not like some of our flags
  CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
  CFLAGS=${CFLAGS/-fno-plt/}
  CXXFLAGS=${CXXFLAGS/-fno-plt/}

  cd valgrind
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --mandir=/usr/share/man
  make
  make -C docs man-pages
}

check() {
  cd valgrind

  # Make sure a basic binary runs. There should be no errors.
  ./vg-in-place --error-exitcode=1 /bin/true

  # Make sure no extra FLAGS leak through, the testsuite
  # sets all flags necessary. See also configure above.
  make check CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS=

  # # XXX: run full regtest but only report issues some tests fail duo
  # # current toolchain and expectations, take a manual look if its fine
  # echo "===============TESTING==================="
  # make regtest || :

  # # Make sure test failures show up in build.log
  # # Gather up the diffs (at most the first 20 lines for each one)
  # local f max_lines=20 diff_files=()
  # mapfile -d '' diff_files < <(find . -name '*.diff' -print0 | sort -z)
  # if (( ${#diff_files[@]} == 0 )); then
  #   echo "Congratulations, all tests passed!"
  # else
  #   warning "Some tests failed!"
  #   for f in "${diff_files[@]}"; do
  #       echo "================================================="
  #       echo "${f}"
  #       echo "================================================="
  #       if (( $(wc -l < "${f}") < ${max_lines} )); then
  #         cat "${f}"
  #       else
  #         head -n ${max_lines} "${f}"
  #         echo "<truncated beyond ${max_lines} lines>"
  #       fi
  #   done | tee diffs
  # fi
  # echo "===============END TESTING==============="
}

package() {
  cd valgrind
  make DESTDIR="${pkgdir}" install

  install -Dm644 docs/*.1 -t "$pkgdir/usr/share/man/man1"

  if check_option 'debug' n; then
    find "${pkgdir}/usr/bin" -type f -executable -exec strip $STRIP_BINARIES {} + || :
  fi
}

# vim: ts=2 sw=2 et: