-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPKGBUILD
61 lines (53 loc) · 2.63 KB
/
PKGBUILD
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
60
61
# Maintainer: Kubescape Maintainers <cncf hyphen kubescape hyphen maintainers at lists dot cncf dot io>
pkgname=kubescape
pkgver=3.0.1
_git2gover=33.0.9
_libgit2ver=1.3.0
pkgrel=2
epoch=0
pkgdesc="An open-source Kubernetes security platform for your IDE, CI/CD pipelines, and clusters."
arch=('x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64' 'i686' 'pentium4')
url="https://github.com/kubescape/kubescape"
license=('Apache-2.0')
makedepends=('go>=2:1.20.0' 'pkg-config' 'cmake' 'make')
provides=('kubescape')
conflicts=('kubescape-bin')
source=("https://github.com/${pkgname}/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
"https://github.com/libgit2/git2go/archive/v${_git2gover}/git2go-${_git2gover}.tar.gz"
"https://github.com/libgit2/libgit2/archive/v${_libgit2ver}/libgit2-${_libgit2ver}.tar.gz")
sha512sums=('234e38f6b6438638ffbe59e772f2091dc07412300f42a95014ea07877ffb84fb3debbc24791fa99f36921eba27b429402a7b00accea1aa08b824827d9603b103'
'07d13cfd11396d2c36bc69ef4177e4962596bf92da3604f035a85940f98ae0d3614718b88fc0631c4c7007841a51deebd7da8c570c1c637d9fb5905995837519'
'842a648a67ff23ba9e6bf14b706ba9081164866e14000ebf3858442b7046925f05e1dbf00a7d740dc4bf32280e260730e23a9492e817094aa90736ae335ee76e')
prepare() {
cd "${pkgname}-${pkgver}"
rm -rf git2go && mv ../git2go-${_git2gover} git2go
rm -rf git2go/vendor/libgit2 && mv ../libgit2-${_libgit2ver} git2go/vendor/libgit2
}
build() {
export CGO_ENABLED=1
export GOCACHE=${PWD}/cache
cd ${pkgname}-${pkgver}/git2go; make install-static; cd ..
go build -buildmode=pie -buildvcs=false -ldflags="-s -w -X github.com/${pkgname}/${pkgname}/v3/core/cautils.BuildNumber=v${pkgver}" -tags=static,gitenabled -o ${pkgname}
}
check() {
# check that binary includes pkgver and git enabled
if [ "$(./${pkgname}-${pkgver}/${pkgname} version)" != "Your current version is: v${pkgver}" ]; then
exit 1
fi
}
package() {
cd "${pkgname}-${pkgver}"
# Bash autocomplete file
./${pkgname} completion bash > ${pkgname}-autocomplete.sh
install -Dm644 ${pkgname}-autocomplete.sh ${pkgdir}/usr/share/bash-completion/completions/${pkgname}
# Zsh autocomplete file
./${pkgname} completion zsh > ${pkgname}-autocomplete.sh
install -Dm644 ${pkgname}-autocomplete.sh ${pkgdir}/usr/share/zsh/vendor-completions/_${pkgname}
# Fish autocomplete file
./${pkgname} completion fish > ${pkgname}-autocomplete.sh
install -Dm644 ${pkgname}-autocomplete.sh ${pkgdir}/usr/share/fish/vendor_completions.d/${pkgname}.fish
install -Dm755 ${pkgname} ${pkgdir}/usr/bin/${pkgname}
# docs
install -Dm644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
cp -a docs -t "${pkgdir}/usr/share/doc/${pkgname}"
}