%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
%define sourcename expat
%define version 1.95.8
%define release 1%{?_dist_release}

Summary:	Expat is an XML 1.0 parser written in C
Summary(ja):	C で書かれた XML 1.0 パーサ
Name:		%{sourcename}1
Version:	%{version}
Release:	%{release}
License:	MIT/X
Group:		Applications/Text
URL:            http://www.libexpat.org/
Source:         http://download.sourceforge.net/expat/%{sourcename}-%{version}.tar.gz
Patch0:		expat-1.95.8-mandir.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root
Requires:	lib%{name} = %{version}-%{release}
BuildPreReq:    libtool

%description

%package -n lib%{name}
Summary:	Runtime library of expat
Summary(ja):	Expat のための実行ライブラリ
Group:		System Environment/Libraries
Obsoletes:      libexpat < 2.0.0

%description -n lib%{name}
This package contains the runtime, shared library of expat, the C
library for parsing XML.

%description -n lib%{name} -l ja
Expat を動作させるために必用となるライブラリです．

## to build compat32 for x86_64 architecture support
%package -n compat32-lib%{name}
Summary:	Runtime library of expat
Group:		System Environment/Libraries
%description -n compat32-lib%{name}
This package contains the runtime, shared library of expat, the C
library for parsing XML.

%prep
%setup -q -n %{sourcename}-%{version}
%patch0 -p1 -b .mandir

%build
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
%if %{build_compat32}
## to build compat32 for x86_64 architecture support
%configure CC='gcc -m32' --enable-shared
%else
%configure --enable-shared
%endif

# Dadou - 1.1-2mdk - Don't try to use optimizations. It breaks build
make

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
rm -rf $RPM_BUILD_ROOT%{_bindir}
rm -rf $RPM_BUILD_ROOT%{_includedir}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.*a
rm -f $RPM_BUILD_ROOT%{_libdir}/*.so
rm -rf $RPM_BUILD_ROOT%{_datadir}

%clean
rm -rf %buildroot

%post -n lib%{name} -p /sbin/ldconfig

%postun -n lib%{name} -p /sbin/ldconfig

%if %{build_compat32}
%post -n compat32-lib%{name} -p /sbin/ldconfig
%postun -n compat32-lib%{name} -p /sbin/ldconfig
%endif

%if !%{build_compat32}
%files -n lib%{name}
%defattr(-,root,root)
%doc COPYING Changes README
%{_libdir}/libexpat.so.*
%endif

## to build compat32 for x86_64 architecture support
%if %{build_compat32}
%files -n compat32-lib%{name}
%defattr(-,root,root)
%{_libdir}/libexpat.so.*
%endif

%changelog
* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> 1.95.8-1vl5
- applied new versioning policy, spec in utf-8

* Mon Feb 18 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.95.8-0vl7
- rename to expat1
- add -fPIC
- distribute libexpat1 only
- add Obsoletes: libexpat < 2.0.0

* Fri Sep 07 2007 Shu KONNO <owa@bg.wakwak.com> 1.95.8-0vl6
- rebuilt

* Mon Feb 06 2006 Shu KONNO <owa@bg.wakwak.com> 1.95.8-0vl5
- moved macros _lib to /usr/lib/rpm/rpmrc or macros files

* Thu Feb 02 2006 Shu KONNO <owa@bg.wakwak.com> 1.95.8-0vl4
- added compat32* packages for x86_64 architecture support

* Tue Feb 15 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 1.95.8-0vl3
- add missing header file (expat_external.h) to %%files.

* Tue Feb 08 2005 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.95.8-0vl2
- updated/revised Patch1 (%%install will fail without this patch)

* Tue Feb 08 2005 Satoshi MACHINO <machino@vinelinux.org> 1.95.8-0vl1
- new upstream release
	-- dropped patch1

* Fri Jan 30 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.95.7-1vl1
- updated to 1.95.7 
- changed URL and Group
- fixed License to MIT/X (based on rpm package at sourceforge)

* Thu Apr 17 2003 IWAI Masaharu <iwai@alib.jp> 1.95.6-0vl1
- version up to 1.95.6
- drop expat-xmlwf-dynamiclink.patch (Patch0)
- add expat-1.95.6-mandir.patch for installing manpage (Patch0)
- add manpage (xmlwf.1)

* Mon Mar 18 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 1.95.2-0vl3
- fixed license ( s/MPL or GPL/distributable/ )
- use License tag

* Sun Oct 07 2001 akira yamada <akira@vinelinux.org> 1.95.2-0vl2
- new sub-package libexpat.
- added BuildPreReq: libtool

* Sat Oct 06 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.95.2-0vl1
- updated to 1.95.2 release

* Sun Jun 17 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.95.1-3vl1
- based on 1.95.1-3mdk from Mandrake 8.0
- added Japanese summary and description
- modified spec macros for Vine

* Thu Feb 15 2001  Daouda Lo <daouda@mandrakesoft.com> 1.95.1-3mdk
- real version is 1.95.1 
- reenable optimisations 

* Thu Feb 15 2001  Daouda Lo <daouda@mandrakesoft.com> 1.95-1mdk
- release .

* Sun Jan 07 2001 David BAUDENS <baudens@mandrakesoft.com> 1.1-2mdk
- Don't try to use optimizations
- Bzip2 sources

* Mon Nov 20 2000 Frederic Lepied <flepied@mandrakesoft.com> 1.1-1mdk
- first version
