%define version 0.9.1
%define release 0vl6

Summary: Text formatting system based on SGML
Summary(ja): SGML ˴Ťƥƥ
Name: linuxdoc-tools
Version: %{version}
Release: %{release}
License: distributable
Group: Applications/Text
Source0: http://people.debian.org/~sano/linuxdoc-tools/archives/linuxdoc-tools_%{version}.tar.gz
Patch0: linuxdoc-tools_0.9.1_platex.patch.gz
Patch1: linuxdoc-tools_replace_dvips.patch.gz
# use ISO entities in 'sgml-common' package
Patch2: linuxdoc-tools_catalog_file.patch.gz
BuildPrereq: openjade
PreReq: sgml-common >= 0.5
Requires: openjade, sgml-common >= 0.5
Obsoletes: sgml-tools
Provides: sgml-tools
Buildroot: %{_tmppath}/%{name}-root
Vendor: Project Vine
Distribution: Vine Linux

%description
linuxdoc-tools is a SGML-based text formatter which allows you to
produce a variety of output formats.  You can create PostScript and
dvi (with LaTeX), plain text (with groff), HTML, and texinfo files
from a single SGML source file.

%description -l ja
linuxdoc-tools  SGML-Tools ΥХեåǤǤ
LinuxDoc DTD 򥵥ݡȤƤꡢSGML ե뤫 PostScript,
(LaTeX ˤ) dvi(groff ˤ)ץ졼ƥȡHTMLtexinfo
եǤޤ

DocBook DTD ʤɡLinuxDoc DTD ʳDTDˤ
ΥѥåΤˡsgml-tools-2.x  docbook ɬפˤʤޤ

%prep
%setup -q -n %{name}
%patch0 -p1 -b .platex
%patch1 -p1 -b .dvips
%patch2 -p1 -b .catalog
perl -i.bak -p -e "s/^(OPTIMIZE=).*$/\$1${RPM_OPT_FLAGS}/" Makefile.in sgmls-1.1/Makefile

%build
autoconf
./configure --prefix=%{_prefix} \
    --with-installed-iso-entities \
    --mandir=%{_mandir}
make

%install
rm -rf ${RPM_BUILD_ROOT}

[ -d guide ] && mv guide doc
make install prefix=${RPM_BUILD_ROOT}%{_prefix} mandir=${RPM_BUILD_ROOT}%{_mandir}

rm -rf guide
cp -af doc guide

## for sgml2latex [JF:09828]
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/share/texmf/tex/latex/misc/
(cd ${RPM_BUILD_ROOT}%{_prefix}/lib/%{name}
## remove url.sty (url.sty is provided from tetex)...
rm -f url.sty
for i in *.sty ; do
    ln -s %{_prefix}/lib/%{name}/$i \
        ${RPM_BUILD_ROOT}%{_prefix}/share/texmf/tex/latex/misc/$i
done)

## remove backup files...
rm -f ${RPM_BUILD_ROOT}%{_prefix}/lib/linuxdoc-tools/dist/fmt_latex2e.pl.*
rm -f guide/Makedoc.sh.dvips
rm -f ${RPM_BUILD_ROOT}%{_prefix}/lib/linuxdoc-tools/LinuxDocTools.pm.catalog_file
cp entity-map/COPYING COPYING.entity-map

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
# Update the centralized catalog corresponding to this version of the DTD
/usr/bin/install-catalog --add /etc/sgml/linuxdoc.cat %{_prefix}/lib/linuxdoc-tools/linuxdoc-tools.catalog > /dev/null

%postun
if [ "$1" = 0 ]; then
# Update the centralized catalog corresponding to this version of the DTD
/usr/bin/install-catalog --remove /etc/sgml/linuxdoc.cat %{_prefix}/lib/linuxdoc-tools/linuxdoc-tools.catalog > /dev/null
fi

%files
%defattr(-,root,root)
%doc COPYING* ChangeLog INSTALL README VERSION guide/ debian/
%{_prefix}/bin/*
%{_prefix}/lib/perl5/Text/*
%{_prefix}/lib/entity-map/
%{_prefix}/lib/linuxdoc-tools/
%{_prefix}/share/texmf/tex/latex/misc/*
%{_mandir}/man1/*

%changelog
* Mon Jan  7 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 0.9.1-0vl6
- sgml-common's super catalog support
- added PreReq: sgml-common >= 0.5

* Wed Jul 18 2001 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- 0.9.1-0vl5: remove url.sty which is provided from tetex

* Mon Apr 23 2001 <sagami@vinelinux.org>
- 0.9.1-0vl4: move manpages to %%{_mandir}

* Tue Jan 23 2001 Yasuhide OOMORI <dasen@icntv.ne.jp>
- 0.9.1-0vl3
- fixed $ENV{SGML_CATALOG_FILES}
- Maybe it's a bug... but it won't work without iso-entities-8879.1986

* Tue Jan 23 2001 Yasuhide OOMORI <dasen@icntv.ne.jp>
- 0.9.1-0vl2
- fixed some in description

* Sun Jan 21 2001 Jun Nishii <jun@vinelinux.org>
- 0.9.1-0vl1
- updated to 0.9.1

* Tue Nov 21 2000 Yasuhide OOMORI <dasen@icntv.ne.jp>
- 0.7.4-0vl3
- now you can choose jlatex for sgml2latex
- set '-l ja' as default

* Sun Nov 19 2000 Yasuhide OOMORI <dasen@icntv.ne.jp>
- 0.7.4-0vl2
- setup quietly
- create symlinks for sgml2latex
- use %{_prefix} macro
- use platex as default in sgml2latex
- use ${RPM_OPT_FLAGS}

* Tue Nov 14 2000 Yasuhide OOMORI <dasen@icntv.ne.jp>
- 0.7.4-0vl1
- updated to 0.7.4
- Modified URL for Source
- remove RPM_BUILD_ROOT first in %install
- renamed directory which contains users' guide
- remove RPM_BUILD_ROOT in %clean

* Wed Jul 12 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.6.1-0vl2
- Obsoletes: sgml_tools -> sgml-tools :-)
- added Provides: sgml-tools (for compatibility with indexhtml)

* Thu Jun 29 2000 Jun Nishii <jun@vinelinux.org>
- 0.6.1-0vl1
- first build
