%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Name:		libgusb
Version:	0.2.7
Release:	1%{?_dist_release}
Summary:	GObject wrapper for libusb1
Summary(ja):	libusb1 用 GObject ラッパー

Group:          System Environment/Libraries
License:        LGPLv2+
URL:            https://gitorious.org/gusb/
Source0:        http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  glib2-devel >= 2.32.0
BuildRequires:  gobject-introspection-devel
BuildRequires:  libusb1-devel >= 1.0.19

Vendor:		Project Vine
Distribution:	Vine Linux
Packager:	Takemikaduchi


%description
GUsb is a GObject wrapper for libusb1 that makes it easy to do
asynchronous control, bulk and interrupt transfers with proper
cancellation and integration into a mainloop.
This makes it easy to integrate low level USB transfers with your
high-level application or system daemon.

Not everything you can do in libusb1 is wrapped, although we'll accept
feature requests (with patches) if it makes sense. There is some pretty
low hanging fruit if you're interested.


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

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


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

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


# compat32
%package -n compat32-%{name}
Summary: GObject wrapper for libusb1
Summary(ja): libusb1 用 GObject ラッパー
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
GUsb is a GObject wrapper for libusb1 that makes it easy to do
asynchronous control, bulk and interrupt transfers with proper
cancellation and integration into a mainloop.
This makes it easy to integrate low level USB transfers with your
high-level application or system daemon.

Not everything you can do in libusb1 is wrapped, although we'll accept
feature requests (with patches) if it makes sense. There is some pretty
low hanging fruit if you're interested.

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

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


%prep
%setup -q

%build
%configure --disable-static --disable-vala
make %{?_smp_mflags}

%check

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'


%clean
rm -rf $RPM_BUILD_ROOT


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%if %{build_compat32}
%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig
%endif


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING MAINTAINERS NEWS README
%{_libdir}/%{name}.so.*
%{_libdir}/girepository-1.0/GUsb-1.0.typelib

%files devel
%defattr(-,root,root,-)
%{_includedir}/gusb-1
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/gusb.pc
%{_datadir}/gir-1.0/GUsb-1.0.gir

%files doc
%defattr(-,root,root,-)
%{_datadir}/gtk-doc/html/gusb

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root,-)
%{_libdir}/%{name}.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root,-)
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/gusb.pc
%endif


%changelog
* Thu Oct 29 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.2.7-1
- new upstream release

* Sat Dec 13 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.2.3-1
- new upstream release
- added compat32 subpackages

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.1.6-2
- rebuild with VineSeed environment

* Wed Apr 17 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.1.6-1
- new upstream release
- add BuildRequires: gobject-introspection-devel

* Wed Jan 02 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.1.4-1
- new upstream release

* Wed Sep 26 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.1.3-1
- initial build