# Maintainer: Joey Yakimowich-Payne <jyapayne@pm.me>
#
# BlueRune's system use example (examples/extensions/system.py) for every user: the program,
# the user unit that runs it in each BlueRune session, and its metainfo and icon for the Store
# (docs/extensions.md, "Packaging an extension"). The files beside this PKGBUILD that link
# into the tree are resolved when release/publish.sh --extras exports it.
pkgname=bluerune-extension-system-monitor
pkgver=1
pkgrel=1
pkgdesc="Processor and memory use on BlueRune's desktop"
arch=('any')
url='https://bluerune.dev/docs/extensions/'
license=('Apache-2.0 OR MIT')
install=bluerune-extension-system-monitor.install
# Desktop cards came after 0.3.3; bluerune-session.target starts the unit.
depends=('bluerune>0.3.3' 'python' 'python-gobject' 'glib2' 'hicolor-icon-theme')
source=(
    system.py
    bluerune-extension-system-monitor.service
    org.bluerune.Extension.SystemMonitor.metainfo.xml
    org.bluerune.Extension.SystemMonitor.svg
    LICENSE-MIT
)
sha256sums=('e427d0485cee9de205066acec908ecdbb0acb6ffc8a175967cce033771415b4e'
            '023d4892ed1e0a1c44ed8843fa4b40c75e7ec38b9431bfd5394daf7c9e9c671d'
            '84340e9241e367bde8c4a907e1e1bf23de811adde85d095b0ab76250ee89c258'
            '4030bf705e8264839623491a41726d78643dc53129cfe2c9e2bae11d54e8c9e4'
            'de6686d0422e16d4c09e5af7bc8b56a0208562a7e57c6d434e8c50ec9b0e5b6d')

package() {
    install -Dm755 system.py "$pkgdir/usr/lib/bluerune/extensions/system-monitor/system"
    install -Dm644 -t "$pkgdir/usr/lib/systemd/user" bluerune-extension-system-monitor.service
    install -d "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants"
    ln -s ../bluerune-extension-system-monitor.service "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants/"
    install -Dm644 -t "$pkgdir/usr/share/metainfo" org.bluerune.Extension.SystemMonitor.metainfo.xml
    install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/apps" org.bluerune.Extension.SystemMonitor.svg
    install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE-MIT
}
