# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Robin Candau <antiz@archlinux.org>

pkgname=remmina
epoch=1
pkgver=1.4.35
pkgrel=4
pkgdesc="remote desktop client written in GTK+"
url="https://www.remmina.org/"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL-2.0-or-later')
depends=(
  'avahi'
  'bash'
  'cairo'
  'curl'
  'gcc-libs'
  'glib2'
  'glibc'
  'gtk3'
  'hicolor-icon-theme'
  'json-glib'
  'libayatana-appindicator'
  'libgcrypt'
  'libsodium'
  'libssh'
  'libx11'
  'openssl'
  'pango'
  'python'
  'vte3'
)
makedepends=(
  'cmake'
  'freerdp'
  'gobject-introspection'
  'gtk-vnc'
  'harfbuzz'
  'kwallet5'
  'libvncserver'
  'ninja'
  'spice-gtk'
  'spice-protocol'
  'webkit2gtk-4.1'
  'xorgproto'
)
optdepends=('freerdp: RDP plugin'
            'libsecret: Secret plugin'
            'libvncserver: VNC plugin'
            'spice-gtk: Spice plugin'
#            'pyhoca-cli: X2Go plugin'
            'webkit2gtk-4.1: WWW plugin'
            'gtk-vnc: GVNC plugin'
            'kwallet5: kwallet plugin'
            'gnome-terminal: external tools')
replaces=('remmina-plugins')
provides=('remmina-plugins')
source=("$pkgname-$pkgver.tar.bz2::https://gitlab.com/Remmina/Remmina/-/archive/v${pkgver/rc/-rc}/Remmina-v${pkgver/rc/-rc}.tar.bz2")
sha512sums=('36dc419b4473c71f6b3e53338f4a3cf7a1fe60534ea0dce375b4c9fd00cd9d8a618c4376be4d031bdee1eed8b4aade4538a6cc414629ef6dde41cdcd513a6d36')

build() {
  cmake -S Remmina-v${pkgver/rc/-rc} -B build -G Ninja \
    -D CMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DWITH_APPINDICATOR=ON \
    -D WITH_FREERDP3=ON \
    -DWITH_NEWS=OFF \
    -DWITH_KF5WALLET=ON \
    -DWITH_X2GO=ON \
    -DWITH_GVNC=ON \
    -W no-dev
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
