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.

68 lines
1.4 KiB

  1. # Copyright 2020-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. CMAKE_MAKEFILE_GENERATOR="emake"
  5. PYTHON_COMPAT=( python3_{8..9} )
  6. inherit python-any-r1 cmake
  7. DESCRIPTION="CBOR protocol implementation for C and others"
  8. HOMEPAGE="https://github.com/pjk/libcbor"
  9. SRC_URI="https://github.com/PJK/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
  10. LICENSE="MIT"
  11. SLOT="0/$(ver_cut 1-2)"
  12. KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ppc ppc64 ~riscv ~s390 sparc x86"
  13. IUSE="+custom-alloc doc test"
  14. BDEPEND="
  15. doc? (
  16. $(python_gen_any_dep '
  17. dev-python/sphinx[${PYTHON_USEDEP}]
  18. dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
  19. dev-python/breathe[${PYTHON_USEDEP}]
  20. ')
  21. )
  22. test? ( dev-util/cmocka )
  23. "
  24. RESTRICT="!test? ( test )"
  25. python_check_deps() {
  26. has_version "dev-python/sphinx[${PYTHON_USEDEP}]" && \
  27. has_version "dev-python/breathe[${PYTHON_USEDEP}]"
  28. }
  29. pkg_setup() {
  30. use doc && python-any-r1_pkg_setup
  31. }
  32. src_configure() {
  33. local -a mycmakeargs=(
  34. -DCMAKE_BUILD_TYPE=Release
  35. -DCBOR_CUSTOM_ALLOC=$(usex custom-alloc 'ON' 'OFF')
  36. -DWITH_TESTS=$(usex test 'ON' 'OFF')
  37. )
  38. cmake_src_configure
  39. }
  40. src_compile() {
  41. cmake_src_compile
  42. if use doc; then
  43. pushd doc >/dev/null || die
  44. emake html man
  45. popd >/dev/null || die
  46. fi
  47. }
  48. src_install() {
  49. cmake_src_install
  50. if use doc; then
  51. dodoc -r doc/build/html
  52. doman doc/build/man/*
  53. fi
  54. }