summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0786ad9f5a08c3f475a348639dd46f00e9a70c55 (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: Sophie Tauchert <sophie at 999eagle dot moe>
# Contributor: Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=clair
pkgver=4.4.4
pkgrel=1
pkgdesc="Vulnerability Static Analysis for Containers"
arch=('x86_64')
url='https://github.com/quay/clair'
license=('Apache')
depends=('glibc')
makedepends=('go')
optdepends=('postgresql: local database')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/quay/clair/archive/v${pkgver}.tar.gz")
sha256sums=('7895442b6c5fb016513b859c4372826008d908ef85d2f506eaf1da301f9f13bc')
install='clair.install'

prepare() {
	cd "${pkgname}-${pkgver}"
	mkdir -p build/
}

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 -mod=readonly -modcacherw"
	go build \
		-ldflags "-linkmode=external -X main.Version=${pkgver}" \
		-o build/ \
		./cmd/...
}

package() {
	cd "${pkgname}-${pkgver}"
	install -Dm755 build/clair "${pkgdir}/usr/bin/clair"
	install -Dm755 build/clairctl "${pkgdir}/usr/bin/clairctl"
	install -Dm755 config.yaml.sample "${pkgdir}/etc/clair/config.yaml"
	go clean -modcache # clean modcache
}