%define name sablotron
%define version 1.0.3
%define release 5%{?_dist_release}

%define	altname Sablot
%define builddir $RPM_BUILD_DIR/%{altname}-%{version}
%define lib_name_orig libsablotron
%define lib_major 0
%define lib_name %{lib_name_orig}%{lib_major}

Summary: 		XSLT processor
Summary(ja): 		XSLT プロセッサ
Name: 			%{name}
Version: 		%{version}
Release: 		%{release}
License: 		MPL/GPL
Group: 			Applications/Text
URL:			http://sourceforge.net/projects/sablotron/

Source0: 		%{url}/files/sablotron-%{version}/Sablot-%{version}.tar.gz

BuildRoot:      	%{_tmppath}/%{name}-%{version}-root
BuildRequires:  	expat-devel >= 1.95.2 
BuildRequires:		perl-XML-Parser
Requires:		expat >= 1.95.2
Requires:		%{lib_name}

%description
Sablotron is a fast, compact and portable XML toolkit
implementing XSLT, DOM and XPath.

The goal of this project is to create a lightweight,
reliable and fast XML library processor conforming to the W3C
specification, which is available for public and can be used as a base
for multi-platform XML applications.

%package -n %{lib_name}
Summary:	Main library for sablotron
Summary(ja):	sablotron ライブラリ
Group:		System Environment/Libraries
Provides:	%{name} = %{version}-%{release}

%description -n %{lib_name}
Contains the library for sablotron.

%package -n %{lib_name}-devel
Summary: 	The development libraries and header files for Sablotron
Summary(ja): 	Sablotron の開発ライブラリおよびヘッダファイル
Requires: 	sablotron = %{version}
Group: 		Development/Libraries
Requires: 	%{lib_name} = %{version}
Provides: 	%{lib_name_orig}-devel = %{version}-%{release}

%description -n %{lib_name}-devel
These are the development libraries and header files for Sablotron

%prep
%setup -q -n %{altname}-%{version}

%build
export CXXFLAGS="${RPM_OPT_FLAGS}"
%configure --disable-static
make %{?_smp_mflags}

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

make install DESTDIR=$RPM_BUILD_ROOT
## remove unuse files
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la

# docs
rm -rf _docs_to_include
mkdir -p _docs_to_include
mv $RPM_BUILD_ROOT/%{_docdir}/html/* _docs_to_include

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

%post -n %{lib_name} -p /sbin/ldconfig

%postun -n %{lib_name} -p /sbin/ldconfig


%files
%defattr(755,root,root)
%doc _docs_to_include/*
%{_bindir}/sabcmd
%{_mandir}/man1/sabcmd.*
#{_docdir}/html/jsdom-ref
#{_docdir}/html/sablot
#{_docdir}/html/sxp

%files -n %{lib_name}
%defattr(-,root,root)
%{_libdir}/libsablot.so.*
%doc README RELEASE

%files -n %{lib_name}-devel
%defattr(-,root,root)
%{_bindir}/sablot-config
#{_libdir}/lib*.a
#{_libdir}/lib*.la
%{_libdir}/lib*.so
%{_includedir}/*.h

%changelog
* Fri Sep 02 2016 Toshiaki Ara <ara_t@384.jp> 1.0.3-5
- rebuild with gcc-5.4.0

* Mon Dec 15 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.0.3-4
- rebuilt on current VineSeed
- excluded static library from libsablotron-devel package
- moved html document to %{_docdir}/%{name}-%{version}

* Sun Feb 05 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.3-3
- rebuild with Vine6 environment

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

* Sat Sep 20 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.3-1vl5
- applied new versioning policy, spec in utf-8
- removed *.la

* Wed Feb 27 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.0.3-0vl2
- rebuild with expat-2.0.1

* Sun Jan  6 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.3-0vl1
- updated Sablot to 1.0.3
- dropt sablot-lib-0.71.patch.bz2

* Sat Jul  7 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.97-0vl5
- rebuilt with new toolchain

* Mon Jun 19 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.97-0vl4
- changed Group to Applications/Text

* Sat Mar 18 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.97-0vl3
- added Japanese summary
- changed Group:

* Sat Jan 25 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.97-0vl2
- added BuildRequires: perl-XML-Parser

* Thu Jan 21 2003 Satoshi MACHINO <machino@vinelinux.org> 0.97-0vl1
- new upstream version

* Thu May 16 2002 Satoshi MACHINO <machino@vinelinux.org> 0.90-1vl1
- build on Vine Linux
	-- modified spec

* Wed Apr 03 2002 Christian Belisle <cbelisle@mandrakesoft.com> 0.90-1mdk
- release 0.90.
- patch to add -lexpat and -lstdc++ in libsablot.so (required for php4)

* Mon Feb 04 2002 Christian Belisle <cbelisle@mandrakesoft.com> 0.82-1mdk
- release 0.82.

* Wed Jan 16 2002 Christian Belisle <cbelisle@mandrakesoft.com> 0.81-1mdk
- release 0.81.
- Removed patch for 0.80.

* Tue Jan 15 2002 Christian Belisle <cbelisle@mandrakesoft.com> 0.80-1mdk
- release 0.80.

* Wed Nov 21 2001 Christian Belisle <cbelisle@mandrakesoft.com> 0.71-1mdk
- release 0.71.
- bzip2 the source.
- remove the patch.

* Tue Nov 06 2001 Philippe Libat <philippe@mandrakesoft.com> 0.70-2mdk
- %macros
- move sabcmd in sablotron rpm

* Mon Nov 05 2001 Christian Belisle <cbelisle@mandrakesoft.com> 0.70-1mdk
- first mdk release.

* Tue Sep 18 2001 Petr Cimprich <petr@gingerall.cz>
- sablotron 0.70 RPM release 1

* Wed Aug 15 2001 Petr Cimprich <petr@gingerall.cz>
- sablotron 0.65 RPM release 1

* Thu Jun 14 2001 Petr Cimprich <petr@gingerall.cz>
- sablotron 0.60 RPM release 1
- build under RedHat 7.1 with rpm 4.0.2

* Wed Apr 22 2001 Petr Cimprich <petr@gingerall.cz>
- sablotron 0.52 RPM release 1
- based on 0.51-5 spec by Henri Gomez

* Thu Feb 22 2001 Henri Gomez <hgomez@slib.fr>
- sablotron 0.51 RPM release 5
- apply patch to add -lexpat and -lstdc++ in libsablot.so
  REQUIRED for use with PHP4

* Thu Feb 22 2001 Henri Gomez <hgomez@slib.fr>
- sablotron 0.51 RPM release 4
- follow Redhat way to dispatch between pack and pack-devel

* Tue Feb 20 2001 Henri Gomez <hgomez@slib.fr>
- sablotron 0.51 RPM release 3
- added ldconfig is post/preun and cleanup stuff
- build under Redhat 6.2 + updates with rpm 3.0.5

* Mon Feb 19 2001 Henri Gomez <hgomez@slib.fr>
- sablotron 0.51 RPM release 2
- added Requires expat >= 1.95.1

* Mon Feb 19 2001 Henri Gomez <hgomez@slib.fr>
- sablotron 0.51 RPM release 1
- updated spec file 

