# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=gperftools
pkgver=%version%
pkgrel=%release%
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')
optdepends=('graphviz: pprof graph generation'
            'perl: pprof and pprof-symbolize commands')
source=("https://github.com/gperftools/gperftools/releases/download/$pkgname-$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('c69fef855628c81ef56f12e3c58f2b7ce1f326c0a1fe783e5cae0b88cbbe9a80')

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

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