# Built and published by CI (.gitea/workflows/release.yml, build-arch job) —
# not published to AUR, just a real .pkg.tar.zst uploaded to the Gitea
# release alongside the .deb/AppImage/exe. CI sed-patches pkgver below to the
# release version before building.
#
# Repackages the .deb the same CI already builds (build-linux) rather than
# recompiling from source: the web client needs the private @lotusguild/*
# npm registry, and build-linux already produced a working Linux binary —
# no reason to build it twice.
pkgname=lotus-chat
pkgver=0.0.0
pkgrel=1
pkgdesc="Matrix chat client for Lotus Guild (desktop app)"
arch=('x86_64')
url="https://chat.lotusguild.org"
license=('AGPL-3.0-only')
depends=(
  'webkit2gtk-4.1'
  'gtk3'
  'libayatana-appindicator'
  # WebRTC calling: WebKitGTK's media pipeline is backed by GStreamer, and
  # these are the plugin sets that actually carry audio/video codecs.
  'gst-plugins-good'
  'gst-plugins-bad'
  'gst-plugins-ugly'
  'gst-libav'
)
provides=('lotus-chat')
conflicts=('lotus-chat')
options=('!strip')
source=("LotusChat-x86_64.deb::https://code.lotusguild.org/LotusGuild/cinny-desktop/releases/download/latest/LotusChat-x86_64.deb")
sha256sums=('SKIP')

package() {
  bsdtar -O -xf "$srcdir/LotusChat-x86_64.deb" data.tar.zst 2>/dev/null \
    || bsdtar -O -xf "$srcdir/LotusChat-x86_64.deb" data.tar.xz 2>/dev/null \
    || bsdtar -O -xf "$srcdir/LotusChat-x86_64.deb" data.tar.gz \
    | bsdtar -C "$pkgdir" -xf -
}
