# Maintainer: Keinv Yue <k3vinyue@gmail.com>

_pkgname=@PKG_NAME@
pkgname=${_pkgname}
pkgver="@VERSION@"
pkgrel=@REVISION@
pkgdesc="A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method."
arch=('x86_64' 'aarch64')
url="https://github.com/yuezk/GlobalProtect-openconnect"
license=('GPL3')
makedepends=('make' 'pkg-config' 'rust' 'cargo' 'jq' 'webkit2gtk' 'curl' 'wget' 'file' 'openssl' 'appmenu-gtk-module' 'gtk3' 'libappindicator-gtk3' 'librsvg' 'libvips' 'libayatana-appindicator' 'openconnect' 'libsecret')
depends=('openconnect>=8.20' webkit2gtk libappindicator-gtk3 libayatana-appindicator libsecret libxml2)
optdepends=('wmctrl: for window management')

provides=('globalprotect-openconnect' 'gpclient' 'gpservice' 'gpauth' 'gpgui')

source=("${_pkgname}-${pkgver}.tar.gz")
sha256sums=('SKIP')

options=('!strip')

build() {
  cd "$pkgname-$pkgver"

  # Must unset the CFLAGS, otherwise the build fails
  unset CFLAGS

  make build OFFLINE=@OFFLINE@ BUILD_FE=0
}

package() {
  cd "$pkgname-$pkgver"

  make install DESTDIR="$pkgdir"
}
