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

%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_bindir %(pkg-config --variable bindir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix}/bin)
%define _qt4_datadir %(pkg-config --variable datadir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix})

Name:		qoauth
Version:	1.0.1
Release:	6%{?_dist_release}
Summary:	Qt library OAuth authorization scheme
Summary(ja):	OAuth 認証スキームのための Qt ライブラリ

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
Summary(ja):	Qt OAuth ライブラリの開発用ファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

%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_bindir}:$PATH
qmake PREFIX="%{_prefix}"
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install INSTALL="install -p" INSTALL_ROOT=$RPM_BUILD_ROOT
doxygen Doxyfile

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

%check
make check || :

%clean
rm -rf $RPM_BUILD_ROOT

%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
* Sat Jul 09 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.0.1-6
- rebuild with gcc-5.4.0

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

* 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