summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8175275e55a8ec58c76a35fdce663e3be896d6b5 (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
# Maintainer: brokenpip3 <brokenpip3[at]gmail[dot]com>
# https://github.com/brokenpip3/my-pkgbuilds

pkgname=driverkit
pkgver=0.20.5
pkgrel=2
pkgdesc="Kit for building Falco drivers: kernel modules or eBPF probes"
arch=('any')
url="https://github.com/falcosecurity/driverkit"
license=('APACHE')
makedepends=('go' 'git')
# Git tag source since the upstream makefile use git info to build
source=("$pkgname-$pkgver::git+$url#tag=v$pkgver")
sha256sums=('daba9a0aa54ad929b1921c67f56c986cfb6cb0d26397a7b1f02ccb3802bd320a')

build() {
  cd "$pkgname-$pkgver"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  make build
}

check() {
  cd "$pkgname-$pkgver"
  go test -v -cover ./...
  go test -v -cover -buildmode=pie ./cmd
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm755 _output/bin/driverkit "${pkgdir}/usr/bin/driverkit"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  "$pkgdir/usr/bin/driverkit" completion bash | install -Dm644 /dev/stdin "$pkgdir/usr/share/bash-completion/completions/driverkit"
  "$pkgdir/usr/bin/driverkit" completion zsh | install -Dm644 /dev/stdin "$pkgdir/usr/share/zsh/site-functions/_driverkit"
  "$pkgdir/usr/bin/driverkit" completion fish | install -Dm644 /dev/stdin "$pkgdir/usr/share/fish/vendor_completions.d/driverkit.fish"
}