# Maintainer: Infrawrench LLC <astrid@infrawrench.com>
pkgname=schist-bin
pkgver=0.15.0
pkgrel=1
# Upstream's own package release, embedded in the asset name. It is
# packages.sh's "release=" and only moves when the packaging changes under
# a version that has already shipped; pkgrel above is this package's own.
# The asset templates in .omarchy/package.json carry the same number.
_relver=1
pkgdesc="Layered image editor with PSD and Affinity support (binary release)"
arch=(x86_64 aarch64)
url="https://github.com/Infrawrench/schist"
license=(MIT)
# The list the payload's own .PKGINFO carries: fontconfig/wayland/
# vulkan-icd-loader are dlopen'd, so namcap flags them "may not be needed"
# — they are.
depends=(fontconfig freetype2 hicolor-icon-theme libxcb libxkbcommon
         libxkbcommon-x11 vulkan-icd-loader wayland)
# A Vulkan ICD is needed to draw, but as a hard dependency makepkg -s would
# resolve it to nvidia-utils in the build container; Omarchy installs the right
# driver per machine. libheif is dlopen'd; everything else opens without it.
optdepends=('vulkan-driver: GPU rendering (any Vulkan ICD, vulkan-swrast in software)'
            'libheif: HEIC import')
provides=(schist)
conflicts=(schist)
# The released binary ships byte-exact: it is already stripped by the
# release workflow, and its build id is what Sentry symbolication matches.
options=(!strip !debug)
# The release asset is already a pacman-format payload, assembled by
# packaging/linux/packages.sh from the CI build — this just re-wraps its
# usr/ tree, so the dependency lists here have to stay in step with that
# script.
source_x86_64=("$url/releases/download/v$pkgver/schist-$pkgver-$_relver-x86_64.pkg.tar.zst")
source_aarch64=("$url/releases/download/v$pkgver/schist-$pkgver-$_relver-aarch64.pkg.tar.zst")
sha256sums_x86_64=('ef4501ecc8109e21d1813fdfc8d618090a9be5bb238545527614a1ff60d983c1')
sha256sums_aarch64=('11e12bd6bc0ee6fb6d27004809750c62a180d64c5eb274a2aac685fdabdeeff1')

package() {
  # makepkg has already extracted the payload into srcdir; its .PKGINFO
  # and .MTREE are upstream's and stay behind, only usr/ is packaged.
  cp -a "$srcdir/usr" "$pkgdir/"
  # The payload keeps the licence under the upstream pkgname.
  mv "$pkgdir/usr/share/licenses/schist" "$pkgdir/usr/share/licenses/$pkgname"
}
