# Maintainer: Burrow Release Automation <packages@burrow.net>

pkgname=burrow-git
pkgver=0.1.r0.g0000000
pkgrel=1
pkgdesc="Burrow VPN daemon and CLI"
arch=("x86_64" "aarch64")
url="https://git.burrow.net/hackclub/burrow"
license=("GPL-3.0-or-later")
depends=("openssl" "sqlite" "systemd")
makedepends=("cargo" "git" "protobuf")
provides=("burrow")
conflicts=("burrow")
source=("git+https://git.burrow.net/hackclub/burrow.git")
sha256sums=("SKIP")
install="burrow.install"

pkgver() {
  cd burrow
  printf "0.1.r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd burrow
  cargo build --locked --release -p burrow --bin burrow
}

package() {
  cd burrow
  install -Dm755 target/release/burrow "${pkgdir}/usr/bin/burrow"
  install -Dm644 systemd/burrow.service "${pkgdir}/usr/lib/systemd/system/burrow.service"
  install -Dm644 systemd/burrow.socket "${pkgdir}/usr/lib/systemd/system/burrow.socket"
  install -Dm644 README.md "${pkgdir}/usr/share/doc/burrow/README.md"
  install -Dm644 LICENSE.md "${pkgdir}/usr/share/licenses/burrow/LICENSE.md"
}
