# Note that this is NOT a relocatable package
%define	ver	4.5.54
%define	rel	0vl4

Summary:	A user-friendly file manager and visual shell.
Summary(ja):	ユーザ・フレンドリーなファイル・マネージャおよびビジュアル・シェル
Name:		mc
Version:	%{ver}
Release:	%{rel}
Copyright:	GPL
Group:		System Environment/Shells
URL:		http://www.gnome.org/
BuildRoot:	%{_tmppath}/%{name}-%{PACKAGE_VERSION}-root

BuildRequires:	gpm-devel
BuildRequires:	gnome-libs-devel >= 1.4.2-0vl2

Requires:	pam >= 0.59
Requires:	vine-logos

Prereq:		/sbin/chkconfig

Source0:	ftp://ftp.gnome.org/pub/GNOME/stable/sources/%{name}/%{name}-%{ver}.tar.bz2
Source1:	gmc-vine.links
Source2:	ldp.xpm
# Source3:	mc-4.5.50.ja.po
Source4:	mc-extraicons.tar.bz2

Patch0:		mc-4.5.35-xtermcolor.patch
Patch2:		mc-4.5.35-fixwarning.patch
Patch3:		mc-4.5.52-mimekeys_vine2.patch
Patch10:	mc-4.5.35-homedir.patch
Patch17:	mc-4.5.52-absoluterm.patch
Patch22:	mc-4.5.43-prototype.patch
Patch23:	mc-4.5.46-system-auth.patch
Patch25:	mc-4.5.51-showagain.patch
Patch26:	mc-4.5.51-stderr.patch
Patch27:	mc-4.5.51-gnome-editor.patch 
Patch28:	mc-4.5.51-extention.patch
#
Patch41:	mc-4.5.51-kudzu.patch
Patch43:	mc-4.5.51-initialdevices.patch

# for Vine
Patch100:	mc-4.5.44-view_fix.patch
Patch101:	mc-4.5.44-kterm.patch
Patch102:	mc-4.5.44-ftpfs.patch
Patch103:	mc-4.5.52-smbfs_url.patch
Patch104:	mc-4.5.54-tempnam.patch
Patch105:	mc-4.5.52-vine_extend-20000619.patch
Patch106:	mc-4.5.52-zsh.patch
Patch107:       mc-4.5.54-newterminal.patch

%description
Midnight Commander is a visual shell much like a file manager, only
with many more features.  It is a text mode application, but it also
includes mouse support if you are running GPM. Midnight Commander's
coolest features are its abilities to FTP, view tar and zip files, and
to poke into RPMs for specific files.

%description -l ja
Midnight Commanderは単に多くの機能を持つ、まさにファイル・マ
ネージャとしてのビジュアル・シェルです。これはテキスト・モー
ドで動くアプリケーションですが、GPMを動かしている場合、マウス
もサポートしています。Midnight Commanderの最もクールな機能は、
FTP、Tarや ZIP、およびRPM内の特定のファイルへアクセスできるこ
とです。

%package -n gmc
Summary:	The GNOME version of the Midnight Commander file manager.
Summary(ja):	Midnight Commanderファイル・マネージャのGNOMEバージョン
Requires:	mc >= %{PACKAGE_VERSION}
Group:		User Interface/Desktops

%description -n gmc
GMC (GNU Midnight Commander) is a file manager based on the terminal
version of Midnight Commander, with the addition of a GNOME GUI
desktop front-end. GMC can FTP, view TAR and compressed files and look
into RPMs for specific files.

Install gmc if you're installing GNOME and you'd like to use the
Midnight Commander file manager with it.

%description -n gmc -l ja
GMC (GNU Midnight Commander)はMidnight Commanderの端末バージョ
ンをベースに、GNOME GUIデスクトップ・フロントエンドを追加した
ファイルマネージャです。GMCはFTPや、TARや圧縮ファイルを閲覧し
たりRPM内の特定のファイルを覗くことができます。

もしGNOMEをインストールして、Midnight Commanderファイルマネー
ジャを一緒に利用したい場合、GMCをインストールしてください。


%package -n mcserv
Summary:	Server for the Midnight Commander network file management system.
Summary(ja):	Midnight Commanderネットワーク・ファイル管理システム用サーバ
Group:		System Environment/Daemons
Requires:	portmap

%description -n mcserv
The Midnight Commander file management system will allow you to
manipulate the files on a remote machine as if they were local.  This
is only possible if the remote machine is running the mcserv server
program.  Mcserv provides clients running Midnight Commander with
access to the host's file systems.

Install mcserv on machines if you want to access their file systems
remotely using the Midnight Commander file management system.

%description -n mcserv -l ja
Midnight Commanderファイル管理システムでは、リモートマシン上の
ファイルをローカル・ファイルのと同等の感覚で操作することができ
ます。これはリモートマシン上でmcservサーバが起動している必要が
あります。Mcservは、クライアントで動いているMidnight Commander
からこのホストのファイルシステムへアクセスすることができるよう
にします。

もしこのマシンのファイルシステムを、Midnight Commanderファイル
管理システムとしてリモートからアクセスできるようにしたい場合、
mcservをインストールしてください。

%prep
%setup -q
%patch -p1 -b .xtermcolor

%patch2 -p1 -b .fixwarning
%patch3 -p1 -b .mimekeys

%patch10 -p1 -b .homedir
%patch17 -p1 -b .absoluterm
%patch22 -p1 -b .prototype
%patch23 -p1 -b .system-auth
%patch25 -p1 -b .showagain
%patch26 -p1 -b .stderr
%patch27 -p1 -b .gnome
%patch28 -p1 -b .extention
%patch41 -p1 -b .kudzu
%patch43 -p1 -b .initialdevices

%patch100 -p1 -b .view_fix
%patch101 -p1 -b .kterm
%patch102 -p1 -b .ftpfs
%patch103 -p1 -b .smbfs_url
%patch104 -p1 -b .tempnam
%patch105 -p1 -b .vine_extend
%patch106 -p1 -b .zsh
%patch107 -p0 -b .newterminal

%configure \
	--with-samba \
	--with-gnome \
	--without-debug \
	--with-included-slang

cd vfs/samba
#CFLAGS="$RPM_OPT_FLAGS" ./configure \
#	--prefix=%{_prefix} \
%configure \
	--localstatedir=/var/log/samba \
	--libdir=/etc \
	--with-privatedir=/etc \
	--with-lockdir=/var/lock/samba
cd -

%build
make

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,pam.d,profile.d,X11/wmconfig}

%makeinstall

(cd icons; make DESTDIR=$RPM_BUILD_ROOT install_icons)
install lib/mcserv.init $RPM_BUILD_ROOT%{_initdir}/mcserv

install lib/mcserv.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/mcserv
install lib/{mc.sh,mc.csh} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install lib/mc.global $RPM_BUILD_ROOT%{_sysconfdir}

# clean up this setuid problem for now
chmod 755 $RPM_BUILD_ROOT/%{_libdir}/mc/bin/cons.saver

# copy vine desktop default icons
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/desktop-links/
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_libdir}/desktop-links/

# ldp icon
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_datadir}/pixmaps/mc

# install home dir and up icons.
tar zxvf %{SOURCE4} -C $RPM_BUILD_ROOT/%{_datadir}/pixmaps/mc

%find_lang %name

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%post   -n mcserv
/sbin/chkconfig --add mcserv

%preun -n mcserv
if [ "$1" = "0" ];
then
	service mcserv stop > /dev/null 2>&1
	/sbin/chkconfig --del mcserv
fi

%postun -n mcserv
if [ "$1" -ge "1" ];
then
	service mcserv restart > /dev/null 2>&1
fi

%files -f %{name}.lang
%defattr(-, root, root)

%doc FAQ COPYING NEWS README
%doc README.vineextend
%{_bindir}/mc
%{_bindir}/mcedit
%{_bindir}/mcmfmt
%{_libdir}/mc/mc.ext
%{_libdir}/mc/mc.hint
%{_libdir}/mc/mc.hlp
%{_libdir}/mc/mc.lib
%{_libdir}/mc/mc.menu
%{_libdir}/mc/bin/cons.saver
%{_libdir}/mc/extfs/*
%{_libdir}/mc/syntax/*
%{_mandir}/man1/*
%config %{_sysconfdir}/profile.d/*
%dir %{_libdir}/mc
%dir %{_libdir}/mc/bin
#%{_datadir}/mime-info/*

%files -n mcserv
%defattr(-, root, root)

%attr(0644, root, root) %config /etc/pam.d/mcserv
%config %{_initdir}/mcserv
%attr(-, root, man)  %{_mandir}/man8/mcserv*
%{_bindir}/mcserv

%files -n gmc
%defattr(-, root, root)

%doc lib/README.desktop
%config %{_sysconfdir}/mc.global
%{_bindir}/gmc
%{_bindir}/gmc-client
%{_bindir}/plain-gmc
%{_libdir}/mc/layout
%{_datadir}/pixmaps/mc/*
%{_datadir}/mime-info/mc.keys
%{_datadir}/idl/*.idl

%config %{_sysconfdir}/CORBA/servers/*
%config %{_libdir}/desktop-links/*

%changelog
* Wed Oct 13 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.5.54-0vl4
- rebuilt with db4-4.2.52

* Sun Jul 18 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 4.5.54-0vl3
- merged with Vine26 package.
  * Wed Nov 12 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 4.5.54-0vl2
  - add Patch107 to fix open_new_terminal on desktop

* Wed Jan 15 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.5.54-0vl2
- rebuilt against gnome-libs-1.4.2-0vl2 (for db1/db4 matters)
- modified Patch104 to meet glibc-devel >= 2.2.x

* Tue May  8 2001 Akira TAGOH <tagoh@gnome.gr.jp> 4.5.54-0vl1
- New upstream release.

* Fri Mar 23 2001 Akira TAGOH <tagoh@gnome.gr.jp> 4.5.52-0vl1
- New upstream release.
- Use rpmmacros.
- Added some RH bug fix patch.

* Sun Dec 24 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 4.5.50-0vl4
- rebuilt with ncurses5
- use better macros

* Thu Oct 12 2000 Yoshihiro Kajiki <kajiki@ylug.org> [0vl3]
- add 8bit_clean patch to view/edit Japanese chars

* Fri Jun 19 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- clean up vine-extend patch.
- modified ja.po for 4.5.50

* Fri Jun  9 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified vine-extend patch about icon layout.

* Wed Jun  7 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 4.5.50

* Tue May 23 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 4.5.46

* Wed May  3 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- fixed vine-extend patch for some stability.

* Sat Apr 22 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- fixed vine-extend patch for timer initialization for busy coursor.

* Wed Apr 19 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified tempnam patch for stability.

* Mon Apr 17 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified vine_extend patch to fix URL DnD action again, sorry...

* Sat Apr 15 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified vine_extend patch to fix URL DnD action and clean up a little.
- added the special up directory pixmap.
- added ftpfs patch to reconnecte after idle timeout.
- added --with-smbfs option to configure.

* Tue Apr 11 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified vine_extend patch to snap and aoto-put icons to better position.
- added gme-client for Gnome 1.1.x

* Sat Apr 8 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- modified vine_extend patch to customize desktop icon appearance and fix dnd.
- added the special home directory pixmap.

* Thu Apr 6 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 4.5.44
- removed kondara's patch
- add fixsh patch from RH6.2
- add kterm and vine_extend and view_fix patch instead of kondara's patch.

* Wed  Feb 23 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- added absoluterm.patch from RH6.2beta SRPM.
- added japo patch

* Tue Dec 21 1999 Jun Nishii <jun@vinelinux.org>
- merge kondara patch, thanks kondara

* Wed Dec  8 1999 Yasuyuki Furukawa <yasu@on.cs.keio.ac.jp>
- updated to 4.5.42

* Sat Sep 18 1999 Kazuhito Nishi <nishi@imasy.or.jp>
- First try at a spec file for Vine

