summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b5cb3edfc649bf53689072987309dcc4c1eebd5b (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
57
58
59
60
# Maintainer: Damjan Georgievski <gdamjan@gmail.com>
# Contributor: George Rawlinson <grawlinson@archlinux.org>

pkgname=firecracker-git
pkgver=1.2.0.r27.g4713a634
pkgrel=1
epoch=2
pkgdesc="Secure and fast microVMs for serverless computing"
arch=('x86_64')
license=('Apache:2.0')
url="https://firecracker-microvm.github.io"
provides=("firecracker")
conflicts=("firecracker")
makedepends=('git' 'rust' 'rust-musl' 'kernel-headers-musl' 'clang')
options=('!lto')
source=("$pkgname::git+https://github.com/firecracker-microvm/firecracker.git")
b2sums=('SKIP')

_cargo_target="$CARCH-unknown-linux-musl"

pkgver() {
  cd "$pkgname"
  git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "$pkgname"

  # download dependencies
  cargo fetch --target="$_cargo_target"
}

build() {
  cd "$pkgname"

  cargo build \
    --package firecracker \
    --package jailer \
    --package seccompiler \
    --release \
    --all-features \
    --target-dir=target \
    --target="$_cargo_target"
}

check() {
  cd "$pkgname"

  cargo test -p firecracker --frozen
}

package() {
  install -m644 -D "$pkgname"/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  install -m644 -D "$pkgname"/README.md "$pkgdir"/usr/share/licenses/$pkgname/README.md
  find "$pkgname/target/$_cargo_target/release" \
    -maxdepth 1 \
    -executable \
    -type f \
    -exec install -vDm0755 -t "$pkgdir/usr/bin/" {} +
}