%global glib2_version 2.36.0
%global libsoup_version 2.37.9

# Packagers: This is the API version of libuhttpmock, as it allows
# for parallel installation of different major API versions (e.g. like
# GTK+ 2 and 3).
%global uhm_api_version 0.0

Name:           uhttpmock
Version:        0.5.0
Release:        1%{?_dist_release}
Summary:        HTTP web service mocking library
Summary(ja):    HTTP Web サービス模擬ライブラリ
License:        LGPLv2
Group:          System Environment/Libraries
URL:            http://gitorious.org/uhttpmock/

Source0:        http://tecnocode.co.uk/downloads/%{name}/%{name}-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires:  glib2-devel >= %{glib2_version}
BuildRequires:  libsoup-devel >= %{libsoup_version}
BuildRequires:  intltool
BuildRequires:  gobject-introspection-devel
BuildRequires:  gtk-doc
BuildRequires:  vala-tools
BuildRequires:  vala-devel
BuildRequires:  gsettings-desktop-schemas

Requires:       glib2 >= %{glib2_version}
Requires:       libsoup >= %{libsoup_version}

%description
uhttpmock is a project for mocking web service APIs which use HTTP or HTTPS.
It provides a library, libuhttpmock, which implements recording and
playback of HTTP request–response traces.


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

%description devel
This package contains libraries, header files and documentation for
developing applications that use %{name}.


%package        docs
Summary:        Documentation for %{name}
Summary(ja):    %{name} 用のドキュメント
Group:          Documentation
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description    docs
This package contains documentation for %{name}.


%package        vala
Summary:        Vala bindings for %{name}
Summary(ja):    %{name} の Vala バインディング
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       vala

%description    vala
Vala bindings for %{name}.


%prep
%setup -q

%build
%configure \
    --enable-gtk-doc \
    --enable-introspection \
    --enable-vala=yes \
    --disable-static
make %{?_smp_mflags}

%check
make check

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc README COPYING NEWS AUTHORS
%{_libdir}/libuhttpmock-%{uhm_api_version}.so.0*
%{_libdir}/girepository-1.0/Uhm-%{uhm_api_version}.typelib

%files devel
%defattr(-,root,root,-)
%{_libdir}/libuhttpmock-%{uhm_api_version}.so
%{_includedir}/libuhttpmock-%{uhm_api_version}/
%{_libdir}/pkgconfig/libuhttpmock-%{uhm_api_version}.pc
%{_datadir}/gir-1.0/Uhm-%{uhm_api_version}.gir

%files docs
%defattr(-,root,root,-)
%{_datadir}/gtk-doc/html/libuhttpmock-%{uhm_api_version}/

%files vala
%defattr(-,root,root,-)
%{_datadir}/vala/vapi/libuhttpmock-%{uhm_api_version}.deps
%{_datadir}/vala/vapi/libuhttpmock-%{uhm_api_version}.vapi

%changelog
* Sat Oct 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.5.0-1
- update to 0.5.0

* Fri Jan 30 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.3.1-3
- added %%clean section
- moved devel subpackage to Development/Libraries Group

* Sat Nov 22 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.3.1-2
- added Group tag to main and devel packages 

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.3.1-1
- initial build for Vine Linux

* Fri Aug 22 2014 Philip Withnall <philip@tecnocode.co.uk> - 0.3.1-1
- Update to 0.3.1

* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jul 22 2014 Kalev Lember <kalevlember@gmail.com> - 0.3.0-2
- Rebuilt for gobject-introspection 1.41.4

* Sun Jun 22 2014 Philip Withnall <philip@tecnocode.co.uk> - 0.3.0-1
- Update to 0.3.0

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue Nov 05 2013 Philip Withnall <philip.withnall@collabora.co.uk> - 0.2.0-1
- Initial spec file for version 0.2.0.
