# Template file for 'guitarix2'
pkgname=guitarix2
version=0.47.0
revision=2
build_style=waf3
configure_args="--cxxflags-release=-DNDEBUG --no-faust $(vopt_if avahi '' '--no-avahi') $(vopt_if bluez '' '--no-bluez')"
make_build_args="--progress"
hostmakedepends="gperf intltool pkg-config sassc"
makedepends="boost-devel-minimal libboost_iostreams
 eigen fftw-devel gtkmm-devel jack-devel
 ladspa-sdk liblrdf-devel libsndfile-devel lilv-devel lv2 sratom-devel
 zita-convolver-devel zita-resampler-devel
 $(vopt_if avahi avahi-glib-libs-devel) $(vopt_if bluez libbluetooth-devel)"
depends="desktop-file-utils fonts-roboto-ttf"
short_desc="Virtual guitar amplifier running on Jack Audio Connection Kit"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-or-later"
homepage="https://guitarix.org"
distfiles="https://github.com/brummer10/guitarix/releases/download/V${version}/guitarix2-${version}.tar.xz"
checksum=f18abd3bd2cb05960d00f15f36c63f97eb1759f9571977e3e42191ff16b9b467

build_options="avahi bluez"
desc_option_bluez="Build with bluez support"

CXXFLAGS="-fpermissive"

case "$XBPS_TARGET_MACHINE" in
	x86_64*) ;;
	i686*) configure_args+=" --cxxflags=-mfxsr" ;;
	*) configure_args+=" --disable-sse" ;;
esac

if [ -n "$CROSS_BUILD" ]; then
	post_extract() {
		# don’t test load the ladspa plugin when cross compiling
		vsed -i "/features='test_loadable',/d" src/ladspa/wscript
	}
fi

post_patch() {
	# we want to replace all occurrences of always_inline that are not in
	# brackets or prefixed by _.
	# defining always_inline as done by default breaks the [[gnu::always_inline]] attribute
	vsed -e 's/\([^(_]\|^\)always_inline/\1guitarix_always_inline/g' \
		-i $(grep -rl '[^(_]always_inline' ./)
}
