# Template file for 'hobbits'
pkgname=hobbits
version=0.54.0
revision=1
_pffft_commit=7914df2127c206ae501a6cb2950ee65a94662215
_pffft_dir="jpommier-pffft-${_pffft_commit:0:12}"
create_wrksrc=yes
build_wrksrc="hobbits-${version}"
build_style=cmake
configure_args="-DBUILD_VERSION=${version} $(vopt_bool simd PFFFT_ENABLE_SIMD)"
hostmakedepends="pkg-config qt5-host-tools qt5-qmake python3"
makedepends="libusb-devel libpcap-devel python3-devel qt5-devel"
short_desc="Multi-platform GUI for bit-based analysis, processing and visualization"
maintainer="classabbyamp <void@placeviolette.net>"
license="MIT, custom:FFTPACK"
homepage="https://mahlet-inc.github.io"
changelog="https://raw.githubusercontent.com/Mahlet-Inc/hobbits/master/CHANGELOG.md"
distfiles="https://github.com/Mahlet-Inc/hobbits/archive/refs/tags/v${version}.tar.gz
 https://bitbucket.org/jpommier/pffft/get/${_pffft_commit}.tar.gz"
checksum="4104cea0af5cdf0f8e735dc883e60ce29874f0ffef72de7dcd07c2d7b535513e
 7bd1450386ccf4f5f82f7124a3f154b73c193dc67a8d043385660655c64adddf"

build_options="simd"
desc_option_simd="Enable SIMD support (SSE, Altivec, or NEON)"

# by default, don't use SIMD on unsupported platforms
# SSE, Altivec, or NEON support is needed to enable this
case "$XBPS_TARGET_MACHINE" in
	aarch64*|ppc64*|x86_64*) build_options_default="simd"
esac

case "$XBPS_TARGET_MACHINE" in
	arm*|aarch64*|ppc*) CXXFLAGS+=" -fsigned-char"
esac

post_extract() {
	rm -rf ${build_wrksrc}/external/pffft
	mv ${_pffft_dir} ${build_wrksrc}/external/pffft
}

post_install() {
	vinstall src/hobbits-gui/images/icons/HobbitsRingSmall.png 644 usr/share/pixmaps
	# capture the FFTPACK license from the header comment of pffft.c
	sed -E '/\*\//,$d; 1s/\/\* //; s/^[[:blank:]]+//' external/pffft/pffft.c > LICENSE.pffft
	vlicense LICENSE.pffft
	vlicense LICENSE.txt
}
