0d91bc5f999883113267cba03397732fd0d93eba
[gentoo.git] / dev-libs / libbytesize / libbytesize-2.1.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=( python3_{6,7,8} )
7
8 inherit python-r1
9
10 DESCRIPTION="Tiny library providing a C \"class\" for working with arbitrary big sizes in bytes"
11 HOMEPAGE="https://github.com/storaged-project/libbytesize"
12 SRC_URI="https://github.com/storaged-project/libbytesize/releases/download/${PV}/${P}.tar.gz"
13 LICENSE="LGPL-2+"
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
16 IUSE="doc python test tools"
17
18 REQUIRED_USE="
19         python? ( ${PYTHON_REQUIRED_USE} )
20         tools? ( python )
21 "
22
23 RDEPEND="
24         dev-libs/gmp:0=
25         dev-libs/mpfr:=
26         dev-libs/libpcre2
27         python? ( ${PYTHON_DEPS} )
28 "
29
30 DEPEND="${RDEPEND}"
31
32 BDEPEND="
33         sys-devel/gettext
34         doc? ( dev-util/gtk-doc )
35         test? (
36                 dev-python/pocketlint[${PYTHON_USEDEP}]
37                 dev-python/polib[${PYTHON_USEDEP}]
38         )
39 "
40
41 DOCS=( README.md )
42
43 RESTRICT="test"
44
45 python_do() {
46         if use python; then
47                 python_foreach_impl run_in_build_dir "$@"
48         else
49                 "$@"
50         fi
51 }
52
53 src_configure() {
54         local myeconfargs=(
55                 $(use_with doc gtk-doc)
56                 $(use_with python python3)
57                 $(use_with tools)
58         )
59         local ECONF_SOURCE="${S}"
60         python_do econf "${myeconfargs[@]}"
61 }
62
63 src_compile() {
64         python_do emake
65 }
66
67 src_test() {
68         python_do emake check
69 }
70
71 install_helper() {
72         emake DESTDIR="${D}" install
73         use python && python_optimize
74 }
75
76 src_install() {
77         python_do install_helper
78         einstalldocs
79         find "${ED}" -name "*.la" -type f -delete || die
80 }