Package mc: Specfile

%define basever	4.6.1

%ifdef cvsver
%define ver	%basever-%cvsver
%else
%define ver	%basever
%endif

Name: mc
Version: %{ver}r
Release: alt9

License: GPL
Summary: A user-friendly file manager and visual shell
Group: File tools
URL: http://www.ibiblio.org/mc/

Source:  ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-%ver.tar.bz2
Source1: synce-mcfs.tar.gz
Source5: mc-dnlike.color
Source6: mc-dark.color
Source11: mc-16.png
Source12: mc-32.png

# from http://nemerle.org/svn/nemerle/trunk/misc/nemerle.syntax
Source20: nemerle.syntax

PreReq: chkconfig

Patch:  mc-4.6.1-alt-Eterm.patch
Patch1: mc-4.6.1-alt-charsets.patch
Patch2: mc-4.6.1-alt-wrapper.patch
Patch3: mc-4.5.55-language.patch
Patch4: mc-4.6.1-alt-m4_configure.patch
Patch5: mc-4.6.1-alt-extfs.patch
Patch6: mc-4.6.1-alt-syntax.patch
Patch7: mc-4.6.1-alt-vfs.patch
Patch8: mc-4.6.0-vfs-date_parse-alt.patch
Patch9: mc-4.6.1-alt-forceexec.patch
Patch10: mc-4.6.1a-alt-po.patch
Patch11: mc-4.6.1-alt-u7z.patch

Patch12: mc-4.6.1-alt-add-nemerle-syntax.patch
Patch13: mc-4.6.1-alt-catdoc-rtf.patch
Patch14: mc-4.6.1-alt-promptfix.patch
Patch15: mc-4.6.1-alt-menu.patch
Patch16: mc-alt-rar_view.patch

# RH
Patch101: mc-4.6.1a-rh-64bit.patch
Patch102: mc-4.6.1a-rh-fish-upload.patch
Patch103: mc-4.6.1a-rh-promptfix.patch
Patch104: mc-4.6.1a-rh-uglydir.patch

# UTF8
Patch201: mc-4.6.1-rh-alt-utf8.patch

# Contributed
Patch301: mc-4.6.1-xs-file-highlight.patch.bz2

Requires: libslang >= 1.4.9

BuildRequires: glib2-devel libe2fs-devel libgpm-devel libslang-devel
BuildRequires: pkgconfig cvs groff-base

%description
Midnight Commander is a visual shell much like a file manager, only with way
more features.  It is text mode, but also includes mouse support if you are
running GPM.  Its coolest feature is the ability to ftp, view tar, zip
files, and poke into RPMs for specific files.  :-)

%prep
%setup -q -n %name-%ver -a1
# ALT
%patch  -p1 -b .Eterm
%patch1 -p1 -b .charsets
%patch2 -p1 -b .wrapper
%patch3 -p1 -b .language
%patch4 -p1 -b .m4_configure
%patch5 -p0 -b .extfs
%patch6 -p0 -b .syntax
%patch7 -p1 -b .vfs
# %patch8 -p0 -b .vfs-date
%patch9 -p1 -b .fe
%patch10 -p1 -b .po_fix
%patch11 -p1 -b .u7z
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1

# RH
%patch101 -p1 -b .64bit
%patch102 -p1 -b .fish
#patch103 -p1 -b .prompt
%patch104 -p1 -b .uglydir
# UTF8
%patch201 -p1 -b .utf8

# Contributed
%patch301 -p1 -b .ftype

%build
%configure --without-gnome \
	    --without-debug \
	    --with-screen=slang \
	    --without-included-gettext \
	    --enable-charset \
	    --enable-largefile \
	    --without-x

%make_build

%install
%__install -d %buildroot%_sysconfdir/{profile.d,bashrc.d}

%makeinstall

%__mv %buildroot%_datadir/mc/bin/mc.* %buildroot%_sysconfdir/profile.d
# Install DosNavigaor color scheme
%__install -m644 %SOURCE5 $RPM_BUILD_DIR/%name-%basever
# Install Dark color scheme
%__install -m644 %SOURCE6 $RPM_BUILD_DIR/%name-%basever
# Install SynCE VFS
%__install -m755 synce-mcfs/src/synce* %buildroot%_datadir/%name/extfs/
%__cat synce-mcfs/src/extfs.ini.add >> %buildroot%_datadir/%name/extfs/extfs.ini

# Add Russian and Ukrainian hints and help for CP1251 & UTF-8 locales
iconv -fkoi8-r -tcp1251 %buildroot%_datadir/mc/mc.hint.ru > %buildroot%_datadir/mc/mc.hint.ru_RU.CP1251
iconv -fkoi8-u -tcp1251 %buildroot%_datadir/mc/mc.hint.uk > %buildroot%_datadir/mc/mc.hint.uk_UA.CP1251
iconv -fkoi8-r -tutf8   %buildroot%_datadir/mc/mc.hint.ru > %buildroot%_datadir/mc/mc.hint.ru_RU.UTF-8
iconv -fkoi8-u -tutf8   %buildroot%_datadir/mc/mc.hint.uk > %buildroot%_datadir/mc/mc.hint.uk_UA.UTF-8

iconv -fkoi8-r -tcp1251 %buildroot%_datadir/mc/mc.hlp.ru >  %buildroot%_datadir/mc/mc.hlp.ru_RU.CP1251
iconv -fkoi8-r -tutf8   %buildroot%_datadir/mc/mc.hlp.ru >  %buildroot%_datadir/mc/mc.hlp.ru_RU.UTF-8


# remove bash wrapper
# rm -f %buildroot%_datadir/mc/bin/mc-wrapper.sh

# Move mc.sh to proper path
%__mkdir_p %buildroot%_sysconfdir/bashrc.d
%__mv %buildroot%_sysconfdir/profile.d/mc.sh %buildroot%_sysconfdir/bashrc.d

# menu
%__cat <<__MENU__ >%name.menu
?package(%name): needs="x11" section="Applications/File tools" \
title="Midnight Commander" longtitle="Midnight Commander" \
command="xvt -bg black -fg grey -e %_datadir/mc/bin/mc-wrapper.sh" \
icon=%name.png
__MENU__
%__install -pD -m644 %name.menu %buildroot%_menudir/%name
# icons
%__install -pD -m644 %SOURCE11 %buildroot%_miconsdir/%name.png
%__install -pD -m644 %SOURCE12 %buildroot%_iconsdir/%name.png
%__install -pD -m644 %SOURCE20 %buildroot%_datadir/mc/syntax/

%find_lang %name

%post
%update_menus

%postun
%clean_menus

%files -f %name.lang
%doc FAQ NEWS README mc-dnlike.color mc-dark.color
%_bindir/mc
%_bindir/mcedit
%_bindir/mcview
%_bindir/mcmfmt
%_libdir/mc
%_datadir/mc
%_mandir/man1/*
%_menudir/%name
%_iconsdir/%name.png
%_miconsdir/%name.png
%config(noreplace) %_datadir/mc/mc.ext
%config(noreplace) %_sysconfdir/bashrc.d/*

%changelog
* Fri Jan 05 2007 Igor Zubkov <icesik@altlinux.org> 4.6.1r-alt9
- fix not readable help when utf-8 locale is used (#9727)

* Mon Oct 23 2006 Igor Zubkov <icesik@altlinux.org> 4.6.1r-alt8
- use unrar instead rar in mc.ext (#8028)

* Mon Oct 16 2006 Igor Zubkov <icesik@altlinux.ru> 4.6.1r-alt7
- added mc-4.6.1-alt-menu.patch (fixed mc.menu scripts)

* Mon Oct 16 2006 Igor Zubkov <icesik@altlinux.ru> 4.6.1r-alt6
- revert mc-4.6.1a-rh-promptfix.patch (buggy)
- fix promt (mc-4.6.1-alt-promptfix.patch) (#8310)

* Mon Oct 16 2006 Igor Zubkov <icesik@altlinux.ru> 4.6.1r-alt5
- add catdoc as RTF viewer (#4443)

* Mon Oct 16 2006 Igor Zubkov <icesik@altlinux.ru> 4.6.1r-alt4
- add nemerle syntax (#10104)

* Thu Sep 15 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1r-alt3
- Updated file-type coloring (X-Stranger)
- Bugfixes:
    + Menu-file fix (#5007)
    + PO translation (#7582, patch from php-coder@)
    + 7zip extension support (#7962)

* Sat Aug 13 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1r-alt2
- Added file-type coloring (thanks to X-Stranger <x@interfax.by>)

* Mon Aug 01 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1r-alt1
- Release 4.6.1

* Mon Jul 11 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1a.20050606-alt1
- 4.6.1a
- New patches (RH):
    + updated UTF8
    + fish upload
    + command prompt fix

* Wed Jun 01 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1.20050601-alt1
- Bugfixes:
    + force subshell execution, forwardport (#6952)
    + question symbols in xterm title bar (#6945)
    + partially fixed codepage conversion (#6944)

* Thu May 19 2005 Kachalov Anton <mouse@altlinux.ru> 4.6.1.20050518-alt1
- 4.6.1 from CVS: 18 May 2005
- Bugfixes:
    + aterm generates symbols instead of cursor movement (#4548)
    + big files from zip archive doesn't show (#5428)
    + files copy failed via remote shell (#6806)
    + play video with mplayer or xine (#5052)
    + broken Grey Enter key (#1214) 
    + missed menu entry (#5007)
- Added:
    + UTF-8 support
    + SynCE VFS

* Tue Jun 29 2004 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt9
- fix iso extension (#4366, #4536)
- additional file types handling (#3334, #4443)
- fix date parsing in vfs (#4545)

* Wed Apr 07 2004 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt8
- fix security bugs (buffer overflow) and backport from CVS version.

* Mon Jan 19 2004 Stanislav Ievlev <inger@altlinux.org> 4.6.0-alt7.1
- fix security bugs.

* Mon Nov 03 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt7
- added .hh and .hpp files to Syntax highlight

* Wed Sep 03 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt6
- removed requires for cdrecord, cdparanoia and wget

* Mon Jul 21 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt5
- using links instead of lynx for viewing html
- added help file in cp1251 (#0002685)
- added DN-like coloration (thanks to Peter V. Chernikoff)

* Tue Apr 29 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt4
- added ISO extfs

* Tue Feb 18 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt3
- bugfix:
    + russian char in cp1251 locale not displayed (#000271)
    + problem with cp866 (#0002023)

* Mon Feb 10 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt2
- bugfix: mc doesn't give hostname to the terminal
- proper recognition of man pages
- wrapper creation temp dir on first startup fix

* Thu Jan 06 2003 Kachalov Anton <mouse@altlinux.ru> 4.6.0-alt1
- new version
- remove mcserv
- remove smbfs
- bugfix:
    + Eterm is considered to be a dumb terminal (#0000851)
    + doen't look inside ~/.terminfo (#0000907)
    + mc crashes on linux console when gpm server closes connection (#0001123)
    + not copyied russian char to command line (#0001208)
    + locale error (#0001550)
    + hostname resolve (#0002010)

* Thu Dec 26 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.5.5
- Fixed wrapper

* Thu Nov 28 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.5
- Rebuilt with latest CVS changes

* Thu Oct 31 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.4
- Rebuilt back with slang library

* Mon Oct 28 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.3
- Fixed gpm bug
- Rebuilt with latest CVS changes
- Rebuilt with ncurses library
- Turn on smbfs support

* Tue Sep 03 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.2
- Rebuild with latest CVS changes
- Fixed restoring mouse events under xterm

* Wed Aug 27 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.6.0-alt0.1
- Rebuild with latest CVS changes
- Fixed some bugs
- Version now 4.6.0pre1a

* Thu Aug 15 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.5.99a-alt3
- Rebuild with latest CVS changes

* Wed Jul 17 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.5.99a-alt2
- Rebuild with fixed libgpm

* Tue Jul 16 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.5.99a-alt1
- Build from snapshot
- Package gmc now removed
- Some spec cleanup

* Tue Apr 16 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.5.55-alt7
- Added --enable-largefile, thnx to sav

* Mon Apr 15 2002 Konstantin Volckov <goldhead@altlinux.ru> 4.5.55-alt6
- Removed umask patch

* Thu Feb 07 2002 AEN <aen@logic.ru> 4.5.55-alt5
- LANGUAGE variable not used anymore
- belarussian translation added
- build requires regenerated
- uk_UA.CP1251 tips added

* Tue Sep 24 2001 Kachalov Anton <mouse@altlinux.ru> 4.5.55-alt4
- Updated Russian translation - thanx to Andrew Borodin

* Tue Sep 11 2001 Konstantin Volckov <goldhead@altlinux.ru> 4.5.55-alt3
- Updated Russian translation - thanx to Andrew Borodin

* Sun Sep 09 2001 Konstantin Volckov <goldhead@altlinux.ru> 4.5.55-alt2
- Fix mc.hint for CP1251 locle
- Now we call links when view html's

* Tue Sep 04 2001 Konstantin Volckov <goldhead@altlinux.ru> 4.5.55-alt1
- 4.5.55
- Use recoding support fom mc
- Fixed Requires
- Show backup files by default now is on

* Thu Jun 21 2001 Konstantin Volckov <goldhead@linux.ru.net> 4.5.54-alt3.1
- Updated recode patch - added editor support & view search support

* Mon Jun 18 2001 Konstantin Volckov <goldhead@linux.ru.net> 4.5.54-alt3
- Fix Full 8 bit input to be on by default

* Thu Jun 14 2001 Konstantin Volckov <goldhead@linux.ru.net> 4.5.54-alt2
- Fixed cdparanoia requires
- Some spec cleanup

* Mon Jun 4 2001 Konstantin Volckov <goldhead@linux.ru.net> 4.5.54-alt1
- New mc version - 4.5.54
- Some new Cooker patches
- Fixed sources (bzip2 -> gz)
- Fixed recode patch
- Removed all entries in changelog before 01012001
- Added umask settings

* Thu Mar 15 2001 Konstantin Volckov <goldhead@linux.ru.net> 4.5.51-ipl11mdk
- Added recode patch
- Fix build with glibc-2.2.2 (time patch)
- Fixed name of po file
- Fixed build with new gtk