%define _qt4_ver 4.8.6
%define _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo %{qt4_ver})
%define _qt4_prefix %(pkg-config --variable prefix --silence-errors Qt 2>/dev/null || echo %{_libdir}/qt4)
%define _qt4_headerdir %(pkg-config --variable headerdir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix}/plugins)

Name:           qtsoap
Summary:        The Simple Object Access Protocol Qt-based client side library
Summary(ja):    Qt ベースの SOAP クライアントライブラリ
Version:        2.7
Release:        5%{?_dist_release}

Group:          System Environment/Libraries
License:        LGPLv2 with exceptions or GPLv3
URL:            http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Utilities/qtsoap/

Source0:        http://get.qt.nokia.com/qt/solutions/lgpl/qtsoap-%{version}_1-opensource.tar.gz
Patch0:         qtsoap-2.7_1-opensource-install-pub-headers.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  qt4-devel

%description
The SOAP (Simple Object Access Protocol) library uses the XML standard
for describing how to exchange messages. Its primary usage is to invoke web
services and get responses from Qt-based applications.

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

%description    devel
Development files for %{name}.

%prep
%setup -q -n qtsoap-%{version}_1-opensource

# headers are not installed for shared library
%patch0 -p1 -b .install-pub-headers

sed -i 's:$$DESTDIR:%{_libdir}:g' buildlib/buildlib.pro

%build
# we want shared library
echo "SOLUTIONS_LIBRARY = yes" > config.pri

echo "QTSOAP_LIBNAME = \$\$qtLibraryTarget(qtsoap)" >> common.pri
echo "VERSION=%{version}" >> common.pri

qmake PREFIX=%{_prefix}
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make INSTALL_ROOT=%{buildroot} install


%clean
rm -rf %{buildroot}


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc README.TXT LGPL_EXCEPTION.txt LICENSE.GPL3 LICENSE.LGPL
%{_libdir}/libqtsoap.so.*

%files devel
%defattr(-,root,root,-)
%doc LGPL_EXCEPTION.txt LICENSE.GPL3 LICENSE.LGPL
%{_libdir}/libqtsoap.so
%{_qt4_headerdir}/QtSoap/

%changelog
* Mon Feb  9 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 2.7-5
- rebuilt on current VineSeed
- added Japanese summary

* Sun Jan  8 2012 Ryoiochi INAGAKI <ryo1@bc.wakwak.com> - 2.7-4
- rebuilt with qt-4.8.0

* Sat Jul 30 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.7-3
- Initial build for Vine Linux

* Thu Jul 14 2011 Jaroslav Reznik <jreznik@redhat.com> - 2.7-2
- libqtsoap library name

* Thu May 19 2011 Jaroslav Reznik <jreznik@redhat.com> - 2.7-1
- fix version

* Tue Oct 26 2010 Jaroslav Reznik <jreznik@redhat.com> - 1.7-1
- Initial spec file
