# Template file for 'qbittorrent'
pkgname=qbittorrent
version=5.0.1
revision=2
build_style=cmake
configure_args="-DSYSTEMD=OFF -DGUI=ON -DWEBUI=OFF"
hostmakedepends="pkg-config qt6-tools qt6-declarative-host-tools"
makedepends="libtorrent-rasterbar-devel qt6-base-private-devel qt6-declarative-devel qt6-svg-devel"
depends="qt6-svg"
short_desc="Free software alternative to µtorrent"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="GPL-2.0-or-later"
homepage="https://www.qbittorrent.org/"
changelog="https://www.qbittorrent.org/news.php"
distfiles="${SOURCEFORGE_SITE}/qbittorrent/qbittorrent-${version}.tar.xz"
checksum=03435c292091cc953ff078da8fd224b9e45074842ea72caa82a4ead72b402e69
CXXFLAGS=-std=gnu++17

post_configure() { # qbittorrent-nox
	configure_args="${configure_args//DGUI=ON/DGUI=OFF}"
	configure_args="${configure_args//DWEBUI=OFF/DWEBUI=ON}"
	(
		cmake_builddir="nox-build"
		do_configure
	)
}

post_build() { # qbittorrent-nox
	(
		cmake_builddir="nox-build"
		do_build
	)
}

post_install() { # qbittorrent-nox
	(
		DESTDIR="${DESTDIR/qbittorrent/qbittorrent-nox}"
		cmake_builddir="nox-build"
		do_install
	)
}

qbittorrent-nox_package() {
	short_desc+=" - no X11"
}
