# option for not using libwmf-0.2.0 or higher
# rpmbuild -ba | --rebuild --without libwmf
%define           LIBWMF  1
%{?_without_libwmf:%define LIBWMF 0}

Summary: an MS-Word document converter
Summary(ja): MS Word 文章コンバータ
Name:  wv
Version: 1.2.4
Release: 3%{?_dist_release}
Group: Applications/Text
License: GPLv2
URL: http://wvware.sourceforge.net/
Source0: http://download.sourceforge.net/wvware/%{name}-%{version}.tar.gz

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: zlib-devel
BuildRequires: glib2-devel
BuildRequires: libgsf-devel
BuildRequires: libpng-devel
BuildRequires: libxml2-devel
BuildRequires: libjpeg-devel
%if %{LIBWMF}
BuildRequires: libwmf-devel >= 0.2.6
Requires: libwmf >= 0.2.6
%endif

%description
wv is an MS-Word document converter.
If you want to get EUC-JP html files, see the example below.
wvHtml foobar.doc foobar.html.utf8
iconv -f UTF-8 -t EUC-JP foobar.html.utf8 | \
sed 's/UTF-8/EUC-JP/g' > foobar.html.euc

%if %{LIBWMF}
This package is configured to use libwmf, so it can convert wmf files
into png.  Please install libwmf-0.2.0 or higher too.
%else
This package is configured not to use libwmf, so it can't convert
wmf files into png.
%endif

%description -l ja
wv は MS Word ドキュメントのコンバータです．EUC-JP エンコードの 
html ファイルを作成したいのであれば，次の例を参考にしてください．

wvHtml foobar.doc foobar.html.utf8
iconv -f UTF-8 -t EUC-JP foobar.html.utf8 | \
sed 's/UTF-8/EUC-JP/g' > foobar.html.euc

%if %{LIBWMF}
このパッケージは libwmf を使用するように設定されているので，wmf 
ファイルを png に変換することができます．libwmf のバージョン 0.2.0 以上
をあわせてインストールしてください．
%else
このパッケージは libwmf を使用しないように設定されているので，
wmf ファイルを png に変換することはできません．
%endif

%package devel
Summary: Development tools for programs to manipulate MS-Word documents
Summary(ja): MS Word ドキュメントを処理するプログラムを開発するためのツール
Group: Development/Libraries
Requires: wv = %{version}
Requires: zlib-devel
Requires: glib2-devel
Requires: libgsf-devel
Requires: libpng-devel
Requires: libxml2-devel
Requires: libjpeg-devel
%if %{LIBWMF}
Requires: libwmf-devel >= 0.2.6
%endif

%description devel
The wv-devel package contains the header files and static
libraries necessary for developing programs using wv.

If you want to develop programs which will manipulate MS-Word documents, you
should install wv-devel. You'll also need to install the wv package.

%description devel -l ja
wv-devel パッケージには wv を使用したプログラムの開発に必要な
ヘッダファイルおよび静的ライブラリが含まれています．

MS Word ドキュメントを処理するプログラムを開発したいのであれば，
wv-devel パッケージをインストールすべきです．wv パッケージを
インストールする必要もあります．

%prep
%setup -q

%build
%configure --disable-static \
%if %{LIBWMF}
	--with-libwmf \
%endif

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc COPYING README
%{_bindir}/wv[A-Z]*
%{_libdir}/lib*.so.*
%{_datadir}/wv
%{_mandir}/man1/*

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

%changelog
* Sat Sep 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.4-3
- rebuild with rpm-4.8.1 for pkg-config file

* Tue May  5 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.4-2
- spec in UTF-8
- removed *.a file from devel package

* Thu May  1 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.4-1
- applied new versioning policy
- removed *.la file from devel package
- added %%post and %%postun for /sbin/ldconfig

* Thu Dec 21 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.4-0vl1
- new upstream release
  includes security fix CVE-2006-4513 <BTS:428>

* Sat Jun 17 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.0-0vl4
- rebuild

* Thu May  5 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.0-0vl3
- added Requires: libwmf-devel to wv-devel

* Tue Mar 14 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.0-0vl2
- rebuilt with libgsf-1.14.0

* Thu Nov 17 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.0-0vl1
- new upstream release

* Fri Feb 18 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.3-0vl1
- updated to 1.0.3
- Patch1 was merged to upstream, dropped 
- added Japanese summary and description
- added --with-expat to %configure
- rewrite build option "--without libwmf"

* Sat Sep 29 2004 SATO Masakiyo <info@pocomoco.net> 1.0.0-0vl3
- correct wv.spec for CAN-2004-0645

* Sat Aug 28 2004 SATO Masakiyo <info@pocomoco.net> 1.0.0-0vl2
- added patch1 for CAN-2004-0645

* Tue Sep 23 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.0-0vl1
- update to 1.0.0
- rebuild with new toolchains
- fixed spec file 

* Thu Oct 03 2002 Shoji Matsumoto <shom@vinelinux.org> 0.7.2-0vl1
- update

* Thu Sep 06 2001 Toru Sagami <sagami@vinelinux.org>
- 0.6.7-0vl1: was ported to VineSeedPlus with better macros
- build with libwmf by default

* Fri Jun  2 2001 NISHIMURA Daisuke <nishi@graco.c.u-tokyo.ac.jp>
- 0.6.5-0vl1
- subpackage devel
- not to require libwmf by default
- macro-usage change

* Mon Dec  6 1999 Yasuhide OOMORI <dasen@typhoon.co.jp>
- [wv-0.5.41-1]
- First attempt.
