# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
# Contributor: Jerome Leclanche <jerome@leclan.ch>

pkgname=qterminal
pkgver=2.0.1
pkgrel=1
pkgdesc="A lightweight Qt-based terminal emulator"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
groups=("lxqt")
url="https://github.com/lxqt/qterminal"
# https://github.com/lxqt/qterminal/blob/2.0.0/qterminal.metainfo.xml#L10
license=('GPL-2.0-or-later' 'BSD-3-Clause')
depends=("hicolor-icon-theme" "qtermwidget" "libcanberra" "layer-shell-qt")
makedepends=("git" "cmake" "lxqt-build-tools")
source=(
  "git+https://github.com/lxqt/qterminal.git?signed#tag=$pkgver"
)
sha256sums=('f8523a955dcc9df8c51457fcc545e255c70f45fce55ba85036de0003aa857255')
validpgpkeys=(
  "19DFDF3A579BD509DBB572D8BE793007AD22DF7E"  # https://github.com/tsujan.gpg
)

build() {
  awk '/\/\*\*/{flag=1} /\*\*\// {print; flag=0} flag' qterminal/src/third-party/qxtglobal.h > LICENSE-LibQxt

  cmake -B build -S qterminal \
    -DCMAKE_INSTALL_PREFIX=/usr
  make -C build
}

package() {
  make -C build DESTDIR="$pkgdir" install

  install -Dm644 LICENSE-LibQxt -t "$pkgdir"/usr/share/licenses/$pkgname
}
