*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / media-libs / hamlib / hamlib-3.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python2_7 python3_6 )
7
8 inherit autotools-utils eutils multilib python-single-r1
9
10 DESCRIPTION="Ham radio backend rig control libraries"
11 HOMEPAGE="https://www.hamlib.org"
12 SRC_URI="https://www.github.com/${PN}/${PN}/releases/download/${PVR}/${P}.tar.gz"
13
14 LICENSE="LGPL-2 GPL-2"
15 SLOT="0"
16 KEYWORDS="amd64 x86"
17 IUSE="doc perl python tcl"
18
19 RESTRICT="test"
20
21 RDEPEND="
22         =virtual/libusb-0*
23         dev-libs/libxml2
24         sys-libs/readline:0=
25         perl? ( dev-lang/perl )
26         python? ( ${PYTHON_DEPS} )
27         tcl? ( dev-lang/tcl:0= )"
28
29 DEPEND=" ${RDEPEND}
30         virtual/pkgconfig
31         dev-lang/swig
32         >=sys-devel/libtool-2.2
33         doc? ( app-doc/doxygen )"
34
35 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
36
37 DOCS=(AUTHORS NEWS PLAN README README.betatester README.developer TODO)
38
39 pkg_setup() {
40         use python && python-single-r1_pkg_setup
41 }
42
43 src_prepare() {
44         # fix hardcoded libdir paths
45         sed -i -e "s#fix}/lib#fix}/$(get_libdir)/hamlib#" \
46                 -e "s#fix}/include#fix}/include/hamlib#" \
47                 hamlib.pc.in || die "sed failed"
48
49         # Correct install target to whatever INSTALLDIRS says and use vendor
50         # installdirs everywhere (bug #611550)
51         sed -i -e "s#install_site#install#"     \
52         -e 's#MAKEFILE="Hamlib-pl.mk"#MAKEFILE="Hamlib-pl.mk" INSTALLDIRS=vendor#' \
53         bindings/Makefile.am || die "sed failed patching for perl"
54
55         # make building of documentation compatible with autotools-utils
56         sed -i -e "s/doc:/html:/g" doc/Makefile.am || die "sed failed"
57
58         eautoreconf
59 }
60
61 src_configure() {
62         local myeconfargs=(
63                 --libdir=/usr/$(get_libdir)/hamlib
64                 --disable-static
65                 --with-xml-support
66                 $(use_with perl perl-binding)
67                 $(use_with python python-binding)
68                 $(use_with tcl tcl-binding)
69                 --disable-silent-rules
70         )
71         autotools-utils_src_configure
72 }
73
74 src_compile() {
75         autotools-utils_src_compile
76         use doc && autotools-utils_src_compile html
77 }
78
79 src_install() {
80         use doc && HTML_DOCS=("${AUTOTOOLS_BUILD_DIR}/doc/html/")
81         autotools-utils_src_install
82
83         insinto /usr/$(get_libdir)/pkgconfig
84         doins "${AUTOTOOLS_BUILD_DIR}"/hamlib.pc
85
86         echo "LDPATH=/usr/$(get_libdir)/hamlib" > "${T}"/73hamlib
87         doenvd "${T}"/73hamlib
88 }