# Template build file for 'gperftools'
pkgname=gperftools
version=2.6.1
revision=1
build_style=gnu-configure
short_desc="Multi-threaded malloc() and performance analysis tools"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="BSD-3-Clause"
homepage="https://github.com/gperftools/gperftools"
distfiles="https://github.com/${pkgname}/${pkgname}/releases/download/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=38b467eb42a028f253d227fbc428263cb39e6c8687c047466aa2ce5bb4699d81
makedepends="libunwind-devel"

case "$XBPS_TARGET_MACHINE" in
arm*-musl|aarch64-musl)
	makedepends=
	configure_args="--disable-libunwind"
	# benchmark/getcontext_light.cc:57: undefined reference to 'getcontext'
	broken=https://build.voidlinux.eu/builders/armv6l-musl_builder/builds/3743/steps/shell_3/logs/stdio
esac

post_extract() {
	sed -i -e 's/__off64_t/off64_t/' \
		src/base/linux_syscall_support.h src/malloc_hook_mmap_linux.h
}

gperftools-devel_package() {
	depends="gperftools>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/share
	}
}
