b2fd8566d7f3f48fcdd3ba85c6b241c3cde67dae
[gentoo.git] / dev-embedded / libftdi / libftdi-1.2-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python3_6 )
7 inherit cmake-utils python-single-r1
8
9 MY_P="${PN}1-${PV}"
10 if [[ ${PV} == 9999* ]] ; then
11         inherit git-r3
12         EGIT_REPO_URI="git://developer.intra2net.com/${PN}"
13 else
14         SRC_URI="http://www.intra2net.com/en/developer/${PN}/download/${MY_P}.tar.bz2"
15         KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 sparc x86"
16 fi
17
18 DESCRIPTION="Userspace access to FTDI USB interface chips"
19 HOMEPAGE="http://www.intra2net.com/en/developer/libftdi/"
20
21 LICENSE="LGPL-2"
22 SLOT="1"
23 IUSE="cxx doc examples python static-libs test tools"
24 RESTRICT="!test? ( test )"
25 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26
27 RDEPEND="virtual/libusb:1
28         cxx? ( dev-libs/boost )
29         python? ( ${PYTHON_DEPS} )
30         tools? (
31                 !<dev-embedded/ftdi_eeprom-1.0
32                 dev-libs/confuse
33         )"
34 DEPEND="${RDEPEND}
35         python? ( dev-lang/swig )
36         doc? ( app-doc/doxygen )"
37
38 pkg_setup() {
39         use python && python-single-r1_pkg_setup
40 }
41
42 S=${WORKDIR}/${MY_P}
43
44 src_configure() {
45         local mycmakeargs=(
46                 -DFTDIPP=$(usex cxx)
47                 -DDOCUMENTATION=$(usex doc)
48                 -DEXAMPLES=$(usex examples)
49                 -DPYTHON_BINDINGS=$(usex python)
50                 -DSTATICLIBS=$(usex static-libs)
51                 -DBUILD_TESTS=$(usex test)
52                 -DFTDI_EEPROM=$(usex tools)
53                 -DCMAKE_SKIP_BUILD_RPATH=ON
54         )
55         cmake-utils_src_configure
56 }
57
58 src_install() {
59         cmake-utils_src_install
60         use python && python_optimize
61         dodoc AUTHORS ChangeLog README TODO
62
63         if use doc ; then
64                 # Clean up crap man pages. #356369
65                 rm -vf "${CMAKE_BUILD_DIR}"/doc/man/man3/_* || die
66
67                 doman "${CMAKE_BUILD_DIR}"/doc/man/man3/*
68                 dodoc -r "${CMAKE_BUILD_DIR}"/doc/html
69         fi
70         if use examples ; then
71                 docinto examples
72                 dodoc examples/*.c
73         fi
74 }