summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 36ac7365ac51981b6beb68c1303a8983d99e9b3c (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
56
# Maintainer: Izu <ccatdev@proton.me>
# Contributor: David Runge <dvzrv@archlinux.org>

pkgname=virtiofsd-git
_pkgname="${pkgname%-git}"
pkgver=1.13.3.r15.g4786298
pkgrel=2
pkgdesc="Vhost-user virtio-fs device backend written in Rust"
arch=(x86_64)
url="https://gitlab.com/virtio-fs/virtiofsd"
license=(
  Apache-2.0
  BSD-3-Clause
)
depends=(
  gcc-libs
  glibc
  libcap-ng
  libseccomp
)
makedepends=(cargo git)
provides=('virtiofsd')
conflicts=('virtiofsd')
source=("git+${url}.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd $_pkgname
  # use /usr/lib instead of /usr/libexec: https://gitlab.com/virtio-fs/virtiofsd/-/issues/86
  sed 's/libexec/lib/' -i 50-$_pkgname.json

  cargo fetch --locked --target "$(rustc --print host-tuple)"
}

build() {
  cd $_pkgname
  cargo build --frozen --release
}

check() {
  cd $_pkgname
  cargo test --frozen
}

package() {
  cd $_pkgname
  install -vDm 755 target/release/$_pkgname -t "$pkgdir/usr/lib/"
  install -vDm 644 50-$_pkgname.json -t "$pkgdir/usr/share/qemu/vhost-user/"
  install -vDm 644 LICENSE* -t "$pkgdir/usr/share/licenses/$_pkgname/"
  install -vDm 644 README.md doc/*.md -t "$pkgdir/usr/share/doc/$_pkgname/"
}