## START: Set by rpmautospec ## (rpmautospec version 0.7.3) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 10; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %bcond mingw %[0%{?fedora} && !0%{?flatpak}] %bcond linux 0 %if %{without linux} %global debug_package %{nil} %endif Summary: Library for accessing USB devices Name: libusb1 Version: 1.0.27 Release: %autorelease Source0: https://github.com/libusb/libusb/releases/download/v%{version}/libusb-%{version}.tar.bz2 License: LGPL-2.1-or-later URL: http://libusb.info Epoch: 1 # upstream patches Patch0001: 0001-sunos-Fix-typos-breaking-build.patch Patch0002: 0002-Add-clang-tidy-config-file.patch Patch0003: 0003-hotplug_exit-Remove-parents-recursively.patch Patch0004: 0004-hotplug_exit-Mutex-protection-of-context-device-list.patch Patch0005: 0005-emscripten-Remove-superfluous-capability.patch Patch0006: 0006-xusb-Avoid-warning-about-implicit-switch-fallthrough.patch Patch0007: 0007-Fix-most-warnings-about-implicit-sign-conversion.patch Patch0008: 0008-darwin-Correct-interpretation-of-COM-style-Release-r.patch Patch0009: 0009-xcode-Enable-several-additional-warnings-in-the-Xcod.patch Patch0010: 0010-darwin-Fix-clang-static-analyzer-warning-about-a-var.patch Patch0011: 0011-darwin-Suppress-false-positive-warning-with-an-asser.patch Patch0012: 0012-haiku-Use-gcc-atomic-builtins-to-fix-build.patch Patch0013: 0013-Increase-usbi_get_tid-size-from-int-to-long.patch Patch0014: 0014-darwin-Cleanup-of-usbi_backend-structure.patch Patch0015: 0015-Add-support-for-SuperSpeed-Capability-Descriptors.patch Patch0016: 0016-Add-API-support-for-LIBUSB_SPEED_SUPER_PLUS_X2-20Gbp.patch Patch0017: 0017-windows-Restore-behaviour-of-skipping-malformed-devi.patch Patch0018: 0018-SuperSpeedPlus-Fix-typo-mantisa-mantissa-in-struct-f.patch Patch0019: 0019-linux-Fix-type-of-open-flags-argument.patch Patch0020: 0020-linux-ioctl-request-number-is-unsigned-long.patch Patch0021: 0021-xusb-Only-retrieve-BOS-descriptor-for-bcdUSB-0x0201-.patch Patch0022: 0022-Cosmetic-cleanup-of-SuperSpeedPlus-comments.patch Patch0023: 0023-windows-Downgrade-get_guid-DeviceInterfaceGUID-messa.patch Patch0024: 0024-Consistent-use-of-C-style-comment-markers.patch Patch0025: 0025-descriptor-Replace-parse_descriptor-function.patch Patch0026: 0026-descriptor-Defer-potentially-truncating-cast-to-last.patch Patch0027: 0027-descriptor-Restore-implicitly-casted-away-const.patch Patch0028: 0028-descriptor-Fix-potential-offsetting-of-pointer-by-to.patch Patch0029: 0029-descriptor-Small-clarifications-with-no-behaviour-ch.patch Patch0030: 0030-descriptor-Avoid-buffer-over-increment-in-parse_iad_.patch Patch0031: 0031-Emscripten-Avoid-uncaught-TypeError-on-browsers-with.patch Patch0032: 0032-examples-ezusb-Replace-rewind-with-fseek-to-check-fo.patch Patch0033: 0033-examples-fxload-Eliminate-all-reserved-C-identifiers.patch Patch0034: 0034-examples-xusb-Make-all-macro-replacement-lists-paren.patch Patch0035: 0035-examples-xusb-Make-some-parameters-const-where-possi.patch Patch0036: 0036-examples-xusb-Match-size-of-loop-index-to-what-is-it.patch Patch0037: 0037-darwin-Always-use-uppercase-literal-suffixes-for-imp.patch Patch0038: 0038-darwin-Explicitly-compare-string-compare-function-re.patch Patch0039: 0039-darwin-Fix-multiplication-overflow-by-better-matchin.patch Patch0040: 0040-Avoid-assignments-within-if-statements.patch Patch0041: 0041-descriptor-Eliminate-all-duplicate-branch-bodies-as-.patch Patch0042: 0042-descriptor-Fix-addition-overflow-by-correcting-casts.patch Patch0043: 0043-libusb.h-Match-parameter-names-in-declaration-and-de.patch Patch0044: 0044-clang-tidy-Stop-suppressing-readability-misleading-i.patch Patch0045: 0045-xusb-Define-proper-exit-status.patch Patch0046: 0046-Add-KEYS-file-for-release-files-verification.patch Patch0047: 0047-Replace-atoi-with-strtol-which-allows-error-checking.patch Patch0048: 0048-netbsd-Debug-print-all-errors.patch Patch0049: 0049-openbsd-Use-default-clause-in-_errno_to_libusb.patch Patch0050: 0050-windows-Base-HID-device-descriptor-on-cached-values.patch Patch0051: 0051-examples-ezusb-Fix-error-checking-regression-in-rece.patch Patch0052: 0052-xcode-Adjust-file-indentation-settings.patch Patch0053: 0053-descriptor-Fix-clang-Wimplicit-int-conversion-warnin.patch Patch0054: 0054-winusb-Fix-winusb_get_device_list-failing-to-find-po.patch Patch0055: 0055-docs-Document-internal_ssplus_capability_descriptor.patch Patch0056: 0056-docs-Hide-internal-descriptor.c-structure-from-doxyg.patch Patch0057: 0057-docs-Fix-broken-doxygen-references.patch Patch0058: 0058-macos-Fix-Zero-Length-Packet-for-multiple-packets-pe.patch Patch0059: 0059-Enable-linux-netlink-event-monitoring-for-Android-OS.patch # windows hotplut implementation Patch0060: 0060-example-hotplugtest-Ignore-unavailable-devices.patch Patch0061: 0061-tests-stress_mt-ignore-errors-in-threads-for-checkin.patch Patch0062: 0062-windows-hotplug-implementation.patch Patch0063: 0063-windows-hotplug-implementation-use-PDEV_BROADCAST_DE.patch Patch0064: 0064-windows-Improve-hotplug-reliability.patch Patch0065: 0065-Format-code-style.patch BuildRequires: systemd-devel doxygen libtool BuildRequires: umockdev-devel BuildRequires: make BuildRequires: gcc # libusbx was removed in F34 Provides: libusbx = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: libusbx < %{version}-%{release} %if %{with mingw} BuildRequires: mingw32-filesystem >= 95 BuildRequires: mingw32-gcc-c++ BuildRequires: mingw64-filesystem >= 95 BuildRequires: mingw64-gcc-c++ # mingw-libusbx was removed in F42 Provides: mingw-libusbx = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: mingw-libusbx < %{version}-%{release} %endif %description This package provides a way for applications to access USB devices. libusb is a library for USB device access from Linux, macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris userspace. libusb is abstracted internally in such a way that it can hopefully be ported to other operating systems. %if %{with linux} %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: libusbx-devel = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: libusbx-devel < %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package devel-doc Summary: Development files for %{name} Requires: libusb1-devel = %{?epoch:%{epoch}:}%{version}-%{release} Provides: libusbx-devel-doc = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: libusbx-devel-doc < %{version}-%{release} BuildArch: noarch %description devel-doc This package contains API documentation for %{name}. %package tests-examples Summary: Tests and examples for %{name} # The fxload example is GPLv2+, the rest is LGPLv2+, like libusb itself. License: LGPLv2+ and GPLv2+ Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: libusbx-tests-examples = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: libusbx-tests-examples < %{version}-%{release} %description tests-examples This package contains tests and examples for %{name}. %endif %if %{with mingw} %package -n mingw32-%{name} Summary: MinGW Windows %{name} library Provides: mingw32-libusbx = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: mingw32-libusbx < %{version}-%{release} %description -n mingw32-%{name} MinGW Windows %{name} library. %package -n mingw64-%{name} Summary: MinGW Windows %{name} library Provides: mingw64-libusbx = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: mingw64-libusbx < %{version}-%{release} %description -n mingw64-%{name} MinGW Windows %{name} library. %endif %prep rm -rf %{name}-%{version} %setup -D -c -T -n %{name}-%{version} -a 0 pushd libusb-%{version} sed -i '/AM_LDFLAGS = -static/d' tests/Makefile.am chmod -x examples/*.c mkdir -p m4 cp COPYING AUTHORS README ChangeLog .. popd %if %{with linux} cp -r libusb-%{version} %{_target_os} %endif mv libusb-%{version} windows %if %{with linux} pushd %{_target_os} %autopatch -p1 -m 1 -M 59 autoreconf -fvi popd %endif pushd windows %autopatch -p1 -m 1 -M 65 autoreconf -fvi popd %build %if %{with linux} pushd %{_target_os} %configure --disable-static --enable-examples-build %{make_build} pushd doc make docs popd pushd tests make popd popd %endif pushd windows %if %{with mingw} # MinGW build %mingw_configure --disable-static %mingw_make_build %endif popd %install %if %{with linux} pushd %{_target_os} %{make_install} mkdir -p $RPM_BUILD_ROOT%{_bindir} install -m 755 tests/.libs/init_context $RPM_BUILD_ROOT%{_bindir}/libusb-test-init_context install -m 755 tests/.libs/set_option $RPM_BUILD_ROOT%{_bindir}/libusb-test-set_option install -m 755 tests/.libs/stress $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress install -m 755 tests/.libs/stress_mt $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress_mt install -m 755 tests/.libs/umockdev $RPM_BUILD_ROOT%{_bindir}/libusb-test-umockdev install -m 755 examples/.libs/testlibusb \ $RPM_BUILD_ROOT%{_bindir}/libusb-test-libusb # Some examples are very device-specific / require specific hw and miss --help # So we only install a subset of more generic / useful examples for i in fxload listdevs xusb; do install -m 755 examples/.libs/$i \ $RPM_BUILD_ROOT%{_bindir}/libusb-example-$i done rm $RPM_BUILD_ROOT%{_libdir}/*.la popd %endif %if %{with mingw} pushd windows %mingw_make_install popd %endif %check %if %{with linux} pushd %{_target_os} LD_LIBRARY_PATH=libusb/.libs ldd $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-init_context LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-set_option LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-umockdev LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-libusb LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-example-listdevs popd %endif %ldconfig_scriptlets %if %{with linux} %files %license COPYING %doc AUTHORS README ChangeLog %{_libdir}/*.so.* %files devel %{_includedir}/libusb-1.0 %{_libdir}/*.so %{_libdir}/pkgconfig/libusb-1.0.pc %files devel-doc %doc %{_target_os}/doc/api-1.0 %{_target_os}/examples/*.c %files tests-examples %{_bindir}/libusb-example-fxload %{_bindir}/libusb-example-listdevs %{_bindir}/libusb-example-xusb %{_bindir}/libusb-test-init_context %{_bindir}/libusb-test-set_option %{_bindir}/libusb-test-stress %{_bindir}/libusb-test-stress_mt %{_bindir}/libusb-test-umockdev %{_bindir}/libusb-test-libusb %endif %if %{with mingw} %files -n mingw32-libusb1 %license COPYING %doc AUTHORS README ChangeLog %{mingw32_bindir}/libusb-1.0.dll %{mingw32_includedir}/libusb-1.0 %{mingw32_libdir}/*.dll.a %{mingw32_libdir}/pkgconfig/libusb-1.0.pc %files -n mingw64-libusb1 %license COPYING %doc AUTHORS README ChangeLog %{mingw64_bindir}/libusb-1.0.dll %{mingw64_includedir}/libusb-1.0 %{mingw64_libdir}/*.dll.a %{mingw64_libdir}/pkgconfig/libusb-1.0.pc %endif %changelog ## START: Generated by rpmautospec * Mon Feb 10 2025 Tomas Chang - 1.0.27-10 - Add Windows Hotplug Implementation to MinGW builds * Thu Jan 30 2025 Marc-André Lureau - 1.0.27-9 - Provides/Obsoletes mingw-libusbx * Mon Jan 20 2025 Fedora Release Engineering - 1.0.27-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Fri Jan 17 2025 Fedora Release Engineering - 1.0.27-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Mon Jan 13 2025 Yaakov Selkowitz - 1.0.27-6 - Fix ELN build * Fri Jan 10 2025 Kate Hsuan - 1.0.27-5 - Fix the build failure with automake-1.17 * Tue Oct 22 2024 Jean THOMAS - 1.0.27-4 - Add MinGW builds * Thu Jul 18 2024 Fedora Release Engineering - 1.0.27-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Wed May 08 2024 Kate Hsuan - 1.0.27-2 - Build the test code without a rpath * Mon Mar 04 2024 Kate Hsuan - 1.0.27-1 - Update to 1.0.27 - Update to 1.0.27 - Add tests, including init_context, set_option, and stress_mt * Thu Jan 25 2024 Fedora Release Engineering - 1.0.26-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Sun Jan 21 2024 Fedora Release Engineering - 1.0.26-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Tue Sep 19 2023 Miroslav Suchý - 1.0.26-4 - Migrate to SPDX license * Thu Jul 20 2023 Fedora Release Engineering - 1.0.26-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild * Thu Jan 19 2023 Fedora Release Engineering - 1.0.26-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild * Fri Sep 30 2022 Kate Hsuan 1.0.26-1 - Update to 1.0.26 * Wed Feb 02 2022 Benjamin Berg 1.0.25-1 macro- Update to 1.0.25 * Thu Jan 20 2022 Fedora Release Engineering - 1.0.24-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Thu Jul 22 2021 Fedora Release Engineering - 1.0.24-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Tue Jan 19 18:47:55 CET 2021 Benjamin Berg - 1.0.24-3 - New libusb1 package replacing libusbx Resolves: #1918269 ## END: Generated by rpmautospec