# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=gperftools
pkgver=2.15
pkgrel=1
pkgdesc='Fast, multi-threaded malloc and nifty performance analysis tools'
arch=('x86_64')
url='https://github.com/gperftools/gperftools'
license=('BSD-3-Clause')
depends=('gcc-libs' 'glibc' 'libunwind')
makedepends=('git')
optdepends=('graphviz: pprof graph generation'
            'perl: pprof and pprof-symbolize commands')
source=("git+https://github.com/gperftools/gperftools.git#tag=$pkgname-$pkgver")
b2sums=('3e13c2ae5a367d9fa6d6bd21954b21ba3139c642b90285df195ce88d41eab79abbb2a59fdc2c7d4a89fb8706382cb66420f47f224e866ab6f88d9fbaa4825a0f')

prepare() {
  cd $pkgname
  autoreconf -fi
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --enable-frame-pointers --enable-libunwind
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
