# Maintainer: Peter Mattern <pmattern at arcor dot de>

_pkgname=nm-tray
pkgname=$_pkgname-git
pkgver=r267.16ffa94
pkgrel=1
pkgdesc='Pure Qt NetworkManager front-end residing in panels'
arch=('i686' 'x86_64')
url='https://github.com/palinek/nm-tray'
license=('GPL')
depends=('networkmanager-qt')
makedepends=('git' 'cmake' 'qt6-tools' 'ninja')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+https://github.com/palinek/nm-tray.git")
sha256sums=("SKIP")

pkgver() {
  cd $_pkgname
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgname"
    -G Ninja
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DNM_TRAY_XDG_AUTOSTART_DIR='/etc/xdg/autostart'
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 "$_pkgname/COPYING" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

