%global githash 726325d
%global gitdate 20100625
#global posttag .%{?gitdate}git%{?githash}

%define qt4_ver 4.8.0
%define _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo %{qt4_ver})
%define _qt4_datadir %(pkg-config --variable datadir --silence-errors Qt 2>/dev/null || echo %{_libdir}/qt4)

Name:		qoauth
Summary:	Qt-based C++ library for OAuth authorization scheme
Version:	1.0.1
Release:	4%{?_dist_release}

Group:		System Environment/Libraries
License:	LGPLv2+
URL:		http://github.com/ayoy/qoauth

Source0:	http://files.ayoy.net/qoauth/release/%{version}/src/%{name}-%{version}-src.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:	qt4-devel qca2-devel doxygen
BuildRequires:	qca-ossl
Requires:	qca-ossl

%description
QOAuth is a Qt-based C++ implementation of an interface to services using
OAuth authorization scheme.

%package devel
Summary:	Development files for the Qt OAuth support library
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	qt4-devel >= %{_qt4_version}
Requires:	qca2-devel

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

%prep
%setup -q -n %{name}-%{version}-src
sed -i -e '/^ *docs \\$/d' \
       -e "s!\(\$\${INSTALL_PREFIX}\)/lib.*!%{_libdir}!" src/src.pro
sed -i -e 's\/lib\/%{_lib}\g' src/pcfile.sh

%build
export PATH=%{_qt4_prefix}/bin:$PATH
%{_qt4_prefix}/bin/qmake PREFIX="%{_prefix}"
make %{?_smp_mflags}


%install
make install INSTALL="install -p" INSTALL_ROOT=%{buildroot}
doxygen Doxyfile

# fix the time stamp
for file in doc/html/*; do
	touch -r Doxyfile $file
done

%check
make check || :

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc README CHANGELOG LICENSE
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc doc/html doc/examples
%{_libdir}/*.so
%{_libdir}/*.prl
%{_libdir}/pkgconfig/*.pc
%{_qt4_datadir}/mkspecs/features/*.prf
%{_includedir}/*

%changelog
* Mon Jan  9 2012 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.1-4
- rebuilt with qt-4.8.0

* Tue Mar  8 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.1-3
- rebuilt with qt4-4.7.2

* Thu Jan 13 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.1-2
- Initial build for Vine Linux

* Sun Aug 08 2010 Chen Lei <supercyper@163.com> - 1.0.1-1
- Update to 1.0.1

* Fri Jun 25 2010 Chen Lei <supercyper@163.com> - 1.0.1-0.3.20100625git726325d
- New upstream version

* Tue Jun 22 2010 Chen Lei <supercyper@163.com> - 1.0.1-0.2.20100622git7f69e33
- New upstream version
- Add %%check section

* Tue May 25 2010 Chen Lei <supercyper@163.com> - 1.0.1-0.1.20100525gitec7e4d5
- initial rpm build
