Blob Blame History Raw
Name:		htmldoc
Version:	1.8.27
Release:	8%{?dist}
Summary:	Converter from HTML into indexed HTML, PostScript, or PDF

Group:		Applications/Publishing

# GPLv2 with OpenSSL exception
License:	GPLv2 with exceptions
URL:		http://www.htmldoc.org/

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source:		http://ftp.easysw.com/pub/%{name}/%{version}/%{name}-%{version}-source.tar.bz2

Patch0:		htmldoc-1.8.27-desktop-icon.patch
Patch3:		htmldoc-1.8.27-scanf-overflows.patch
Patch4:		htmldoc-1.8.27-fortify-fail.patch

BuildRequires:	openssl-devel libjpeg-devel libpng-devel zlib-devel
BuildRequires:	fltk-devel libXpm-devel desktop-file-utils
#Requires:


%description
HTMLDOC converts HTML source files into indexed HTML, PostScript, or
Portable Document Format (PDF) files that can be viewed online or
printed. With no options a HTML document is produced on stdout.

The second form of HTMLDOC reads HTML source from stdin, which allows
you to use HTMLDOC as a filter.

The third form of HTMLDOC launches a graphical interface that allows
you to change options and generate documents interactively.


%prep
%setup -q

# fix up hardcoded documentation path
sed -i 's/\(\$prefix\/share\/doc\/htmldoc\)/\1-%{version}/g' configure

# fix desktop icon (http://www.htmldoc.org/str.php?L169)
%patch0 -p1 -b .desktop-icon

# fix some scanf overflows (http://www.htmldoc.org/str.php?L214)
%patch3 -p1 -b .scanf-overflows

# fix limitation of -D_FORTIFY_SOURCE=2
%patch4 -p1 -b .fortify-fail


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install prefix=${RPM_BUILD_ROOT}%{_prefix} mandir=${RPM_BUILD_ROOT}%{_mandir} bindir=${RPM_BUILD_ROOT}%{_bindir} datadir=${RPM_BUILD_ROOT}%{_datadir}

# kill thing which we get later in the right place with %doc
rm -rf ${RPM_BUILD_ROOT}%{_docdir}/htmldoc

# install icons
for s in 16 24 32 48 64 96 128; do 			\
	install -d ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/${s}x${s}/apps; \
	cp -a desktop/htmldoc-$s.png 			\
	${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/${s}x${s}/apps/htmldoc.png;\
done

# install MIME
install -d ${RPM_BUILD_ROOT}%{_datadir}/mime/packages
cp -a desktop/htmldoc.xml ${RPM_BUILD_ROOT}%{_datadir}/mime/packages

# desktop file
desktop-file-install --vendor fedora				\
	--dir ${RPM_BUILD_ROOT}%{_datadir}/applications		\
	--remove-category=X-Red-Hat-Base			\
	--add-mime-type=application/vnd.htmldoc-book		\
	desktop/htmldoc.desktop


%post
# scriptlet for icons
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

# scriptlet for MIME
update-mime-database %{_datadir}/mime &> /dev/null || :

# scriptlet for desktop database
update-desktop-database &> /dev/null || :


%postun
# scriptlet for icons
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

# scriptlet for MIME
update-mime-database %{_datadir}/mime &> /dev/null || :

# scriptlet for desktop database
update-desktop-database &> /dev/null || :


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc doc/intro.html doc/c-relnotes.html doc/htmldoc.{html,pdf,ps} doc/help.html
%doc CHANGES.txt COPYING.txt README.txt
%{_datadir}/htmldoc
%{_datadir}/applications/*
%{_mandir}/man1/*
%{_bindir}/htmldoc
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/mime/packages/htmldoc.xml


%changelog
* Thu Aug 13 2009 Adam Goode <adam@spicenitz.org> - 1.8.27-8
- Fix limitation of -D_FORTIFY_SOURCE=2 (#511520)
- Fix scanf overflows (#512513)

* Sat Aug 30 2008 Adam Goode <adam@spicenitz.org> - 1.8.27-7
- RPM 4.6 fix for patch tag

* Sat Feb  9 2008 Adam Goode <adam@spicenitz.org> - 1.8.27-6
- GCC 4.3 mass rebuild

* Wed Dec  5 2007 Adam Goode <adam@spicenitz.org> - 1.8.27-5
- Fix desktop file validation

* Wed Dec 05 2007 Release Engineering <rel-eng at fedoraproject dot org> - 1.8.27-4
 - Rebuild for deps

* Wed Aug 22 2007 Adam Goode <adam@spicenitz.org> - 1.8.27-3
- Update license tag
- Rebuild for buildid

* Sat May  5 2007 Adam Goode <adam@spicenitz.org> - 1.8.27-2
- Remove X-Fedora

* Thu Aug 31 2006 Adam Goode <adam@spicenitz.org> - 1.8.27-1.1
- Mass rebuild

* Wed Aug  2 2006 Adam Goode <adam@spicenitz.org> - 1.8.27-1
- New upstream release

* Wed May 31 2006 Adam Goode <adam@spicenitz.org> - 1.8.26-4
- Fix hardcoded documentation path in configure
- Add help.html to documentation

* Mon May 29 2006 Adam Goode <adam@spicenitz.org> - 1.8.26-3
- Use upstream desktop file
- Install icons
- Install mime XML file
- Eliminate strange spaces in description

* Sat May 27 2006 Adam Goode <adam@spicenitz.org> - 1.8.26-2
- Add downloadable source

* Thu May 25 2006 Adam Goode <adam@spicenitz.org> - 1.8.26-1
- New upstream release
- Rebuild for FC5

* Mon Oct 24 2005 Thomas Chung <tchung@fedoranews.org> 1.8.24-1
- Rebuild for FC4

* Tue Feb 22 2005 Thomas Chung <tchung@fedoranews.org> 1.8.24-0
- Initial RPM build for FC3