# Copyright 1999-2026 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit multilib

DESCRIPTION="VST3 wrapper for Guitarix (prebuilt upstream binary release)"
HOMEPAGE="https://github.com/brummer10/guitarix.vst"
SRC_URI="https://github.com/brummer10/guitarix.vst/releases/download/v${PV}/Guitarix.vst3.zip -> ${P}.zip"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

# Prebuilt binary: don't strip (may break the plugin), don't try to
# mirror on Gentoo infra without explicit redistribution confirmation.
RESTRICT="mirror strip bindist"
QA_PREBUILT="usr/lib/vst3/Guitarix.vst3/Contents/x86_64-linux/Guitarix.so"

# Runtime deps per upstream README (translated to Gentoo atoms; verified
# via ldd after install, apart from the libcurl-gnutls.so.4 soname
# mismatch handled below).
RDEPEND="
	media-libs/freetype:2
	dev-cpp/glibmm:2
	dev-libs/glib:2
	dev-libs/libsigc++
	sci-libs/fftw:3.0=
	media-libs/libsndfile
	media-libs/lilv
	dev-libs/boost:=
	net-misc/curl
"

S="${WORKDIR}"

src_install() {
	insinto /usr/lib/vst3
	doins -r Guitarix.vst3

	fperms +x /usr/lib/vst3/Guitarix.vst3/Contents/x86_64-linux/Guitarix.so

	# Upstream binary was linked against Debian's libcurl-gnutls.so.4,
	# a distinctly-named soname that only exists on curl builds split
	# by TLS backend (Debian/Ubuntu style). Gentoo's net-misc/curl always
	# ships a single libcurl.so.4 regardless of SSL backend, so provide
	# a compatibility symlink in the standard system lib dir; the
	# SONAME/ABI is stable across backends.
	dosym libcurl.so.4 /usr/$(get_libdir)/libcurl-gnutls.so.4
}