# Maintainer: Breadway <rileyhorsham@gmail.com>

pkgname=bos-settings
pkgver=0.1.0
pkgrel=1
pkgdesc="System settings app for Bread OS"
arch=('x86_64')
url="https://github.com/Breadway/bos"
license=('MIT')
# Some Rust deps (ring/mlua) build vendored C/asm into static archives; makepkg's
# default -flto=auto emits GCC LTO bitcode the Rust (lld) link cannot read,
# causing undefined-symbol errors. Disable LTO.
options=(!lto !debug)
depends=('gtk4' 'glib2' 'hicolor-icon-theme')
optdepends=(
  'snapper: snapshot management view'
)
makedepends=('rust' 'cargo')
source=("${pkgname}-${pkgver}.tar.gz")
sha256sums=('SKIP')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cargo build --release --locked -p bos-settings
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cargo test --release --locked -p bos-settings
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  install -Dm755 target/release/bos-settings "${pkgdir}/usr/bin/bos-settings"
  install -Dm644 packaging/arch/bos-settings.desktop \
    "${pkgdir}/usr/share/applications/bos-settings.desktop"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
