summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0db82155e822510e3767cf41cb61a1299f38dfd7 (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
# Maintainer: samarthj <dev@samarthj.com>

pkgname=conmon-git
_pkgname=conmon
pkgver=2.0.30_dev.r387.g018c40e
pkgrel=1
pkgdesc="OCI container runtime monitor (git)"
arch=('any')
depends=(glib2 systemd-libs)
makedepends=(go go-md2man git)
provides=("$_pkgname")
conflicts=("$_pkgname")
url="https://github.com/containers/$_pkgname.git"
license=(Apache)
options=('emptydirs')
source=("git+$url")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname" || exit 1
  commit=$(printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)")
  ver=$(cat VERSION)
  echo "${ver//-/_}.${commit}"
}

build() {
  export BUILDTAGS='seccomp apparmor'
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath"

  cd $_pkgname || exit 1
  make EXTRA_LDFLAGS='-s -w -linkmode=external'
}

package() {
  cd $_pkgname || exit 1
  make install PREFIX="$pkgdir"/usr
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}