# Maintainer: ElectroModder <support@electromodder.co.uk>

pkgname=emspy-bin
pkgver=2.1.0
pkgrel=1
pkgdesc="Live controller input display and utilities for ElectroModder adapters"
arch=('x86_64')
url="https://electromodder.co.uk/emspy"
license=('LicenseRef-proprietary')
depends=('glibc' 'zlib' 'sdl2-compat' 'sdl2_ttf' 'sdl2_image')
provides=('emspy')
conflicts=('emspy')

# !strip is REQUIRED - the payload is a pre-compiled binary plus bundled
# libraries; letting makepkg strip them risks breaking the app for no gain.
options=('!strip' '!debug' '!emptydirs')

_deb="emspy_${pkgver}_amd64.deb"

source=("https://electromodder.co.uk/assets/files/apps/$_deb")
sha256sums=('17b14230f4d87960e82fe5202ea22bfce275f2cebe12b4666c6123aab934f938')
noextract=("$_deb")

package() {
    # A .deb is an ar archive containing data.tar.zst; unpack both stages.
    bsdtar -xf "$srcdir/$_deb" -C "$srcdir"
    bsdtar -xf "$srcdir"/data.tar.* -C "$pkgdir"

    # Everything else is already at freedesktop-standard paths and needs no
    # rearranging. Arch additionally expects the licence here.
    install -Dm644 "$pkgdir/usr/share/doc/emspy/copyright" \
                   "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
