summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1ba9bb7cfe41c8a5bae9526cfc582bc727d9328d (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
# Maintainer: unknowndev (unknowndevQwQ at pm dot me)

_pkgname='youki'
pkgname="${_pkgname}-git"
pkgver=0.2.0.r81.g646c1034
pkgrel=1
pkgdesc="A container runtime written in rust"
arch=('x86_64')
url='https://github.com/containers/youki'
license=('Apache')
sha512sums=('SKIP')
source=("git+${url}")
provides=("${_pkgname}")
depends=('dbus' 'gcc-libs' 'libseccomp')
makedepends=('git' 'dbus-glib' 'libelf' 'pkg-config' 'rust' 'systemd')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  # cutting off 'v' prefix that presents in the git tag
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${srcdir}/${_pkgname}"

  # download dependencies
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd "${srcdir}/${_pkgname}"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  cargo build --frozen --release --bin youki

  # generate shell completions
  for shell in bash fish zsh; do
    target/release/youki completion --shell "${shell}" > "target/${shell}-completion"
  done

}

check() {
  cd "${srcdir}/${_pkgname}"
  cargo test --frozen --release
}

package() {
  cd "${srcdir}/${_pkgname}"

  install -vDm0755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
  install -vDm0644 "LICENSE"     "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"

  # shell completions
  install -vDm644 "target/bash-completion" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
  install -vDm644 "target/fish-completion" "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish"
  install -vDm644 "target/zsh-completion" "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
}