%define	name	docbook-utils
%define	ver	0.6.14
%define	rel	2%{?_dist_release}

Summary:	Shell scripts for managing DocBook documents.
Summary(ja):	DocBook ドキュメントを操作するためのスクリプト集
Name:		%{name}
Version:	%{ver}
Release:	%{rel}
License:	GPL
Group:		Applications/Text
BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildArch:	noarch

Requires:	docbook-style-dsssl >= 1.72
Requires:       docbook-dtds
Requires:	perl-SGMLSpm >= 1.03ii
Requires:       which
Requires:       jadetex w3m
Obsoletes:	stylesheets
Provides:       stylesheets

BuildRequires: perl-SGMLSpm

Source0: %{name}-%{version}.tar.gz
Source1: db2html
Source2: gdp-both.dsl
# Vine (Original of Source3 is Source2)
Source3: gdp-both.dsl.vine  

# Vine Patches
# for using w3m priority
Patch100: docbook-utils-w3m.patch


%description
This package contains scripts are for easy conversion from DocBook
files to other formats (for example, HTML, RTF, and PostScript), and
for comparing SGML files.

%description -l ja
DocBook ドキュメントを他の形式 (例: HTML, RTF, PostScript) に変換したり、
SGML と比較するためのスクリプト集です。

%package pdf
Summary: A script for converting DocBook documents to PDF format.
Summary(ja): DocBook ドキュメントを PDF 形式に変換するスクリプト
Group: Applications/Text
Requires: jadetex >= 2.5
Requires: docbook-utils = %{version}
Obsoletes: stylesheets-db2pdf
Provides: stylesheets-db2pdf


%description pdf
This package contains a script for converting DocBook documents to
PDF format.

%description pdf
DocBook ドキュメントを PDF 形式に変換するためのスクリプトです。

%prep
%setup -q
%patch100 -p1 -b .w3m

%build

%configure --prefix=%{_prefix} --mandir=%{_mandir}
make

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%makeinstall
for util in dvi html pdf ps rtf
do
	ln -s docbook2$util $RPM_BUILD_ROOT%{_bindir}/db2$util
	ln -s jw.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/db2$util.1
done
# db2html is not just a symlink, as it has to create the output directory
rm -f $RPM_BUILD_ROOT%{_bindir}/db2html
install -c -m 775 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/db2html
install -c -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/sgml/docbook/utils-%{version}/docbook-utils.dsl
install -c -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/sgml/docbook/utils-%{version}/docbook-utils-a4.dsl
perl -pi -e 's/^ "USletter"/ "A4"/' $RPM_BUILD_ROOT%{_datadir}/sgml/docbook/utils-%{version}/docbook-utils-a4.dsl

# rm docdir
rm -r $RPM_BUILD_ROOT/usr/doc

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT


%files
%defattr (-,root,root)
%doc README COPYING TODO doc/HTML/*.html
%{_bindir}/jw
%{_bindir}/docbook2dvi
%{_bindir}/docbook2html
%{_bindir}/docbook2man
%{_bindir}/docbook2ps
%{_bindir}/docbook2rtf
%{_bindir}/docbook2tex
%{_bindir}/docbook2texi
%{_bindir}/docbook2txt
%{_bindir}/db2dvi
%{_bindir}/db2html
%{_bindir}/db2ps
%{_bindir}/db2rtf
%{_bindir}/sgmldiff
%{_datadir}/sgml/docbook/utils-%{version}
%{_mandir}/*/db2dvi.*
%{_mandir}/*/db2html.*
%{_mandir}/*/db2ps.*
%{_mandir}/*/db2rtf.*
%{_mandir}/*/docbook2dvi.*
%{_mandir}/*/docbook2html.*
%{_mandir}/*/docbook2ps.*
%{_mandir}/*/docbook2rtf.*
%{_mandir}/*/docbook2man.*
%{_mandir}/*/docbook2tex.*
%{_mandir}/*/docbook2texi.*
%{_mandir}/*/jw.*
%{_mandir}/*/sgmldiff.*
%{_mandir}/*/*-spec.*

%files pdf
%defattr (-,root,root)
%{_bindir}/docbook2pdf
%{_bindir}/db2pdf
%{_mandir}/*/db2pdf.*
%{_mandir}/*/docbook2pdf.*

%changelog
* Fri Aug 15 2008 Shu KONNO <owa@bg.wakwak.com> 0.6.14-2vl5
- applied new versioning policy, spec in utf-8

* Tue Jul 13 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.14-2vl1
- new upstream release
- dropped Patch0 and 1 because those integrated to upstream
- add Requires: jadetex, w3m
- added Patch100 to use /usr/bin/w3m priority

* Mon Sep 15 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.13-7vl1
- based on Rawhide 0.6.13-7
  * Tue Jun 10 2003 Tim Waugh <twaugh@redhat.com> 0.6.13-7
  - Fix manpage output: escape dots in column 1 (bug #97087).

* Sun May 18 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.13-3vl2
- use gdp-both.dsl.vine instead of gdp-both.dsl
  (for enable use-id-as-filename)
- fixed spec file

* Wed May  7 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.13-3vl1
- based on Rawhide 0.6.13-3
  - Move docbook2pdf man pages to pdf subpackage (bug #90041).
  - 0.6.13, fixing bug #86152.
- added html document in %{_docdir}

* Sun Feb  9 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.12-5vl1
- based on Rawhide 0.6.12-5
  - Build reqires perl-SGMLSpm
  - Fixed from CVS
  - No longer need separate stylesheet for A4
- add Japanese summary and description

* Sat Oct 26 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.12-0vl1
- 0.6.12
- add BuildRequires docbook-dtd31-sgml (make uses this...)

* Mon Sep 30 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.11-2vl4
- fix Requires (previous version didn't change... )

* Sat Sep 28 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.11-2vl3
- change Require docbook-dtd-sgml, docbook-dtd-xml

* Sat Sep 28 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.11-2vl2
- updated to 0.6.11 by based on rawhide 0.6.11-2
- don't apply patch

* Thu Oct 11 2001 Akira TAGOH <tagoh@gnome.gr.jpj> 0.6.9-2vl1
- Rebuild for Vine.

* Mon Aug 13 2001 Tim Waugh <twaugh@redhat.com> 0.6.9-2
- Larger bottom margin in gdp-both.dsl to fix RTF output (bug #49677).

* Tue Jul  3 2001 Tim Waugh <twaugh@redhat.com> 0.6.9-1
- 0.6.9.
- With --nochunks, send output to a file instead of stdout (bug #46913).

* Mon Jun  4 2001 Tim Waugh <twaugh@redhat.com> 0.6.8-2
- Make sure COPYING isn't installed as a symlink.

* Mon May 21 2001 Tim Waugh <twaugh@redhat.com> 0.6.8-1
- 0.6.8.

* Mon May 21 2001 Tim Waugh <twaugh@redhat.com> 0.6-14
- db2html: copy admon graphics to output directory (bug #40143).
- Require docbook-style-dsssl 1.64-2 for symbolic link used by db2html.
- db2html: handle arguments with spaces better.

* Sat Mar 24 2001 Tim Waugh <twaugh@redhat.com> 0.6-13
- Fix man pages (bug #32820).

* Mon Mar 12 2001 Tim Waugh <twaugh@redhat.com>
- Fix argument parsing in docbook2xxx (bug #31518).
- Fix argument passing in db2html (bug #31520).
- Fix pdf generation (bug #31524).

* Fri Feb 23 2001 Tim Waugh <twaugh@redhat.com>
- Allow the use of custom backends and frontends (bug #29067).

* Fri Feb 16 2001 Tim Waugh <twaugh@redhat.com>
- Use gdp-both.dsl as the default stylesheet.

* Mon Feb 12 2001 Tim Waugh <twaugh@redhat.com>
- REALLY only create output directory for db2html (duh).
- Handle filenames with dots in properly.

* Sun Feb 11 2001 Tim Waugh <twaugh@redhat.com>
- Only create output directory for db2html (bug #27092). (docbook2html
  does not create an output directory in the upstream version, but
  the compatibility script has been made to do so.)

* Mon Jan 22 2001 Tim Waugh <twaugh@redhat.com>
- Move the jadetex requirement to the -pdf subpackage.

* Tue Jan 16 2001 Tim Waugh <twaugh@redhat.com>
- Put output files in new directory instead of current directory.

* Mon Jan 15 2001 Tim Waugh <twaugh@redhat.com>
- Don't play so many macro games.
- Be sure to own utils directory.

* Fri Jan 12 2001 Tim Waugh <twaugh@redhat.com>
- Split off docbook2pdf into subpackage for dependency reasons.

* Mon Jan 08 2001 Tim Waugh <twaugh@redhat.com>
- Change group.
- Use %%{_mandir} and %%{_prefix}.
- db2* symlinks.
- Obsolete stylesheets (and -db2pdf).
- Change Copyright: to License:.
- Remove Packager: line.
- Reword description.

* Mon Jan 08 2001 Tim Waugh <twaugh@redhat.com>
- Based on Eric Bischoff's new-trials packages.
