%define exec_texhash	[ -x %{_bindir}/texhash ] && %{_bindir}/env - %{_bindir}/texhash 2> /dev/null
%define texmf		%{_datadir}/texmf
%define build_texmf	%{buildroot}%{texmf}

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

%define reldate 20090225

Summary: teTeX macro packages of writing manuscript for the Information Processing Society of Japan
Summary(ja): teTeX で使うマクロパッケージ 情報処理学会論文原稿作成用
Name: texmacro-ipsj
Version: 1.0.%{reldate}
Release: 1%{?_dist_release}
BuildArch: noarch
#Source0: ftp://ftp.ipsj.or.jp/pub/toukou/ipsj-sty-unix.tgz
Source0: ftp://ftp.ipsj.or.jp/pub/toukou/ipsj-unix.tgz
URL: http://www.ipsj.or.jp/08editt/journal/shippitsu/wabun.html
License: distributable
Group:  Applications/Publishing
BuildPrereq: tetex
Buildroot: %{_tmppath}/%{name}-%{version}-root

Distribution: Vine Linux
Vendor: Project Vine

%description
teTeX macro packages of writing manuscript for the
Information Processing Society of Japan.
Users can use this macro specifying "ipsjpapers" class.

Including
	ipsjcommon.sty
	ipsjdrafts.sty
	ipsjpapers.cls
	ipsjpapers.sty
	ipsjsort-e.bst
	ipsjsort.bst
	ipsjunsrt-e.bst
	ipsjunsrt.bst      

%description -l ja
情報処理学会論文原稿作成用の teTeX 追加マクロパッケージです。
ipsjpapers クラスを指定して使用します。

このパッケージには以下のマクロが含まれています。
	ipsjcommon.sty
	ipsjdrafts.sty
	ipsjpapers.cls
	ipsjpapers.sty
	ipsjsort-e.bst
	ipsjsort.bst
	ipsjunsrt-e.bst
	ipsjunsrt.bst      

%prep
%setup -q -c -n %{name}-%{version}/

%build

pushd ipsj_UNIX

for i in sample dsample esample desample ; do 
    %makepdf $i
done

popd

%__rm -f *.{aux,dvi,log,toc,bbl,blg,end}

cd -

%install
%__rm -rf %{buildroot}

%__mkdir_p %{build_texmf}/ptex/platex/ipsj
%__mkdir_p %{build_texmf}/bibtex/bst/ipsj

%__install -p -m644 ipsj_UNIX/*.{cls,sty} %{build_texmf}/ptex/platex/ipsj
%__install -p -m644 ipsj_UNIX/*.bst %{build_texmf}/bibtex/bst/ipsj

%post
%{exec_texhash}
exit 0

%postun
%{exec_texhash}
exit 0

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc ipsj_UNIX/README ipsj_UNIX/*.{tex,bib,pdf}
%{texmf}/ptex/platex/ipsj
%{texmf}/bibtex/bst/ipsj

%changelog
* Sun Mar 29 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0.20090225-1
- update source to 20090225
- new versioning policy
- spec in utf8

* Thu Dec 21 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.20060418-0vl1
- update source to 20060418
- use release date as micro version

* Sat Jun 25 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0-0vl5
- update source
- update source-URL
- docs
  - compile only with native mode
  - convert to pdf instead of ps

* Sun Apr 25 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0-0vl4
- s/Copyright/License/
- update URL
- use %%{_bindir} instead of %%{_prefix}/bin
- use %%{_datadir} instead of %%{_prefix}/share
- compile {sample,esample}.tex with platex209
- fix desample2e.tex to include esample.tex (Patch0)

* Thu Jan 30 2003 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl3
- fix file access permissions
- use %%{texmf} at %%files instead of /usr/share/texmf

* Sat Jan 18 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl2
- compile docs

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