shfmt-3.7.0.ebuild 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright 2023 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. LICENSE="BSD"
  16. SLOT="0"
  17. KEYWORDS="amd64"
  18. IUSE="+man"
  19. BDEPEND="
  20. man? ( app-text/scdoc )
  21. "
  22. S="${WORKDIR}/sh-${PV}"
  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. }