# Maintainer: vrubelroman <vrubelroman@gmail.com>
pkgname=chesspenguin-bin
_appid=io.github.vrubelroman.chessPenguin
pkgver=2.1.2
pkgrel=1
pkgdesc="Chess database: view, enter and analyse PGN and ChessBase games; Stockfish on request"
arch=('x86_64')
url="https://github.com/vrubelroman/chessPenguin"
license=('GPL-3.0-or-later' 'GPL-3.0-only')
depends=('glibc' 'gcc-libs' 'alsa-lib' 'libxkbcommon' 'dbus' 'hicolor-icon-theme')
optdepends=('vulkan-icd-loader: GPU rendering via Vulkan'
            'stockfish: chess engine from the AUR (otherwise the program offers to download it)')
provides=('chesspenguin')
conflicts=('chesspenguin')
options=('!debug')
source=("${url}/releases/download/v${pkgver}/ChessPenguin-${pkgver}-linux-x86_64.tar.gz")
sha256sums=('08fe84825cab23a4c01629f1aea24ea6a2a9f8c4a953ad6c1aa845e9ab300b4c')

package() {
    cd "ChessPenguin-${pkgver}-linux-x86_64"
    install -Dm755 chesspenguin "${pkgdir}/usr/bin/chesspenguin"
    install -Dm644 "${_appid}.desktop" "${pkgdir}/usr/share/applications/${_appid}.desktop"
    for size in 16 24 32 48 64 128 256 512; do
        install -Dm644 "icons/hicolor/${size}x${size}/apps/${_appid}.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/${_appid}.png"
    done
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm644 THIRD_PARTY_NOTICES.md "${pkgdir}/usr/share/doc/${pkgname}/THIRD_PARTY_NOTICES.md"
    install -Dm644 examples/classics.pgn "${pkgdir}/usr/share/doc/${pkgname}/examples/classics.pgn"
}
