# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=lttng-tools
pkgver=2.9.6
pkgrel=0
pkgdesc="LTTng 2.0 control and utility programs"
url="https://lttng.org"
arch="all !aarch64"
license="GPL-2.0"
depends="babeltrace"
depends_dev="popt-dev libxml2-dev userspace-rcu-dev lttng-ust-dev kmod-dev
	util-linux-dev"
makedepends="$depends_dev bash grep coreutils automake autoconf"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://lttng.org/files/$pkgname/$pkgname-$pkgver.tar.bz2
	musl-has-no-dlmopen.patch"

builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	unset LDFLAGS
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		|| return 1
	make V=1 || return 1
	make -j1 check || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
	mv "$pkgdir"/usr/share/doc/$pkgname/LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="5fc9da4280587c4dc3c695f713e3ae51ad46a9bd0c82d4241a95f406e2644ef296d46c507171b7adc549a933f3abc64c993106287a84a0b8c6901b3b122a0646  lttng-tools-2.9.6.tar.bz2
cb5136007b0d8ea0a84557ab025e709dc4c5d818272f057a9f6c78ed7cf5104b9d904a1b8c5e8674e3455fe85dc28bb890c190cc04f0c1d9c29d87b40dadb88b  musl-has-no-dlmopen.patch"
