aports/testing/bomctl/APKBUILD
2025-04-11 19:40:50 +02:00

58 lines
2 KiB
Text

# Maintainer: Ian Dunbar-Hall <ian.dunbarhall@gmail.com>
pkgname=bomctl
pkgver=0.1.9
pkgrel=5
pkgdesc="Format agnostic SBOM tooling"
url="https://github.com/bomctl/bomctl"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="$pkgname-$pkgver.tar.gz::https://github.com/bomctl/bomctl/archive/refs/tags/v$pkgver.tar.gz
gomod-update.patch"
options="chmod-clean net"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
build() {
export major_minor_patch=$(echo $pkgver | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | head -n 1)
export major=$(echo $major_minor_patch | cut -d'.' -f1)
export minor=$(echo $major_minor_patch | cut -d'.' -f2)
export patch=$(echo $major_minor_patch | cut -d'.' -f3)
mkdir build
go build -o build/ \
-trimpath \
-ldflags="-s -w
-X=github.com/bomctl/bomctl/cmd.VersionMajor=$major
-X=github.com/bomctl/bomctl/cmd.VersionMinor=$minor
-X=github.com/bomctl/bomctl/cmd.VersionPatch=$patch
-X=github.com/bomctl/bomctl/cmd.BuildDate=alpine"
for i in bash fish zsh; do
"$builddir"/build/bomctl completion $i > "$builddir"/bomctl.$i
done
}
check() {
"$builddir"/build/bomctl --version
}
package() {
install -Dm755 "$builddir"/build/bomctl "$pkgdir"/usr/bin/bomctl
install -Dm644 "$builddir"/bomctl.bash "$pkgdir"/usr/share/bash-completion/completions/bomctl
install -Dm644 "$builddir"/bomctl.fish "$pkgdir"/usr/share/fish/vendor_completions.d/bomctl.fish
install -Dm644 "$builddir"/bomctl.zsh "$pkgdir"/usr/share/zsh/site-functions/_bomctl
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
sha512sums="
7870d422869c494303bbcb6f1a930945e2abdd07e38222201d0e0484729edcc4f291e65264e6ee8d94b57a10e0b8c721a8100bd669e4fff9721042033d3518b9 bomctl-0.1.9.tar.gz
589c02b543c8ecd2ad14016a7d636014d838153e0941f3c7648510613b7435608909899af086e689dc8d543e968ea44be0e82ddf656108a4f46c73128e967ef0 gomod-update.patch
"