*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / media-libs / hamlib / hamlib-3.3.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=( python2_7 python3_6 )
7
8 inherit autotools 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         eapply_user
61 }
62
63 src_configure() {
64         econf \
65                 --libdir=/usr/$(get_libdir)/hamlib \
66                 --disable-static \
67                 --with-xml-support \
68                 $(use_with perl perl-binding) \
69                 $(use_with python python-binding) \
70                 $(use_with tcl tcl-binding)
71 }
72
73 src_compile() {
74         emake
75         use doc && emake html
76 }
77
78 src_install() {
79         emake DESTDIR="${D}" install
80
81         use doc && HTML_DOCS=( doc/html/ )
82         einstalldocs
83
84         insinto /usr/$(get_libdir)/pkgconfig
85         doins hamlib.pc
86
87         echo "LDPATH=/usr/$(get_libdir)/hamlib" > "${T}"/73hamlib
88         doenvd "${T}"/73hamlib
89 }