Summary: BookView is a NDTP client.
Summary(ja): BookView - NDTP クライアント
Name: bookview
Version: 3.2
Release: 1%{?_dist_release}
Source: ftp://ftp.sra.co.jp/pub/net/ndtp/bookview/%{name}-%{version}.tar.gz
Source1: %{name}-redhat.tar.gz
License: GPL
Group: Applications/Text
Url: http://www.sra.co.jp/people/m-kasahr/bookview/
Buildarch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: tcl >= 8.0.5_jp
Requires: tk >= 8.0.5_jp
BuildPrereq: tcl >= 8.4
%define tkpath /usr/lib/tk8.0jp
%define appsdir /etc/X11/applnk
%define docpath %{_docdir}/%{name}-%{version}

%description
BookView is a NDTP (Network Dictionary Transfer Protocol) client 
written in Tcl /Tk. It requires Tcl/Tk8.0jp or Tcl/Tk8.3 and higher
 (`jp' means `Japanized version').

#'

%description -l ja
BookView は CD-ROM 書籍を読むための、Tcl/Tkで書かれた NDTP 
(Network Dictionary Transfer Protocol) クライアントです。
動作させるには Tcl/Tk8.0jp あるいは Tcl/Tk8.3 以上が必要です。

%prep
rm -rf $RPM_BUILD_ROOT

%setup -q -a 1

# correct documents
for i in doc/bookview.texi doc-ja/bookview-ja.texi;do
    mv $i $i.org
    cat $i.org | sed \
	-e 's:/usr/local/etc/bookview.conf:/etc/%{name}/bookview.conf:g' \
	-e 's:/usr/local:%{_prefix}:g' \
	> $i 
done

%build
./configure --prefix=%{_prefix}       \
    --sysconfdir=/etc/%{name}       \
    --infodir=%{_infodir}
make

%install
make DESTDIR=$RPM_BUILD_ROOT install
install -d $RPM_BUILD_ROOT/etc/%{name}
install -m 644 %{name}.conf  $RPM_BUILD_ROOT/etc/%{name}
install -d $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -m 644 *.xpm  $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -d $RPM_BUILD_ROOT%{appsdir}/Applications
install -m 644 *.desktop  $RPM_BUILD_ROOT%{appsdir}/Applications

echo "Categories=Application;Utility;" >> \
    $RPM_BUILD_ROOT%{appsdir}/Applications/BookView.desktop

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -x /bin/grep -a -f /etc/services ] ; then
grep -q "^ndtp" /etc/services || \
echo "ndtp          2010/tcp       # added by bookview RPM" >>  /etc/services
fi

if [ -f %{tkpath}/kinput.tcl -a -x /bin/grep -a -x /bin/sed ]; then
    if ! grep -q 'set KIStart .*<Shift-space>'  %{tkpath}/kinput.tcl; then
	cat %{tkpath}/kinput.tcl  | \
	sed 's/set KIStart "/set KIStart "<Shift-space> /' \
	     > %{tkpath}/kinput.tmp
	mv  %{tkpath}/kinput.tcl %{tkpath}/kinput.tcl.rpmsave
	echo Original file is saved as %{tkpath}/kinput.tcl.rpmsave
	mv  %{tkpath}/kinput.tmp %{tkpath}/kinput.tcl
    fi
fi

%files
%defattr(-,root,root)
%doc [ACNR]* doc*/help*.txt
%{_bindir}/*
%dir /etc/%{name}
%config(missingok) /etc/%{name}/*
%{_infodir}/*
%{_datadir}/bookview/*
%{_datadir}/pixmaps/*.xpm
%config(missingok) %{appsdir}/Applications/*.desktop

%changelog
* Fri Sep 19 2008 Shu KONNO <owa@bg.wakwak.com> 3.2-1vl5
- applied new versioning policy, spec in utf-8

* Sun Dec  5 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.2-0vl3
- fixed .desktop 

* Tue Nov 23 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.2-0vl2
- fixed spec file encoding (it was utf-8...)
- fixed Group to Applications/Text

* Wed Jun 25 2003 Masaki Shinomiya <shino@pos.to> 3.2-0vl1
- new upstream release supports Tcl/Tk-8.3 and higher
- noarch, omit documents for install
- buildrequire tcl >= 8.4 to prevent to rebuild on Vine 2.x
-
- if you want to use this version on Vine 2.x,
- just install noarch.rpm build with tcl >= 8.4.
- it may works.

* Sat Jun 14 2003 Masaki Shinomiya <shino@pos.to> 3.1.1-0vl1
- post install script to modify services and kinput.tcl
- configure with specifying sysconfdir and infdir
- files, add luncher, description ja, requires, bookview.conf
- requires, buildprereq

* Sun May 20 2001 UECHI Yasumasa <uh@u.dhis.portside.net>
- 1st release

