*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-i18n / nkf / nkf-2.1.4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5 PYTHON_COMPAT=( python{2_7,3_6} )
6
7 inherit distutils-r1 perl-module toolchain-funcs vcs-snapshot
8
9 PY_P="python-${PN}-0.2.0_p20141211"
10 PY_COMMIT="000915e115acac57a1fdbceb1e6361788af83a3d"
11
12 DESCRIPTION="Network Kanji code conversion Filter with UTF-8/16 support"
13 HOMEPAGE="https://ja.osdn.net/projects/nkf/"
14 SRC_URI="mirror://sourceforge.jp/${PN}/64158/${P}.tar.gz
15         python? ( https://github.com/fumiyas/python-${PN}/archive/${PY_COMMIT}.tar.gz -> ${PY_P}.tar.gz )"
16
17 LICENSE="ZLIB python? ( BSD )"
18 SLOT="0"
19 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-macos"
20 IUSE="perl python l10n_ja"
21
22 src_prepare() {
23         sed -i \
24                 -e "/^CFLAGS/{ s/-g -O2//; s/=/+=/; }" \
25                 -e "/ -o ${PN}/s/\(-o \)/\$(LDFLAGS) \1/" \
26                 Makefile
27         if use python; then
28                 mv "${WORKDIR}"/${PY_P} NKF.python || die
29                 eapply "${FILESDIR}"/${P}-python.patch
30         fi
31
32         default
33 }
34
35 src_configure() {
36         default
37         if use perl; then
38                 cd NKF.mod
39                 perl-module_src_configure
40                 cd - >/dev/null
41         fi
42 }
43
44 src_compile() {
45         emake CC="$(tc-getCC)"
46         if use perl; then
47                 cd NKF.mod
48                 perl-module_src_compile
49                 cd - >/dev/null
50         fi
51         if use python; then
52                 cd NKF.python
53                 distutils-r1_src_compile
54                 cd - >/dev/null
55         fi
56 }
57
58 src_test() {
59         default
60         if use perl; then
61                 cd NKF.mod
62                 perl-module_src_test
63                 cd - >/dev/null
64         fi
65 }
66
67 src_install() {
68         dobin ${PN}
69         doman ${PN}.1
70
71         if use l10n_ja; then
72                 iconv -f ISO-2022-JP-3 -t UTF-8 ${PN}.1j > ${PN}.ja.1 || die
73                 doman ${PN}.ja.1
74         fi
75         dodoc ${PN}.doc
76
77         if use perl; then
78                 cd NKF.mod
79                 docinto perl
80                 perl-module_src_install
81                 cd - >/dev/null
82         fi
83         if use python; then
84                 cd NKF.python
85                 docinto python
86                 DOCS= distutils-r1_src_install
87                 dodoc CHANGES README.md
88                 cd - >/dev/null
89         fi
90 }