# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=cloud-hypervisor
pkgver=17.0
pkgrel=1
pkgdesc="A Virtual Machine Monitor for modern cloud workloads"
url="https://github.com/cloud-hypervisor/cloud-hypervisor"
arch=('x86_64')
license=('Apache')
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
b2sums=('6ed3dfffd888d8380d2469e085f0974d93f020df8679e06c530bd7a56c5b262785ea7d33e7c62218353f0f2544222ae0b10bfe1f940250d44bd714eab0fde481')

prepare() {
  cd "$pkgname-$pkgver"
  # fetch all dependencies
  cargo fetch --locked
}

build() {
  cd "$pkgname-$pkgver"
  # FTBFS: --all-features due to hypervisor not compiling
  #RUSTUP_TOOLCHAIN=stable cargo build --release --locked --all-features --target-dir=target
  cargo build --release --offline
}

package() {
   find "$pkgname-$pkgver/target/release" \
     -maxdepth 1 \
     -executable \
     -type f \
     -exec install -vDm755 -t "$pkgdir/usr/bin" "{}" \+
}