1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
10 DESCRIPTION="GNU Midnight Commander is a text based file manager"
11 HOMEPAGE="https://www.midnight-commander.org"
12 SRC_URI="http://ftp.midnight-commander.org/${MY_P}.tar.xz"
16 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris"
17 IUSE="+edit gpm nls samba sftp +slang spell test unicode X +xdg"
19 REQUIRED_USE="spell? ( edit )"
21 RDEPEND=">=dev-libs/glib-2.26.0:2
23 kernel_linux? ( sys-fs/e2fsprogs )
24 samba? ( net-fs/samba )
25 sftp? ( net-libs/libssh2 )
26 slang? ( >=sys-libs/slang-2 )
27 !slang? ( sys-libs/ncurses:0=[unicode?] )
28 spell? ( app-text/aspell )
37 nls? ( sys-devel/gettext )
38 test? ( dev-libs/check )
41 RESTRICT="!test? ( test )"
45 PATCHES=("${FILESDIR}"/${P}-mc-lib-twice-4070.patch)
48 if use slang && use unicode ; then
49 ewarn "\"unicode\" USE flag only takes effect when the \"slang\" USE flag is disabled."
54 [[ ${CHOST} == *-solaris* ]] && append-ldflags "-lnsl -lsocket"
59 --with-homedir=$(usex xdg 'XDG' '.mc')
60 --with-screen=$(usex slang 'slang' "ncurses$(usex unicode 'w' '')")
61 $(use_enable kernel_linux vfs-undelfs)
62 # Today mclib does not expose any headers and is linked to
63 # single 'mc' binary. Thus there is no advantage of having
64 # a library. Let's avoid shared library altogether
65 # as it also conflicts with sci-libs/mc: bug #685938
68 $(use_enable samba vfs-smb)
69 $(use_enable sftp vfs-sftp)
70 $(use_enable spell aspell)
71 $(use_enable test tests)
72 $(use_with gpm gpm-mouse)
74 $(use_with edit internal-edit)
76 econf "${myeconfargs[@]}"
80 # CK_FORK=no to avoid using fork() in check library
81 # as mc mocks fork() itself: bug #644462.
83 # VERBOSE=1 to make test failures contain detailed
85 CK_FORK=no emake check VERBOSE=1
89 emake DESTDIR="${D}" install
90 dodoc AUTHORS README NEWS
93 if use kernel_linux && [[ ${EUID} == 0 ]] ; then
94 fowners root:tty /usr/libexec/mc/cons.saver
95 fperms g+s /usr/libexec/mc/cons.saver
99 sed 's@MC_XDG_OPEN="xdg-open"@MC_XDG_OPEN="/bin/false"@' \
100 -i "${ED}"/usr/libexec/mc/ext.d/*.sh || die
105 elog "To enable exiting to latest working directory,"
106 elog "put this into your ~/.bashrc:"
107 elog ". ${EPREFIX}/usr/libexec/mc/mc.sh"