%define exec_texhash	[ -x %{_prefix}/bin/texhash ] && /usr/bin/env - %{_prefix}/bin/texhash 2> /dev/null
%define texmf		%{_prefix}/share/texmf
%define build_texmf	%{buildroot}%{texmf}

%define altplatex	platex --kanji=euc
%define makepdf(%1)	%altplatex %1 && %altplatex %1 && %altplatex %1 && dvipdfmx %1;

Summary: TeX Live macro packages of writing manuscript for the Transactions of Human Interface Society
Summary(ja): TeX Live で使うマクロパッケージ ヒューマンインタフェース学会論文原稿作成用
Name: texmacro-his
Version: 1.0
Release: 4%{?_dist_release}
BuildArch: noarch
Source0: http://www.his.gr.jp/download/paper/latex2e-euc/hisset.tar.gz
Source1: http://www.his.gr.jp/download/meeting/latex2e-euc/hiskenset2e.tar.gz
# hissympset.gz は hissympset.tar.gz にリネームしてあります.
# Source2: http://www.his.gr.jp/download/his/latex2e-euc/hissympset.gz
Source2: http://www.his.gr.jp/download/his/latex2e-euc/hissympset.tar.gz
URL: http://www.his.gr.jp/download/index.html
License: distributable
Group:  Applications/Publishing
BuildRequires: texlive-common
Requires: texlive-common
Requires(post): texlive
Requires(postun): texlive
Buildroot: %{_tmppath}/%{name}-%{version}-root

Distribution: Vine Linux
Vendor: Project Vine

%description
teTeX macro packages of writing manuscript for the journal of 
the Transactions of Human Interface Society
Users can use this macro specifying "his" class (in Japanese) 
or "ehis"  class (in English).
Including the following class files: 
	his.cls
	ehis.cls
	hisken.cls
	ehisken.cls
	hissymp.cls
	ehissymp.cls

%description -l ja
ヒューマンインタフェース学会論文原稿作成用の tetex で用いる追加マクロパッケージです.
his クラスを指定して使用します。
英文は ehis クラスを指定します。
以下のクラスファイルが含まれています。
	his.cls
	ehis.cls
	hisken.cls
	ehisken.cls
	hissymp.cls
	ehissymp.cls

%prep
%setup -q -c -n %{name}-%{version} -a 1 -a 2

%build

(cd hisset
%__sed -i s/dviout/dvips/ format.tex
%makepdf format
)
(cd hiskenset_2eeuc
%makepdf ken
)
(cd hissympset_euc
%makepdf symptebiki
)

%install
%__rm -rf %{buildroot}

#InstallClass(){
#target=$1; shift
#(cd $target
#bzip2 -dc ${RPM_SOURCE_DIR}/$target.tar.bz2 | tar xf - -C %{build_texmf}/packages/
#rm %{build_texmf}/packages/$target/*.{ins,def,bst,rtx,sty,cls,ltx,fnt,cyr,fdd} || :
#if [ -f src/$target.ins ]; then
#    cp src/* .
#fi
#latex $target.ins
#mkdir -p %{build_texmf}/tex/latex/$target
#cp *.{ldf,sty,def,cls,rtx} %{build_texmf}/tex/latex/$target || :
#if [ ! -z "$*" ]; then 
#    cp -d $* %{build_texmf}/tex/latex/$target || :
#fi
#if [ -n "`ls *.bst`" ]; then
#    mkdir -p %{build_texmf}/bibtex/bst/$target
#    cp *.bst %{build_texmf}/bibtex/bst/$target || :
#fi
#)
#}
#
#mkdir -p %{build_texmf}/packages/

%__mkdir_p %{build_texmf}/ptex/platex/his
%__cp -af */*.cls %{build_texmf}/ptex/platex/his/

%post
%{exec_texhash}
exit 0

%postun
%{exec_texhash}
exit 0

%clean
%__rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc */*.{tex,pdf} hisset/fig1.* hissympset_euc/fig1.bb
%{texmf}/ptex/platex/his/

%changelog 
* Sun Jul 03 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-4
- TeX Live 2009

* Sun Mar 29 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-3
- source update as his.cls Version 1.0 2006-12-15
- new versioning policy
- spec in utf8
- s/Copyright/License/

* Sat Jan 18 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl2
- update as of 2002.12.6

* Mon Sep 10 2001 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl1
- first release