# Template file for 'toxcore'
pkgname=toxcore
version=0.2.19
revision=1
build_style=cmake
configure_args="-DMUST_BUILD_TOXAV=ON -DBUILD_TOXAV=ON -DDHT_BOOTSTRAP=OFF
 -DBOOTSTRAP_DAEMON=ON"
hostmakedepends="pkg-config"
makedepends="libconfig-devel libsodium-devel libvpx-devel opus-devel"
short_desc="Encrypted peer-to-peer instant messenger protocol library"
maintainer="Piraty <mail@piraty.dev>"
license="GPL-3.0-or-later"
homepage="https://tox.chat"
changelog="https://raw.githubusercontent.com/TokTok/c-toxcore/master/CHANGELOG.md"
distfiles="https://github.com/TokTok/c-toxcore/releases/download/v${version}/c-toxcore-${version}.tar.gz"
checksum=8b418f6470db085cf59a9915685613556556df2bf427148f1814b7b118628594

conf_files="/etc/tox-bootstrapd.conf"
system_accounts="_tox_bootstrapd"
make_dirs="/var/lib/tox-bootstrapd 0700 _tox_bootstrapd _tox_bootstrapd"
_tox_bootstrapd_homedir="/var/lib/tox-bootstrapd"
_tox_bootstrapd_desc="Account to run Tox's DHT bootstrap daemon"

if [ "${XBPS_CHECK_PKGS}" ]; then
	configure_args+=" -DAUTOTEST=ON"
fi

post_install() {
	vconf other/bootstrap_daemon/tox-bootstrapd.conf
	vsv tox-bootstrapd
}

toxcore-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}
