dev-libs/leatherman: 1.12.0 stable amd64/x86 with cleanup
[gentoo.git] / dev-libs / libusb / libusb-1.0.22.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit ltprune toolchain-funcs multilib-minimal usr-ldscript
6
7 DESCRIPTION="Userspace access to USB devices"
8 HOMEPAGE="https://libusb.info/ https://github.com/libusb/libusb"
9 SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.bz2"
10
11 LICENSE="LGPL-2.1"
12 SLOT="1"
13 KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
14 IUSE="debug doc examples static-libs test udev"
15 RESTRICT="!test? ( test )"
16
17 RDEPEND="udev? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP},static-libs(-)?] )"
18 DEPEND="${RDEPEND}
19         doc? ( app-doc/doxygen )
20         !udev? ( virtual/os-headers )"
21
22 multilib_src_configure() {
23         ECONF_SOURCE=${S} \
24         econf \
25                 $(use_enable static-libs static) \
26                 $(use_enable udev) \
27                 $(use_enable debug debug-log) \
28                 $(use_enable test tests-build)
29 }
30
31 multilib_src_compile() {
32         emake
33
34         if multilib_is_native_abi; then
35                 use doc && emake -C doc docs
36         fi
37 }
38
39 multilib_src_test() {
40         emake check
41
42         # noinst_PROGRAMS from tests/Makefile.am
43         tests/stress || die
44 }
45
46 multilib_src_install() {
47         emake DESTDIR="${D}" install
48
49         if multilib_is_native_abi; then
50                 gen_usr_ldscript -a usb-1.0
51
52                 use doc && dodoc -r doc/html
53         fi
54 }
55
56 multilib_src_install_all() {
57         prune_libtool_files
58
59         dodoc AUTHORS ChangeLog NEWS PORTING README TODO
60
61         if use examples; then
62                 insinto /usr/share/doc/${PF}/examples
63                 doins examples/*.{c,h}
64                 insinto /usr/share/doc/${PF}/examples/getopt
65                 doins examples/getopt/*.{c,h}
66         fi
67 }