# Maintainer: Jerome Leclanche <jerome@leclan.ch>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

pkgname=qtermwidget
pkgver=0.17.0
pkgrel=2
pkgdesc="A terminal widget for Qt, used by QTerminal"
arch=("x86_64")
url="https://github.com/lxqt/$pkgname"
# Yep, it's messy when you're talking about licenses
license=("LGPL" "custom:BSD" "custom:Public Domain")
depends=("qt5-base")
makedepends=("lxqt-build-tools" "python-pyqt5" "python-sip4" "sip4")
optdepends=(
  'python: PyQt5 bindings'
)
source=(
  "https://github.com/lxqt/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.xz"
  "https://github.com/lxqt/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.xz.asc"
  "FS71280.patch"::"https://github.com/lxqt/qtermwidget/commit/9613dcd6c594cc6c59734112680bab0be43eff71.patch"
)
sha256sums=('4e04b2fb71d7382266a1ea168bf02d1283e04df6127a42f760a30389cb219b82'
            'SKIP'
            '77f19cf04e54576ed4d022d32e55b8558d292522f2fb531ca246afd2aa7427ce')
validpgpkeys=(
  "169704C6FB490C6892C7F23C37E0AF1FDA48F373"  # Jerome Leclanche <jerome@leclan.ch>
  "7C733BA5F585AAD669E4D23A42C9C8D3AF5EA5E3"  # Alf Gaida <agaida@siduction.org>
  "19DFDF3A579BD509DBB572D8BE793007AD22DF7E"  # Pedram Pourang <tsujan2000@gmail.com>
)

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../FS71280.patch
}

build() {
  mkdir -p build
  cd build

  cmake "$srcdir/$pkgname-$pkgver" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQTERMWIDGET_BUILD_PYTHON_BINDING=ON
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
  install -Dm644 "$srcdir/$pkgname-$pkgver/README.md" -t "$pkgdir"/usr/share/licenses/$pkgname
}
