# Maintainer: Coelacanthus <uwu@coelacanthus.name>
# Contributor: huggy <arch@huggy.moe>
# Contributor: Nick Cao <nickcao@nichi.co>

pkgname=ranet
pkgver=0.13.0
pkgrel=2
pkgdesc="ranet, acronym for redundant array of networks, forms full mesh IPSec VPN"
arch=('x86_64' 'aarch64')
url="https://github.com/NickCao/ranet"
license=('MIT')
depends=(
  gcc-libs
  glibc
  openssl
)
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://github.com/NickCao/ranet/archive/refs/tags/v${pkgver}.tar.gz")
b2sums=('9acefb3a34c57baa0b1d67154f354b004dad239e7dc4127e00d05549cfaf322e171eab39959bdd4497cdac66f89b219ed1be91ce170fa36ba1bad23f7d3d0e76')

prepare() {
  cd "$pkgname-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "$pkgname-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm0755 -t "$pkgdir/usr/bin/" target/release/"$pkgname"
  install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}

# vim :set ts=2 sw=2 et:
