%define pkgname latex2html
%define ver 2002
%define srcver 2002-2-1
%define jpver 1.9
%define _prefix /usr
%define exec_texhash [ -x %{_bindir}/texhash ] && %{_bindir}/env - %{_bindir}/texhash 2> /dev/null
%define ownlibdir %{_prefix}/lib/%{pkgname}
Summary: LaTeX to HTML converter.
Summary(ja): LaTeX ファイルを HTML 形式に変換するツール
Name: latex2html2002
Version: %{ver}
Release: 9%{?_dist_release}
License: distributable
Group: Applications/Publishing
Url: http://www.latex2html.org/
Source0: http://saftsack.fs.uni-bayreuth.de/~latex2ht/current/latex2html-%{srcver}.tar.gz
Source1: l2h-japanese.perl
# vine patch
Patch0: http://takeno.iee.niit.ac.jp/~shige/TeX/latex2html/data/l2h-%{srcver}+jp%{jpver}.patch.gz
Patch1: l2h-vine.patch
Patch2: latex2html.gs510.diff
Patch3: l2h-netpbm-10.25.patch
BuildArch: noarch
%if %{?_dist_release} == "vl5"
Requires: tetex
%endif
%if %{?_dist_release} >= "vl6"
Requires: texlive-common
%endif
Requires: ghostscript >= 5.50
Requires: perl
Requires: netpbm-progs
%if %{?_dist_release} == "vl5"
BuildRequires: tetex
%endif
%if %{?_dist_release} >= "vl6"
BuildRequires: texlive-common
%endif
BuildRequires: perl
BuildRequires: netpbm-progs
BuildRequires: netpbm >= 9.12
Buildroot: %{_tmppath}/%{pkgname}-%{version}-root
Vendor: Project Vine
Distribution: Vine Linux
Packager: munepi
%description
Elaborate perl program to convert latex documents to html, using LaTeX
to process images and equations.
%description -l ja
Latex ファイルを HTML形式に変換するperlプログラムです.
%prep
%setup -q -n latex2html-%{srcver}
%patch0 -p1
%patch1 -p0
%__cp -f %{SOURCE1} styles/japanese.perl
cd config
%patch2 -p0
cd ..
%patch3 -p1
# fix perl path in a few places:
%__sed -i -e "s|^#!/perl|#!%{__perl}|" l2hconf.pin || exit 1
%build
TMP=/var/tmp ./configure \
--with-gs=%{_bindir}/gs \
%if %{?_dist_release} == "vl6"
--with-dvips=%{_bindir}/pdvips \
%endif
--with-latex=%{_bindir}/platex \
--without-mktexlsr \
--with-perl=%{__perl} \
--prefix=%{_prefix} \
--enable-eps \
--enable-png \
--disable-gif \
--libdir=%{ownlibdir} \
--shlibdir=%{ownlibdir}
#./configure --prefix=%{_prefix} --sysconfdir=/etc --host=localhost\
# --enable-png --disable-gif --without-mktexlsr
%__make
##
## make several l2hconf.pm and wrapper
##
%__sed -e 's/"jarticle"/"article"/' -e 's/japanese/english/' \
-e 's/UNUSEACCENT = 1/UNUSEACCENT = 0/' \
-e 's/texexpand/texexpand-en/' \
l2hconf.pm > l2hconf_en.pm
%__sed -e 's/#$TOHTML/$TOHTML = "|nkf -j";/' \
-e 's/#$charset/$charset = "iso-2022-jp";/' \
l2hconf.pm > l2hconf_jis.pm
%__sed -e 's/#$TOHTML/$TOHTML = "|nkf -s";/' \
-e 's/#$charset/$charset = "Shift_JIS";/' \
l2hconf.pm > l2hconf_sjis.pm
%__sed -e 's/#$TOHTML/$TOHTML = "|nkf -e";/' \
-e 's/#$charset/$charset = "EUC-JP";/' \
l2hconf.pm > l2hconf_euc.pm
%__sed -e 's/#$TOHTML/$TOHTML = "|nkf -w";/' \
-e 's/#$charset/$charset = "UTF-8";/' \
l2hconf.pm > l2hconf_utf8.pm
%__cp l2hconf.pm l2hconf_png_ja.pm
%__sed -e 's/"jarticle"/"article"/' -e 's/japanese/english/' \
l2hconf.pm > l2hconf_png_en.pm
%__sed 's/png gif/gif png/' l2hconf.pm > l2hconf_gif_ja.pm
%__sed 's/png gif/gif png/' l2hconf_png_en.pm > l2hconf_gif_en.pm
%__sed -e 's/${FROMNATIVE} $infile |/<$infile/' texexpand > texexpand-en
%__sed -e "s@LIBDIR@%{ownlibdir}@" -e "s@BINDIR@%{_bindir}@" l2h-wrapper-temp > l2h-wrapper
%install
%__rm -rf $RPM_BUILD_ROOT
# fake root directory
%__sed -e 's|/usr|'"${RPM_BUILD_ROOT}"'/usr|' \
-e 's|bin/latex|bin/platex|' cfgcache.pm > cfgcache.pm.new || exit 1
%__mv cfgcache.pm.new cfgcache.pm || exit 1
%__mkdir_p $RPM_BUILD_ROOT%{_datadir}/texmf/tex/latex/html || exit 1
%__make install
(cd %{buildroot}
%__perl -pi -e 's@iso-8859-1@euc-jp@g' %{_bindir}/latex2html || exit 1
for i in `grep -ir -l %{buildroot} *`;
do
%__perl -pi -e "s@%{buildroot}@@g" $i || exit 1
%__chmod 755 $i
done
for i in `grep -ir -l %{_builddir} *`;
do
%__perl -pi -e "s@%{_builddir}@@g" $i || exit 1
%__chmod 755 $i
done
)
# fix perl path in a few places:
%__perl -pi -e 's#/usr/local/bin/perl#%{__perl}#' $RPM_BUILD_ROOT%{ownlibdir}/cweb2html/cweb2html || exit 1
%__perl -pi -e 's#/usr/local/bin/perl#%{__perl}#' $RPM_BUILD_ROOT%{ownlibdir}/makeseg/makeseg || exit 1
%__perl -pi -e 's#/usr/local/bin/perl#%{__perl}#' $RPM_BUILD_ROOT%{ownlibdir}/makemap || exit 1
%__perl -pi -e "s#$RPM_BUILD_DIR/%{pkgname}-%{version}#%{ownlibdir}#" $RPM_BUILD_ROOT%{ownlibdir}/cfgcache.pm || exit 1
(cd $RPM_BUILD_ROOT%{_datadir}/texmf/tex/latex/html
%__rm -f floatflt.ins latin9.def url.sty
)
(cd docs
# ## changebar.sty: provided by texlive-collection-latexextra
# %__rm -f changebar.sty
export TEXINPUTS=:.:../texinputs
## article.cls don't provide \address.
%__sed -i -e 's/\\author{\(.*\)}/\\author{\1/' -e 's!\\address{!\\\\hoge!' manual.tex || exit 1
%__make clean
%__make LATEX=platex manual.dvi
dvipdfmx manual.dvi || exit 1
)
#### l2h wrapper install
%__cp l2hconf_{gif,png}_{ja,en}.pm $RPM_BUILD_ROOT%{ownlibdir} || exit 1
%__install -c -m 0755 l2h-wrapper $RPM_BUILD_ROOT%{_bindir}/l2h || exit 1
## NO use perl(Win32), which is required by perl(L2hos::Win32)
%__rm -f $RPM_BUILD_ROOT%{ownlibdir}/L2hos/Win32.pm
%post
%{exec_texhash}
exit 0
%postun
%{exec_texhash}
exit 0
%clean
%__rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc BUGS Changes FAQ INSTALL LICENSE MANIFEST README TODO
%doc docs/ example/ tests/
%doc dot.latex2html-init
%{_bindir}/*
%{ownlibdir}
%{_datadir}/texmf/tex/latex/html/
%changelog
* Sun Jan 29 2012 Munehiro Yamamoto 2002-9
- Requires, BuildRequires: s/texlive/texlive-common/ (for vl6 or higher)
* Thu Aug 12 2010 Munehiro Yamamoto 2002-8
- TeX Live 2009
- used rpm macros for some commands
- defined %%pkgname to latex2html
- changed %%ownlibdir to %%{_prefix}/lib/%%{pkgname}
- added configure options:
--with-dvips=%%{_bindir}/pdvips \
--with-latex=%%{_bindir}/platex \
* Sun Mar 29 2009 Munehiro Yamamoto 2002-7
- comment out "use Win32;" in %%{ownlibdir}/L2hos/Win32.pm
* Sun Mar 29 2009 Munehiro Yamamoto 2002-6
- applied new versioning policy
- spec in utf8
- corrected generating docs/manual.pdf process
* Wed Aug 31 2005 KOBAYASHI Taizo 2002-0vl5
- source update
* Wed Jun 11 2003 KOBAYASHI R. Taizo 2002-0vl4
- patch2 update
- source update (23-May-2003 07:15)
* Tue Oct 08 2002 KOBAYASHI R. Taizo 2002-0vl3
- source update
* Fri Jun 21 2002 KOBAYASHI R. Taizo 2002-0vl2
- source update
* Sun Jun 09 2002 KOBAYASHI R. Taizo 2002-0vl1
- update to 2002
- added BuildPrereq: netpbm >= 9.12
* Fri Mar 29 2002 MATSUBAYASHI Kohji 2000.1-0.1vl4
- added BuildPreReq: tetex
* Fri Mar 29 2002 MATSUBAYASHI Kohji 2000.1-0.1vl3
- %%post and %%postun fixed ([VineSeed:06257], thanks Tsuchimura-san)
* Wed Jul 18 2001 KOBAYASHI R. Taizo 0.1vl2
- source update
- fix requires tag
* Wed Jul 18 2001 KOBAYASHI R. Taizo
- latex2html-2000.1-0.1vl1
- update for teTeX
* Thu Aug 17 2000 Jun Nishii
- latex2html-99.2-0.8vl2
- fix requires tag
* Mon Jul 31 2000 Jun Nishii
- latex2html-99.2-0.8vl1
- use png
* Fri Jan 28 2000 Yasuhide OOMORI
- [latex2html-98.1p1-5]
- Modified to show generator correctly.
- Setup quietly.
* Fri Jan 7 2000 Jun Nishii
- [latex2html-98.1p1-4]
- change group
* Sun Nov 14 1999 Jun Nishii
- build for Vine-2.0
* Mon May 3 1999 Jun Nishii
- modify post installation script
- build for Vine
* Tue Nov 10 1998 Jun Nishii
- first build for PJE-0.3alpha