# Maintainer: Gioacchino Mazzurco <gio@altermundi.net>
# 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
pkgver=0.6.6
pkgrel=20210324
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-unstable')

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 DATA_DIR=/usr/share/retroshare \
		RS_MAJOR_VERSION=0 RS_MINOR_VERSION=6 RS_MINI_VERSION=6 \
		RS_EXTRA_VERSION="-retroshare-service-OBS-Arch" \
		CONFIG-=debug CONFIG+=release \
		CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_gui \
		CONFIG+=no_tests \
		CONFIG+=retroshare_service CONFIG+=rs_jsonapi \
		RetroShare.pro
	make -j$(nproc)
}

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