1 # Maintainer: Justin Kromlinger <hashworks@archlinux.org>
2 # Contributor: Hao Long <imlonghao@archlinuxcn.org>
7 pkgdesc='A Simple and Comprehensive Vulnerability Scanner for Containers, Suitable for CI'
9 url='https://github.com/aquasecurity/trivy'
12 optdepends=('rpm: RHEL/CentOS based image support')
13 makedepends=('go' 'btrfs-progs')
16 source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
17 b2sums=('48e8cc03137d653ff434f2b29baf01b8a862df9ae59ce14eed958ff8b5e56c726d74d38faa539cb6c16855b4cae9f76c4010397fae3d967bf5aad954db0181f7')
20 cd ${pkgname}-${pkgver}
22 find docs -type f -name "*.md" \
23 -exec sed "s|\(../\)*imgs/\(.*\.[a-z]\{3\}\)|${url}/raw/main/docs/imgs/\2|g" -i {} \;
25 rm -Rf docs/{build,imgs}
29 cd ${pkgname}-${pkgver}/cmd/trivy
31 export CGO_CPPFLAGS="${CPPFLAGS}"
32 export CGO_CFLAGS="${CFLAGS}"
33 export CGO_CXXFLAGS="${CXXFLAGS}"
34 export CGO_LDFLAGS="${LDFLAGS}"
35 export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
36 go build -ldflags "-linkmode=external -s -w -X=main.version=${pkgver}" .
40 cd ${pkgname}-${pkgver}
42 install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
43 install -Dm755 "cmd/trivy/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
45 mkdir -p "${pkgdir}/usr/share/doc"
46 cp -r docs "${pkgdir}/usr/share/doc/${pkgname}"