dev-libs/libcec: x86 stable wrt bug #721708
[gentoo.git] / dev-libs / libcec / libcec-4.0.4-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python{3_6,3_7,3_8} )
7 MY_PV=${PV/_p/-}
8 MY_P=${PN}-${MY_PV}
9
10 inherit cmake-utils linux-info python-single-r1 toolchain-funcs
11
12 DESCRIPTION="Library for communicating with the Pulse-Eight USB HDMI-CEC Adaptor"
13 HOMEPAGE="http://libcec.pulse-eight.com"
14 SRC_URI="https://github.com/Pulse-Eight/${PN}/archive/${MY_P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="amd64 ~arm x86"
19 IUSE="cubox exynos python raspberry-pi +xrandr"
20 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
21
22 RDEPEND="virtual/udev
23         >=dev-libs/libplatform-2.0.0
24         sys-libs/ncurses:=
25         raspberry-pi? ( >=media-libs/raspberrypi-userland-0_pre20160305-r1 )
26         xrandr? ( x11-libs/libXrandr )
27         python? ( ${PYTHON_DEPS} )"
28 DEPEND="${RDEPEND}
29         python? ( dev-lang/swig )
30         virtual/pkgconfig"
31
32 CONFIG_CHECK="~USB_ACM"
33
34 S="${WORKDIR}/${PN}-${MY_P}"
35
36 pkg_pretend() {
37         linux-info_pkg_setup
38 }
39
40 pkg_setup() {
41         linux-info_pkg_setup
42         use python && python-single-r1_pkg_setup
43 }
44
45 src_prepare() {
46         cmake-utils_src_prepare
47
48         # Do not hardcode the python libpath #577612
49         sed -i \
50                 -e '/DESTINATION/s:lib/python${PYTHON_VERSION}/dist-packages:${PYTHON_SITEDIR}:' \
51                 src/libcec/cmake/CheckPlatformSupport.cmake || die
52
53         use python || cmake_comment_add_subdirectory "src/pyCecClient"
54 }
55
56 src_configure() {
57         local mycmakeargs=(
58                 -DSKIP_PYTHON_WRAPPER=$(usex !python)
59                 -DHAVE_EXYNOS_API=$(usex exynos)
60                 -DHAVE_TDA995X_API=$(usex cubox)
61                 -DHAVE_RPI_API=$(usex raspberry-pi)
62         )
63
64         # raspberrypi-userland itself does not provide .pc file so using
65         # bcm_host.pc instead
66         use raspberry-pi && mycmakeargs+=(
67                 -DRPI_INCLUDE_DIR=$( $(tc-getPKG_CONFIG) --variable=includedir bcm_host) \
68                 -DRPI_LIB_DIR=$( $(tc-getPKG_CONFIG) --variable=libdir bcm_host)
69         )
70
71         cmake-utils_src_configure
72 }
73
74 pkg_postinst() {
75         elog "You will need to ensure the user running your CEC client has"
76         elog "read/write access to the device. You can ensure this by adding"
77         elog "them to the uucp group"
78 }