# Contributor: Sodface <sod@sodface.com>
# Maintainer: Sodface <sod@sodface.com>
pkgname=signal-estimator
pkgver=0.0.9
pkgrel=1
pkgdesc="Measure characteristics of a looped back signal"
url="https://github.com/gavv/signal-estimator"
arch="all"
license="MIT"
options="!check" # no test suite
makedepends="
	alsa-lib-dev
	cmake
	fmt-dev
	kissfft-dev
	qt5-qtbase-dev
	qwt-dev
	samurai
	spdlog-dev
	"
subpackages="$pkgname-doc $pkgname-gui"
_cli11_ver=2.3.2
_concurrentqueue_ver=1.0.4
_intrusive_shared_ptr_ver=1.4
source="$pkgname-$pkgver.tar.gz::https://github.com/gavv/signal-estimator/archive/refs/tags/v$pkgver.tar.gz
	https://github.com/CLIUtils/CLI11/releases/download/v$_cli11_ver/CLI11.hpp
	concurrentqueue-$_concurrentqueue_ver.tar.gz::https://github.com/cameron314/concurrentqueue/archive/refs/tags/v$_concurrentqueue_ver.tar.gz
	https://github.com/gershnik/intrusive_shared_ptr/releases/download/v$_intrusive_shared_ptr_ver/intrusive_shared_ptr-$_intrusive_shared_ptr_ver.tar.gz
	use-system-libs.patch
	"

prepare() {
	default_prepare

	install -D "$srcdir"/CLI11.hpp "$builddir"/src/base/CLI/CLI.hpp
	install -D "$srcdir"/concurrentqueue-$_concurrentqueue_ver/*.h -t "$builddir"/src/base/
	install -D "$srcdir"/intrusive_shared_ptr/inc/intrusive_shared_ptr/*.h -t "$builddir"/src/base/intrusive_shared_ptr/
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm0644 LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

gui() {
	pkgdesc="$pkgdesc (GUI)"
	amove usr/bin/signal-estimator-gui
}

sha512sums="
7347f82ec009f76edc6fbffcc5663ef70f9b3c3ac05f93ee9ec8a695e9ce2c9e8b1c833d70f593903792c8f49840f1248791e2032c8d9a10c1468e3348491097  signal-estimator-0.0.9.tar.gz
4ee9958c7ae84e7e22b4662a0b79ee42aea4ab785d3a18fd167723bec71d94cb6219d31ba9e3bc0861d77f443797cd065036886960001cb4df1ac25d4202c5b9  CLI11.hpp
a27306d1a7ad725daf5155a8e33a93efd29839708b2147ba703d036c4a92e04cbd8a505d804d2596ccb4dd797e88aca030b1cb34a4eaf09c45abb0ab55e604ea  concurrentqueue-1.0.4.tar.gz
00819a4b6fa7a3acac42b39a6db70d7d78576a6e0436b31e4ba642765d000c8beab61cc3fd24f4b6682ca8447760b098ed6b27615fb87f97227c7077dfb4b23b  intrusive_shared_ptr-1.4.tar.gz
2409cedd642b2a7f88fac7ec1410bbd6204b7226ea3f4184c79a21c8205b7d14b6b8ee8fa9986f32421c0ed0e313f11b4a13f7be9755a6bcce76742c8e4df611  use-system-libs.patch
"
