*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-libs / newt / newt-0.52.21-r1.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=( python2_7 python3_{6,7,8} )
7
8 inherit autotools python-r1 toolchain-funcs
9
10 DESCRIPTION="Redhat's Newt windowing toolkit development files"
11 HOMEPAGE="https://pagure.io/newt"
12 SRC_URI="https://releases.pagure.org/newt/${P}.tar.gz"
13
14 LICENSE="LGPL-2"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
17 IUSE="gpm nls tcl"
18 RESTRICT="test"
19
20 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
21
22 RDEPEND="
23         ${PYTHON_DEPS}
24         >=dev-libs/popt-1.6
25         =sys-libs/slang-2*
26         elibc_uclibc? ( sys-libs/ncurses:0= )
27         gpm? ( sys-libs/gpm )
28         tcl? ( >=dev-lang/tcl-8.5:0 )
29         "
30 DEPEND="${RDEPEND}"
31
32 src_prepare() {
33         # bug 73850
34         if use elibc_uclibc; then
35                 sed -i -e 's:-lslang:-lslang -lncurses:g' Makefile.in || die
36         fi
37
38         sed -i Makefile.in \
39                 -e 's|$(SHCFLAGS) -o|$(LDFLAGS) &|g' \
40                 -e 's|-g -o|$(CFLAGS) $(LDFLAGS) -o|g' \
41                 -e 's|-shared -o|$(CFLAGS) $(LDFLAGS) &|g' \
42                 -e 's|instroot|DESTDIR|g' \
43                 -e 's|  make |  $(MAKE) |g' \
44                 -e "s|  ar |    $(tc-getAR) |g" \
45                 || die "sed Makefile.in"
46
47         if [[ -n ${LINGUAS} ]]; then
48                 local lang langs
49                 for lang in ${LINGUAS}; do
50                         test -r po/${lang}.po && langs="${langs} ${lang}.po"
51                 done
52                 sed -i po/Makefile \
53                         -e "/^CATALOGS = /cCATALOGS = ${langs}" \
54                         || die "sed po/Makefile"
55         fi
56
57         eapply \
58                 "${FILESDIR}"/${PN}-0.52.13-gold.patch \
59                 "${FILESDIR}"/${PN}-0.52.14-tcl.patch \
60                 "${FILESDIR}"/${PN}-0.52.21-python-sitedir.patch
61         eapply_user
62         eautoreconf
63
64         # can't build out-of-source
65         python_copy_sources
66 }
67
68 src_configure() {
69         configuring() {
70                 econf \
71                         PYTHONVERS="${PYTHON}" \
72                         $(use_with gpm gpm-support) \
73                         $(use_with tcl) \
74                         $(use_enable nls)
75         }
76         python_foreach_impl run_in_build_dir configuring
77 }
78
79 src_compile() {
80         building() {
81                 emake PYTHONVERS="${EPYTHON}"
82         }
83         python_foreach_impl run_in_build_dir building
84 }
85
86 src_install() {
87         installit() {
88                 python_export PYTHON_SITEDIR
89                 emake \
90                         DESTDIR="${D}" \
91                         PYTHONVERS="${EPYTHON}" \
92                         install
93                 python_optimize
94         }
95         python_foreach_impl run_in_build_dir installit
96         dodoc peanuts.py popcorn.py tutorial.sgml
97         doman whiptail.1
98         einstalldocs
99
100         # don't want static archives
101         rm "${ED}"/usr/$(get_libdir)/libnewt.a || die
102 }