huxdemp-0.1.0.ebuild 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright 2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit toolchain-funcs
  5. MY_PN=hxd
  6. DESCRIPTION="A better hexdump"
  7. HOMEPAGE="https://github.com/lptstr/hxd"
  8. SRC_URI="
  9. ${HOMEPAGE}/archive/${PV}.tar.gz
  10. -> ${P}.tar.gz
  11. "
  12. LICENSE="GPL-3 MIT"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~arm ~arm64 ~x86"
  15. IUSE="+doc"
  16. DEPEND="!dev-util/hxd"
  17. BDEPEND="doc? ( app-text/scdoc )"
  18. S="${WORKDIR}/${MY_PN}-${PV}"
  19. src_prepare() {
  20. local doc=()
  21. use doc || doc=(
  22. -e '/^install:/s/[^ ]\+\.[0-9]//'
  23. -e '/^\s\+install.*\.[0-9]$/d'
  24. )
  25. sed -i Makefile \
  26. "${doc[@]}" \
  27. -e '/^CC/d' \
  28. -e '/^CMD/d' \
  29. -e '/^PKGNAME/d' \
  30. -e '/^\(C\|LD\)FLAGS/s/=/+&/' \
  31. -e '/^LDFLAGS/s/-fuse-ld=[^ ]\+//' \
  32. -e '/^release:/{
  33. /O_CFLAGS/s/-O[0-9]\+//;
  34. /O_LDFLAGS/s/=.*/= $(LDFLAGS)/;
  35. }' \
  36. || die 'sed failed'
  37. default
  38. tc-export CC
  39. }
  40. src_compile() {
  41. local doc=()
  42. use doc && doc=( "${MY_PN}.1" )
  43. emake release "${doc[@]}"
  44. }
  45. src_install() {
  46. emake DESTDIR="${ED}" PREFIX=/usr install
  47. }