File tcsh.spec of Package tcsh

#
# spec file for package tcsh
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           tcsh
BuildRequires:  ncurses-devel
Url:            http://www.tcsh.org/
License:        BSD3c(or similar)
Group:          System/Shells
Requires:       gawk textutils
AutoReqProv:    on
Version:        6.17.02
Release:        2
Summary:        The C SHell
Source:         ftp.astron.com:/pub/tcsh/tcsh-6.17.02.tar.bz2
Source1:        nls-iconv
Source2:        bindkey.tcsh
Source3:        complete.tcsh
Patch:          tcsh-6.17.02.dif
Patch1:         tcsh-6.17.02-spelling.dif
Patch2:         tcsh-6.15.00-utf8.dif
Patch3:         tcsh-6.15.00-pipe.dif
Patch4:         tcsh-6.17.00-longjmp.dif
Patch5:         tcsh-6.16.00-norm-cmd.dif
Patch6:         tcsh-6.17.02-history.dif
Patch7:         tcsh-6.15.00-blanks.dif
Patch8:         tcsh-6.15.00-fullpath.dif
Patch9:         tcsh-6.17.02-multibyte.patch
Patch10:        tcsh-6.17.02-colorls.dif
Patch11:        tcsh-6.16.00-mailbox.dif
Patch12:        tcsh-6.17.02-catalogs.patch
Patch13:        tcsh-6.17.02-kanji.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Tcsh is an enhanced, but completely compatible, version of the Berkeley
UNIX C shell, csh(1). It is a command language interpreter usable as an
interactive login shell and a shell script command processor. It
includes a command-line editor, programmable word completion, spelling
correction, a history mechanism, job control, and a C-like syntax.



Authors:
--------
    Christos Zoulas <christos@deshaw.com>
    Scott Krotz <krotz@mot.com>

%prep
%setup
%patch1 -p0 -b .spell
%patch2 -p0 -b .utf8
%patch3 -p0 -b .pipe
%patch4 -p0 -b .longjmp
%patch5 -p0 -b .normcmd
%patch6 -p0 -b .history
### disabled for know, should work on os11.1 without
### %patch7 -p0 -b .blanks
%patch8 -p0 -b .fullpath
%patch9 -p1 -b .mb
%patch10 -p0 -b .colorls
%patch11 -p0 -b .mailbox
%patch12 -p1 -b .catalog
%patch13 -p0 -b .kanji
%patch -b .0
    sh $RPM_SOURCE_DIR/nls-iconv

%build
    CC=gcc
    CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -DBUFSIZE=8192 -pipe"
    export CC CFLAGS
%ifarch %ix86
    CPU=i586
%else
    CPU=${RPM_ARCH}
%endif
    ./configure --build=${CPU}-suse-linux \
	--prefix=/usr			\
	--bindir=/bin			\
	--sysconfdir=/etc		\
	--localstatedir=/var		\
	--sharedstatedir=%_datadir	\
	--infodir=%_infodir		\
	--mandir=%_mandir		\
	--libexecdir=/usr/%{_lib}/tcsh	\
	--disable-rpath			\
	--with-gnu-ld
    make
#
# requires a working terminal on stdin
#   make check
    rm -vf nls/*/set[0-9]*.*
    make catalogs

%install
    rm -rf $RPM_BUILD_ROOT
    for nls in nls/*.cat ; do
	msg=$nls
	nls=${nls##*/}
	nls=${nls%%.*}
	case "${nls}" in
	fi*)	nls=fi	    ;;
	fr*)	nls=fr	    ;;
	ge*)	nls=de	    ;;
	gr*)	nls=el	    ;;
	it*)	nls=it	    ;;
	ru*)	nls=ru	    ;;
	sp*)	nls=es	    ;;
	uk*)	nls=uk_UA   ;;
	C)	continue    ;;
	esac
	dir=$RPM_BUILD_ROOT/usr/share/locale/${nls}/LC_MESSAGES
	mkdir -p -m 0755 $dir
	install -m 0444 ${msg} ${dir}/tcsh
    done
    make DESTDIR=$RPM_BUILD_ROOT install
    make DESTDIR=$RPM_BUILD_ROOT install.man
    mkdir -p $RPM_BUILD_ROOT%{_docdir}/tcsh
    install -m 0444 FAQ $RPM_BUILD_ROOT%{_docdir}/tcsh/FAQ.tcsh
    mkdir -p $RPM_BUILD_ROOT/etc/profile.d/
    mkdir -p $RPM_BUILD_ROOT/usr/bin
    install -m 644 $RPM_SOURCE_DIR/bindkey.tcsh  $RPM_BUILD_ROOT/etc/profile.d/
    install -m 644 $RPM_SOURCE_DIR/complete.tcsh $RPM_BUILD_ROOT/etc/profile.d/
    rm -f $RPM_BUILD_ROOT/bin/csh
    rm -f $RPM_BUILD_ROOT/usr/bin/csh
    rm -f $RPM_BUILD_ROOT/usr/bin/tcsh
    rm -f $RPM_BUILD_ROOT%{_mandir}/man1/csh.*
    ln -sf tcsh           $RPM_BUILD_ROOT/bin/csh
    ln -sf tcsh.1.gz      $RPM_BUILD_ROOT%{_mandir}/man1/csh.1.gz
    ln -sf ../../bin/tcsh $RPM_BUILD_ROOT/usr/bin/csh
    ln -sf ../../bin/tcsh $RPM_BUILD_ROOT/usr/bin/tcsh

%clean
    rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%dir %{_docdir}/tcsh
/bin/csh
/bin/tcsh
%config /etc/profile.d/bindkey.tcsh
%config /etc/profile.d/complete.tcsh
/usr/bin/csh
/usr/bin/tcsh
%doc %{_docdir}/tcsh/FAQ.tcsh
%doc %{_mandir}/man1/csh.1.gz
%doc %{_mandir}/man1/tcsh.1.gz
%{_datadir}/locale/*/LC_MESSAGES/tcsh

%changelog