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

Summary: A library which allows userspace access to USB devices
Summary(ja): USB デバイスにユーザスペースからアクセスするためのライブラリ
Name: libusb1
Version: 1.0.24
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: LGPLv2+
URL: https://libusb.info/
Source0: https://github.com/libusb/libusb/releases/download/v%{version}/libusb-%{version}.tar.bz2

BuildRoot: %{_tmppath}/%{name}-%{version}-root
ExcludeArch: s390 s390x
BuildRequires: libudev-devel
BuildRequires: doxygen

%global __provides_exclude_from ^%{_libdir}/pkgconfig/.*$

%description
This package provides a way for applications to access USB devices. Note that
this library is not compatible with the original libusb-0.1 series.

%description -l ja
このパッケージはアプリケーションが USB デバイスにアクセスする方法を提供します。
このライブラリはオリジナルの libusb-0.1 シリーズと互換性がないことに注意してください。


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

%description devel
This package contains the header files, libraries and documentation needed to
develop applications that use libusb1.

%description devel -l ja
このパッケージは libusb1 を使うアプリケーションを開発するために
必要なヘッダファイル、ライブラリ、ドキュメントを含んでいます。


%package static
Summary: Static development files for libusb
Summary(ja): libusb の静的開発ファイル
Group: programming
Requires: %{name}-devel = %{version}-%{release}

%description static
This package contains static libraries to develop applications that use libusb1.

%description static -l ja
このパッケージは libusb1 を使うアプリケーションを開発するための
静的ライブラリを含んでいます。


# compat32
%package -n compat32-%{name}
Summary: A library which allows userspace access to USB devices
Summary(ja): USB デバイスにユーザスペースからアクセスするためのライブラリ
Group:    system
Requires: %{name} = %{version}-%{release}
Requires: compat32-eudev-libudev

%description -n compat32-%{name}
This package provides a way for applications to access USB devices. Note that
this library is not compatible with the original libusb-0.1 series.

%description -n compat32-%{name} -l ja
このパッケージはアプリケーションが USB デバイスにアクセスする方法を提供します。
このライブラリはオリジナルの libusb-0.1 シリーズと互換性がないことに注意してください。

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

%description -n compat32-%{name}-devel
This package contains the header files, libraries and documentation needed to
develop applications that use libusb1.

%description -n compat32-%{name}-devel -l ja
このパッケージは libusb1 を使うアプリケーションを開発するために
必要なヘッダファイル、ライブラリ、ドキュメントを含んでいます。


%debug_package


%prep
%setup -q -n libusb-%{version}


%build
%configure
make CFLAGS="$RPM_OPT_FLAGS"
pushd doc
make docs
popd


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la


%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)
%license COPYING
%doc AUTHORS README*
%{_libdir}/libusb-1.0.so.*

%files devel
%defattr(-,root,root)
%doc doc/html examples/*.c
%{_includedir}/libusb-1.0
%{_libdir}/libusb-1.0.so
%{_libdir}/pkgconfig/libusb-1.0.pc

%files static
%defattr(-,root,root)
%{_libdir}/libusb-1.0.a

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

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


%changelog
* Tue Feb 02 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.24-1
- new upstream release.

* Sun Mar 29 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.23-1
- new upstream release.

* Fri Jan 05 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.21-1
- new upstream release.

* Sat Dec 13 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.0.19-2
- added compat32 subpackages

* Sat Jul 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.19-1
- new upstream release
- add BuildRequires: eudev-libudev-devel

* Thu May 10 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.9-1
- new upstream release

* Sun Sep 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.8-2
- rebuild with rpm-4.8.1 for pkg-config file

* Tue May 25 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.8-1
- new upstream release

* Thu Dec 3 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.6-1
- new upstream release

* Wed Sep 23 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.3-1
- new upstream release

* Mon Aug 3 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.2-1
- new upstream release

* Sun Jun 14 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.1-1
- new upstream release
- fixed BuildRoot
- added Japanese description, summary

* Wed May 13 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.0-1
- initial build for Vine Linux

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Dec 15 2008 - Bastien Nocera <bnocera@redhat.com> - 1.0.0-1
- Update to 1.0.0

* Fri Nov 21 2008 - Bastien Nocera <bnocera@redhat.com> - 0.9.4-1
- Update to 0.9.4

* Tue Sep 23 2008 Jindrich Novy <jnovy@redhat.com> 0.9.3-0.1
- update to 0.9.3

* Sun Jul 06 2008 - Bastien Nocera <bnocera@redhat.com> - 0.9.1
- Update to 0.9.1

* Mon May 26 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.4
- update to official beta

* Fri May 23 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.3.gitbef33bb
- update comment on how the tarball was created
- use abbreviated git hash within package name to avoid conflicts
- add to %%description that libusb1 is incompatible with libsub-0.1

* Thu May 22 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.2.gitbef33bb
- add info on how the snapshot tarball was created

* Wed May 21 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.1.gitbef33bb
- use proper version to denote it is a git snapshot

* Thu May 15 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.1
- initial packaging
