Blob Blame Raw
Name:           tinyxpath
Version:        1.3.1
Release:        3%{?dist}
Summary:        Small XPath syntax decoder

License:        zlib
URL:            http://tinyxpath.sourceforge.net/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}_1_3_1.zip
# tinyxpath include a bundled version of tinyxml
Patch0:         %{name}.remove_bundled_tinyxml.patch
# Fix false-positive of the binary test (see https://sourceforge.net/p/tinyxpath/support-requests/7/ )
Patch1:         %name.fix_test.patch

BuildRequires:  tinyxml-devel autoconf automake

%description
TinyXPath is a small footprint XPath syntax decoder, written in C++.
- Syntax decoding
- Application to a TinyXML tree
- Function to extract a result from a tree (string, node set or integer)

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       tinyxml-devel

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


%prep
%setup -q -c %{name}-%{version}
%patch0
%patch1
rm -rf tinyxml* tinystr*

# Correct some errors due to bundled tinyxml
sed -i 's+TiXmlNode::+TiXmlNode::TINYXML_+g' *.cpp
sed -i 's+#include "tinystr.h"+//#include "tinystr.h"+g' *.h

# Fix wrong EOF encoding
sed -i 's/\r$//' AUTHORS


%build
make -f Makefile.configure
# Build with -fPIC for the library
%configure CPPFLAGS="-fPIC"
make %{?_smp_mflags}

# Not really designed to be build as lib, DYI
g++ $RPM_OPT_FLAGS -shared -o lib%{name}.so.0.1 \
   -Wl,-soname,lib%{name}.so.0.1 `ls *.o | grep -v main.o` -ltinyxml


%check
./tinyxpath
grep -q '<em>' out.htm && false

%install
%make_install

# Install headers by hands.
mkdir -p %{buildroot}%{_includedir}/%{name}
install -pDm644 *.h %{buildroot}%{_includedir}/%{name}

#Install lib by hands.
mkdir -p %{buildroot}%{_libdir}
install -m 755 lib%{name}.so.0.1 %{buildroot}%{_libdir}
ln -s lib%{name}.so.0.1 %{buildroot}%{_libdir}/lib%{name}.so.0
ln -s lib%{name}.so.0.1 %{buildroot}%{_libdir}/lib%{name}.so

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
# Exclude binary, whicih is only for test
%exclude %{_bindir}/tinyxpath

%doc AUTHORS
%{_libdir}/lib%{name}.so.0
%{_libdir}/lib%{name}.so.0.*

%files devel
%{_includedir}/%{name}
%{_libdir}/lib%{name}.so


%changelog
* Fri Jul 31 2015 Alexandre Moine <nobrakal@gmail.com> 1.3.1-3
- Add tinyxml-devel as a Requires for tinyxpath-devel
- Remove by-hands installation of AUTHORS

* Thu Jul 30 2015 Alexandre Moine <nobrakal@gmail.com> 1.3.1-2
- Remove wrong license link
- Add AUTHORS to %%doc
- Exclude %%{_bindir}/tinyxpath beceause it is not useful
- Remove explicit dependency tinyxml
- Change soname to libtinyxpath.so.0.1 

* Tue Jul 14 2015 Alexandre Moine <nobrakal@gmail.com> 1.3.1-1
- Initial spec