app-shells/fish: fix build with ncurses[tinfo]
[gentoo.git] / app-shells / fish / fish-3.0.0.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake-utils readme.gentoo-r1
7
8 DESCRIPTION="Friendly Interactive SHell"
9 HOMEPAGE="http://fishshell.com/"
10
11 MY_PV="${PV/_beta/b}"
12 MY_P="${PN}-${MY_PV}"
13
14 if [[ ${PV} == "9999" ]]; then
15         inherit git-r3
16         EGIT_REPO_URI="https://github.com/${PN}-shell/${PN}-shell.git"
17 else
18         SRC_URI="https://github.com/${PN}-shell/${PN}-shell/releases/download/${MY_PV}/${MY_P}.tar.gz"
19         KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
20 fi
21
22 LICENSE="GPL-2"
23 SLOT="0"
24
25 IUSE="doc nls test"
26
27 RDEPEND="
28         >=dev-libs/libpcre2-10.21[pcre32]
29         sys-devel/bc
30         sys-libs/ncurses:0=
31 "
32
33 DEPEND="${RDEPEND}
34         doc? ( app-doc/doxygen )
35         nls? ( sys-devel/gettext )
36         test? ( dev-tcltk/expect )
37 "
38
39 S="${WORKDIR}/${MY_P}"
40
41 src_prepare() {
42         # workaround for https://github.com/fish-shell/fish-shell/issues/4883
43         sed -i 's#${TEST_INSTALL_DIR}/${CMAKE_INSTALL_PREFIX}#${TEST_INSTALL_DIR}#' \
44                 cmake/Tests.cmake || die
45         cmake-utils_src_prepare
46 }
47
48 src_configure() {
49         local mycmakeargs=(
50                 -DCMAKE_INSTALL_BINDIR="${EPREFIX}/bin"
51                 -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}"
52                 -DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}/etc"
53                 -DINTERNAL_WCWIDTH=OFF
54                 -DBUILD_DOCS="$(usex doc)"
55                 -DWITH_GETTEXT="$(usex nls)"
56         )
57         # HACK: https://bugs.gentoo.org/673942
58         if has_version -d 'sys-libs/ncurses:0[tinfo]'; then
59                 mycmakeargs+=( -DCURSES_EXTRA_LIBRARY=tinfo )
60         fi
61         cmake-utils_src_configure
62 }
63
64 src_install() {
65         cmake-utils_src_install
66         keepdir /usr/share/fish/vendor_{completions,conf,functions}.d
67         readme.gentoo_create_doc
68 }
69
70 src_test() {
71         cmake-utils_src_make -j1 test
72 }
73
74 pkg_postinst() {
75         readme.gentoo_print_elog
76 }