%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;

# \ProvidesClass{ipsjpapers}[2010/10/28 ver 3.02]
%define reldate 20101028

Summary: TeX Live macro packages of writing manuscript for the Information Processing Society of Japan
Summary(ja): TeX Live で使うマクロパッケージ 情報処理学会論文原稿作成用
Name: texmacro-ipsj
Version: 3.02
Release: 1%{?reldate:.%reldate}%{?_dist_release}
BuildArch: noarch
# $ sha1sum ipsj-unix.tgz
# 951c81020f12d7b43cc65e1ca9c9910b85f3a1cf  ipsj-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
BuildRequires: texlive-common
Requires: texlive-common
Requires(post): texlive
Requires(postun): texlive
Buildroot: %{_tmppath}/%{name}-%{version}-root

Distribution: Vine Linux
Vendor: Project Vine

%description
TeX Live 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
情報処理学会論文原稿作成用の TeX Live 追加マクロパッケージです。
ipsjpapers クラスを指定して使用します。

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

%prep

%__rm -rf %{name}-%{version}
%__mkdir_p %{name}-%{version}
%__tar -C %{name}-%{version} -xvf %{SOURCE0}
%setup -D -T -n %{name}-%{version}/ipsj-unix

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

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

%install
%__rm -rf %{buildroot}

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

%__install -p -m644 *.{cls,sty} %{build_texmf}/ptex/platex/ipsj
%__install -p -m644 *.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 *.{tex,bib,pdf}
%{texmf}/ptex/platex/ipsj
%{texmf}/bibtex/bst/ipsj

%changelog
* Sun Jul 03 2011 Munehiro Yamamoto <munepi@vinelinux.org> 3.02-1.20101028
- update source to ver 3.02 2010/10/28 (ipsjpapers.cls)
- TeX Live 2009

* 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