*/*: [QA] Fix trivial cases of MissingTestRestrict
[gentoo.git] / app-text / sdcv / sdcv-0.5.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PLOCALES="cs fr ru sk uk zh_CN zh_TW"
7 : ${CMAKE_MAKEFILE_GENERATOR:="ninja"}
8
9 inherit cmake-utils l10n
10
11 DESCRIPTION="Console version of Stardict program"
12 HOMEPAGE="https://dushistov.github.io/sdcv/"
13 SRC_URI="https://github.com/Dushistov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="amd64 x86"
18 IUSE="darkterm nls readline test"
19 RESTRICT="!test? ( test )"
20
21 RDEPEND="
22         >=dev-libs/glib-2.6.1
23         sys-libs/zlib
24         readline? ( sys-libs/readline:= )
25 "
26 DEPEND="${RDEPEND}
27         nls? ( >=sys-devel/gettext-0.14.1 )
28         test? ( app-misc/jq )
29 "
30
31 PATCHES=(
32         "${FILESDIR}/${PN}-t_list.patch"
33         "${FILESDIR}/${PN}-t_interactive.patch"
34 )
35
36 src_prepare() {
37         if use darkterm; then
38                 sed -i 's/;34m/;36m/' src/libwrapper.cpp || die
39         fi
40
41         rm_loc() {
42                 rm "po/${1}.po" || die
43         }
44         l10n_for_each_disabled_locale_do rm_loc
45
46         # do not install locale-specific man pages unless asked to
47         if ! has uk ${LINGUAS-uk}; then
48                 sed -ni '/share\/man\/uk/!p' CMakeLists.txt || die
49         fi
50
51         cmake-utils_src_prepare
52 }
53
54 src_configure() {
55         local mycmakeargs=(
56                 -DENABLE_NLS="$(usex nls)"
57                 -DWITH_READLINE="$(usex readline)"
58                 -DBUILD_TESTS="$(usex test ON OFF)"
59         )
60         cmake-utils_src_configure
61 }
62
63 src_compile() {
64         cmake-utils_src_compile
65         use nls && cmake-utils_src_compile lang
66 }
67
68 src_install() {
69         # with USE=nls, but empty intersection of LINGUAS and list of
70         # supported translations, this directory is required, see bug 583386
71         mkdir -p "${BUILD_DIR}/locale"
72         cmake-utils_src_install
73         dodoc doc/DICTFILE_FORMAT
74 }