## -*- coding: utf-8-unix -*-
%bcond_with firstbuild

Provides:    jadetex
Obsoletes:   texlive-common < %{version}
Obsoletes:   jadetex tetex dvipdfmx xdvik xdvik-motif
Obsoletes:   tetex-latex tetex-afm tetex-type1 tetex-devel
Obsoletes:   pTeX pLaTeX2e pLaTeX2e_Macros dvipsk
Obsoletes:   dvipdfm texmacro-aps
Obsoletes:   makejvf <= 1.1a
Conflicts:   task-texmacro-phys < 1.1

%global _use_internal_dependency_generator 0
%global __find_provides %{nil}
%global __find_requires %{nil}

%define tex_destdir	%{_datadir}
%define texmf		%{tex_destdir}/texmf
%define texlive_src	%{tex_destdir}/texlive-sources
%define build_tex_destdir	%{buildroot}%{tex_destdir}
%define build_texmf	%{buildroot}%{texmf}

%define exec_mktexlsr  [ -x %{_bindir}/texconfig-sys ] && PATH=%{_bindir}:$PATH %{_bindir}/texconfig-sys rehash
%define exec_texhash  [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:$PATH %{_bindir}/texhash
%define exec_updmap   [ -x %{_bindir}/updmap-sys ] && PATH=%{_bindir}:$PATH %{_bindir}/updmap-sys
## NOTE: For only texlive-common, if %exec_fmtutil fails, 
## we show the STDERR of %exec_fmtutil. 
%define exec_fmtutil  [ -x %{_bindir}/fmtutil-sys ] && PATH=%{_bindir}:$PATH %{_bindir}/fmtutil-sys --all >/dev/null
%define exec_upddeffont    [ -x %{_sbindir}/update-defaultfont ] && %{_sbindir}/update-defaultfont 2> /dev/null
%define vartexfonts %{_var}/lib/texmf/fonts

Summary: Common base for all TeX Live packages
Summary(ja): TeX Live パッケージの共通ベース
Name: texlive-common
Version: 2011
Release: 1%{?_dist_release}
License: distributable
Group: Applications/Publishing
URL: http://www.tug.org/texlive/

Requires: texlive = %{version}
Requires(pre,post): texlive = %{version}
Requires: texlive-collection-basic = %{version}
Requires(post): texlive-collection-basic = %{version}
Requires: texlive-collection-latex = %{version}
Requires(post): texlive-collection-latex = %{version}
Requires: texlive-collection-latexrecommended = %{version}
Requires(post): texlive-collection-latexrecommended = %{version}
Requires: texlive-collection-fontsrecommended = %{version}
Requires(post): texlive-collection-fontsrecommended = %{version}

#### $ pdftex -ini  -jobname=latex -progname=latex -translate-file=cp227.tcx *latex.ini
## dehypht-x-2009-06-19.tex
Requires: texlive-collection-langgerman = %{version}
Requires(post): texlive-collection-langgerman = %{version}
## catkoi
Requires: texlive-collection-langcyrillic = %{version}
Requires(post): texlive-collection-langcyrillic = %{version}

#### $ xetex -ini  -jobname=xelatex -progname=xelatex -etex xelatex.ini
## unicode-letters
Requires: texlive-collection-xetex = %{version}
Requires(post): texlive-collection-xetex = %{version}

Requires: texlive-collection-langcjk = %{version}
Requires(pre,post): texlive-collection-langcjk = %{version}

BuildArch:	noarch
Buildroot:    %{_tmppath}/%{name}-%{version}-root

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     munepi


%description
The TeX Live software distribution offers a complete TeX system for a
variety of Unix, Macintosh, Windows and other platforms. It
encompasses programs for editing, typesetting, previewing and printing
of TeX documents in many different languages, and a large collection
of TeX macros and font libraries.

The distribution includes extensive general documentation about TeX,
as well as the documentation for the included software packages.

This package is a virtual package 
to provide a common base for all TeX Live packages.


%description -l ja
TeX Live ソフトウェアディストリビューションは、
さまざまな Unix, Macintosh, Windows、および
他のプラットホームに対して完全な TeX システムを提供します。
多くの異なった言語を含む TeX ドキュメントの
編集、組版、閲覧、印刷するためのプログラム、
そして、TeX マクロやフォントライブラリの大きなコレクションを
同梱しています。

このディストリビューションは
同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、
TeX に関するたくさんの一般的なドキュメントを含んでいます。

このパッケージは TeX Live パッケージの共通ベースを
提供ための仮想パッケージです。


%files


%posttrans
%{exec_texhash}

updmap_lock=%{texmf}/updmap.lock
# The packages required texlive-common contained the following maps. 
(cat<<EOF
MixedMap cm.map
MixedMap cmextra.map
MixedMap cyrillic.map
Map euler.map
MixedMap latxfont.map
MixedMap symbols.map
MixedMap cmtext-bsr-interpolated.map
MixedMap mflogo.map
Map mathpple.map
Map charter.map
Map fpls.map
Map pazo.map
Map utopia.map
MixedMap cm-super-t1.map
MixedMap cm-super-t2a.map
MixedMap cm-super-t2b.map
MixedMap cm-super-t2c.map
MixedMap cm-super-ts1.map
MixedMap cm-super-x2.map
MixedMap eurosym.map
Map lm.map
Map marvosym.map
Map pxfonts.map
MixedMap rsfs.map
Map qag.map
Map qbk.map
Map qcr.map
Map qcs.map
Map qhv.map
Map qpl.map
Map qtm.map
Map qzc.map
MixedMap tipa.map
Map txfonts.map
MixedMap wasy.map
Map cmcyr.map
Map bkaiu.map
Map bsmiu.map
Map gbsnu.map
Map gkaiu.map
Map garuda-c90.map
Map norasi-c90.map
Map umj.map
Map dgj.map
Map dmj.map
Map mc2j.map
Map mcj.map
Map mr2j.map
Map mrj.map
EOF
) | while read maptype map; do
%{exec_updmap} --listmaps 2>/dev/null | egrep -q "^#! ${maptype} ${map}" && \
    echo -n "    " && \
    echo -n "Running updmap: enable ${map} ... " && \
    %{exec_updmap} --nomkmap --enable ${maptype} ${map} >/dev/null 2>&1 && \
    echo "done." && \
    touch ${updmap_lock}
done



echo -n "    "
echo -n "Running updmap ... " && %{exec_updmap} >/dev/null 2>&1 && echo "done."
rm -f %{texmf}/updmap.lock
echo -n "    "
echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done."

exit 0


# %postun
# %{exec_texhash}
# echo -n "    "
# echo -n "Running updmap ... " && %{exec_updmap} >/dev/null 2>&1 && echo "done."
# echo -n "    "
# echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done."

exit 0


%changelog
* Sat Nov 26 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-1
- TeX Live 2011

* Mon May 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-6
- added Requires(post): for all requirements of texlive-collection-*
- added Requires: texlive

* Sat Apr 16 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-5
- improved %%post
  - checked the maps containing Require(post) dependencies

* Sun Mar 27 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4
- added Requires(post): texlive
- changed Requires(pre): -> Requires(post): for all requirements

* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
- added to remove %%{texmf}/updmap.lock in %%post
  - When texlive-common is installed, this lock generating 
    texlive-collection-* leaves. 
- dropped %%postun
- added some comments for the definition of %%exec_fmtutil

* Sat Jan 08 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2
- changed Requires: -> Requires(pre): for all requirements
- merged dependencies of Provides:/Obsoletes: tags from texlive-vl.spec

* Mon Jul 19 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
- TeX Live 2009
