From 4db97531e887ef3455548ce09dd6cbff54b630ed Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 22 Apr 2022 13:33:50 +0200 Subject: [PATCH] Upgrade libusb (1.0.26) for Windows Upgrade and enable libusb support for Windows 32-bit builds. Refs #3011 Fixes #3204 PR #3206 --- app/meson.build | 4 ++-- app/prebuilt-deps/prepare-libusb.sh | 20 +++++++++++++------- cross_win32.txt | 4 ++-- cross_win64.txt | 4 ++-- release.mk | 6 ++---- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/meson.build b/app/meson.build index e34b1893..f5d76c61 100644 --- a/app/meson.build +++ b/app/meson.build @@ -143,12 +143,12 @@ else prebuilt_libusb = meson.get_cross_property('prebuilt_libusb') prebuilt_libusb_root = meson.get_cross_property('prebuilt_libusb_root') - libusb_bin_dir = meson.current_source_dir() + '/prebuilt-deps/data/' + prebuilt_libusb + '/dll' + libusb_bin_dir = meson.current_source_dir() + '/prebuilt-deps/data/' + prebuilt_libusb libusb_include_dir = 'prebuilt-deps/data/' + prebuilt_libusb_root + '/include' libusb = declare_dependency( dependencies: [ - cc.find_library('libusb-1.0', dirs: libusb_bin_dir), + cc.find_library('msys-usb-1.0', dirs: libusb_bin_dir), ], include_directories: include_directories(libusb_include_dir) ) diff --git a/app/prebuilt-deps/prepare-libusb.sh b/app/prebuilt-deps/prepare-libusb.sh index 54ead536..a0c3721d 100755 --- a/app/prebuilt-deps/prepare-libusb.sh +++ b/app/prebuilt-deps/prepare-libusb.sh @@ -6,10 +6,10 @@ cd "$DIR" mkdir -p "$PREBUILT_DATA_DIR" cd "$PREBUILT_DATA_DIR" -DEP_DIR=libusb-1.0.25 +DEP_DIR=libusb-1.0.26 -FILENAME=libusb-1.0.25.7z -SHA256SUM=3d1c98416f454026034b2b5d67f8a294053898cb70a8b489874e75b136c6674d +FILENAME=libusb-1.0.26-binaries.7z +SHA256SUM=9c242696342dbde9cdc47239391f71833939bf9f7aa2bbb28cdaabe890465ec5 if [[ -d "$DEP_DIR" ]] then @@ -17,12 +17,18 @@ then exit 0 fi -get_file "https://github.com/libusb/libusb/releases/download/v1.0.25/$FILENAME" "$FILENAME" "$SHA256SUM" +get_file "https://github.com/libusb/libusb/releases/download/v1.0.26/$FILENAME" "$FILENAME" "$SHA256SUM" mkdir "$DEP_DIR" cd "$DEP_DIR" +# include/ is the same in all folders of the archive 7z x "../$FILENAME" \ - MinGW32/dll/libusb-1.0.dll \ - MinGW64/dll/libusb-1.0.dll \ - include / + libusb-1.0.26-binaries/libusb-MinGW-Win32/bin/msys-usb-1.0.dll \ + libusb-1.0.26-binaries/libusb-MinGW-x64/bin/msys-usb-1.0.dll \ + libusb-1.0.26-binaries/libusb-MinGW-x64/include/ + +mv libusb-1.0.26-binaries/libusb-MinGW-Win32/bin MinGW-Win32 +mv libusb-1.0.26-binaries/libusb-MinGW-x64/bin MinGW-x64 +mv libusb-1.0.26-binaries/libusb-MinGW-x64/include . +rm -rf libusb-1.0.26-binaries diff --git a/cross_win32.txt b/cross_win32.txt index 750dbd78..a2341f21 100644 --- a/cross_win32.txt +++ b/cross_win32.txt @@ -21,5 +21,5 @@ ffmpeg_avformat = 'avformat-58' ffmpeg_avutil = 'avutil-56' prebuilt_ffmpeg = 'ffmpeg-win32-4.3.1' prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32' -prebuilt_libusb_root = 'libusb-1.0.25' -prebuilt_libusb = prebuilt_libusb_root + '/MinGW32' +prebuilt_libusb_root = 'libusb-1.0.26' +prebuilt_libusb = prebuilt_libusb_root + '/MinGW-Win32' diff --git a/cross_win64.txt b/cross_win64.txt index 114b0c22..0404aedc 100644 --- a/cross_win64.txt +++ b/cross_win64.txt @@ -21,5 +21,5 @@ ffmpeg_avformat = 'avformat-59' ffmpeg_avutil = 'avutil-57' prebuilt_ffmpeg = 'ffmpeg-win64-5.0' prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32' -prebuilt_libusb_root = 'libusb-1.0.25' -prebuilt_libusb = prebuilt_libusb_root + '/MinGW64' +prebuilt_libusb_root = 'libusb-1.0.26' +prebuilt_libusb = prebuilt_libusb_root + '/MinGW-x64' diff --git a/release.mk b/release.mk index caf6ab1a..1c550afb 100644 --- a/release.mk +++ b/release.mk @@ -75,12 +75,10 @@ prepare-deps-win64: @app/prebuilt-deps/prepare-libusb.sh build-win32: prepare-deps-win32 - # -Dusb=false because of libusb-win32 build issue, cf #3011 [ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \ meson "$(WIN32_BUILD_DIR)" \ --cross-file cross_win32.txt \ --buildtype release --strip -Db_lto=true \ - -Dusb=false \ -Dcompile_server=false \ -Dportable=true ) ninja -C "$(WIN32_BUILD_DIR)" @@ -111,7 +109,7 @@ dist-win32: build-server build-win32 cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/" cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/" cp app/prebuilt-deps/data/SDL2-2.0.20/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/" - #cp app/prebuilt-deps/data/libusb-1.0.25/MinGW32/dll/libusb-1.0.dll "$(DIST)/$(WIN32_TARGET_DIR)/" + cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-Win32/msys-usb-1.0.dll "$(DIST)/$(WIN32_TARGET_DIR)/" dist-win64: build-server build-win64 mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)" @@ -130,7 +128,7 @@ dist-win64: build-server build-win64 cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/" cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/" cp app/prebuilt-deps/data/SDL2-2.0.20/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/" - cp app/prebuilt-deps/data/libusb-1.0.25/MinGW64/dll/libusb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/" + cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-x64/msys-usb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/" zip-win32: dist-win32 cd "$(DIST)/$(WIN32_TARGET_DIR)"; \