%define texmf           %{_prefix}/share/texmf
%define build_texmf     %{buildroot}%{texmf}
%define prosper_ver	1.00.4
%define powerdot_ver	1.3
%define xkeyval_ver	2.5d
%define beamer_ver	3.07
%define pgf_ver		2.00
%define pict2e_ver	0.2x
%define jsclasses_ver	090826
%define jlisting_ver	0.2
%define breqnver	094
%define hyperref_ver	6.78r

%define bkmk2uni	convert-bkmk2uni

%define exec_texhash	[ -x %{_bindir}/texhash ] && %{_bindir}/env - %{_bindir}/texhash 2> /dev/null
%define exec_updmap	[ -x %{_bindir}/updmap-sys ] && %{_bindir}/env - %{_bindir}/updmap-sys --nostop 2> /dev/null

Summary: Extra macro packages for tetex
Summary(ja): tetex で使うマクロパッケージ集
Name: tetex-macros
Obsoletes: pLaTeX2e_Macros
Version: 3.0
Release: 7%{?_dist_release}
%define knjfonts kanjifonts-3.1
Source0: %{knjfonts}.tar.bz2
Source3: ftp://ftp.ams.org/pub/tex/breqn%{breqnver}.tgz
#Source4: prosper-%{prosper_ver}.tar.bz2
Source5: http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/jsclasses-%{jsclasses_ver}.zip
Source6: http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/index.html
Source7: ftp://ftp.ascii.co.jp/pub/TeX/ascii-ptex/jvf/morisawa.tar.gz
Source12: http://prdownloads.sourceforge.jp/mytexpert/26068/jlisting.sty.bz2

## prosper
## http://sourceforge.net/projects/prosper/
Source20: http://tug.ctan.org/get/macros/latex/contrib/prosper.zip
Source21: http://prosper.cvs.sourceforge.net/viewvc/*checkout*/prosper/prosper/prosper.cls
#Source25: ftp://fsci.fuk.kindai.ac.jp/pub/ptex/utils/bkmk2uni.c.gz
#Source25: http://www.rmatsumoto.org/tex-ps-pdf/convert-euc.txt

## powerdot
## http://stuwww.uvt.nl/~hendri/Downloads/powerdot.html
## requires: xkeyval
## http://stuwww.uvt.nl/~hendri/Downloads/xkeyval.html
Source30: http://tug.ctan.org/get/macros/latex/contrib/powerdot.zip
Source31: http://tug.ctan.org/get/macros/latex/contrib/xkeyval.zip

## beamer
## http://latex-beamer.sourceforge.net/
## requires: pgf
## http://pgf.sourceforge.net/
Source40: http://dl.sourceforge.net/sourceforge/latex-beamer/latex-beamer-%{beamer_ver}.tar.gz
Source41: http://dl.sourceforge.net/sourceforge/pgf/pgf-%{pgf_ver}.tar.gz

## pict2e
Source50: http://tug.ctan.org/get/macros/latex/contrib/pict2e.zip

# ### oberdiek
# Source98: http://tug.ctan.org/get/install/macros/latex/contrib/oberdiek.tds.zip

# ## hyperref
# ## http://tug.org/applications/hyperref/
# Source99: http://tug.org/applications/hyperref/ftp/hyperref.tds.zip

License: distributable
Group:  Applications/Publishing
Buildroot: %{_tmppath}/%{name}-root
Requires: tetex perl
BuildRequires: tetex jvf nkf unzip
BuildArch: noarch
Distribution: Vine Linux
Vendor: Project Vine


%define list_macros \
	jsclasses-%{jsclasses_ver} \
	jlisting-%{jlisting_ver} \
	prosper-%{prosper_ver} \
	powerdot-%{powerdot_ver} \
	xkeyval-%{xkeyval_ver} \
	beamer-%{beamer_ver} \
	pgf-%{pgf_ver} \
	pict2e-%{pict2e_ver} \
	breqn.sty \
	flexisym.sty \
	cmbase.sym \
	msabm.sym \
	mathstyle.sty

%description
extra macro packages for tetex, including 
	kanjifonts-3.1 (for Ricoh Fonts/DynaLab Fonts and JIS font metric)
%{list_macros}

# This package contained a perl script 
#   http://www.rmatsumoto.org/tex-ps-pdf/convert-euc.txt

%description -l ja
tetex で用いる追加マクロパッケージ集です. 以下のマクロを収録しています.
	kanjifonts-3.1 (Vine Linux 3.1R 付属のリコーフォント/ダイナフォントやJISフォントメトリックを使う)
%{list_macros}

# このパッケージには prosper, powerdot 用に 
# PDF ブックマークの文字化けを修正するための perl スクリプト
#   http://www.rmatsumoto.org/tex-ps-pdf/convert-euc.txt
# を同梱しています．

%prep
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
#%%setup -q -a 3 -a 4 -a 7 -c -n ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}
%setup -q -a 3 -a 7 -a 20 -a 30 -a 31 -a 40 -a 41 -a 50 -c -n %{name}-%{version}

(mkdir jsclasses
cd jsclasses
mkdir jsclasses
unzip -a -qq %{SOURCE5}
cp -p %{SOURCE6} ./jsclasses/README.html
)

(cd prosper
    mv doc prosper
    mv FAQ AUTHORS NEWS README TODO ChangeLog INSTALL prosper/
    mv seminar-bg2-lepennec.fix prosper/
)

(cd xkeyval
    mv doc xkeyval
    mv README source/xkeyval.dtx xkeyval/
)

(cd powerdot
    mv doc powerdot
    mv README source/powerdot.dtx powerdot/
)

(cd latex-beamer-%{beamer_ver}
    mv doc beamer
    mv AUTHORS FILES README ChangeLog INSTALL TODO beamer/
    mv examples solutions beamer/
)

(cd breqn%{breqnver}
mv readme-%{breqnver}.txt readme-breqn%{breqnver}.txt
)

# get rid of unwanted files
find . -type d -name CVS | xargs -r rm -frv
find . -type f -name .cvsignore | xargs -r rm -fv

(cd jsclasses
mkdir tmp
for i in *.*; do nkf $i > tmp/$i; done
mv tmp/* .
rmdir tmp
)


%build

(cd jsclasses
platex jsclasses.dtx
platex jsclasses.dtx
platex okumacro.dtx
platex okumacro.dtx
platex okuverb.dtx
platex okuverb.dtx
platex morisawa.dtx
platex morisawa.dtx
cp *.dvi jsclasses
)

(cd pict2e
    latex pict2e.ins
    cp -a pict2e-example.cfg pict2e.cfg
    latex p2e-drivers.dtx
    latex p2e-drivers.dtx
    latex p2e-drivers.dtx
    latex pict2e.dtx
    latex pict2e.dtx
    latex pict2e.dtx
    mkdir pict2e
    mv README *.txt *.dvi *.pdf pict2e
)

%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/
#InstallClass geometry

# install kanjifonts
mkdir -p %{build_texmf}/ptex/platex/generic
mv %{knjfonts}/*.sty %{build_texmf}/ptex/platex/generic
mv %{knjfonts}/*.def %{build_texmf}/ptex/platex/generic

# install prosper
mkdir -p %{build_texmf}/tex/latex/prosper/{contrib,img}
mkdir -p %{buildroot}%{_bindir}
mv prosper/*.{sty,cls} %{build_texmf}/tex/latex/prosper
mv prosper/contrib/* %{build_texmf}/tex/latex/prosper/contrib
mv prosper/img/*.{ps,gif} %{build_texmf}/tex/latex/prosper/img
(cd %{build_texmf}/tex/latex/prosper
    %__mv prosper.cls %{build_texmf}/tex/latex/prosper/prosper15.cls
)
%__cp -a %{SOURCE21} %{build_texmf}/tex/latex/prosper/
# nkf --utf8 %{SOURCE25} | \
#     sed -e "s@^#!/usr/local/bin/perl5 -w@#!/usr/bin/perl -w@" > \
#     %{buildroot}%{_bindir}/%{bkmk2uni}
# chmod 755 %{buildroot}%{_bindir}/%{bkmk2uni}

# install xkeyval
mkdir -p %{build_texmf}/tex/latex/xkeyval/
mv xkeyval/run/* %{build_texmf}/tex/latex/xkeyval/

# install powerdot
mkdir -p %{build_texmf}/tex/latex/powerdot/
mv powerdot/run/* %{build_texmf}/tex/latex/powerdot/

# install pgf
for DIR in context generic latex plain;
do
    %__mkdir_p %{build_texmf}/tex/${DIR}
    %__mv pgf-%{pgf_ver}/${DIR}/pgf %{build_texmf}/tex/${DIR}/
done

# install beamer
%__mkdir_p %{build_texmf}/tex/latex/beamer
(cd latex-beamer-%{beamer_ver}
    %__mv base emulation extensions themes \
	%{build_texmf}/tex/latex/beamer/
)

# install pict2e
%__mkdir_p %{build_texmf}/tex/latex/pict2e
%__mv pict2e/*.{def,sty,cfg} %{build_texmf}/tex/latex/pict2e


# # install oberdiek
# %__mkdir_p %{build_texmf}/tex/{generic,latex}/oberdiek
# %__mv tex/generic/oberdiek/* %{build_texmf}/tex/generic/oberdiek/
# %__mv tex/latex/oberdiek/* %{build_texmf}/tex/latex/oberdiek/

# # install hyperref
# %__mkdir_p %{build_texmf}/tex/latex/hyperref
# %__mv tex/latex/hyperref/* %{build_texmf}/tex/latex/hyperref/

# install breqn
mkdir -p %{build_texmf}/tex/latex/breqn/
install -m 644 breqn%{breqnver}/*.{sty,sym} %{build_texmf}/tex/latex/breqn/

# install jsclasses
(cd jsclasses
mkdir -p %{build_texmf}/ptex/platex/js
cp -fp *.dtx *.ins *.cls *.sty %{build_texmf}/ptex/platex/js/
)

# install jlisting
mkdir -p %{build_texmf}/ptex/platex/jlisting
%__install -m 644 %{SOURCE12} %{build_texmf}/ptex/platex/jlisting/
bunzip2 %{build_texmf}/ptex/platex/jlisting/jlisting.sty.bz2


# install MORISAWA basic 5 fonts
#mkdir -p %{build_texmf}/dvips/config/extmap
mkdir -p %{build_texmf}/fonts/tfm/ptex
mkdir -p %{build_texmf}/fonts/tfm/dvips
mkdir -p %{build_texmf}/fonts/vf/ptex
#mv morisawa/morisawa.map %{build_texmf}/dvips/config/extmap/
mv morisawa/tfm/ptex/* %{build_texmf}/fonts/tfm/ptex/
mv morisawa/tfm/dvips/* %{build_texmf}/fonts/tfm/dvips/
mv morisawa/vf/* %{build_texmf}/fonts/vf/ptex/

%post
%{exec_texhash}
%{exec_updmap}
exit 0

%postun
if [ "$1" = 0 ]; then
    %{exec_texhash}
    %{exec_updmap}
fi
exit 0

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc %{knjfonts}
%doc prosper/prosper
%doc xkeyval/xkeyval
%doc powerdot/powerdot
%doc pgf-%{pgf_ver}/doc/generic/pgf
%doc latex-beamer-%{beamer_ver}/beamer
%doc pict2e/pict2e
#%doc doc/latex/oberdiek
#%doc doc/latex/hyperref
%doc jsclasses/jsclasses
%doc breqn%{breqnver}/*.{dvi,txt}
#%{_bindir}/%{bkmk2uni}
%{texmf}/ptex/platex/generic/kanjifonts.sty
%{texmf}/ptex/platex/generic/*.def
%{texmf}/tex/latex/prosper/
%{texmf}/tex/latex/xkeyval/
%{texmf}/tex/latex/powerdot/
%{texmf}/tex/*/pgf/
%{texmf}/tex/latex/beamer/
%{texmf}/tex/latex/pict2e/
#%{texmf}/tex/*/oberdiek/
#%{texmf}/tex/latex/hyperref/
%{texmf}/tex/latex/breqn/
%{texmf}/ptex/platex/js
%{texmf}/ptex/platex/jlisting
%{texmf}/fonts/vf/ptex/*
%{texmf}/fonts/tfm/ptex/*
%{texmf}/fonts/tfm/dvips/*
#%{texmf}/dvips/config/extmap/morisawa.map


%changelog
* Mon Oct 12 2009 Munehiro Yamamoto <munepi@vinelinux.org> 3.0-7
- added BuildRequires: unzip
- updated jsclasses to 090826
- updated pict2e to 0.2x

* Sun May 17 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 3.0-6
- dropped epsbox.sty, eclepsf.sty 
  (bacause there style files for platex209 are obsolete)

* Fri May 15 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 3.0-5
- added jlisting v0.2
- defined list_macros
  - used %%{list_macros} in %%description and %%description -l ja

* Thu May 14 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 3.0-4
- dropped convert-euc.txt

* Sat May 09 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 3.0-3
- updated prosper
  - added some contrib themes from CTAN
  - added prosper.cls v1.6 from CVS HEAD
  - added a perl script: convert-euc.txt
- added powerdot v1.3
  - added xkeyval v2.5d
- added beamer v3.07
  - added pgf v2.00
- added pict2e v0.2w

* Sat May 09 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 3.0-2
- updated jsclasses to 20090222
- updated jsclasses/index.html to 2009-02-22
- removed /usr/share/texmf/dvips/config/extmap/morisawa.map (See [BTS:524])

* Wed Sep 03 2008 Shu KONNO <owa@bg.wakwak.com> 3.0-1vl5
- applied new versioning policy, spec in utf-8

* Mon Oct 08 2007 KOBAYASHI Taizo <tkoba@vinelinux.org> 3.0-0vl3
- update jsclasses/index.html to 2006-11-06.

* Fri May 19 2006 KOBAYASHI Taizo <tkoba@vinelinux.org> 3.0-0vl2
- update jsclasses/index.html to 2006-02-12.

* Sun Nov 06 2005 KOBAYASHI Taizo <tkoba@vinelinux.org> 3.0-0vl1
- update jsclasses/index.html to 2005-10-26.

* Sat Jun 18 2005 KOBAYASHI Taizo <tkoba@vinelinux.org> 3.0-0vl0.1
- update jsclasses/index.html to 2005-4-30.
- added breqn

* Tue Jan 18 2005 KOBAYASHI Taizo <tkoba@vinelinux.org> 2.0-0vl7
- update jsclasses/index.html to 2004-12-29.

* Mon Jan 17 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0-0vl6
- add missing files in kanjifonts-3.0

* Sun Jan 16 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0-0vl6
- update to kanjifonts.sty-3.0.

* Mon Nov 29 2004 KOBAYASHI Taizo <tkoba@vinelinux.org> 2.0-0vl4
- update jsclasses/index.html to 2004-11-03.

* Sat Oct 16 2004 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> 2.0-0vl3
- update jsclasses/index.html to 2004-09-27.

* Sat Apr 17 2004 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> 2.0-0vl2
- update jsclasses/index.html to 2004-02-25.
- added eclepsf.sty.
- removed epsf.sty (symlink to epsbox.sty).
- removed geometry, which is in tetex-2.0.

* Fri Apr 18 2003 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> 2.0-0vl1
- update jsclasses/index.html to 2003-04-18.
- added morisawa.dvi.

* Fri Mar 14 2003 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> 2.0-0t2
- update jsclasses/index.html to 2003-03-06

* Mon Feb  3 2003 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> 2.0-0t1
- remove natbib, which is in tetex-2.0
- let version number same as tetex
- added Requires: tetex

* Sat Jan 18 2003 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl9
- update jsclasses/index.html to 2003-01-16

* Mon Jan 13 2003 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl8
- update jsclasses to 2003-01-05
- update index.html to 2003-01-12

* Thu Nov 28 2002 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl7
- update jsclasses and index.html to 2002-11-27

* Sun Nov 03 2002 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl6
- update jsclasses and index.html to 2002-11-01

* Thu Oct 17 2002 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl5
- oops, packager was incorrect

* Mon Jul 15 2002 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl4
- update jsclasses to 2002-06-29
- update index.html to 2002-07-03

* Sun Apr 28 2002 KAZUKI SHIMURA <rito@pos.to> 1.1-0vl3
- update jsclasses to 2002-04-21
- update index.html to 2002-04-09

* Tue Apr 16 2002 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.1-0vl2
- added MORISAWA basic 5 fonts

* Mon Mar 25 2002 Jun Nishii <jun@vinelinux.org> 1.1-0vl1
- update to kanjifonts-1.1

* Thu Feb 07 2002 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl11
- update jsclasses and index.html to 2002-02-07

* Tue Jan 31 2002 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl10
- update jsclasses and index.html to 2002-01-27
- fix typo in changelog

* Fri Jan 25 2002 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl9
- update jsclasses and index.html to 2002-01-18

* Tue Dec 18 2001 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl8
- update index.html (jsclasses)

* Sat Dec 15 2001 KAZUKI SHIMURA <rito@pos.to> 1.0-0vl7
- update jsclasses to 2001-11-29

* Sun Sep 16 2001 IWAI Masaharu <iwaim@cc.mbn.or.jp> 1.0-0vl6
- fixed spec file for Prosper and jsclasses
- use RPM macro in %files
- added BuildPrereq: jvf

* Mon Sep 10 2001 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl5
- move revtex4 to texmacro-aps package

* Sun Sep  9 2001 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl4
- added prosper jsclasses

* Mon Sep  6 2001 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.0-0vl3
- added revtex4 natbib

* Mon Sep  3 2001 Jun Nishii <jun@vinelinux.org> 1.0-0vl2
- remove prereq tetex to avoid dependency-loop

* Wed Aug  1 2001 Jun Nishii <jun@vinelinux.org>
- tetex-macros-1.0-0vl1

* Fri Jan 21 2000 Jun Nishii <jun@vinelinux.org>
- 2.0-2
- added kanjifonts-1.0 and removed jisfontsmetric

* Sun Jan  9 2000 Jun Nishii <jun@vinelinux.org>
- 2.0-1
- install ldf in babel

* Sat Jan  8 2000 Jun Nishii <jun@vinelinux.org>
- added jisfontmetric.tex

* Fri Oct 29 1999 Norihito Ohmori <ohmori@flatout.org>
- change group.

* Sun Oct 17 1999 Jun Nishii <jun@flatout.org>
- added babel

* Fri Aug 27 1999 Jun Nishii <jun@flatout.org>
- added hoekwater

* Mon Aug 3 1999 Jun Nishii <jun@flatout.org>
- added psfrag

* Mon Jun 21 1999 Jun Nishii <jun@flatout.org>
- added psnfss
- Change directory tree according to the suggestion by Dr.Okumura.
- remove many files from packages directory except documentations
- disable mktexlsr and erase ls-R

* Tue Feb 16 1999 Jun Nishii <jun@flatout.org>
- added url.sty

* Thu Dec 3 1998 Jun Nishii <jun@flatout.org>
- pLaTeX2e_Macros-1-2
- added fancyhdr.sty, boxedminipage.sty
- added graphics.cfg, color.cfg (use dvips as default)
- symlink from epsbox to epsf

* Mon Nov 9 1998 Jun Nishii <jun@flatout.org>
- pLaTeX2e_Macros-1-1
  (rename as pLaTeX2e_Macros from pLaTeX-Classes)
- added def files of graphics
- added tools and hyperref
- check the existence of mktexlsr

* Tue Oct 5 1998 Jun Nishii <jun@flatout.org>
- buildarch: noarch
- added requires

* Tue Sep 29 1998 Jun Nishii <jun@flatout.org>
- tiny bug fix and add %defattr

* Wed Sep 23 1998 Jun Nishii <jun@flatout.org>
- first version fo platex-19980901
