%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 makepdf(%1)	latex %1 && latex %1 && latex %1 && dvipdfm %1;

Summary: TeX Live macro packages of writing manuscript for the journal of BUTSURI (the Journal of the Physical Society of Japan)
Summary(ja): TeX Live で使うマクロパッケージ 日本物理学会論文原稿作成用
Name: texmacro-jps
Version: 1.2.0
Release: 4%{?_dist_release}
BuildArch: noarch
Source0: http://wwwsoc.nii.ac.jp/jps/jpsj/style/jpsj2.tar.gz
URL: http://wwwsoc.nii.ac.jp/jps/jps/topics/j_move.html
License: The Institue of Pure and Applied Physics
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 journal of BUTSURI 
(the Journal of the Physical Society of Japan)
Users can use this macro specifying jpsj2 class.
Including
	jpsj2.cls : Version 1.2 (May 8, 2003)


%description -l ja
日本物理学会誌論文原稿作成用の TeX Live で用いる追加マクロパッケージです.
jpsj2 クラスを指定してしようします。
以下のマクロが含まれています。
	jpsj2.cls : Version 1.2 (May 8, 2003)

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

%build

# latex injpsj2
# latex injpsj2
# for i in *.dvi
# do
#   dvips $i
# done
%makepdf injpsj2

mv template.tex template.bak
nkf -d template.bak > template.tex

%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}/tex/latex/jpsj2
mv *.cls %{build_texmf}/tex/latex/jpsj2


%post
%{exec_texhash}
exit 0

%postun
%{exec_texhash}
exit 0

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc *.{tex,pdf,txt} dummy.eps
%{texmf}/tex/latex/jpsj2/

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

* Sun Mar 29 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.2.0-3
- new versioning policy
- spec in utf8
- created injpsj2.pdf

* Fri Aug  4 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2-0vl2
- s/Copyright/License/

* Wed May 25 2005 Masaki Kawamura <kawamura@is.sci.yamaguchi-u.ac.jp> 1.2
- update to 1.2 

* Sat Jan 18 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.1.1-0vl2
- update jpsj2.tar.gz

* Thu Jul 18 2002 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.1.1-0vl1
- update to 1.1.1

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