# Template file for 'input-leap'
pkgname=input-leap
version=3.0.3
revision=1
build_style=cmake
configure_args="-DINPUTLEAP_BUILD_X11=ON -DINPUTLEAP_BUILD_LIBEI=ON"
hostmakedepends="pkg-config qt6-base qt6-tools"
makedepends="qt6-base-devel avahi-compat-libs-devel libei-devel libportal-devel"
checkdepends="gtest-devel"
short_desc="Open-source KVM software"
maintainer="classabbyamp <void@placeviolette.net>"
license="GPL-2.0-only"
homepage="https://github.com/input-leap/input-leap"
changelog="https://github.com/input-leap/input-leap/releases"
distfiles="https://github.com/input-leap/input-leap/archive/refs/tags/v${version}.tar.gz"
checksum=fbbf6e3f99abccfc3592939a039daf13f0e003dd33764c7c591d354b1a6c07eb

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -DINPUTLEAP_BUILD_TESTS=ON -DINPUTLEAP_USE_EXTERNAL_GTEST=ON"
else
	configure_args+=" -DINPUTLEAP_BUILD_TESTS=OFF -DINPUTLEAP_USE_EXTERNAL_GTEST=OFF"
fi

input-leap-gui_package() {
	short_desc+=" - GUI"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/bin/input-leap
		vmove usr/share/applications
		vmove usr/share/icons
		vmove usr/share/metainfo
	}
}

barrier_package() {
	short_desc+=" (transitional dummy package)"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmkdir usr/bin
		vmkdir usr/share/man/man1
		for sfx in s c; do
			ln -s "input-leap$sfx" "$PKGDESTDIR/usr/bin/barrier$sfx"
			ln -s "input-leap$sfx.1" "$PKGDESTDIR/usr/share/man/man1/barrier$sfx.1"
		done
	}
}

barrier-gui_package() {
	short_desc+=" - GUI (transitional dummy package)"
	depends="${sourcepkg}-gui>=${version}_${revision}"
	pkg_install() {
		vmkdir usr/bin
		ln -s input-leap "$PKGDESTDIR"/usr/bin/barrier
	}
}
