# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=babeltrace
pkgver=2.0.6
pkgrel=0
pkgdesc="Trace converter and read/write library"
url="https://www.efficios.com/babeltrace"
arch="all"
license="MIT"
depends_dev="glib-dev"
makedepends="$depends_dev python3-dev py3-setuptools swig"
checkdepends="bash grep"  # test cases use both Bash and grep tools
subpackages="$pkgname-dev $pkgname-doc py3-$pkgname-pyc py3-babeltrace:py3bindings"
source="https://www.efficios.com/files/babeltrace/babeltrace2-$pkgver.tar.bz2
	fix-swig-4.3.patch
	gcc12.patch
	"
builddir="$srcdir/babeltrace2-$pkgver"

build() {
	# This package uses _init functions to initialise extensions. With
	# --as-needed this will not work.
	export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--disable-debug-info \
		--enable-python-bindings \
		--enable-python-plugins \
		--disable-Werror
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	python3 -m compileall -fq "$pkgdir"/usr/lib/python*
}

py3bindings() {
	amove usr/lib/python3*
}

sha512sums="
53107313e4870f6d28484102da2406f6e6eb13751035162b02ca7495d34409d3a8c7d3c14747924f4cf4620eaea113d8ceebf29872fed00bc38cc6e4329cca5d  babeltrace2-2.0.6.tar.bz2
d4251000d9a7a3281d7380714d6dc5db74b8b1e9a1c86b0208c1f63c4f8c1cf764573aa31b5b4d0e68868dc3be53e67673dbc9fac4170bc1c7bc92a2093c1f7f  fix-swig-4.3.patch
23ccf456450ce7146eb5747ece63e6f7443b77e7a107be0a6b86fd074130cb1a46b4c92b3983e46ae6ee7761203575d24d5e9d4ea4d489789b78ebd29905c585  gcc12.patch
"
