Summary:	gtkhtml library
Name:		gtkhtml
Version:	1.1.9
Release:	5vl2
License:	LGPL
Group:		System Environment/Libraries
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Source:		ftp://ftp.gnome.org/pub/GNOME/sources/%{name}/1.1/%{name}-%{version}.tar.bz2
Source1: pohack.awk
Patch0: gtkhtml-1.1.7-bequiet.patch
Patch1: gtkhtml-1.1.7-fixfont.patch
Patch2: gtkhtml-1.1.9-textslave.patch
Patch3: gtkhtml-1.1-nocapplet.patch
Patch4: gtkhtml-1.1.9-gcc34_fixes.patch

Requires: libgnomeprint15 >= 0.24
Requires: gdk-pixbuf >= 0.8.0
Requires: bonobo >= 0.32
BuildRequires: gdk-pixbuf-devel >= 0.8.0
BuildRequires: libgnomeprint-devel >= 0.24
BuildRequires: gal-devel >= 0.24
BuildRequires: gnome-libs-devel libcapplet0-devel libxml-devel libglade-devel
BuildRequires: bonobo-devel >= 0.32

%description
This is GtkHTML, a lightweight HTML rendering/printing/editing engine.
It was originally based on KHTMLW, but is now being developed
independently of it.


%package devel
Summary: Libraries, includes, etc to develop gtkhtml applications
Group: Development/Libraries
Requires: gtkhtml = %{version}-%{release} gnome-libs-devel
Requires: libgnomeprint-devel >= 0.25
Requires: gdk-pixbuf-devel >= 0.8.0
Requires: libglade-devel libxml-devel
Requires: bonobo-devel
Requires: gal-devel >= 0.24

%description devel
Libraries, include files, etc you can use to develop gtkhtml applications.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1 -b .textslave
%patch3 -p1
%patch4 -p1

%build
%configure
# Patch1: hack to modify po. (ugly!)
function pohack() {
POHACKTMP=`mktemp /tmp/pohack.XXXXXX` || exit 1
POHACKNEW=`mktemp /tmp/pohack.XXXXXX` || exit 1
awk -v tempfile=${POHACKTMP} -v tempnewfile=${POHACKNEW} -v key="\"$1\"" -v val="$2" -f %{SOURCE1} $3 > $3.new
mv $3.new $3
rm -f $POHACKTMP $POHACKNEW
}

(cd po
make update-po
pohack '-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' '-*-kochi gothic-*-*-*-*-14-*-*-*-*-*-*-*' ja.po
pohack '-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' '-*-kochi gothic-*-*-*-*-14-*-*-*-*-*-*-*' ja.po
pohack 'font_variable_print=-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' 'font_variable_print=-*-kochi gothic-*-*-*-*-14-*-*-*-*-*-*-*' ja.po
pohack 'font_fixed_print=-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' 'font_fixed_print=-*-kochi gothic-*-*-*-*-14-*-*-*-*-*-*-*' ja.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-helvetica-*-*-*-*-14-*-*-*-*-*-%s-%s,-alias-*-*-r-*' ja.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-courier-*-*-*-*-14-*-*-*-*-*-%s-%s,-alias-*-*-r-*' ja.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*' '-*-helvetica-*-*-*-*-14-*-*-*-*-*-*-*,-alias-*-*-r-*' ja.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*' '-*-courier-*-*-*-*-14-*-*-*-*-*-*-*,-alias-*-*-r-*' ja.po
pohack '-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' '-*-baekmuk gulim-*-*-*-*-12-*-*-*-*-*-*-*' ko.po
pohack '-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' '-*-baekmuk gulim-*-*-*-*-12-*-*-*-*-*-*-*' ko.po
pohack 'font_variable_print=-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' 'font_variable_print=-*-baekmuk gulim-*-*-*-*-12-*-*-*-*-*-*-*' ko.po
pohack 'font_fixed_print=-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' 'font_fixed_print=-*-baekmuk gulim-*-*-*-*-12-*-*-*-*-*-*-*' ko.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s,-*-baekmuk gulim-*-r-*' ko.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s,-*-baekmuk gulim-*-r-*' ko.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*,-*-baekmuk gulim-*-r-*' ko.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*' '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*,-*-baekmuk gulim-*-r-*' ko.po
pohack '-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' '-*-ar pl sungtil gb-*-*-*-*-10-*-*-*-*-*-*-*' zh_CN.po
pohack '-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' '-*-ar pl sungtil gb-*-*-*-*-10-*-*-*-*-*-*-*' zh_CN.po
pohack 'font_variable_print=-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' 'font_variable_print=-*-ar pl sungtil gb-*-*-*-*-10-*-*-*-*-*-*-*' zh_CN.po
pohack 'font_fixed_print=-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' 'font_fixed_print=-*-ar pl sungtil gb-*-*-*-*-10-*-*-*-*-*-*-*' zh_CN.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s,*-r-*' zh_CN.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s,*-r-*' zh_CN.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*,*-r-*' zh_CN.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*' '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*,*-r-*' zh_CN.po
pohack '-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' '-*-ar pl mingti2l big5-*-*-*-*-10-*-*-*-*-*-*-*' zh_TW.po
pohack '-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' '-*-ar pl mingti2l big5-*-*-*-*-10-*-*-*-*-*-*-*' zh_TW.po
pohack 'font_variable_print=-*-helvetica-*-*-*-*-10-*-*-*-*-*-*-*' 'font_variable_print=-*-ar pl mingti2l big5-*-*-*-*-10-*-*-*-*-*-*-*' zh_TW.po
pohack 'font_fixed_print=-*-courier-*-*-*-*-10-*-*-*-*-*-*-*' 'font_fixed_print=-*-ar pl mingti2l big5-*-*-*-*-10-*-*-*-*-*-*-*' zh_TW.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-%s-%s,*-r-*' zh_TW.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s' '-*-courier-*-*-*-*-12-*-*-*-*-*-%s-%s,*-r-*' zh_TW.po
pohack '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*' '-*-helvetica-*-*-*-*-12-*-*-*-*-*-*-*,*-r-*' zh_TW.po
pohack '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*' '-*-courier-*-*-*-*-12-*-*-*-*-*-*-*,*-r-*' zh_TW.po
)
make


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

make DESTDIR=$RPM_BUILD_ROOT install

# remove things for new gnomecc that we don't have
rm -rf $RPM_BUILD_ROOT/%{_libdir}/control-center/capplets
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT/%{_libdir}/bonobo

rm -rf $RPM_BUILD_ROOT/%{_datadir}/control-center
rm -rf $RPM_BUILD_ROOT/%{_datadir}/gnome/apps

%find_lang %{name}


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


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS ChangeLog NEWS README COPYING TODO
%{_bindir}/*
%{_libdir}/*.so.*
%{_datadir}/gnome/*
%{_datadir}/gtkhtml-1.1/*
%{_datadir}/oaf/*

%files devel
%defattr(-, root, root)
%{_includedir}/gtkhtml-1.1
%{_libdir}/*.a
%{_libdir}/*.so
#%{_libdir}/*.sh
%{_libdir}/pkgconfig/*.pc

%changelog
* Fri Jan  2 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.9-5vl2
- rebuilt with db4-4.2.52, gdk-pixbuf-0.22.0-0vl5, gal-0.24-1vl2
- s/Copyright/License/
- added Patched from Fedora
  * Mon Jun 21 2004 David Malcolm <dmalcolm@redhat.com> - 1.1.9-10
  - Added fix for gcc 3.4
  * Tue Mar 16 2004 Bill Nottingham <notting@redhat.com> 1.1.9-7
  - don't build the capplet

* Fri Jan  2 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.9-5vl1
- based on Fedora 1.1.9-5
  * Fri Sep  5 2003 Bill Nottingham <notting@redhat.com> 1.1.9-5
  - don't buildprereq libunicode-devel
  * Wed Aug 20 2003 Havoc Pennington <hp@redhat.com> 1.1.9-4.1
  - fix crash in htmltextslave.c
- rebuilt with new toolchains

* Thu May 15 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.9-3vl1
- based on Rawhide 1.1.9-3 
- rebuilt with new toolchains
- removed BuildPreReq gnome-core-devel, control-center-devel
- added BuildPrereq /usr/lib/libcapples.so 
  (for compatible control-center-devel and libcapplet0-devel :p)
- added Requires pkgconfig

* Sun Sep 15 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.4-0vl1
- updated to new upstream release

* Tue Jan 15 2002 Akira TAGOH <tagoh@gnome.gr.jp> 1.0.1-0vl1
- New upstream release.

* Tue Dec 18 2001 Akira TAGOH <tagoh@gnome.gr.jp> 1.0.0-0vl1
- New upstream release.

* Tue May  8 2001 Akira TAGOH <tagoh@gnome.gr.jp> 0.9.2-0vl1
- New upstream release.

* Tue Apr  3 2001 Shoji Matsumoto <shom@vinelinux.org> 0.8.3-0vl1
- updated to 0.8.3
- add may BuildPrereq: and Requires:
- add fontencfix / fontset patch

* Wed Mar 14 2001 Akira TAGOH <tagoh@gnome.gr.jp> 0.8.2-0vl1
- New upstream Release.