%define underscore_version 2_6_2

Name:           tinyxml
Version:        2.6.2
Release:        3%{?_dist_release}
Summary:        A simple, small, C++ XML parser
Summary(ja):    シンプルで小さな C++ XML パーサー
Group:          System Environment/Libraries
License:        zlib
URL:            http://www.grinninglizard.com/tinyxml/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}_%{underscore_version}.tar.gz
Patch0:         tinyxml-2.5.3-stl.patch
Patch1:         entity.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires: gcc-c++

%description
TinyXML is a simple, small, C++ XML parser that can be easily integrating
into other programs. Have you ever found yourself writing a text file parser
every time you needed to save human readable data or serialize objects?
TinyXML solves the text I/O file once and for all.
(Or, as a friend said, ends the Just Another Text File Parser problem.)


%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{name} の開発ファイル
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -q -n %{name}
%patch0 -p1 -b .stl
%patch1
touch -r tinyxml.h.stl tinyxml.h


%build
# Not really designed to be build as lib, DYI
for i in tinyxml.cpp tinystr.cpp tinyxmlerror.cpp tinyxmlparser.cpp; do
  g++ $RPM_OPT_FLAGS -fPIC -o $i.o -c $i
done
g++ $RPM_OPT_FLAGS -shared -o lib%{name}.so.0.%{version} \
   -Wl,-soname,lib%{name}.so.0 *.cpp.o


%install
rm -rf $RPM_BUILD_ROOT
# Not really designed to be build as lib, DYI
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT%{_includedir}
install -m 755 lib%{name}.so.0.%{version} $RPM_BUILD_ROOT%{_libdir}
ln -s lib%{name}.so.0.%{version} $RPM_BUILD_ROOT%{_libdir}/lib%{name}.so.0
ln -s lib%{name}.so.0.%{version} $RPM_BUILD_ROOT%{_libdir}/lib%{name}.so
install -p -m 644 %{name}.h $RPM_BUILD_ROOT%{_includedir}


%clean
rm -rf $RPM_BUILD_ROOT


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc changes.txt readme.txt
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc docs/*
%{_includedir}/*
%{_libdir}/*.so


%changelog
* Sat Jul 09 2016 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.2-3
- rebuilt with new toolchain

* Sat Feb 08 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.2-2
- rebuilt with new toolchain

* Sun Jun 12 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.2-1
- new upstream release
- added BuildRequires: gcc-c++

* Wed Sep 29 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.1-3
- rebuilt with rpm-4.8.1 for pkg-config

* Sun Aug 15 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.1-2
- added patch1 to fix incorrect entity encoding from upstream BTS

* Tue Mar 23 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.1-1
- new upstream release

* Mon Mar 22 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.6.0-1
- new upstream release
- applied new naming policy to spec
- added summary(ja)

* Tue Mar 02 2010 Shu KONNO <owa@bg.wakwak.com> 2.5.3-3
- rebuilt with new toolchain

* Sat May 9 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.5.3-2vl5
- fixed %BuildRoot
- spec in UTF-8

* Wed Jan 21 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.5.3-1vl5
- initial build for VineSeed
- import Fedora's 2.5.3-3

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.5.3-3
- Autorebuild for GCC 4.3

* Fri Dec 14 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.5.3-2
- Various improvements from review (bz 407571)

* Fri Nov 30 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.5.3-1
- Initial Fedora Package
