# Template file for 'libffado'
pkgname=libffado
version=2.5.0
revision=1
build_style=scons
scons_use_destdir=yes
make_build_args="PREFIX=/usr MANDIR=/usr/share/man
 UDEVDIR=/usr/lib/udev/rules.d CUSTOM_ENV=1 BUILD_TESTS=0
 ENABLE_OPTIMIZATIONS=0 DEBUG=0 PYTHON_INTERPRETER=/usr/bin/python3
 DETECT_USERSPACE_ENV=0 PYPKGDIR=/${py3_sitelib}
 DIST_TARGET=none DETECT_USERSPACE_ENV=0"
make_install_args="$make_build_args"
hostmakedepends="pkg-config xdg-utils python3-setuptools python3-PyQt5-devel-tools which"
makedepends="libxml++-devel libdbus-c++-devel libsigc++-devel libconfig++-devel
 jack-devel libavc1394-devel libiec61883-devel libraw1394-devel alsa-lib-devel
 python3-PyQt5-dbus"
depends="libffado-python"
short_desc="Library for accessing BeBoB IEEE1394 devices"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="GPL-2.0-only, GPL-3.0-only"
homepage="http://www.ffado.org"
distfiles="http://www.ffado.org/files/libffado-${version}.tgz"
checksum=25c12d93d53988f3caf9965236ed379f167abde3ea4cc633b134ee6254d87ca1

case "$XBPS_TARGET_MACHINE" in
	*-musl)	makedepends+=" argp-standalone" ;;
esac

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)	# Requires argp functions
		vsed -i 's;-lffado";-lffado -largp";' support/tools/SConscript
		vsed -i 's;-lpthread";-lpthread -largp";' support/firmware/SConscript
		vsed -i 's;"pthread";"pthread", "argp";' support/dbus/SConscript
	esac
}

libffado-python_package() {
	depends="python3-PyQt5-dbus python3-dbus"
	short_desc+=" - python3 bindings"
	pkg_install() {
		vmove ${py3_sitelib}
	}
}

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