You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. GIT_COMMIT=3967b7d28e
  5. EGO_PN="github.com/docker/cli"
  6. MY_PV=${PV/_/-}
  7. inherit bash-completion-r1 golang-vcs-snapshot
  8. DESCRIPTION="the command line binary for docker"
  9. HOMEPAGE="https://www.docker.com/"
  10. SRC_URI="https://github.com/docker/cli/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
  11. LICENSE="Apache-2.0"
  12. SLOT="0"
  13. KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
  14. IUSE="hardened"
  15. RDEPEND="!<app-emulation/docker-20.10.1"
  16. BDEPEND="
  17. >=dev-lang/go-1.16.6
  18. dev-go/go-md2man"
  19. RESTRICT="installsources strip"
  20. S="${WORKDIR}/${P}/src/${EGO_PN}"
  21. src_prepare() {
  22. default
  23. sed -i 's@dockerd\?\.exe@@g' contrib/completion/bash/docker || die
  24. }
  25. src_compile() {
  26. export DISABLE_WARN_OUTSIDE_CONTAINER=1
  27. export GOPATH="${WORKDIR}/${P}"
  28. # setup CFLAGS and LDFLAGS for separate build target
  29. # see https://github.com/tianon/docker-overlay/pull/10
  30. export CGO_CFLAGS="-I${ESYSROOT}/usr/include"
  31. export CGO_LDFLAGS="-L${ESYSROOT}/usr/$(get_libdir)"
  32. emake \
  33. LDFLAGS="$(usex hardened '-extldflags -fno-PIC' '')" \
  34. VERSION="${PV}" \
  35. GITCOMMIT="${GIT_COMMIT}" \
  36. dynbinary
  37. # build man pages
  38. # see "cli/scripts/docs/generate-man.sh" (which also does "go get" for go-md2man)
  39. mkdir -p ./man/man1 || die "mkdir failed"
  40. go build -o "${T}"/gen-manpages ./man ||
  41. die 'build gen-manpages failed'
  42. "${T}"/gen-manpages --root "$(pwd)" --target "$(pwd)"/man/man1 ||
  43. die 'gen-manpages failed'
  44. ./man/md2man-all.sh -q ||
  45. die 'md2man-all.sh failed'
  46. }
  47. src_install() {
  48. dobin build/docker
  49. doman man/man*/*
  50. dobashcomp contrib/completion/bash/*
  51. bashcomp_alias docker dockerd
  52. insinto /usr/share/fish/vendor_completions.d/
  53. doins contrib/completion/fish/docker.fish
  54. insinto /usr/share/zsh/site-functions
  55. doins contrib/completion/zsh/_*
  56. }