huxdemp-1.0.0.ebuild 1.1 KB

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