# Template file for 'docker-cli'
# should be kept in sync with moby
pkgname=docker-cli
version=29.7.2
revision=1
build_style=go
go_package="github.com/docker/cli/cmd/docker"
go_import_path="github.com/docker/cli"
_cli_ver_path="github.com/docker/cli/cli/version"
go_ldflags="-X \"${_cli_ver_path}.Version=${version}\"
 -X \"${_cli_ver_path}.GitCommit=tag v${version}\""
hostmakedepends="pkg-config go-md2man"
depends="git"
short_desc="Command-line interface for the Docker daemon"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="Apache-2.0"
homepage="https://www.docker.com"
distfiles="https://github.com/docker/cli/archive/v${version}.tar.gz"
checksum=225b7ab2a15f5230b482df8461069cd4bce38891266fb9898d4188d0a3cbf54a
system_groups="docker"
# tests seem designed to run in docker
make_check=no

pre_build() {
	go_ldflags+=" -X \"${_cli_ver_path}.BuildTime=$(date +%Y-%m-%dT%H:%M:%SZ)\""
}

post_build() {
	GOARCH= GOARM= GOOS= CGO_ENABLED=0 DISABLE_WARN_OUTSIDE_CONTAINER=1 make manpages
}

post_install() {
	vcompletion contrib/completion/fish/docker.fish fish docker
	vcompletion contrib/completion/zsh/_docker zsh docker
	vcompletion contrib/completion/bash/docker bash docker

	for f in man/man1/*.1 man/man5/*.5; do
		vman "$f"
	done
}

docker_package() {
	metapackage=yes
	short_desc="Docker container runtime"
	depends="${sourcepkg}>=${version}_${revision} moby tini"
}
