# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=openbao
pkgver=2.3.1
_pkgver=${pkgver/_/-}
pkgrel=0
pkgdesc="solution to manage, store, and distribute sensitive data including secrets, certificates, and keys"
url="https://openbao.org/"
arch="all"
license="MPL-2.0"
makedepends="go bash"
options="!check net" # many tests require docker
source="https://github.com/openbao/openbao/archive/v$_pkgver/openbao-$_pkgver.tar.gz
	make-bin-without-ui.patch
	build-do-not-assume-git-repo.patch
	build-do-not-install.patch
	"

# secfixes:
#   2.3.1-r0:
#     - CVE-2025-52894
#     - CVE-2025-52893
#   2.2.2-r0:
#     - CVE-2025-4166

prepare() {
	default_prepare

	echo "$_pkgver" >version/VERSION
}

build() {
	OPENBAO_VERSION=$pkgver CGO_ENABLED=1 make bin
}

check() {
	make test
}

package() {
	install -Dm0755 -t "$pkgdir/usr/bin/" bin/bao
}

sha512sums="
7bc1e141c416b80624b0ffe368436ec53c907bc8aa6b26f99717b78458322355283e7862393e9ec1d58854cc8d15144c46df72b11aa90f64d554c6c7283aeb79  openbao-2.3.1.tar.gz
367c1f063d66dfa1937d7363975bbb6b2f2fafc2f38ce4ba1a1ee0e153443dc99b4e9ad2a944083a186d34bbe494d2c522c92f44ba09ad63dc56b66e42686b02  make-bin-without-ui.patch
7805e6bf9d88cd2321832151ec1e985ecf5a1350176fd18ef1032398ffbf8ff2f0a73b9ba44e41b15e3e8bdc825679463c8ef04ae04f9096f459fcda6f44a11c  build-do-not-assume-git-repo.patch
4277f815de3b9d2e54489a10fec06416d8f2802c0cc702d4a81dae3ab41b23bd8387981536925765450077bffdb05a43f10e4516a89e28c9a2899d480a9fe8f9  build-do-not-install.patch
"
