# Template file for 'gnuradio-nrsc5'
pkgname=gnuradio-nrsc5
version=2.0.0
revision=9
build_style=cmake
make_cmd=make
configure_args="-Dpybind11_DIR=${XBPS_CROSS_BASE}/${py3_sitelib}/pybind11/share/cmake/pybind11"
hostmakedepends="git automake libtool pkg-config gnuradio python3"
makedepends="gnuradio-devel python3-pybind11"
short_desc="GNU Radio implementation of HD Radio"
maintainer="Remi Pommarel <repk@triplefau.lt>"
license="GPL-3.0-or-later"
homepage="https://github.com/argilo/gr-nrsc5"
distfiles="https://github.com/argilo/gr-nrsc5/archive/v${version}.tar.gz"
checksum=cc9135b20e79111f609b95e02c5b5926c8c71c3ed8ab6e58b2b484d4efb333ae
make_check=no  # XXX: ModuleNotFoundError: No module named 'nrsc5'

export CMAKE_GENERATOR="Unix Makefiles"

if [ "$CROSS_BUILD" ]; then
	configure_args+=" -DPYBIND11_USE_CROSSCOMPILING=ON"
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		vsed -i CMakeLists.txt \
			-e "s;\./configure ;& --host=${XBPS_MACHINE%-musl} ;"
	fi
}

gnuradio-nrsc5-devel_package() {
	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
	}
}
