# Contributor: Jared Szechy <jared.szechy@gmail.com>
# Maintainer: Jared Szechy <jared.szechy@gmail.com>
pkgname=librtlsdr
pkgver=0.5.3
pkgrel=0
pkgdesc="Software defined radio receiver for Realtek RTL2832U"
url="https://osmocom.org/projects/sdr/wiki/rtl-sdr"
arch="all"
license="GPL-2.0"
depends=""
depends_dev="libusb-dev"
makedepends="$depends_dev cmake"
install=""
subpackages="$pkgname-dev rtl-sdr:tools"
source="${pkgname}-${pkgver}.tar.gz::https://github.com/steve-m/$pkgname/archive/v$pkgver.tar.gz"

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

build() {
	cd "$builddir"
	mkdir -p build
	cd build
	cmake -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX:PATH=/usr \
		-DDETACH_KERNEL_DRIVER=ON \
		-Wno-dev ..
	make
}

package() {
	cd "$builddir"/build

	make DESTDIR="$pkgdir" install
}

tools() {
	pkgdesc="Software defined radio receiver for Realtek RTL2832U (tools)"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="b2887b5df2728f8481b07fb4d8b9bee18b98c5c0ccd0c8e65c2e784a32826cc2301631e95e54071324e5dfbdaa11f0a5aa483cc619b864d4788c3700980b38b6  librtlsdr-0.5.3.tar.gz"
