# Arch Linux package of Firemold, built on OBS. .obs/prepare.sh writes the version of the tag and
# the checksum of the tarball here. The helper goes to /usr/libexec: the polkit policy names that path.
# Maintainer: liloman <148582-liloman@users.noreply.gitlab.com>

pkgname=firemold
pkgver=0.0.0
pkgrel=1
pkgdesc="Graphical wizard to create firejail profiles"
arch=('any')
license=('MIT')
depends=('firejail' 'bubblewrap' 'python' 'python-gobject' 'gtk4' 'libadwaita' 'gtksourceview5' 'polkit')
optdepends=('systemd: seccomp diagnosis when testing a profile'
            'strace: detailed log in the Sandbox tab')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=("$pkgname-$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
    cd "$pkgname-$pkgver"
    python -m build --wheel --no-isolation
}

package() {
    cd "$pkgname-$pkgver"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm755 helper/firemold-helper "$pkgdir/usr/libexec/firemold-helper"
    install -Dm644 data/org.firemold.helper.policy "$pkgdir/usr/share/polkit-1/actions/org.firemold.helper.policy"
    install -Dm644 data/io.gitlab.firemold.Firemold.desktop "$pkgdir/usr/share/applications/io.gitlab.firemold.Firemold.desktop"
    install -Dm644 firemold/data/icons/io.gitlab.firemold.Firemold.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/io.gitlab.firemold.Firemold.svg"
    install -Dm644 data/firemold.1 "$pkgdir/usr/share/man/man1/firemold.1"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
