# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Contributor: NexAdn <git@nexadn.de>
# Contributor: Techflash <officialtechflashyt@gmail.com>
# Maintainer: javsanpar <javsanpar@riseup.net>
pkgname=abaddon
_pkgname=abaddon
pkgver=0.2.1.83.gbd5bb61f456d
pkgrel=1
pkgdesc='An alternative Discord client made with C++/gtkmm'
url='https://github.com/uowuo/abaddon'
source=("git+https://github.com/uowuo/abaddon#commit=bd5bb61f456d68ef69a822704860a06c79c0418c")
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL3')
makedepends=('git' 'cmake' 'nlohmann-json')
# 'rnnoise' not packaged in ArchPOWER, and is optional according
# to abaddon's readme.
depends=('gtkmm3' 'libhandy' 'spdlog' 'opus' 'libsodium')
sha256sums=('2a9145cd28cc3f1007a950b6862cd062024f272134c89796aa88027f2e3349c9')

pkgver() {
  cd "$_pkgname"
  git describe --abbrev=12 --tags | sed 's/v//;s/-/./g'
}

prepare () {
  cd "$_pkgname"
  git submodule update --init --filter=tree:0 subprojects/{ixwebsocket,keychain,miniaudio,qrcodegen}
}

build () {
  cmake -B build -S "$_pkgname" -DENABLE_RNNOISE=OFF
  make -C build
}

package() {
  install -Dm755 build/abaddon "$pkgdir"/usr/bin/abaddon

  install -Dm644 "$_pkgname"/res/css/* -t "$pkgdir"/usr/share/abaddon/css
  install -Dm644 "$_pkgname"/res/res/sound/* -t "$pkgdir"/usr/share/abaddon/res/sound
  rm -r "$_pkgname"/res/res/sound/
  install -Dm644 "$_pkgname"/res/res/* -t "$pkgdir"/usr/share/abaddon/res

  #install -Dm755 abaddon.desktop \
  #  "$pkgdir"/usr/share/applications/abaddon.desktop
}
