summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 48de3fce776c7be821d51f9769ce43585c00221f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=cloud-hypervisor-git
pkgver=31.0.r1.g90dcbc323
pkgrel=1
pkgdesc="An open source Virtual Machine Monitor (VMM) that runs on top of KVM"
arch=('x86_64')
url="https://github.com/cloud-hypervisor/cloud-hypervisor"
license=('Apache' 'BSD')
depends=('gcc-libs')
makedepends=('git' 'rust')
provides=("cloud-hypervisor=$pkgver")
conflicts=('cloud-hypervisor')
source=("git+https://github.com/cloud-hypervisor/cloud-hypervisor.git")
sha256sums=('SKIP')


prepare() {
  cd "cloud-hypervisor"

  if [ ! -f "Cargo.lock" ]; then
    cargo update
  fi
  cargo fetch
}

pkgver() {
  cd "cloud-hypervisor"

  _tag=$(git tag -l --sort -v:refname | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/^v//'
}

check() {
  cd "cloud-hypervisor"

  #cargo test \
  #  --frozen
}

package() {
  cd "cloud-hypervisor"

  cargo install \
    --locked \
    --no-track \
    --root "$pkgdir/usr" \
    --path .

  install -Dm644 "README.md" -t "$pkgdir/usr/share/doc/cloud-hypervisor"
  install -Dm644 "docs"/* -t "$pkgdir/usr/share/doc/cloud-hypervisor"
  install -Dm644 "LICENSE-BSD-3-Clause" -t "$pkgdir/usr/share/licenses/cloud-hypervisor"
}