summaryrefslogtreecommitdiff
blob: dd88d9913273c3a275c72898d6035d84a1412ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit flag-o-matic eutils pam multilib

MY_PN="mc"
MY_P="${MY_PN}-${PV/_/-}"

DESCRIPTION="GNU Midnight Commander cli-based file manager. 4.1.x branch"
HOMEPAGE="http://mc.linuxinside.com/cgi-bin/dir.cgi"
SRC_URI="http://mc.linuxinside.com/Releases/${MY_P}.tar.bz2"

LICENSE="GPL-2"
SLOT=0
KEYWORDS="~amd64 ~x86"
IUSE="7zip gpm nls ncurses pam slang"

PROVIDE="virtual/editor"

RDEPEND="kernel_linux? ( >=sys-fs/e2fsprogs-1.19 )
	ncurses? ( >=sys-libs/ncurses-5.2-r5 )
	pam? ( >=sys-libs/pam-0.78-r3 net-nds/portmap )
	gpm? ( >=sys-libs/gpm-1.19.3 )
	slang? ( =sys-libs/slang-1.4* )
	x86? ( 7zip? ( >=app-arch/p7zip-4.16 ) )
	amd64? ( 7zip? ( >=app-arch/p7zip-4.16 ) )
	!app-misc/mc"

DEPEND="${RDEPEND}
	dev-util/pkgconfig"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"
	if ( use x86 || use amd64 ) && use 7zip; then
		epatch "${FILESDIR}/${PV}/u7z.patch"
	fi

	epatch "${FILESDIR}/${PV}/ebuild-syntax.patch"
	epatch "${FILESDIR}/${PV}/mc-menu.patch"
	epatch "${FILESDIR}/${PV}/gcc34.patch"
}

src_compile() {
	filter-flags -malign-double

	local myconf=""

	if ! use slang && ! use ncurses ; then
		myconf="${myconf}"
	elif
		use ncurses && ! use slang ; then
			myconf="${myconf} --with-ncurses --without-included-slang"
	else
		use slang && myconf="${myconf} --with-included-slang --with-terminfo --with-slang"
	fi

	myconf="${myconf} `use_with gpm gpm-mouse`"

	use nls \
		&& myconf="${myconf} --with-included-gettext" \
		|| myconf="${myconf} --disable-nls"

	# X support not ready yet
	# myconf="${myconf} `use_with X x`"

	econf \
	--with-vfs \
	--with-ext2undel \
	--with-edit \
	--enable-charset \
	--with-mcfs \
	--with-subshell \
	--with-netrc \
	--with-dusum \
	${myconf} || die

	emake || die
}

src_install() {
	cat "${FILESDIR}/chdir.gentoo" > "${S}/$(get_libdir)/mc.sh"
	rm -f "${S}/README."{NT,OS2,QNX}

	einstall || die

	# install cons.saver setuid, to actually work
	chmod u+s "${D}/usr/$(get_libdir)/mc/bin/cons.saver"

	use pam && newpamd "${FILESDIR}/mcserv.pamd" mcserv
	use pam && newinitd "${FILESDIR}/mcserv.rc" mcserv

	exeinto /usr/$(get_libdir)/mc/bin
	doexe "${S}/$(get_libdir)/mc.sh"
	doexe "${S}/$(get_libdir)/mc.csh"

	insinto /usr/$(get_libdir)/mc
	doins "${FILESDIR}/mc."{gentoo,ini}

	insinto /usr/$(get_libdir)/mc/syntax
	doins "${FILESDIR}/ebuild.syntax"

	rm -rf "${D}/usr/man" "${D}/usr/share/man"
	doman "${S}/doc/"*.{1,8}
	dodoc FAQ NEWS README.*
}

pkg_postinst() {
	elog "Add the following line to your ~/.bashrc to"
	elog "allow mc to chdir to its latest working dir at exit"
	elog
	elog "# Midnight Commander chdir enhancement"
	elog "if [ -f /usr/$(get_libdir)/mc/mc.gentoo ]; then"
	elog ". /usr/$(get_libdir)/mc/mc.gentoo"
	elog "fi"
}