# Maintainer: Gioacchino Mazzurco <gio@retroshare.cc>
# Contributor: AsamK
# Contributor: sehraf
# Contributor: stqn
# Contributor: JHeaton <jheaton at archlinux dot us>
# Contributor: Tristero <tristero at online dot de>
# Contributor: funkyou

pkgname=retroshare-service-0.6.7
pkgver=stable
pkgrel=20231116
pkgdesc="Serverless encrypted instant messenger with filesharing, chatgroups, e-mail. System service version."
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
url="https://retroshare.cc/"
license=('AGPL' 'GPL' 'LGPL')
depends=('bzip2' 'libupnp' 'libzip' 'openssl' 'rapidjson' 'sqlcipher' 'xapian-core')
makedepends=('cmake' 'doxygen' 'git' 'pkgconf' 'qt5-tools')
provides=('retroshare-service')
conflicts=('retroshare-service')

source=(RetroShare.tar.gz)
md5sums=(SKIP)

prepare() {
	cd "${srcdir}/RetroShare"
}

build() {
	[ "$(doxygen --version)" == "1.8.16" ] && {
		echo Doxygen 1.8.16 is not supported due to \
			https://github.com/doxygen/doxygen/issues/7236 please report it \
			to your distribution
		exit -1
	}

	qmake-qt5 --version
	gcc --version

	cd "${srcdir}/RetroShare"
	qmake-qt5 PREFIX=/usr RS_DATA_DIR=/usr/share/retroshare \
		$(build_scripts/OBS/get_source_version.sh) \
		CONFIG-=debug CONFIG+=release CONFIG+=ipv6 \
		CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_friendserver \
		CONFIG+=no_retroshare_gui CONFIG+=no_tests \
		CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=no_rs_webui \
		RetroShare.pro
	make -j$(nproc)
}

package() {
	cd "${srcdir}/RetroShare"
	make INSTALL_ROOT="${pkgdir}" install
}
