shfmt-3.7.0.ebuild 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright 2023-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit go-module
  5. DESCRIPTION="A shell parser, formatter, and interpreter with bash support"
  6. HOMEPAGE="
  7. https://pkg.go.dev/mvdan.cc/sh/v3
  8. https://github.com/mvdan/sh
  9. "
  10. SRC_URI="
  11. https://github.com/mvdan/sh/archive/v${PV}.tar.gz -> ${P}.tar.gz
  12. https://github.com/dm9pZCAq/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
  13. https://github.com/dm9pZCAq/gentoo-go-deps/releases/download/${P}/${P}-vendor.tar.xz
  14. "
  15. S="${WORKDIR}/sh-${PV}"
  16. LICENSE="BSD"
  17. SLOT="0"
  18. KEYWORDS="amd64"
  19. IUSE="+man"
  20. BDEPEND="
  21. man? ( app-text/scdoc )
  22. "
  23. src_compile() {
  24. CGO_ENABLED=0 ego build -ldflags="
  25. -X main.version=${PV}
  26. -w -s -extldflags '-static'
  27. " "./cmd/${PN}"
  28. use man && {
  29. local man_in="./cmd/${PN}/${PN}.1.scd"
  30. local man_out="./${PN}.1"
  31. ebegin "scdoc: '${man_in}' -> '${man_out}'"
  32. scdoc <"${man_in}" >"${man_out}"
  33. eend "${?}" 'failed to generate man page' || die "${_}"
  34. }
  35. }
  36. src_install() {
  37. dobin "${PN}"
  38. use man && doman "./${PN}.1"
  39. }