From ae94c817ad69e13ec58fe2cffe69253d2d0b43aa Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 22 Aug 2026 05:04:12 +0300 Subject: [PATCH 01/81] Add CI --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..17e046a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: [ master, ci ] + pull_request: + branches: [ master, ci ] + +jobs: + build: + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + targetos: linux + targetarch: amd64 + - os: ubuntu-22.04 + targetos: linux + targetarch: i386 + - os: ubuntu-22.04-arm + targetos: linux + targetarch: arm64 + - os: ubuntu-22.04-arm + targetos: linux + targetarch: armhf + + steps: + - uses: actions/checkout@v7 + - name: Set up JDK + uses: actions/setup-java@v5 + with: + distribution: jetbrains + java-version: 25 + + - name: Install dependencies + run: sudo apt update && sudo apt install -y cmake libusb-1.0-0-dev + + - uses: actions/upload-artifact@v5 + with: + name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so + path: src/libusb4java.so From e17bbe59e39247bbf69c7c79f0c67ad5a70bd74b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 22 Aug 2026 05:09:04 +0300 Subject: [PATCH 02/81] inc --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17e046a..c55de40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,10 @@ jobs: - name: Install dependencies run: sudo apt update && sudo apt install -y cmake libusb-1.0-0-dev + - name: Build artifacts + run: mkdir build && cd build && cmake .. && make + - uses: actions/upload-artifact@v5 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so - path: src/libusb4java.so + path: build/src/libusb4java.so From 4d607568b6b8844d17e08483b8a6187123f68e32 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 22 Aug 2026 05:16:05 +0300 Subject: [PATCH 03/81] inc+1 --- .github/workflows/ci.yml | 12 ++++++------ ci/linux.sh | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 ci/linux.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c55de40..6353c20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,16 +14,16 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-22.04 + - os: ubuntu-latest targetos: linux targetarch: amd64 - - os: ubuntu-22.04 + - os: ubuntu-latest targetos: linux targetarch: i386 - - os: ubuntu-22.04-arm + - os: ubuntu-latest-arm targetos: linux targetarch: arm64 - - os: ubuntu-22.04-arm + - os: ubuntu-latest-arm targetos: linux targetarch: armhf @@ -36,12 +36,12 @@ jobs: java-version: 25 - name: Install dependencies - run: sudo apt update && sudo apt install -y cmake libusb-1.0-0-dev + run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts run: mkdir build && cd build && cmake .. && make - - uses: actions/upload-artifact@v5 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so path: build/src/libusb4java.so diff --git a/ci/linux.sh b/ci/linux.sh new file mode 100644 index 0000000..9c5cdcc --- /dev/null +++ b/ci/linux.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sudo apt update || die +sudo apt install -y cmake libusb-1.0-0-dev || die From e9b548ad58460dcf6c3e3119eff058c9c5f9c05f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 22 Aug 2026 05:18:26 +0300 Subject: [PATCH 04/81] inc+2 --- ci/{linux.sh => deps_linux.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ci/{linux.sh => deps_linux.sh} (100%) diff --git a/ci/linux.sh b/ci/deps_linux.sh similarity index 100% rename from ci/linux.sh rename to ci/deps_linux.sh From bd1d2c4d68a6de5aa4cb115e909c0c8813d92b39 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 22 Aug 2026 05:32:18 +0300 Subject: [PATCH 05/81] inc+3 --- .github/workflows/ci.yml | 10 ++++++++-- ci/deps_apple.sh | 3 +++ ci/deps_linux.sh | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 ci/deps_apple.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6353c20..de128a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,12 +20,18 @@ jobs: - os: ubuntu-latest targetos: linux targetarch: i386 - - os: ubuntu-latest-arm + - os: ubuntu-24.04-arm targetos: linux targetarch: arm64 - - os: ubuntu-latest-arm + - os: ubuntu-24.04-arm targetos: linux targetarch: armhf + - os: macos-14 + targetos: apple + targetarch: arm64 + - os: macos-15-intel + targetos: apple + targetarch: amd64 steps: - uses: actions/checkout@v7 diff --git a/ci/deps_apple.sh b/ci/deps_apple.sh new file mode 100644 index 0000000..e15e8b8 --- /dev/null +++ b/ci/deps_apple.sh @@ -0,0 +1,3 @@ +#!/bin/zsh +brew update || die +brew install libusb || die diff --git a/ci/deps_linux.sh b/ci/deps_linux.sh index 9c5cdcc..6e51b5b 100644 --- a/ci/deps_linux.sh +++ b/ci/deps_linux.sh @@ -1,3 +1,3 @@ #!/bin/bash sudo apt update || die -sudo apt install -y cmake libusb-1.0-0-dev || die +sudo apt install -y libusb-1.0-0-dev || die From 9e0cf338b1758c520e04a91f368ad04864103222 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 03:09:36 +0300 Subject: [PATCH 06/81] temp tests +1 --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++----------------- ci/deps_apple.sh | 4 ++-- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de128a1..35724a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,24 +14,30 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - targetos: linux - targetarch: amd64 - - os: ubuntu-latest - targetos: linux - targetarch: i386 - - os: ubuntu-24.04-arm - targetos: linux - targetarch: arm64 - - os: ubuntu-24.04-arm - targetos: linux - targetarch: armhf - - os: macos-14 - targetos: apple - targetarch: arm64 - - os: macos-15-intel - targetos: apple +# - os: ubuntu-latest +# targetos: linux +# targetarch: amd64 +# - os: ubuntu-latest +# targetos: linux +# targetarch: i386 +# - os: ubuntu-24.04-arm +# targetos: linux +# targetarch: arm64 +# - os: ubuntu-24.04-arm +# targetos: linux +# targetarch: armhf +# - os: macos-14 +# targetos: apple +# targetarch: arm64 +# - os: macos-15-intel +# targetos: apple +# targetarch: amd64 + - os: windows-latest + targetos: win32 targetarch: amd64 +# - os: windows-2022 +# targetos: win32 +# targetarch: i386 steps: - uses: actions/checkout@v7 diff --git a/ci/deps_apple.sh b/ci/deps_apple.sh index e15e8b8..48fae1c 100644 --- a/ci/deps_apple.sh +++ b/ci/deps_apple.sh @@ -1,3 +1,3 @@ #!/bin/zsh -brew update || die -brew install libusb || die +# brew update || die +# brew install libusb || die From 484526c071e2e7ca8278a7ee07286d7ce10bf4ab Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 03:12:33 +0300 Subject: [PATCH 07/81] temp tests +2 --- ci/deps_win32.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 ci/deps_win32.sh diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh new file mode 100644 index 0000000..a9bf588 --- /dev/null +++ b/ci/deps_win32.sh @@ -0,0 +1 @@ +#!/bin/bash From d29eb28e4f7b9434ebd5691b566af41f5618ac47 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 12:45:48 +0300 Subject: [PATCH 08/81] temp tests +3 --- ci/deps_win32.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index a9bf588..85025b0 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -1 +1,6 @@ #!/bin/bash +# LIBUSB_VERSION=v1.0.30 +# curl -L "https://github.com/libusb/libusb/archive/$LIBUSB_VERSION.zip" -o libusb.zip +# unzip -q libusb.zip +# cd libusb +vcpkg install libusb From f347f8be7cfe0c2acb59daaac89df999a7208376 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 14:16:28 +0300 Subject: [PATCH 09/81] temp tests +4 --- ci/deps_win32.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 85025b0..6c69e90 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,3 +4,5 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb +export LibUsb_INCLUDE_DIR=C:/vcpkg/packages/libusb_x64-windows/include/ +export LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/ From 30d0cf1ca29eea49c737a29b39f08024c6399dfa Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 17:30:30 +0300 Subject: [PATCH 10/81] temp tests +5 --- ci/deps_win32.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 6c69e90..500d611 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,5 +4,5 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -export LibUsb_INCLUDE_DIR=C:/vcpkg/packages/libusb_x64-windows/include/ -export LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/ +echo LibUsb_INCLUDE_DIR=C:/vcpkg/packages/libusb_x64-windows/include/ >> $GITHUB_ENV +echo LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/ >> $GITHUB_ENV From 3e72ab8df285341f46331000e1ce43a9e513063a Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 17:50:48 +0300 Subject: [PATCH 11/81] temp tests +6 --- ci/deps_win32.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 500d611..d779a01 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,5 +4,6 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -echo LibUsb_INCLUDE_DIR=C:/vcpkg/packages/libusb_x64-windows/include/ >> $GITHUB_ENV -echo LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/ >> $GITHUB_ENV +ls C:\vcpkg\packages\libusb_x64-windows\ +echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV From 2640bbae22521168d8ed01509a2886183e94bef9 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 17:54:00 +0300 Subject: [PATCH 12/81] temp tests +7 --- ci/deps_win32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index d779a01..a63199b 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,6 +4,6 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -ls C:\vcpkg\packages\libusb_x64-windows\ +ls 'C:\vcpkg\packages\libusb_x64-windows\' echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV From bfd3673802fd14998063141f17d3328301a5bb0f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:05:44 +0300 Subject: [PATCH 13/81] temp tests +8 --- ci/deps_win32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index a63199b..23fa20a 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,5 +5,5 @@ # cd libusb vcpkg install libusb ls 'C:\vcpkg\packages\libusb_x64-windows\' -echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV +echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV From 745d364cb93ef88c5bc3967197c2e8529bb3a86c Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:09:12 +0300 Subject: [PATCH 14/81] temp tests +9 --- ci/deps_win32.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 23fa20a..fdeddec 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,5 +5,5 @@ # cd libusb vcpkg install libusb ls 'C:\vcpkg\packages\libusb_x64-windows\' -echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV +echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV From 82f5025c4ea65b4cf3897e6ca9234679bb3bdbd5 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:20:04 +0300 Subject: [PATCH 15/81] temp tests +10 --- ci/deps_win32.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index fdeddec..2d3752f 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,5 +5,7 @@ # cd libusb vcpkg install libusb ls 'C:\vcpkg\packages\libusb_x64-windows\' -echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV +ls 'C:\vcpkg\packages\libusb_x64-windows\bin\' +ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' +echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV From 104e1221876e72c9527ddb5b84c1def3ef30622b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:23:52 +0300 Subject: [PATCH 16/81] temp tests +11 --- ci/deps_win32.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 2d3752f..188f607 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,8 +4,6 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -ls 'C:\vcpkg\packages\libusb_x64-windows\' -ls 'C:\vcpkg\packages\libusb_x64-windows\bin\' -ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' +dir /s /b 'C:\vcpkg\packages\libusb_x64-windows\' echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV From 42a48fae9d061cf344ea68a71d3c0bc5236eaeac Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:29:06 +0300 Subject: [PATCH 17/81] temp tests +12 --- ci/deps_win32.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 188f607..1155a75 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,6 +4,9 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -dir /s /b 'C:\vcpkg\packages\libusb_x64-windows\' +ls 'C:\vcpkg\packages\libusb_x64-windows\*' +ls 'C:\vcpkg\packages\libusb_x64-windows\*\*' echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\' >> $GITHUB_ENV echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV +set LibUsb_INCLUDE_DIR='C:\vcpkg\packages\libusb_x64-windows\' +set LibUsb_LIBRARIES='C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' From 85a8dcda11b4038a3a624aaffd36577dd6974816 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 18:36:13 +0300 Subject: [PATCH 18/81] temp tests +13 --- ci/deps_win32.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 1155a75..740d498 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,8 +4,11 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -ls 'C:\vcpkg\packages\libusb_x64-windows\*' +ls 'C:\vcpkg\packages\libusb_x64-windows\include\' ls 'C:\vcpkg\packages\libusb_x64-windows\*\*' +ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' +echo "---" +ls 'C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\' >> $GITHUB_ENV echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV set LibUsb_INCLUDE_DIR='C:\vcpkg\packages\libusb_x64-windows\' From ac05d614e7827264ca6de0989d51887ac18ab42c Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 22:29:20 +0300 Subject: [PATCH 19/81] temp tests +14 --- ci/deps_win32.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 740d498..1142cce 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,12 +4,14 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb +echo "--- bin" +ls 'C:\vcpkg\packages\libusb_x64-windows\bin\' +echo "--- include" ls 'C:\vcpkg\packages\libusb_x64-windows\include\' -ls 'C:\vcpkg\packages\libusb_x64-windows\*\*' +echo "--- include libusb-1.0" +ls 'C:\vcpkg\packages\libusb_x64-windows\include\libusb-1.0' +echo "--- lib" ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' -echo "---" -ls 'C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' -echo 'LibUsb_INCLUDE_DIR=C:\vcpkg\packages\libusb_x64-windows\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV -set LibUsb_INCLUDE_DIR='C:\vcpkg\packages\libusb_x64-windows\' -set LibUsb_LIBRARIES='C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' + +echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV From 69c52502f81f0ae145c679284061e790ca590cfc Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 22:32:06 +0300 Subject: [PATCH 20/81] temp tests +15 --- ci/deps_win32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 1142cce..62e030b 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -14,4 +14,4 @@ echo "--- lib" ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\lib\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV From 15731e77e9f222c386a1d4e1013b3f547696b212 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 22:49:17 +0300 Subject: [PATCH 21/81] temp tests +16 --- ci/deps_win32.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 62e030b..e2351ec 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -13,5 +13,5 @@ ls 'C:\vcpkg\packages\libusb_x64-windows\include\libusb-1.0' echo "--- lib" ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' -echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include\' >> $GITHUB_ENV -echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\bin\' >> $GITHUB_ENV +echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include' >> $GITHUB_ENV +echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\bin' >> $GITHUB_ENV From 5324ffdac68af2f5d2a1d787c20b63b464ee074c Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 12 Sep 2026 22:55:55 +0300 Subject: [PATCH 22/81] temp tests +17 --- ci/deps_win32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index e2351ec..41fab4d 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -14,4 +14,4 @@ echo "--- lib" ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include' >> $GITHUB_ENV -echo 'LibUsb_LIBRARY_HINTS=C:\vcpkg\packages\libusb_x64-windows\bin' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV From bb5f14bb1cbe00432363a27af584c4c431071b30 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 01:42:25 +0300 Subject: [PATCH 23/81] temp tests +18 --- .cmake/Modules/FindLibUsb.cmake | 2 +- ci/deps_win32.sh | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.cmake/Modules/FindLibUsb.cmake b/.cmake/Modules/FindLibUsb.cmake index f0f6e54..18ef2dc 100644 --- a/.cmake/Modules/FindLibUsb.cmake +++ b/.cmake/Modules/FindLibUsb.cmake @@ -40,7 +40,7 @@ if (LibUsb_USE_STATIC_LIBS) endif() endif() -set(LibUsb_LIBRARY_NAMES "usb-1.0") +set(LibUsb_LIBRARY_NAMES "libusb-1.0") # Search libraries and include directories with pkg-config when possible find_package(PkgConfig QUIET) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 41fab4d..40b6f40 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,13 +5,12 @@ # cd libusb vcpkg install libusb echo "--- bin" -ls 'C:\vcpkg\packages\libusb_x64-windows\bin\' +ls 'C:\vcpkg\installed\x64-windows\bin\' echo "--- include" -ls 'C:\vcpkg\packages\libusb_x64-windows\include\' +ls 'C:\vcpkg\installed\x64-windows\include\' echo "--- include libusb-1.0" -ls 'C:\vcpkg\packages\libusb_x64-windows\include\libusb-1.0' +ls 'C:\vcpkg\installed\x64-windows\include\libusb-1.0' echo "--- lib" -ls 'C:\vcpkg\packages\libusb_x64-windows\lib\' +ls 'C:\vcpkg\installed\x64-windows\lib\' -echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\packages\libusb_x64-windows\include' >> $GITHUB_ENV -echo 'LibUsb_LIBRARIES=C:\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib' >> $GITHUB_ENV +echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\installed\x64-windows\' >> $GITHUB_ENV From e87b99ac775dfe2104dc7d0328b214ee637110d7 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 02:09:55 +0300 Subject: [PATCH 24/81] temp tests +19 --- ci/deps_win32.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 40b6f40..96e8fd7 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -13,4 +13,5 @@ ls 'C:\vcpkg\installed\x64-windows\include\libusb-1.0' echo "--- lib" ls 'C:\vcpkg\installed\x64-windows\lib\' -echo 'LibUsb_INCLUDE_HINTS=C:\vcpkg\installed\x64-windows\' >> $GITHUB_ENV +echo 'LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/libusb-1.0.lib' >> $GITHUB_ENV +echo 'LibUsb_INCLUDE_DIRS=C:/vcpkg/packages/libusb_x64-windows/include/libusb-1.0' >> $GITHUB_ENV From 383591ed0764ab8207a1ac913a92ada13330b50a Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 02:23:18 +0300 Subject: [PATCH 25/81] temp tests +20 --- .cmake/Modules/FindLibUsb.cmake | 5 +++++ ci/deps_win32.sh | 12 +----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.cmake/Modules/FindLibUsb.cmake b/.cmake/Modules/FindLibUsb.cmake index 18ef2dc..acdb67c 100644 --- a/.cmake/Modules/FindLibUsb.cmake +++ b/.cmake/Modules/FindLibUsb.cmake @@ -30,6 +30,11 @@ # See COPYING file for copying conditions. # ============================================================================ +if(DEFINED ENV{LIBUSB_ROOT}) + set(LibUsb_LIBRARY_HINTS "$ENV{LIBUSB_ROOT}/lib") + set(LibUsb_INCLUDE_HINTS "$ENV{LIBUSB_ROOT}/include") +endif() + # Change the find-library suffix order in case we prefer to use static libs set(LibUsb_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) if (LibUsb_USE_STATIC_LIBS) diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 96e8fd7..3e0bcdd 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -4,14 +4,4 @@ # unzip -q libusb.zip # cd libusb vcpkg install libusb -echo "--- bin" -ls 'C:\vcpkg\installed\x64-windows\bin\' -echo "--- include" -ls 'C:\vcpkg\installed\x64-windows\include\' -echo "--- include libusb-1.0" -ls 'C:\vcpkg\installed\x64-windows\include\libusb-1.0' -echo "--- lib" -ls 'C:\vcpkg\installed\x64-windows\lib\' - -echo 'LibUsb_LIBRARIES=C:/vcpkg/packages/libusb_x64-windows/lib/libusb-1.0.lib' >> $GITHUB_ENV -echo 'LibUsb_INCLUDE_DIRS=C:/vcpkg/packages/libusb_x64-windows/include/libusb-1.0' >> $GITHUB_ENV +echo 'LIBUSB_ROOT=C:/vcpkg/packages/libusb_x64-windows/' >> $GITHUB_ENV From d6d0619a603166d67213cdfbb8a989aefa1a6d49 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 02:56:30 +0300 Subject: [PATCH 26/81] temp tests +21 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35724a5..74e0578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && make + run: mkdir build && cd build && cmake .. && cmake --build . - uses: actions/upload-artifact@v7 with: From 46a9e565ba6b25628fa564f8f4ec130c1e344a4d Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 03:01:32 +0300 Subject: [PATCH 27/81] temp tests +22 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74e0578..3e7e5cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,4 +56,4 @@ jobs: - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so - path: build/src/libusb4java.so + path: build/src/libusb4java.(so|dll) From 5eea462868d13082a07d6fa7607db2d49d0946b4 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 03:06:27 +0300 Subject: [PATCH 28/81] temp tests +23 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e7e5cd..6480c1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,9 +51,9 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . + run: mkdir build && cd build && cmake .. && cmake --build . --config Release - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so - path: build/src/libusb4java.(so|dll) + path: build/src/Release/libusb4java.(so|dll) From 849356a8bfa16b21fc53f3a51da4b5bfc1e6d066 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 03:10:53 +0300 Subject: [PATCH 29/81] temp tests +24 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6480c1d..296c44f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,4 +56,4 @@ jobs: - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so - path: build/src/Release/libusb4java.(so|dll) + path: build/src/Release/(libusb4java.so|usb4java.dll) From 7eea3a2a6a6def9fc7fa0310a92a576dbddb2d10 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 03:13:45 +0300 Subject: [PATCH 30/81] temp tests +25 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 296c44f..e5f6836 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,4 +56,4 @@ jobs: - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so - path: build/src/Release/(libusb4java.so|usb4java.dll) + path: build/src/Release/*usb4java.* From 73517202a94271125f2815e912e088c0669454c9 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 12:39:23 +0300 Subject: [PATCH 31/81] temp tests +26 --- .github/workflows/ci.yml | 4 +++- ci/deps_win32.sh | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5f6836..a85e202 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ on: jobs: build: runs-on: ${{ matrix.os }} + env: + NAME_POSTFIX: "libusb4java.so" continue-on-error: true strategy: fail-fast: false @@ -55,5 +57,5 @@ jobs: - uses: actions/upload-artifact@v7 with: - name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.so + name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_${{ env.NAME_POSTFIX }} path: build/src/Release/*usb4java.* diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 3e0bcdd..06f6cac 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,3 +5,4 @@ # cd libusb vcpkg install libusb echo 'LIBUSB_ROOT=C:/vcpkg/packages/libusb_x64-windows/' >> $GITHUB_ENV +echo 'NAME_POSTFIX=libusb4java.dll' >> $GITHUB_ENV From f259093cb3f84ce0b62538307e4a459720672c74 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 13:06:06 +0300 Subject: [PATCH 32/81] temp tests +27 --- .github/workflows/ci.yml | 6 +++--- ci/deps_win32.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a85e202..ce4e402 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: build: runs-on: ${{ matrix.os }} env: - NAME_POSTFIX: "libusb4java.so" + EXTENSION: "so" continue-on-error: true strategy: fail-fast: false @@ -57,5 +57,5 @@ jobs: - uses: actions/upload-artifact@v7 with: - name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_${{ env.NAME_POSTFIX }} - path: build/src/Release/*usb4java.* + name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.${{ env.EXTENSION }} + path: build/src/Release/*usb4java.${{ env.EXTENSION }} diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 06f6cac..4cc603a 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -5,4 +5,4 @@ # cd libusb vcpkg install libusb echo 'LIBUSB_ROOT=C:/vcpkg/packages/libusb_x64-windows/' >> $GITHUB_ENV -echo 'NAME_POSTFIX=libusb4java.dll' >> $GITHUB_ENV +echo 'EXTENSION=dll' >> $GITHUB_ENV From 7f2d51eb725abc3111a71be5f8b98d95e3cb1bba Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 13:11:42 +0300 Subject: [PATCH 33/81] temp i386 +1 --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce4e402..67da9ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,12 +34,12 @@ jobs: # - os: macos-15-intel # targetos: apple # targetarch: amd64 - - os: windows-latest - targetos: win32 - targetarch: amd64 -# - os: windows-2022 +# - os: windows-latest # targetos: win32 -# targetarch: i386 +# targetarch: amd64 + - os: windows-2022 + targetos: win32 + targetarch: i386 steps: - uses: actions/checkout@v7 From 5f98e115e2a9b358dcebc87c43976fe938bdb59d Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 20:47:01 +0300 Subject: [PATCH 34/81] temp i386 +2 --- .github/workflows/ci.yml | 10 ++++++---- ci/deps_apple.sh | 1 + ci/mkfolder.jsh | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 ci/mkfolder.jsh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67da9ad..c9bca39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: # - os: ubuntu-latest # targetos: linux # targetarch: i386 -# - os: ubuntu-24.04-arm +# - os: ubuntu-24.04 # targetos: linux # targetarch: arm64 # - os: ubuntu-24.04-arm @@ -36,7 +36,7 @@ jobs: # targetarch: amd64 # - os: windows-latest # targetos: win32 -# targetarch: amd64 +# targetarch: x64 - os: windows-2022 targetos: win32 targetarch: i386 @@ -53,9 +53,11 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && \ + jshell ./ci/mkfolder.jsh && \ + mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ - uses: actions/upload-artifact@v7 with: name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.${{ env.EXTENSION }} - path: build/src/Release/*usb4java.${{ env.EXTENSION }} + path: publish/* diff --git a/ci/deps_apple.sh b/ci/deps_apple.sh index 48fae1c..b97506d 100644 --- a/ci/deps_apple.sh +++ b/ci/deps_apple.sh @@ -1,3 +1,4 @@ #!/bin/zsh # brew update || die # brew install libusb || die +echo 'EXTENSION=dylib' >> $GITHUB_ENV diff --git a/ci/mkfolder.jsh b/ci/mkfolder.jsh new file mode 100644 index 0000000..68c7df3 --- /dev/null +++ b/ci/mkfolder.jsh @@ -0,0 +1,20 @@ +var osFullName = System.getProperty("os.name").toLowerCase(); +var os = switch(osFullName) { + case String str when str.contains("windows") -> "win32"; + case String str when str.contains("macos") -> "darwin"; + default -> osFullName; +} + +var archFullName = System.getProperty("os.arch").toLowerCase(); +var arch = switch(archFullName) { + case String str when str.equals("i386") -> "x86"; + case String str when str.equals("amd64") || + str.equals("x86_64") -> "x86-64"; + case String str when str.equals("arm64") -> "aarch64"; + case String str when str.equals("armhf") || + str.equals("astr32") || + str.equals("armv7l") -> "arm"; + default -> archFullName; +} +new File("publish/"+os+"-"+arch).mkdirs(); +/exit From 83b83af410cd665e1f4a3a15cdc8d139f84e255f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 20:49:51 +0300 Subject: [PATCH 35/81] temp i386 +3 --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9bca39..761662d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,9 +53,7 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && \ - jshell ./ci/mkfolder.jsh && \ - mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && jshell ./ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ - uses: actions/upload-artifact@v7 with: From dbfdce34686bb1cf1f1a7d0089a0cc92c5885d1f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 20:54:03 +0300 Subject: [PATCH 36/81] temp i386 +4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 761662d..01dc73d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && jshell ./ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ - uses: actions/upload-artifact@v7 with: From 6f32511742dab06df0b98bf173e209a5165c1adf Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 20:57:00 +0300 Subject: [PATCH 37/81] temp i386 +5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01dc73d..8f1a17f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ - uses: actions/upload-artifact@v7 with: From a5b9f3d84b2a756ef17c95d9df27dd89825929b4 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 21:00:28 +0300 Subject: [PATCH 38/81] temp i386 +6 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f1a17f..4d0ba1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} ./publish/*/ + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} publish/*/ - uses: actions/upload-artifact@v7 with: From 2f75448c7172512de6447fc6ed4b9a28cea28c5b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 23:00:41 +0300 Subject: [PATCH 39/81] temp i386 +7 --- .github/workflows/ci.yml | 14 ++++---------- ci/{mkfolder.jsh => mk-artifact.jsh} | 14 +++++++++++++- 2 files changed, 17 insertions(+), 11 deletions(-) rename ci/{mkfolder.jsh => mk-artifact.jsh} (65%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d0ba1b..d4b8dad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,6 @@ on: jobs: build: runs-on: ${{ matrix.os }} - env: - EXTENSION: "so" continue-on-error: true strategy: fail-fast: false @@ -34,12 +32,9 @@ jobs: # - os: macos-15-intel # targetos: apple # targetarch: amd64 -# - os: windows-latest -# targetos: win32 -# targetarch: x64 - - os: windows-2022 - targetos: win32 - targetarch: i386 + - os: windows-latest + targetos: win32 + targetarch: x64 steps: - uses: actions/checkout@v7 @@ -53,9 +48,8 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mkfolder.jsh && mv build/src/Release/*usb4java.${{ env.EXTENSION }} publish/*/ + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mk-artifact.jsh - uses: actions/upload-artifact@v7 with: - name: ${{ matrix.targetos }}-${{ matrix.targetarch }}_libusb4java.${{ env.EXTENSION }} path: publish/* diff --git a/ci/mkfolder.jsh b/ci/mk-artifact.jsh similarity index 65% rename from ci/mkfolder.jsh rename to ci/mk-artifact.jsh index 68c7df3..32a849e 100644 --- a/ci/mkfolder.jsh +++ b/ci/mk-artifact.jsh @@ -16,5 +16,17 @@ var arch = switch(archFullName) { str.equals("armv7l") -> "arm"; default -> archFullName; } -new File("publish/"+os+"-"+arch).mkdirs(); + +var extension = switch(os) { + case "win32" -> "dll"; + case "darwin" -> "dylib"; + default -> "so"; +} + +var dir = new File("publish/"+os+"-"+arch); +dir.mkdirs(); + +var lib = Files.walk(Paths.get("build/src/Release/")).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); + +Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); /exit From f793dedb09107b3f5fc33940f3ade814e4f1604c Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 23:17:19 +0300 Subject: [PATCH 40/81] =) --- .github/workflows/ci.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4b8dad..5c69bef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,24 +14,24 @@ jobs: fail-fast: false matrix: include: -# - os: ubuntu-latest -# targetos: linux -# targetarch: amd64 + - os: ubuntu-latest + targetos: linux + targetarch: amd64 # - os: ubuntu-latest # targetos: linux # targetarch: i386 # - os: ubuntu-24.04 # targetos: linux # targetarch: arm64 -# - os: ubuntu-24.04-arm -# targetos: linux -# targetarch: armhf -# - os: macos-14 -# targetos: apple -# targetarch: arm64 -# - os: macos-15-intel -# targetos: apple -# targetarch: amd64 + - os: ubuntu-24.04-arm + targetos: linux + targetarch: armhf + - os: macos-14 + targetos: apple + targetarch: arm64 + - os: macos-15-intel + targetos: apple + targetarch: amd64 - os: windows-latest targetos: win32 targetarch: x64 @@ -52,4 +52,5 @@ jobs: - uses: actions/upload-artifact@v7 with: + name: ${{ matrix.targetos }}-${{ matrix.targetarch }} path: publish/* From f8eeedd278a4ab70d96e6209263a037afbdfffea Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 13 Sep 2026 23:40:03 +0300 Subject: [PATCH 41/81] =)) --- ci/mk-artifact.jsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index 32a849e..238a636 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -26,7 +26,8 @@ var extension = switch(os) { var dir = new File("publish/"+os+"-"+arch); dir.mkdirs(); -var lib = Files.walk(Paths.get("build/src/Release/")).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); +var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); +var lib = Files.walk(artifactFolder).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); /exit From f748c42df37951d4b827c8bbbc250124e0619ca7 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 18 Sep 2026 00:03:38 +0300 Subject: [PATCH 42/81] =))) --- ci/mk-artifact.jsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index 238a636..ddd3947 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -27,7 +27,7 @@ var dir = new File("publish/"+os+"-"+arch); dir.mkdirs(); var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); -var lib = Files.walk(artifactFolder).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); +var lib = Files.walk(artifactFolder).forEach(System.out::println).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); /exit From 716567c9f0c123fa376575425f94f38b7020ee80 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 18 Sep 2026 00:23:18 +0300 Subject: [PATCH 43/81] =)))) --- .github/workflows/ci.yml | 25 +++++++++++++------------ ci/mk-artifact.jsh | 6 +++++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c69bef..cc36355 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,27 +14,28 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - targetos: linux - targetarch: amd64 # - os: ubuntu-latest # targetos: linux # targetarch: i386 # - os: ubuntu-24.04 # targetos: linux # targetarch: arm64 - - os: ubuntu-24.04-arm - targetos: linux - targetarch: armhf - - os: macos-14 - targetos: apple - targetarch: arm64 +# +# - os: ubuntu-latest +# targetos: linux +# targetarch: amd64 +# - os: ubuntu-24.04-arm +# targetos: linux +# targetarch: armhf +# - os: macos-14 +# targetos: apple +# targetarch: arm64 - os: macos-15-intel targetos: apple targetarch: amd64 - - os: windows-latest - targetos: win32 - targetarch: x64 +# - os: windows-latest +# targetos: win32 +# targetarch: x64 steps: - uses: actions/checkout@v7 diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index ddd3947..d33268c 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -27,7 +27,11 @@ var dir = new File("publish/"+os+"-"+arch); dir.mkdirs(); var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); -var lib = Files.walk(artifactFolder).forEach(System.out::println).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); +System.out.println("."); +Files.walk(Paths.get(".")).forEach(System.out::println); +System.out.println("build/src"); +Files.walk(Paths.get("build/src")).forEach(System.out::println); +var lib = Files.walk(artifactFolder).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); /exit From c3e06f8e34a8b7ffac30846934dbf741f3e88eac Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 18 Sep 2026 00:33:38 +0300 Subject: [PATCH 44/81] =))))) --- ci/mk-artifact.jsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index d33268c..78654a6 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -1,10 +1,13 @@ -var osFullName = System.getProperty("os.name").toLowerCase(); +var osFullName = System.getProperty("os.name").toLowerCase().replace(" ", ""); var os = switch(osFullName) { case String str when str.contains("windows") -> "win32"; case String str when str.contains("macos") -> "darwin"; default -> osFullName; } +System.out.println("OS full name is '"+osFullName+"'"); +System.out.println("OS internal name: '"+os+"'"); + var archFullName = System.getProperty("os.arch").toLowerCase(); var arch = switch(archFullName) { case String str when str.equals("i386") -> "x86"; @@ -23,14 +26,12 @@ var extension = switch(os) { default -> "so"; } +System.out.println("Looking for "+extension); + var dir = new File("publish/"+os+"-"+arch); dir.mkdirs(); var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); -System.out.println("."); -Files.walk(Paths.get(".")).forEach(System.out::println); -System.out.println("build/src"); -Files.walk(Paths.get("build/src")).forEach(System.out::println); var lib = Files.walk(artifactFolder).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); From 4f9a6d0a17d13332d559d6746f8aa571c54db685 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 18 Sep 2026 02:28:22 +0300 Subject: [PATCH 45/81] :) --- .github/workflows/ci.yml | 40 +++++++++++++++++++++------------------- ci/mk-artifact.jsh | 5 ++++- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc36355..1882c8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,28 +14,30 @@ jobs: fail-fast: false matrix: include: -# - os: ubuntu-latest -# targetos: linux -# targetarch: i386 -# - os: ubuntu-24.04 -# targetos: linux -# targetarch: arm64 -# -# - os: ubuntu-latest -# targetos: linux -# targetarch: amd64 -# - os: ubuntu-24.04-arm -# targetos: linux -# targetarch: armhf -# - os: macos-14 -# targetos: apple -# targetarch: arm64 +# linux-x86-64 + - os: ubuntu-latest + targetos: linux + targetarch: amd64 +# arm | armhf astr32 armv7l + - os: ubuntu-24.04-arm + targetos: linux + targetarch: armhf +# linux-aarch64 + - os: ubuntu-24.04 + targetos: linux + targetarch: arm64 +# win32-x86-64 + - os: windows-latest + targetos: win32 + targetarch: x64 +# darwin-x86-64 - os: macos-15-intel targetos: apple targetarch: amd64 -# - os: windows-latest -# targetos: win32 -# targetarch: x64 +# darwin-arm-64 + - os: macos-14 + targetos: apple + targetarch: arm64 steps: - uses: actions/checkout@v7 diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index 78654a6..65c592d 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -20,13 +20,16 @@ var arch = switch(archFullName) { default -> archFullName; } +System.out.println("Arch full name: '"+archFullName+"'"); +System.out.println("Arch internal name: '"+arch+"'"); + var extension = switch(os) { case "win32" -> "dll"; case "darwin" -> "dylib"; default -> "so"; } -System.out.println("Looking for "+extension); +System.out.println("Looking for [lib]usbjava."+extension); var dir = new File("publish/"+os+"-"+arch); dir.mkdirs(); From 5a01b3cc48ae28d8387203da332432bedd198940 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 20 Sep 2026 00:57:14 +0300 Subject: [PATCH 46/81] ) --- ci/deps_apple.sh | 2 +- ci/deps_win32.sh | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ci/deps_apple.sh b/ci/deps_apple.sh index b97506d..2d91d11 100644 --- a/ci/deps_apple.sh +++ b/ci/deps_apple.sh @@ -1,4 +1,4 @@ #!/bin/zsh # brew update || die # brew install libusb || die -echo 'EXTENSION=dylib' >> $GITHUB_ENV +echo "nothing to do" diff --git a/ci/deps_win32.sh b/ci/deps_win32.sh index 4cc603a..d38ea51 100644 --- a/ci/deps_win32.sh +++ b/ci/deps_win32.sh @@ -1,8 +1,3 @@ #!/bin/bash -# LIBUSB_VERSION=v1.0.30 -# curl -L "https://github.com/libusb/libusb/archive/$LIBUSB_VERSION.zip" -o libusb.zip -# unzip -q libusb.zip -# cd libusb vcpkg install libusb echo 'LIBUSB_ROOT=C:/vcpkg/packages/libusb_x64-windows/' >> $GITHUB_ENV -echo 'EXTENSION=dll' >> $GITHUB_ENV From cd97d14eb591edb686373cf36d674ae86adabe59 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 10 Oct 2026 22:40:19 +0300 Subject: [PATCH 47/81] tests --- .github/workflows/ci.yml | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1882c8b..8940b71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,28 +16,28 @@ jobs: include: # linux-x86-64 - os: ubuntu-latest - targetos: linux + targetos: literally-any-possible-shit targetarch: amd64 -# arm | armhf astr32 armv7l - - os: ubuntu-24.04-arm - targetos: linux - targetarch: armhf -# linux-aarch64 - - os: ubuntu-24.04 - targetos: linux - targetarch: arm64 -# win32-x86-64 - - os: windows-latest - targetos: win32 - targetarch: x64 -# darwin-x86-64 - - os: macos-15-intel - targetos: apple - targetarch: amd64 -# darwin-arm-64 - - os: macos-14 - targetos: apple - targetarch: arm64 +## arm | armhf astr32 armv7l +# - os: ubuntu-24.04-arm +# targetos: linux +# targetarch: armhf +## linux-aarch64 +# - os: ubuntu-24.04 +# targetos: linux +# targetarch: arm64 +## win32-x86-64 +# - os: windows-latest +# targetos: win32 +# targetarch: x64 +## darwin-x86-64 +# - os: macos-15-intel +# targetos: apple +# targetarch: amd64 +## darwin-arm-64 +# - os: macos-14 +# targetos: apple +# targetarch: arm64 steps: - uses: actions/checkout@v7 From 65b54ad22b9b0d5fda4e1acec030594b53cfe247 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 10 Oct 2026 22:41:43 +0300 Subject: [PATCH 48/81] stub --- ci/deps_literally-any-possible-shit.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ci/deps_literally-any-possible-shit.sh diff --git a/ci/deps_literally-any-possible-shit.sh b/ci/deps_literally-any-possible-shit.sh new file mode 100644 index 0000000..e69de29 From fcd481febb0a1901f35ea39b05f975c67c3251e1 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sat, 10 Oct 2026 22:43:29 +0300 Subject: [PATCH 49/81] stub+1 --- ci/deps_literally-any-possible-shit.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/deps_literally-any-possible-shit.sh b/ci/deps_literally-any-possible-shit.sh index e69de29..6e51b5b 100644 --- a/ci/deps_literally-any-possible-shit.sh +++ b/ci/deps_literally-any-possible-shit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sudo apt update || die +sudo apt install -y libusb-1.0-0-dev || die From 53c5c267594b3ecbaf9517af2cb2364dceb33dc4 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 01:06:41 +0300 Subject: [PATCH 50/81] tst --- .github/workflows/ci.yml | 46 +++++++++++++++----------- ci/{deps_apple.sh => deps_darwin.sh} | 0 ci/deps_literally-any-possible-shit.sh | 3 -- ci/mk-artifact.jsh | 2 +- 4 files changed, 27 insertions(+), 24 deletions(-) rename ci/{deps_apple.sh => deps_darwin.sh} (100%) delete mode 100644 ci/deps_literally-any-possible-shit.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8940b71..fdc65b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [ master, ci ] + branches: [ master ] pull_request: - branches: [ master, ci ] + branches: [ master ] jobs: build: @@ -16,28 +16,32 @@ jobs: include: # linux-x86-64 - os: ubuntu-latest - targetos: literally-any-possible-shit - targetarch: amd64 + targetos: linux + targetarch: x86-64 +## windows arm +# - os: windows-11-arm +# targetos: win32 +# targetarch: aarch64 ## arm | armhf astr32 armv7l # - os: ubuntu-24.04-arm # targetos: linux # targetarch: armhf ## linux-aarch64 -# - os: ubuntu-24.04 +# - os: ubuntu-24.04-arm # targetos: linux -# targetarch: arm64 +# targetarch: aarch64 ## win32-x86-64 # - os: windows-latest # targetos: win32 -# targetarch: x64 +# targetarch: x86-64 ## darwin-x86-64 # - os: macos-15-intel -# targetos: apple -# targetarch: amd64 +# targetos: darwin +# targetarch: x86-64 ## darwin-arm-64 # - os: macos-14 -# targetos: apple -# targetarch: arm64 +# targetos: darwin +# targetarch: aarch64 steps: - uses: actions/checkout@v7 @@ -48,12 +52,14 @@ jobs: java-version: 25 - name: Install dependencies - run: bash ci/deps_${{ matrix.targetos }}.sh - - - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mk-artifact.jsh - - - uses: actions/upload-artifact@v7 - with: - name: ${{ matrix.targetos }}-${{ matrix.targetarch }} - path: publish/* + run: bash printenv +# - name: Install dependencies +# run: bash ci/deps_${{ matrix.targetos }}.sh +# +# - name: Build artifacts +# run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mk-artifact.jsh +# +# - uses: actions/upload-artifact@v7 +# with: +# name: ${{ matrix.targetos }}-${{ matrix.targetarch }} +# path: publish/* diff --git a/ci/deps_apple.sh b/ci/deps_darwin.sh similarity index 100% rename from ci/deps_apple.sh rename to ci/deps_darwin.sh diff --git a/ci/deps_literally-any-possible-shit.sh b/ci/deps_literally-any-possible-shit.sh deleted file mode 100644 index 6e51b5b..0000000 --- a/ci/deps_literally-any-possible-shit.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -sudo apt update || die -sudo apt install -y libusb-1.0-0-dev || die diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh index 65c592d..4e5a2e0 100644 --- a/ci/mk-artifact.jsh +++ b/ci/mk-artifact.jsh @@ -31,7 +31,7 @@ var extension = switch(os) { System.out.println("Looking for [lib]usbjava."+extension); -var dir = new File("publish/"+os+"-"+arch); +var dir = new File("publish/org/usb4java/"+os+"-"+arch); dir.mkdirs(); var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); From a4743989e5a01a9a330ab37c35b8ad8a660d2a88 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 01:09:37 +0300 Subject: [PATCH 51/81] tst --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdc65b5..344c8c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ master ] + branches: [ master, ci ] pull_request: branches: [ master ] From eb3762f89d0c58b81d8b9e4e718793ae4d6d7a45 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 01:23:04 +0300 Subject: [PATCH 52/81] tst --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 344c8c8..78c833f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,8 @@ jobs: - os: ubuntu-latest targetos: linux targetarch: x86-64 + env: + EXTENSION: so ## windows arm # - os: windows-11-arm # targetos: win32 @@ -52,7 +54,7 @@ jobs: java-version: 25 - name: Install dependencies - run: bash printenv + run: bash echo $EXTENSION # - name: Install dependencies # run: bash ci/deps_${{ matrix.targetos }}.sh # From b288366f5dc7492311d2a84a86392e213c26918b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 01:29:17 +0300 Subject: [PATCH 53/81] tst --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78c833f..9b3f50c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,7 @@ jobs: - os: ubuntu-latest targetos: linux targetarch: x86-64 - env: - EXTENSION: so + ext: so ## windows arm # - os: windows-11-arm # targetos: win32 @@ -54,6 +53,8 @@ jobs: java-version: 25 - name: Install dependencies + env: + EXTENSION: ${{ matrix.ext }} run: bash echo $EXTENSION # - name: Install dependencies # run: bash ci/deps_${{ matrix.targetos }}.sh From 3295c54090dfa819f7172b40be3f0b661cef9396 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 02:11:48 +0300 Subject: [PATCH 54/81] tst --- .github/workflows/ci.yml | 43 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b3f50c..f2b35ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,35 +14,41 @@ jobs: fail-fast: false matrix: include: +## windows arm +# - os: windows-11-arm +# targetos: win32 +# targetarch: aarch64 +# ext: dll +## win32-x86-64 +# - os: windows-latest +# targetos: win32 +# targetarch: x86-64 +# ext: dll # linux-x86-64 - os: ubuntu-latest targetos: linux targetarch: x86-64 ext: so -## windows arm -# - os: windows-11-arm -# targetos: win32 -# targetarch: aarch64 ## arm | armhf astr32 armv7l # - os: ubuntu-24.04-arm # targetos: linux # targetarch: armhf +# ext: so ## linux-aarch64 # - os: ubuntu-24.04-arm # targetos: linux # targetarch: aarch64 -## win32-x86-64 -# - os: windows-latest -# targetos: win32 -# targetarch: x86-64 +# ext: so ## darwin-x86-64 # - os: macos-15-intel # targetos: darwin # targetarch: x86-64 +# ext: dylib ## darwin-arm-64 # - os: macos-14 # targetos: darwin # targetarch: aarch64 +# ext: dylib steps: - uses: actions/checkout@v7 @@ -53,16 +59,11 @@ jobs: java-version: 25 - name: Install dependencies - env: - EXTENSION: ${{ matrix.ext }} - run: bash echo $EXTENSION -# - name: Install dependencies -# run: bash ci/deps_${{ matrix.targetos }}.sh -# -# - name: Build artifacts -# run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && jshell ci/mk-artifact.jsh -# -# - uses: actions/upload-artifact@v7 -# with: -# name: ${{ matrix.targetos }}-${{ matrix.targetarch }} -# path: publish/* + run: bash ci/deps_${{ matrix.targetos }}.sh + + - name: Build artifacts + run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && mv ./*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || mv ./Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} && cd Release && jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * + + - uses: actions/upload-artifact@v7 + with: + path: Release/libusb4java-1.0.30-bundle.jar From ae24e0be16f50e3b0b8660fadf0b1a0b79418903 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 02:21:38 +0300 Subject: [PATCH 55/81] tst --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2b35ad..eb087bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,17 @@ jobs: run: bash ci/deps_${{ matrix.targetos }}.sh - name: Build artifacts - run: mkdir build && cd build && cmake .. && cmake --build . --config Release && cd .. && mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && mv ./*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || mv ./Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} && cd Release && jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * + run: >- + mkdir build && + cd build && + cmake .. && + cmake --build . --config Release && + cd .. && + mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && + mv ./build/src/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || + mv ./build/src/Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} && + cd Release && + jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * - uses: actions/upload-artifact@v7 with: From 5461e10ce9a4aea09420d79e0dcad2b9aa8984b4 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 02:25:13 +0300 Subject: [PATCH 56/81] tst-- --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb087bf..9ccec82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,8 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && - mv ./build/src/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || - mv ./build/src/Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} && + (mv ./build/src/Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || + mv ./build/src/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }}) && cd Release && jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * From c2d83015854edb2c705561a448df99f389d6a279 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 02:37:48 +0300 Subject: [PATCH 57/81] tst-+ --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ccec82..bc9f93f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,8 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && - (mv ./build/src/Release/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || - mv ./build/src/*.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }}) && + (mv ./build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || + mv ./build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }}) && cd Release && jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * From 12884b7800b4b99f19d33fefc63923ca8042c3bc Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 02:55:33 +0300 Subject: [PATCH 58/81] tst++ --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc9f93f..dfd7920 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,7 @@ jobs: # ext: dll # linux-x86-64 - os: ubuntu-latest - targetos: linux - targetarch: x86-64 + target: linux-x86-64 ext: so ## arm | armhf astr32 armv7l # - os: ubuntu-24.04-arm @@ -68,11 +67,11 @@ jobs: cmake .. && cmake --build . --config Release && cd .. && - mkdir -p Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }} && - (mv ./build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }} || - mv ./build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.targetos }}-{{ matrix.targetarch }}/libusb4java.${{ matrix.ext }}) && + mkdir -p Release/org/usb4java/{{ matrix.target }} && + mv build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | + mv build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} && cd Release && - jar cf ./libusb4java-1.0.30-{{ matrix.targetos }}-{{ matrix.targetarch }}.jar * + jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * - uses: actions/upload-artifact@v7 with: From 7db7d20f7a2443ece861dfbf1ad8307b208c7cb3 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:00:20 +0300 Subject: [PATCH 59/81] v --- .github/workflows/ci.yml | 2 +- ci/{deps_win32.sh => deps_dll.sh} | 0 ci/{deps_darwin.sh => deps_dylib.sh} | 0 ci/{deps_linux.sh => deps_so.sh} | 0 ci/mk-artifact.jsh | 41 ---------------------------- 5 files changed, 1 insertion(+), 42 deletions(-) rename ci/{deps_win32.sh => deps_dll.sh} (100%) rename ci/{deps_darwin.sh => deps_dylib.sh} (100%) rename ci/{deps_linux.sh => deps_so.sh} (100%) delete mode 100644 ci/mk-artifact.jsh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfd7920..59b93bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: java-version: 25 - name: Install dependencies - run: bash ci/deps_${{ matrix.targetos }}.sh + run: bash ci/deps_${{ matrix.ext }}.sh - name: Build artifacts run: >- diff --git a/ci/deps_win32.sh b/ci/deps_dll.sh similarity index 100% rename from ci/deps_win32.sh rename to ci/deps_dll.sh diff --git a/ci/deps_darwin.sh b/ci/deps_dylib.sh similarity index 100% rename from ci/deps_darwin.sh rename to ci/deps_dylib.sh diff --git a/ci/deps_linux.sh b/ci/deps_so.sh similarity index 100% rename from ci/deps_linux.sh rename to ci/deps_so.sh diff --git a/ci/mk-artifact.jsh b/ci/mk-artifact.jsh deleted file mode 100644 index 4e5a2e0..0000000 --- a/ci/mk-artifact.jsh +++ /dev/null @@ -1,41 +0,0 @@ -var osFullName = System.getProperty("os.name").toLowerCase().replace(" ", ""); -var os = switch(osFullName) { - case String str when str.contains("windows") -> "win32"; - case String str when str.contains("macos") -> "darwin"; - default -> osFullName; -} - -System.out.println("OS full name is '"+osFullName+"'"); -System.out.println("OS internal name: '"+os+"'"); - -var archFullName = System.getProperty("os.arch").toLowerCase(); -var arch = switch(archFullName) { - case String str when str.equals("i386") -> "x86"; - case String str when str.equals("amd64") || - str.equals("x86_64") -> "x86-64"; - case String str when str.equals("arm64") -> "aarch64"; - case String str when str.equals("armhf") || - str.equals("astr32") || - str.equals("armv7l") -> "arm"; - default -> archFullName; -} - -System.out.println("Arch full name: '"+archFullName+"'"); -System.out.println("Arch internal name: '"+arch+"'"); - -var extension = switch(os) { - case "win32" -> "dll"; - case "darwin" -> "dylib"; - default -> "so"; -} - -System.out.println("Looking for [lib]usbjava."+extension); - -var dir = new File("publish/org/usb4java/"+os+"-"+arch); -dir.mkdirs(); - -var artifactFolder = Files.exists(Paths.get("build/src/Release/")) ? Paths.get("build/src/Release/") : Paths.get("build/src/"); -var lib = Files.walk(artifactFolder).filter(path -> path.toString().endsWith(extension)).toList().getFirst(); - -Files.move(lib, dir.toPath().resolve(lib.getFileName()), StandardCopyOption.ATOMIC_MOVE); -/exit From 6cdf274f83f7059983222747902543cb1d341f77 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:03:21 +0300 Subject: [PATCH 60/81] v1 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59b93bc..73e1da4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,8 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p Release/org/usb4java/{{ matrix.target }} && - mv build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | - mv build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} && + (mv build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | + mv build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && cd Release && jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * From 05a93d9e613a660c57cc4da0f11bf3a3663ac760 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:09:52 +0300 Subject: [PATCH 61/81] v2 --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73e1da4..ae97265 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,12 +67,12 @@ jobs: cmake .. && cmake --build . --config Release && cd .. && - mkdir -p Release/org/usb4java/{{ matrix.target }} && - (mv build/src/Release/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | - mv build/src/*usb4java.{{ matrix.ext }} Release/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && - cd Release && + mkdir -p publish/org/usb4java/{{ matrix.target }} && + (mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | + mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && + cd publish && jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * - uses: actions/upload-artifact@v7 with: - path: Release/libusb4java-1.0.30-bundle.jar + path: publish/libusb4java-1.0.30-bundle.jar From 6f7cac76c1d3077ce32f62bfd2376699832748e1 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:15:50 +0300 Subject: [PATCH 62/81] v3 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae97265..def19c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,8 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/{{ matrix.target }} && - (mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | - mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && + (mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | + mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && cd publish && jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * From 199af4ebc397afd5484ec44dac1a3982f3b3623b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:18:06 +0300 Subject: [PATCH 63/81] v3 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index def19c8..1aecec4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,8 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/{{ matrix.target }} && - (mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }} | - mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/libusb4java.${{ matrix.ext }}) && + (mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/ | + mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/) && cd publish && jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * From b679cf0a23050b3dfb64d62e97dd561fe8380aef Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:22:37 +0300 Subject: [PATCH 64/81] v4 --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1aecec4..90af25e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,11 +67,11 @@ jobs: cmake .. && cmake --build . --config Release && cd .. && - mkdir -p publish/org/usb4java/{{ matrix.target }} && - (mv build/src/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/ | - mv build/src/Release/*usb4java.{{ matrix.ext }} publish/org/usb4java/{{ matrix.target }}/) && + mkdir -p publish/org/usb4java/${{ matrix.target }} && + (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }} | + mv build/src/Release/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }}) && cd publish && - jar cf ./libusb4java-1.0.30-{{ matrix.target }}.jar * + jar cf ./libusb4java-1.0.30-${{ matrix.target }}.jar * - uses: actions/upload-artifact@v7 with: From 2657a891a48873cc743898c2ac1ba82fdd0979f1 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:25:12 +0300 Subject: [PATCH 65/81] v5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90af25e..1753cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/${{ matrix.target }} && - (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }} | + (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }} || mv build/src/Release/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }}) && cd publish && jar cf ./libusb4java-1.0.30-${{ matrix.target }}.jar * From 0a0b4a0e84c955cad000f1108703075a668a66a7 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:27:16 +0300 Subject: [PATCH 66/81] v6 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1753cf3..f8003f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,4 +75,4 @@ jobs: - uses: actions/upload-artifact@v7 with: - path: publish/libusb4java-1.0.30-bundle.jar + path: publish/libusb4java-1.0.30-${{ matrix.target }}.jar From b47cf0c65172905359146e6a080fc56b129b13bf Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:30:35 +0300 Subject: [PATCH 67/81] v7 --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8003f9..cf6164a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,10 +68,11 @@ jobs: cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/${{ matrix.target }} && - (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }} || - mv build/src/Release/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.$${{ matrix.ext }}) && + (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.${{ matrix.ext }} || + mv build/src/Release/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.${{ matrix.ext }}) && cd publish && - jar cf ./libusb4java-1.0.30-${{ matrix.target }}.jar * + jar cf ./libusb4java-1.0.30-${{ matrix.target }}.jar * || + die - uses: actions/upload-artifact@v7 with: From c3071840585a759e97299e010e1e760ec8dbf95a Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 03:34:24 +0300 Subject: [PATCH 68/81] v8 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf6164a..0d0fc4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,3 +77,4 @@ jobs: - uses: actions/upload-artifact@v7 with: path: publish/libusb4java-1.0.30-${{ matrix.target }}.jar + archive: false From a2fbf55b0a39d5b32e93902ce8170b8f85182eeb Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 10:39:20 +0300 Subject: [PATCH 69/81] win --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d0fc4d..8d8b181 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,15 +19,15 @@ jobs: # targetos: win32 # targetarch: aarch64 # ext: dll -## win32-x86-64 -# - os: windows-latest -# targetos: win32 -# targetarch: x86-64 -# ext: dll +# win32-x86-64 + - os: windows-latest + targetos: win32 + targetarch: x86-64 + ext: dll # linux-x86-64 - - os: ubuntu-latest - target: linux-x86-64 - ext: so +# - os: ubuntu-latest +# target: linux-x86-64 +# ext: so ## arm | armhf astr32 armv7l # - os: ubuntu-24.04-arm # targetos: linux From 84bc8a936bad2e9f66c1f2a8eeb8ebc0ea28a389 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 10:49:32 +0300 Subject: [PATCH 70/81] win1 --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d8b181..d3feea4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,7 @@ jobs: # ext: dll # win32-x86-64 - os: windows-latest - targetos: win32 - targetarch: x86-64 + target: win32-x86-64 ext: dll # linux-x86-64 # - os: ubuntu-latest From ca343869110e8ab869ec0af7ae88ad8dc2036448 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 14:12:47 +0300 Subject: [PATCH 71/81] all-rewrite --- .cmake/Modules/FindLibUsb.cmake | 21 ++++++++++--- .github/workflows/ci.yml | 54 +++++++++++++++++---------------- CMakeLists.txt | 4 +++ ci/deps_dll.sh | 23 ++++++++++++-- ci/deps_dylib.sh | 29 +++++++++++++++--- ci/deps_so.sh | 32 +++++++++++++++++-- src/CMakeLists.txt | 5 +++ 7 files changed, 129 insertions(+), 39 deletions(-) diff --git a/.cmake/Modules/FindLibUsb.cmake b/.cmake/Modules/FindLibUsb.cmake index acdb67c..a67a4a1 100644 --- a/.cmake/Modules/FindLibUsb.cmake +++ b/.cmake/Modules/FindLibUsb.cmake @@ -45,7 +45,15 @@ if (LibUsb_USE_STATIC_LIBS) endif() endif() -set(LibUsb_LIBRARY_NAMES "libusb-1.0") +# find_library prepends CMAKE_FIND_LIBRARY_PREFIXES to each name. On Unix that +# prefix is "lib", so the unprefixed name "usb-1.0" resolves to libusb-1.0.{a,so, +# dylib}. On Windows the prefix is empty, so the name must already carry the "lib" +# prefix ("libusb-1.0") to resolve to libusb-1.0.lib. +if(WIN32) + set(LibUsb_LIBRARY_NAMES "libusb-1.0") +else() + set(LibUsb_LIBRARY_NAMES "usb-1.0") +endif() # Search libraries and include directories with pkg-config when possible find_package(PkgConfig QUIET) @@ -53,10 +61,13 @@ if(PKG_CONFIG_FOUND) pkg_check_modules(PkgConfigLibUsb libusb-1.0) if (PkgConfigLibUsb_FOUND) if(LibUsb_USE_STATIC_LIBS) - set(LibUsb_LIBRARY_NAMES ${PkgConfigLibUsb_STATIC_LIBRARIES}) - set(LibUsb_INCLUDE_HINTS ${PkgConfigLibUsb_STATIC_INCLUDE_DIRS}) - set(LibUsb_LIBRARY_HINTS ${PkgConfigLibUsb_STATIC_LIBRARY_DIRS}) - set(LibUsb_LDFLAGS ${PkgConfigLibUsb_STATIC_LDFLAGS_OTHER}) + # Static: leave LibUsb_LIBRARY_NAMES as "libusb-1.0" (set above) so that + # find_library (with the .a/.lib suffix preference set above) plus the + # LIBUSB_ROOT hints locate libusb-1.0.a / libusb-1.0.lib. Do NOT use + # PkgConfigLibUsb_STATIC_LIBRARIES: libusb's .pc has no Static-Libraries + # field and pkg_check_modules was not called with STATIC, so it is empty + # and would break the search. Also do not clobber LibUsb_LDFLAGS or the + # LIBUSB_ROOT hints here. else() set(LibUsb_LIBRARY_NAMES ${PkgConfigLibUsb_LIBRARIES}) set(LibUsb_INCLUDE_HINTS ${PkgConfigLibUsb_INCLUDE_DIRS}) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3feea4..1bb304d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ master ] +env: + VERSION: 1.0.30 + jobs: build: runs-on: ${{ matrix.os }} @@ -14,39 +17,40 @@ jobs: fail-fast: false matrix: include: -## windows arm +## windows arm; should be using `vcpkg install libusb:arm64-windows-static`. Probably requires custom libusbK # - os: windows-11-arm -# targetos: win32 -# targetarch: aarch64 +# target: win32-aarch64 # ext: dll # win32-x86-64 - os: windows-latest target: win32-x86-64 ext: dll -# linux-x86-64 -# - os: ubuntu-latest -# target: linux-x86-64 -# ext: so + static: true +# linux-x86-64 + - os: ubuntu-latest + target: linux-x86-64 + ext: so + static: true ## arm | armhf astr32 armv7l # - os: ubuntu-24.04-arm -# targetos: linux -# targetarch: armhf +# target: linux-armhf # ext: so +# static: true ## linux-aarch64 # - os: ubuntu-24.04-arm -# targetos: linux -# targetarch: aarch64 +# target: linux-aarch64 # ext: so +# static: true ## darwin-x86-64 -# - os: macos-15-intel -# targetos: darwin -# targetarch: x86-64 -# ext: dylib + - os: macos-15-intel + target: darwin-x86-64 + ext: dylib + static: true ## darwin-arm-64 -# - os: macos-14 -# targetos: darwin -# targetarch: aarch64 -# ext: dylib +# - os: macos-14 +# target: darwin-aarch64 +# ext: dylib +# static: true steps: - uses: actions/checkout@v7 @@ -63,17 +67,15 @@ jobs: run: >- mkdir build && cd build && - cmake .. && - cmake --build . --config Release && + cmake .. -DCMAKE_BUILD_TYPE=Release -DLibUsb_USE_STATIC_LIBS=${{ matrix.static }} -DLibUsb_LDFLAGS="${{ env.LIBUSB_LDFLAGS }}" && + cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/${{ matrix.target }} && - (mv build/src/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.${{ matrix.ext }} || - mv build/src/Release/*usb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.${{ matrix.ext }}) && + mv build/out/libusb4java.${{ matrix.ext }} publish/org/usb4java/${{ matrix.target }}/libusb4java.${{ matrix.ext }} && cd publish && - jar cf ./libusb4java-1.0.30-${{ matrix.target }}.jar * || - die + jar cf ./libusb4java-${{ env.VERSION }}-${{ matrix.target }}.jar * - uses: actions/upload-artifact@v7 with: - path: publish/libusb4java-1.0.30-${{ matrix.target }}.jar + path: publish/libusb4java-${{ env.VERSION }}-${{ matrix.target }}.jar archive: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 61156ed..2afa0d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,10 @@ find_package(LibUsb REQUIRED) include_directories(${JNI_INCLUDE_DIRS}) include_directories(${LibUsb_INCLUDE_DIRS}) +if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang") + set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") +endif() + if(CMAKE_COMPILER_IS_GNUCC) add_definitions(-Wall -Werror -std=c99) endif() diff --git a/ci/deps_dll.sh b/ci/deps_dll.sh index d38ea51..0dd373a 100644 --- a/ci/deps_dll.sh +++ b/ci/deps_dll.sh @@ -1,3 +1,22 @@ #!/bin/bash -vcpkg install libusb -echo 'LIBUSB_ROOT=C:/vcpkg/packages/libusb_x64-windows/' >> $GITHUB_ENV +set -euo pipefail + +# :static builds msvc/libusb_static.vcxproj -> libusb-1.0.lib +vcpkg install libusb:static + +LIBUSB_ROOT="C:/vcpkg/packages/libusb_x64-windows/" + +# Version guard: vcpkg's libusb must match the workflow VERSION exactly. +# (vcpkg resolves to the registry version, not a pinned one, so this fails the +# build if the registry serves a different libusb than $VERSION.) +VERSION="${VERSION}" +INSTALLED="$(grep -m1 '^Version:' "$LIBUSB_ROOT/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" +if [ "$INSTALLED" != "$VERSION" ]; then + echo "ERROR: vcpkg libusb version is '$INSTALLED', expected '$VERSION'" >&2 + exit 1 +fi + +# LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints +echo "LIBUSB_ROOT=$LIBUSB_ROOT" >> "$GITHUB_ENV" +# Static libusb on Windows needs the WinUSB system library linked in +echo "LIBUSB_LDFLAGS=setupapi.lib" >> "$GITHUB_ENV" diff --git a/ci/deps_dylib.sh b/ci/deps_dylib.sh index 2d91d11..43b3984 100644 --- a/ci/deps_dylib.sh +++ b/ci/deps_dylib.sh @@ -1,4 +1,25 @@ -#!/bin/zsh -# brew update || die -# brew install libusb || die -echo "nothing to do" +#!/bin/bash +set -euo pipefail + +brew install libusb pkgconf + +PREFIX="$(brew --prefix)" +if [ ! -f "$PREFIX/lib/libusb-1.0.a" ]; then + echo "ERROR: static libusb-1.0.a not found under $PREFIX/lib (brew may not provide a static lib; fall back to building libusb from source)" >&2 + exit 1 +fi + +# Version guard: brew's libusb must match the workflow VERSION exactly. +# (brew cannot pin a version, so this fails the build if Homebrew serves a +# different libusb than $VERSION.) +VERSION="${VERSION}" +INSTALLED="$(grep -m1 '^Version:' "$PREFIX/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" +if [ "$INSTALLED" != "$VERSION" ]; then + echo "ERROR: brew libusb version is '$INSTALLED', expected '$VERSION'" >&2 + exit 1 +fi + +# LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints +echo "LIBUSB_ROOT=$PREFIX" >> "$GITHUB_ENV" +# Static libusb on macOS needs these frameworks linked into libusb4java.dylib +echo "LIBUSB_LDFLAGS=-framework IOKit -framework CoreFoundation -framework Security" >> "$GITHUB_ENV" diff --git a/ci/deps_so.sh b/ci/deps_so.sh index 6e51b5b..5673234 100644 --- a/ci/deps_so.sh +++ b/ci/deps_so.sh @@ -1,3 +1,31 @@ #!/bin/bash -sudo apt update || die -sudo apt install -y libusb-1.0-0-dev || die +set -euo pipefail + +# apt ships no static libusb-1.0.a, so build one from source. +# --disable-udev keeps the .a free of a libudev dependency -> fully self-contained. +sudo apt update -y +sudo apt install -y build-essential autoconf automake libtool pkg-config + +LIBUSB_VERSION="${VERSION}" +PREFIX=/usr/local + +curl -L https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.tar.bz2 | tar xj +cd "libusb-${LIBUSB_VERSION}" +autoreconf -fi +./configure --prefix="$PREFIX" --disable-shared --enable-static --disable-udev +make -j"$(nproc)" +make install + +test -f "$PREFIX/lib/libusb-1.0.a" || { echo "ERROR: static libusb-1.0.a not built" >&2; exit 1; } + +# Version guard: the built libusb must match the workflow VERSION exactly. +INSTALLED="$(grep -m1 '^Version:' "$PREFIX/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" +if [ "$INSTALLED" != "$LIBUSB_VERSION" ]; then + echo "ERROR: built libusb version is '$INSTALLED', expected '$LIBUSB_VERSION'" >&2 + exit 1 +fi + +# LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints +echo "LIBUSB_ROOT=$PREFIX" >> "$GITHUB_ENV" +# Static libusb on Linux needs pthread/rt linked into libusb4java.so +echo "LIBUSB_LDFLAGS=-lpthread -lrt" >> "$GITHUB_ENV" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a739520..71df17e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,10 @@ file(GLOB_RECURSE USB4JAVA_SOURCES *.c) add_library(usb4java SHARED ${USB4JAVA_SOURCES}) +set_target_properties(usb4java PROPERTIES + PREFIX "lib" + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out + LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/out +) target_link_libraries(usb4java ${LibUsb_LIBRARIES}) if(CMAKE_COMPILER_IS_GNUCC) set_target_properties(usb4java PROPERTIES LINK_FLAGS -static-libgcc) From 3a6cf51a4d0b034dcbb2cff2ca3ae0ab968b84da Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 15:05:50 +0300 Subject: [PATCH 72/81] slop --- ci/deps_dll.sh | 50 +++++++++++++++++++++++++++++++++++----------- ci/deps_dylib.sh | 35 +++++++++++++++++++------------- ci/deps_so.sh | 27 +++++++++++++------------ ci/libusb_build.sh | 21 +++++++++++++++++++ 4 files changed, 94 insertions(+), 39 deletions(-) create mode 100644 ci/libusb_build.sh diff --git a/ci/deps_dll.sh b/ci/deps_dll.sh index 0dd373a..d45a206 100644 --- a/ci/deps_dll.sh +++ b/ci/deps_dll.sh @@ -1,22 +1,48 @@ #!/bin/bash +# Build a self-contained static libusb from source for Windows (no vcpkg). +# Built with MSVC via the libusb msvc/ static project so it matches the MSVC +# toolchain used to build libusb4java.dll. Runs under Git Bash; the prefix is +# converted to a Windows path (cygpath -w) because CMake/MSVC needs one. set -euo pipefail -# :static builds msvc/libusb_static.vcxproj -> libusb-1.0.lib -vcpkg install libusb:static +# shellcheck source=ci/libusb_build.sh +source ci/libusb_build.sh -LIBUSB_ROOT="C:/vcpkg/packages/libusb_x64-windows/" +# Locate MSBuild via vswhere (present on the GH windows image). +MSBUILD="$(vswhere -latest -find 'MSBuild\**\Bin\MSBuild.exe' | head -n1)" +[ -n "${MSBUILD}" ] || { echo "ERROR: MSBuild not found via vswhere" >&2; exit 1; } -# Version guard: vcpkg's libusb must match the workflow VERSION exactly. -# (vcpkg resolves to the registry version, not a pinned one, so this fails the -# build if the registry serves a different libusb than $VERSION.) -VERSION="${VERSION}" -INSTALLED="$(grep -m1 '^Version:' "$LIBUSB_ROOT/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" -if [ "$INSTALLED" != "$VERSION" ]; then - echo "ERROR: vcpkg libusb version is '$INSTALLED', expected '$VERSION'" >&2 +# Build the static lib (libusb_static.vcxproj -> libusb-1.0.lib). +# MSYS2_ARG_CONV_EXCL stops Git Bash from mangling the backslash project path +# and the /p:... arguments before they reach MSBuild. +export MSYS2_ARG_CONV_EXCL="*" +"${MSBUILD}" "msvc/libusb_static.vcxproj" /p:Configuration=Release /p:Platform=x64 /m /v:minimal + +# msbuild emits the .lib under /build////lib/ +LIB_ARTIFACT="$(find "${LIBUSB_SRC}/build" -name 'libusb-1.0.lib' 2>/dev/null | head -n1)" +[ -n "${LIB_ARTIFACT}" ] && [ -f "${LIB_ARTIFACT}" ] || { echo "ERROR: libusb-1.0.lib not found after msbuild" >&2; exit 1; } + +# Stage into a conventional prefix: /lib/libusb-1.0.lib and +# /include/libusb-1.0/libusb.h (mirrors `make install` on Unix). +mkdir -p "${LIBUSB_PREFIX}/lib" "${LIBUSB_PREFIX}/include/libusb-1.0" +cp "${LIB_ARTIFACT}" "${LIBUSB_PREFIX}/lib/libusb-1.0.lib" +cp "${LIBUSB_SRC}/libusb/libusb.h" "${LIBUSB_SRC}/libusb/version.h" "${LIBUSB_SRC}/libusb/version_nano.h" "${LIBUSB_PREFIX}/include/libusb-1.0/" + +test -f "${LIBUSB_PREFIX}/lib/libusb-1.0.lib" || { echo "ERROR: libusb-1.0.lib not staged" >&2; exit 1; } +test -f "${LIBUSB_PREFIX}/include/libusb-1.0/libusb.h" || { echo "ERROR: libusb-1.0/libusb.h not staged" >&2; exit 1; } + +# Version guard: the built libusb must match the workflow VERSION exactly. +MAJOR="$(grep -m1 '^#define LIBUSB_MAJOR' "${LIBUSB_SRC}/libusb/version.h" | awk '{print $3}')" +MINOR="$(grep -m1 '^#define LIBUSB_MINOR' "${LIBUSB_SRC}/libusb/version.h" | awk '{print $3}')" +MICRO="$(grep -m1 '^#define LIBUSB_MICRO' "${LIBUSB_SRC}/libusb/version.h" | awk '{print $3}')" +INSTALLED="${MAJOR}.${MINOR}.${MICRO}" +if [ "${INSTALLED}" != "${LIBUSB_VERSION}" ]; then + echo "ERROR: built libusb version is '${INSTALLED}', expected '${LIBUSB_VERSION}'" >&2 exit 1 fi -# LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints -echo "LIBUSB_ROOT=$LIBUSB_ROOT" >> "$GITHUB_ENV" +# LIBUSB_ROOT (Windows path) -> FindLibUsb.cmake uses \lib and \include +LIBUSB_ROOT_WIN="$(cygpath -w "${LIBUSB_PREFIX}")" +echo "LIBUSB_ROOT=${LIBUSB_ROOT_WIN}" >> "$GITHUB_ENV" # Static libusb on Windows needs the WinUSB system library linked in echo "LIBUSB_LDFLAGS=setupapi.lib" >> "$GITHUB_ENV" diff --git a/ci/deps_dylib.sh b/ci/deps_dylib.sh index 43b3984..e096113 100644 --- a/ci/deps_dylib.sh +++ b/ci/deps_dylib.sh @@ -1,25 +1,32 @@ #!/bin/bash +# Build a self-contained static libusb from source for macOS (no brew libusb). +# macOS does not ship autoconf/automake/libtool, so install just the autotools +# chain via brew (build tooling only -- libusb itself is still built from source). +# libusb has no udev backend on macOS, so no --disable-udev is needed. set -euo pipefail -brew install libusb pkgconf +# shellcheck source=ci/libusb_build.sh +source ci/libusb_build.sh -PREFIX="$(brew --prefix)" -if [ ! -f "$PREFIX/lib/libusb-1.0.a" ]; then - echo "ERROR: static libusb-1.0.a not found under $PREFIX/lib (brew may not provide a static lib; fall back to building libusb from source)" >&2 - exit 1 -fi +brew install autoconf automake libtool + +cd "${LIBUSB_SRC}" +autoreconf -fi +./configure --prefix="${LIBUSB_PREFIX}" --disable-shared --enable-static +make -j"$(sysctl -n hw.ncpu)" +make install + +test -f "${LIBUSB_PREFIX}/lib/libusb-1.0.a" || { echo "ERROR: static libusb-1.0.a not built" >&2; exit 1; } +test -f "${LIBUSB_PREFIX}/include/libusb-1.0/libusb.h" || { echo "ERROR: libusb-1.0/libusb.h not installed" >&2; exit 1; } -# Version guard: brew's libusb must match the workflow VERSION exactly. -# (brew cannot pin a version, so this fails the build if Homebrew serves a -# different libusb than $VERSION.) -VERSION="${VERSION}" -INSTALLED="$(grep -m1 '^Version:' "$PREFIX/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" -if [ "$INSTALLED" != "$VERSION" ]; then - echo "ERROR: brew libusb version is '$INSTALLED', expected '$VERSION'" >&2 +# Version guard: the built libusb must match the workflow VERSION exactly. +INSTALLED="$(grep -m1 '^Version:' "${LIBUSB_PREFIX}/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" +if [ "${INSTALLED}" != "${LIBUSB_VERSION}" ]; then + echo "ERROR: built libusb version is '${INSTALLED}', expected '${LIBUSB_VERSION}'" >&2 exit 1 fi # LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints -echo "LIBUSB_ROOT=$PREFIX" >> "$GITHUB_ENV" +echo "LIBUSB_ROOT=${LIBUSB_PREFIX}" >> "$GITHUB_ENV" # Static libusb on macOS needs these frameworks linked into libusb4java.dylib echo "LIBUSB_LDFLAGS=-framework IOKit -framework CoreFoundation -framework Security" >> "$GITHUB_ENV" diff --git a/ci/deps_so.sh b/ci/deps_so.sh index 5673234..8e6cae4 100644 --- a/ci/deps_so.sh +++ b/ci/deps_so.sh @@ -1,31 +1,32 @@ #!/bin/bash +# Build a self-contained static libusb from source for Linux. +# apt has no static libusb-1.0.a, so we build one. --disable-udev keeps the .a +# free of a libudev dependency so libusb4java.so stays fully self-contained. set -euo pipefail -# apt ships no static libusb-1.0.a, so build one from source. -# --disable-udev keeps the .a free of a libudev dependency -> fully self-contained. +# shellcheck source=ci/libusb_build.sh +source ci/libusb_build.sh + sudo apt update -y sudo apt install -y build-essential autoconf automake libtool pkg-config -LIBUSB_VERSION="${VERSION}" -PREFIX=/usr/local - -curl -L https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.tar.bz2 | tar xj -cd "libusb-${LIBUSB_VERSION}" +cd "${LIBUSB_SRC}" autoreconf -fi -./configure --prefix="$PREFIX" --disable-shared --enable-static --disable-udev +./configure --prefix="${LIBUSB_PREFIX}" --disable-shared --enable-static --disable-udev make -j"$(nproc)" make install -test -f "$PREFIX/lib/libusb-1.0.a" || { echo "ERROR: static libusb-1.0.a not built" >&2; exit 1; } +test -f "${LIBUSB_PREFIX}/lib/libusb-1.0.a" || { echo "ERROR: static libusb-1.0.a not built" >&2; exit 1; } +test -f "${LIBUSB_PREFIX}/include/libusb-1.0/libusb.h" || { echo "ERROR: libusb-1.0/libusb.h not installed" >&2; exit 1; } # Version guard: the built libusb must match the workflow VERSION exactly. -INSTALLED="$(grep -m1 '^Version:' "$PREFIX/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" -if [ "$INSTALLED" != "$LIBUSB_VERSION" ]; then - echo "ERROR: built libusb version is '$INSTALLED', expected '$LIBUSB_VERSION'" >&2 +INSTALLED="$(grep -m1 '^Version:' "${LIBUSB_PREFIX}/lib/pkgconfig/libusb-1.0.pc" | awk '{print $2}')" +if [ "${INSTALLED}" != "${LIBUSB_VERSION}" ]; then + echo "ERROR: built libusb version is '${INSTALLED}', expected '${LIBUSB_VERSION}'" >&2 exit 1 fi # LIBUSB_ROOT -> FindLibUsb.cmake uses /lib and /include as search hints -echo "LIBUSB_ROOT=$PREFIX" >> "$GITHUB_ENV" +echo "LIBUSB_ROOT=${LIBUSB_PREFIX}" >> "$GITHUB_ENV" # Static libusb on Linux needs pthread/rt linked into libusb4java.so echo "LIBUSB_LDFLAGS=-lpthread -lrt" >> "$GITHUB_ENV" diff --git a/ci/libusb_build.sh b/ci/libusb_build.sh new file mode 100644 index 0000000..7f420ca --- /dev/null +++ b/ci/libusb_build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Download + extract libusb $VERSION source into the workspace (no package manager). +# Sourced by the per-platform deps_*.sh scripts. After sourcing, these are set: +# LIBUSB_VERSION libusb version to build (single source of truth: workflow VERSION) +# LIBUSB_BUILD_DIR workspace dir that holds the source tree +# LIBUSB_PREFIX install prefix the platform build script must install into +# LIBUSB_SRC extracted source root ($LIBUSB_BUILD_DIR/libusb-$LIBUSB_VERSION) +set -euo pipefail + +# VERSION is the single source of truth, set in .github/workflows/ci.yml. +LIBUSB_VERSION="${VERSION:?ERROR: VERSION is not set; define it in .github/workflows/ci.yml}" +LIBUSB_BUILD_DIR="${GITHUB_WORKSPACE}/libusb-build" +LIBUSB_PREFIX="${LIBUSB_BUILD_DIR}/prefix" +LIBUSB_SRC="${LIBUSB_BUILD_DIR}/libusb-${LIBUSB_VERSION}" + +rm -rf "${LIBUSB_BUILD_DIR}" +mkdir -p "${LIBUSB_BUILD_DIR}" +curl -fsSL "https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.tar.bz2" \ + | tar xj -C "${LIBUSB_BUILD_DIR}" + +test -d "${LIBUSB_SRC}" || { echo "ERROR: failed to download/extract libusb-${LIBUSB_VERSION}" >&2; exit 1; } From e5d9409d37ff331342d7005ede18147134401b87 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 15:15:06 +0300 Subject: [PATCH 73/81] slop 1 --- ci/deps_so.sh | 4 +++- ci/libusb_build.sh | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ci/deps_so.sh b/ci/deps_so.sh index 8e6cae4..73b3720 100644 --- a/ci/deps_so.sh +++ b/ci/deps_so.sh @@ -12,7 +12,9 @@ sudo apt install -y build-essential autoconf automake libtool pkg-config cd "${LIBUSB_SRC}" autoreconf -fi -./configure --prefix="${LIBUSB_PREFIX}" --disable-shared --enable-static --disable-udev +# -fPIC is required: libusb4java.so is a shared object and pulls libusb's +# objects out of the static .a, so they must be position-independent. +CFLAGS="-fPIC" ./configure --prefix="${LIBUSB_PREFIX}" --disable-shared --enable-static --disable-udev make -j"$(nproc)" make install diff --git a/ci/libusb_build.sh b/ci/libusb_build.sh index 7f420ca..5e70950 100644 --- a/ci/libusb_build.sh +++ b/ci/libusb_build.sh @@ -9,7 +9,15 @@ set -euo pipefail # VERSION is the single source of truth, set in .github/workflows/ci.yml. LIBUSB_VERSION="${VERSION:?ERROR: VERSION is not set; define it in .github/workflows/ci.yml}" -LIBUSB_BUILD_DIR="${GITHUB_WORKSPACE}/libusb-build" + +# On Windows (Git Bash) GITHUB_WORKSPACE is a Windows path (D:\a\...); the bash +# tools in this script need a POSIX path, so convert it. On Linux/macOS it is +# already POSIX and cygpath is absent, so leave it untouched. +WORKSPACE="${GITHUB_WORKSPACE}" +if [ -n "${MSYSTEM:-}" ]; then + WORKSPACE="$(cygpath -u "${GITHUB_WORKSPACE}")" +fi +LIBUSB_BUILD_DIR="${WORKSPACE}/libusb-build" LIBUSB_PREFIX="${LIBUSB_BUILD_DIR}/prefix" LIBUSB_SRC="${LIBUSB_BUILD_DIR}/libusb-${LIBUSB_VERSION}" From ab3f7208a940c9b0815ac019137bd1baa1e86824 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 15:19:41 +0300 Subject: [PATCH 74/81] sloop --- ci/deps_dll.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/deps_dll.sh b/ci/deps_dll.sh index d45a206..461abb8 100644 --- a/ci/deps_dll.sh +++ b/ci/deps_dll.sh @@ -13,10 +13,12 @@ MSBUILD="$(vswhere -latest -find 'MSBuild\**\Bin\MSBuild.exe' | head -n1)" [ -n "${MSBUILD}" ] || { echo "ERROR: MSBuild not found via vswhere" >&2; exit 1; } # Build the static lib (libusb_static.vcxproj -> libusb-1.0.lib). -# MSYS2_ARG_CONV_EXCL stops Git Bash from mangling the backslash project path -# and the /p:... arguments before they reach MSBuild. +# The .vcxproj lives inside the extracted libusb source tree, so pass its +# absolute Windows path (cygpath -w). MSYS2_ARG_CONV_EXCL stops Git Bash from +# mangling the backslash path and the /p:... arguments before they reach MSBuild. +VCPROJ_WIN="$(cygpath -w "${LIBUSB_SRC}/msvc/libusb_static.vcxproj")" export MSYS2_ARG_CONV_EXCL="*" -"${MSBUILD}" "msvc/libusb_static.vcxproj" /p:Configuration=Release /p:Platform=x64 /m /v:minimal +"${MSBUILD}" "${VCPROJ_WIN}" /p:Configuration=Release /p:Platform=x64 /m /v:minimal # msbuild emits the .lib under /build////lib/ LIB_ARTIFACT="$(find "${LIBUSB_SRC}/build" -name 'libusb-1.0.lib' 2>/dev/null | head -n1)" From 8c76ba44251166fefbf562d5370bbae0c387ad6d Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 15:55:31 +0300 Subject: [PATCH 75/81] file --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71df17e..1300f87 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,17 @@ file(GLOB_RECURSE USB4JAVA_SOURCES *.c) add_library(usb4java SHARED ${USB4JAVA_SOURCES}) +# On Unix the .so/.dylib is a library artifact (LIBRARY_OUTPUT_DIRECTORY). On +# Windows the .dll is a RUNTIME artifact and its import .lib uses +# IMPORT_LIBRARY_OUTPUT_DIRECTORY, so set all of them to keep the artifact in +# /out for every generator/config. set_target_properties(usb4java PROPERTIES PREFIX "lib" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/out + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/out + IMPORT_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out + IMPORT_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/out ) target_link_libraries(usb4java ${LibUsb_LIBRARIES}) if(CMAKE_COMPILER_IS_GNUCC) From ce3f4fdd15b5d5c5e1cb4abca845c8041a68b6ed Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 16:05:26 +0300 Subject: [PATCH 76/81] rel --- .github/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- ci/libusb_build.sh | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bb304d..b0cfaea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,10 @@ jobs: fail-fast: false matrix: include: -## windows arm; should be using `vcpkg install libusb:arm64-windows-static`. Probably requires custom libusbK -# - os: windows-11-arm -# target: win32-aarch64 -# ext: dll +# windows arm; should be using `vcpkg install libusb:arm64-windows-static`. Probably requires custom libusbK + - os: windows-11-arm + target: win32-aarch64 + ext: dll # win32-x86-64 - os: windows-latest target: win32-x86-64 @@ -31,26 +31,26 @@ jobs: target: linux-x86-64 ext: so static: true -## arm | armhf astr32 armv7l -# - os: ubuntu-24.04-arm -# target: linux-armhf -# ext: so -# static: true -## linux-aarch64 -# - os: ubuntu-24.04-arm -# target: linux-aarch64 -# ext: so -# static: true -## darwin-x86-64 +# arm | armhf astr32 armv7l + - os: ubuntu-24.04-arm + target: linux-armhf + ext: so + static: true +# linux-aarch64 + - os: ubuntu-24.04-arm + target: linux-aarch64 + ext: so + static: true +# darwin-x86-64 - os: macos-15-intel target: darwin-x86-64 ext: dylib static: true -## darwin-arm-64 -# - os: macos-14 -# target: darwin-aarch64 -# ext: dylib -# static: true +# darwin-arm-64 + - os: macos-14 + target: darwin-aarch64 + ext: dylib + static: true steps: - uses: actions/checkout@v7 diff --git a/ci/libusb_build.sh b/ci/libusb_build.sh index 5e70950..648c67d 100644 --- a/ci/libusb_build.sh +++ b/ci/libusb_build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Download + extract libusb $VERSION source into the workspace (no package manager). +# Download + extract libusb $VERSION source into the workspace # Sourced by the per-platform deps_*.sh scripts. After sourcing, these are set: # LIBUSB_VERSION libusb version to build (single source of truth: workflow VERSION) # LIBUSB_BUILD_DIR workspace dir that holds the source tree From f462cf6b60eb3be1897c298aeecd66cd7891357f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 16:07:30 +0300 Subject: [PATCH 77/81] rel+1 --- .github/workflows/ci.yml | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0cfaea..1058469 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,40 +17,40 @@ jobs: fail-fast: false matrix: include: -# windows arm; should be using `vcpkg install libusb:arm64-windows-static`. Probably requires custom libusbK - - os: windows-11-arm - target: win32-aarch64 - ext: dll -# win32-x86-64 - - os: windows-latest - target: win32-x86-64 - ext: dll - static: true -# linux-x86-64 - - os: ubuntu-latest - target: linux-x86-64 - ext: so - static: true -# arm | armhf astr32 armv7l - - os: ubuntu-24.04-arm - target: linux-armhf - ext: so - static: true -# linux-aarch64 - - os: ubuntu-24.04-arm - target: linux-aarch64 - ext: so - static: true -# darwin-x86-64 - - os: macos-15-intel - target: darwin-x86-64 - ext: dylib - static: true -# darwin-arm-64 - - os: macos-14 - target: darwin-aarch64 - ext: dylib - static: true +# # windows arm; should be using `vcpkg install libusb:arm64-windows-static`. Probably requires custom libusbK +# - os: windows-11-arm +# target: win32-aarch64 +# ext: dll +# win32-x86-64 + - os: windows-latest + target: win32-x86-64 + ext: dll + static: true +# linux-x86-64 + - os: ubuntu-latest + target: linux-x86-64 + ext: so + static: true +# arm | armhf astr32 armv7l + - os: ubuntu-24.04-arm + target: linux-armhf + ext: so + static: true +# linux-aarch64 + - os: ubuntu-24.04-arm + target: linux-aarch64 + ext: so + static: true +# darwin-x86-64 + - os: macos-15-intel + target: darwin-x86-64 + ext: dylib + static: true +# darwin-arm-64 + - os: macos-14 + target: darwin-aarch64 + ext: dylib + static: true steps: - uses: actions/checkout@v7 From edac3ad96e32da842fb0c6f62404694575b4619d Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 11 Oct 2026 20:22:42 +0300 Subject: [PATCH 78/81] build fat jar # Conflicts: # .github/workflows/ci.yml --- .github/workflows/ci.yml | 27 ++++++++++++++++++-- CMakeLists.txt | 2 +- README.md | 46 ++++++++++++--------------------- ci/deps_dll.sh | 2 +- ci/deps_dylib.sh | 0 ci/deps_so.sh | 0 ci/libusb_build.sh | 0 pom.xml | 55 ++++++++++++++++------------------------ 8 files changed, 65 insertions(+), 67 deletions(-) mode change 100644 => 100755 ci/deps_dll.sh mode change 100644 => 100755 ci/deps_dylib.sh mode change 100644 => 100755 ci/deps_so.sh mode change 100644 => 100755 ci/libusb_build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1058469..ec4f978 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ env: jobs: build: runs-on: ${{ matrix.os }} - continue-on-error: true strategy: fail-fast: false matrix: @@ -67,7 +66,7 @@ jobs: run: >- mkdir build && cd build && - cmake .. -DCMAKE_BUILD_TYPE=Release -DLibUsb_USE_STATIC_LIBS=${{ matrix.static }} -DLibUsb_LDFLAGS="${{ env.LIBUSB_LDFLAGS }}" && + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DLibUsb_USE_STATIC_LIBS=${{ matrix.static }} -DLibUsb_LDFLAGS="${{ env.LIBUSB_LDFLAGS }}" && cmake --build . --config Release && cd .. && mkdir -p publish/org/usb4java/${{ matrix.target }} && @@ -77,5 +76,29 @@ jobs: - uses: actions/upload-artifact@v7 with: + name: libusb4java-${{ matrix.target }} path: publish/libusb4java-${{ env.VERSION }}-${{ matrix.target }}.jar + if-no-files-found: error + archive: false + + bundle: + needs: build + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v7 + with: + path: jars + merge-multiple: true + - name: Pack bundle jar + run: | + mkdir -p bundle + cp jars/libusb4java-${{ env.VERSION }}-*.jar bundle/ + cp pom.xml "bundle/libusb4java-${{ env.VERSION }}.pom" + jar cf "dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar" -C bundle . + - uses: actions/upload-artifact@v7 + with: + name: bundle + path: dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar + if-no-files-found: error archive: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 2afa0d5..561ae78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.14) project(usb4java C) -set(PROJECT_VERSION 1.3.1) +set(PROJECT_VERSION 1.0.30) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/.cmake/Modules/") find_package(JNI REQUIRED) diff --git a/README.md b/README.md index ba882df..73e0365 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,18 @@ -This is the source code of the JNI wrapper for libusb. usb4java -already includes prebuilt libraries for the following platforms: +This is for of https://github.com/usb4java/libusb4java +Statically-linked JNI wrapper for libusb used by usb4java. -* linux-x86 -* linux-x86-64 -* linux-arm -* linux-armel -* linux-aarch64 -* win32-x86 -* win32-x86-64 -* darwin-x86-64 -* darwin-arm-64 +```java -If you need the library on an other platform then you can easily compile it -yourself. On a Unix-compatible operating system you only need the Java JDK, -an up-to-date libusb library version, the GNU C compiler and cmake. When -everything is correctly installed then you should be able to build the -library with the following commands: - - $ mkdir build - $ cd build - $ cmake .. - $ make - -When compilation was successful then you can find the library in the -`build/src` directory. - -usb4java searches for the library in the CLASSPATH directory -`org/libusb4java/-/`. On a 32 bit x86 linux machine for -example the directory name is `org/libusb4java/linux-x86`. Usually -you can find the required name in the exception thrown by usb4java when it -does not find the required library. + + org.usb4java + usb4java + 1.3.0 + + + org.usb4java + libusb4java + + + compile + +``` diff --git a/ci/deps_dll.sh b/ci/deps_dll.sh old mode 100644 new mode 100755 index 461abb8..409efbb --- a/ci/deps_dll.sh +++ b/ci/deps_dll.sh @@ -18,7 +18,7 @@ MSBUILD="$(vswhere -latest -find 'MSBuild\**\Bin\MSBuild.exe' | head -n1)" # mangling the backslash path and the /p:... arguments before they reach MSBuild. VCPROJ_WIN="$(cygpath -w "${LIBUSB_SRC}/msvc/libusb_static.vcxproj")" export MSYS2_ARG_CONV_EXCL="*" -"${MSBUILD}" "${VCPROJ_WIN}" /p:Configuration=Release /p:Platform=x64 /m /v:minimal +"${MSBUILD}" "${VCPROJ_WIN}" /p:Configuration=Release /p:Platform=x64 /p:RuntimeLibrary=MT /m /v:minimal # msbuild emits the .lib under /build////lib/ LIB_ARTIFACT="$(find "${LIBUSB_SRC}/build" -name 'libusb-1.0.lib' 2>/dev/null | head -n1)" diff --git a/ci/deps_dylib.sh b/ci/deps_dylib.sh old mode 100644 new mode 100755 diff --git a/ci/deps_so.sh b/ci/deps_so.sh old mode 100644 new mode 100755 diff --git a/ci/libusb_build.sh b/ci/libusb_build.sh old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml index da23b4b..51decde 100644 --- a/pom.xml +++ b/pom.xml @@ -2,17 +2,17 @@ 4.0.0 - org.usb4java + com.github.developersu libusb4java pom libusb4java - 1.3.1-SNAPSHOT - https://github.com/usb4java/libusb4java/ - The native JNI library used by usb4java - 2011 + 1.0.30 + https://github.com/developersu/libusb4java/ + Libusb native JNI builds used by usb4java + 2026 - usb4java Team - http://usb4java.org/ + developersu + https://github.com/developersu/ @@ -23,16 +23,6 @@ - - - Discussions - usb4java+subscribe@googlegroups.com - usb4java+unsubscribe@googlegroups.com - usb4java@googlegroups.com - http://groups.google.com/group/usb4java - - - kayahr @@ -54,6 +44,15 @@ +1 http://l.longi.li/ + + developersu + Dmitry Isaenko + + CI pipeline maintainer + + +3 + http://redrise.ru/ + @@ -62,15 +61,15 @@ - scm:git:git://github.com/usb4java/${project.artifactId}.git - scm:git:ssh://git@github.com/usb4java/${project.artifactId}.git - http://github.com/usb4java/${project.artifactId} + scm:git:git://github.com/developersu/${project.artifactId}.git + scm:git:ssh://git@github.com/developersu/${project.artifactId}.git + http://github.com/developersu/${project.artifactId} HEAD GitHub - https://github.com/usb4java/${project.artifactId}/issues + https://github.com/developersu/${project.artifactId}/issues @@ -119,19 +118,9 @@ - sonatype-snapshots - Sonatype Snapshot Repository - https://oss.sonatype.org/content/repositories/snapshots - true + jitpack.io + https://jitpack.io - - - sonatype-snapshots - Sonatype Snapshot Repository - https://oss.sonatype.org/content/repositories/snapshots - - - From 0fc5b488624287e51a591b7e83f5e605f9819f21 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Thu, 15 Oct 2026 03:30:53 +0300 Subject: [PATCH 79/81] refactor --- .github/workflows/ci.yml | 45 +++++---- .gitignore | 1 + README.md | 8 +- ci/deploy.sh | 191 +++++++++++++++++++++++++++++++++++++ ci/libusb_build.sh | 2 +- dists/README.md | 11 --- dists/bundle | 53 ---------- dists/darwin/build | 96 ------------------- dists/linux/Dockerfile | 52 ---------- dists/linux/Dockerfile.arm | 54 ----------- dists/linux/README.md | 86 ----------------- dists/linux/build | 96 ------------------- dists/linux/build-all | 26 ----- dists/linux/build-arm | 50 ---------- dists/win32/build-all.bat | 15 --- dists/win32/build.bat | 96 ------------------- pom.xml | 51 ++++------ 17 files changed, 238 insertions(+), 695 deletions(-) create mode 100755 ci/deploy.sh delete mode 100644 dists/README.md delete mode 100755 dists/bundle delete mode 100755 dists/darwin/build delete mode 100644 dists/linux/Dockerfile delete mode 100644 dists/linux/Dockerfile.arm delete mode 100644 dists/linux/README.md delete mode 100755 dists/linux/build delete mode 100755 dists/linux/build-all delete mode 100755 dists/linux/build-arm delete mode 100644 dists/win32/build-all.bat delete mode 100644 dists/win32/build.bat diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec4f978..463203a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: static: true # arm | armhf astr32 armv7l - os: ubuntu-24.04-arm - target: linux-armhf + target: linux-arm ext: so static: true # linux-aarch64 @@ -76,29 +76,28 @@ jobs: - uses: actions/upload-artifact@v7 with: - name: libusb4java-${{ matrix.target }} path: publish/libusb4java-${{ env.VERSION }}-${{ matrix.target }}.jar if-no-files-found: error archive: false - bundle: - needs: build - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v7 - with: - path: jars - merge-multiple: true - - name: Pack bundle jar - run: | - mkdir -p bundle - cp jars/libusb4java-${{ env.VERSION }}-*.jar bundle/ - cp pom.xml "bundle/libusb4java-${{ env.VERSION }}.pom" - jar cf "dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar" -C bundle . - - uses: actions/upload-artifact@v7 - with: - name: bundle - path: dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar - if-no-files-found: error - archive: false +# bundle: +# needs: build +## if: github.event_name == 'push' && github.ref == 'refs/heads/master' +# runs-on: ubuntu-latest +# steps: +# - uses: actions/download-artifact@v7 +# with: +# path: jars +# merge-multiple: true +# - name: Pack bundle jar +# run: | +# mkdir -p bundle +# cp jars/libusb4java-${{ env.VERSION }}-*.jar bundle/ +# cp pom.xml "bundle/libusb4java-${{ env.VERSION }}.pom" +# jar cf "dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar" -C bundle . +# - uses: actions/upload-artifact@v7 +# with: +# name: bundle +# path: dist-bundle/libusb4java-${{ env.VERSION }}-bundle.jar +# if-no-files-found: error +# archive: false diff --git a/.gitignore b/.gitignore index d291403..b6e6027 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ target /build /.vs /out/build/x64-Debug +target diff --git a/README.md b/README.md index 73e0365..94656f9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Statically-linked JNI wrapper for libusb used by usb4java. ```java - org.usb4java + org.usb4jav usb4java 1.3.0 @@ -15,4 +15,10 @@ Statically-linked JNI wrapper for libusb used by usb4java. compile + + + ru.redrise + libusb4java + 1.0.30 + ``` diff --git a/ci/deploy.sh b/ci/deploy.sh new file mode 100755 index 0000000..f4eee08 --- /dev/null +++ b/ci/deploy.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash +# Sign the prebuilt per-platform native JARs (from target/) with GPG and +# install them into the local Maven repository (always). Deployment to the +# remote release repository defined in pom.xml distributionManagement +# (id=redrise) is performed only after explicit user confirmation. +# +# Usage: +# bash ci/deploy.sh # uses VERSION from pom.xml, jars in target/ +# VERSION=1.0.30 DIR=target bash ci/deploy.sh +# +# Requires: mvn, gpg (a GPG signing key already selected, e.g. via +# gpg-preset-passphrase or a cached agent). Remote credentials are taken from +# the REPO_USERNAME / REPO_PASSWORD environment variables (only needed for +# the remote deploy step; ~/.m2/settings.xml is NOT consulted). + +set -euo pipefail + +VERSION="${VERSION:-$(grep -m1 -oP '(?<=).+(?=)' pom.xml)}" +DIR="${DIR:-target}" +POM="pom.xml" + +# GAV coordinates (explicit, so deploy-file does NOT need -DpomFile: with +# pomFile the plugin resolves the POM artifact from the remote repository, +# which fails on the very first deploy of a version). +GROUP_ID="$(grep -m1 -oP '(?<=).+(?=)' "$POM")" +ARTIFACT_ID="$(grep -m1 -oP '(?<=).+(?=)' "$POM")" +if [ -z "$GROUP_ID" ] || [ -z "$ARTIFACT_ID" ]; then + echo "could not resolve groupId/artifactId in $POM" >&2 + exit 1 +fi + +# Derive CLASSIFIERS dynamically from the per-platform JARs present in DIR +# (expected naming: libusb4java-$VERSION-.jar). +CLASSIFIERS=() +for j in "$DIR"/libusb4java-"$VERSION"-*.jar; do + [ -e "$j" ] || continue + c="$(basename "$j")" + c="${c#libusb4java-$VERSION-}" + c="${c%.jar}" + CLASSIFIERS+=("$c") +done +if [ ${#CLASSIFIERS[@]} -eq 0 ]; then + echo "no libusb4java-$VERSION-*.jar found in $DIR" >&2 + exit 1 +fi + +# Repository coordinates from pom.xml distributionManagement. +DM_BLOCK="$(awk '//,/<\/distributionManagement>/' "$POM")" +REPO_ID="$(printf '%s\n' "$DM_BLOCK" | grep -m1 -oP '(?<=).*?(?=)')" +REPO_URL="$(printf '%s\n' "$DM_BLOCK" | grep -m1 -oP '(?<=).*?(?=)')" +if [ -z "$REPO_ID" ] || [ -z "$REPO_URL" ]; then + echo "could not resolve distributionManagement repository in $POM" >&2 + exit 1 +fi + +sign() { + gpg --batch --yes --armor --detach-sign --output "$1.asc" "$1" +} + +# 1) Sign + install the POM into the local repository +sign "$POM" +mvn -q install:install-file \ + -Dfile="$POM" \ + -DpomFile="$POM" \ + -Dpackaging=pom + +# 2) Sign + install each platform JAR into the local repository +for c in "${CLASSIFIERS[@]}"; do + f="$DIR/libusb4java-$VERSION-$c.jar" + if [ ! -f "$f" ]; then + echo "missing artifact: $f" >&2 + exit 1 + fi + sign "$f" + mvn -q install:install-file \ + -Dfile="$f" \ + -DpomFile="$POM" \ + -Dpackaging=jar \ + -Dclassifier="$c" + echo "installed: libusb4java-$VERSION-$c" +done + +echo "Done: installed libusb4java $VERSION (pom + ${#CLASSIFIERS[@]} classifiers) into local m2" + +# 3) Remote deploy only with explicit user consent +answer="" +read -r -p "Deploy to remote repository ${REPO_URL} (id=${REPO_ID})? [y/N] " answer || true +case "${answer,,}" in + y|yes) ;; + *) + echo "Remote deploy skipped" + exit 0 + ;; +esac + +# 4) Remote credentials from environment variables (never from settings.xml) +if [ -z "${REPO_USERNAME:-}" ] || [ -z "${REPO_PASSWORD:-}" ]; then + echo "REPO_USERNAME / REPO_PASSWORD must be set for remote deploy" >&2 + exit 1 +fi + +xml_escape() { + local s="$1" + s="${s//&/\&}" + s="${s///\>}" + s="${s//\"/\"}" + printf '%s' "$s" +} + +U="$(xml_escape "$REPO_USERNAME")" +P="$(xml_escape "$REPO_PASSWORD")" + +# Temporary settings file holding the server credentials; 0600 by default. +TMP_SETTINGS="$(mktemp "${TMPDIR:-/tmp}/maven-settings.XXXXXX")" +# deploy-file resolves the *current* Maven project's POM from the remote repo. +# Launched from this project root that project is libusb4java, so on a first +# deploy the (not-yet-present) POM 404s and the deploy fails. Run deploy-file +# from a directory with no pom.xml so there is no current project and only the +# explicitly-named artifacts are uploaded. +NEUTRAL="$(mktemp -d "${TMPDIR:-/tmp}/deploy-file.XXXXXX")" +trap 'rm -f "$TMP_SETTINGS"; rm -rf "$NEUTRAL"' EXIT +ROOT="$(pwd)" +POM_ABS="$ROOT/$POM" +cd "$NEUTRAL" +cat > "$TMP_SETTINGS" < + + + ${REPO_ID} + ${U} + ${P} + + + +EOF + +# 4b) The releases repository is immutable: it has no DELETE and re-PUTting an +# existing artifact returns 400. deploy-file (re)generates the .md5/.sha1 for +# every artifact it uploads, so to refresh a stale checksum the artifact (and +# its .md5/.sha1/.asc) must be deleted first, then this script re-deploys it. +REPO_BASE="${REPO_URL%/}/$(printf '%s' "$GROUP_ID" | tr '.' '/')/$ARTIFACT_ID/$VERSION" +remote_exists() { [ "$(curl -s -o /dev/null -w '%{http_code}' "$1")" = "200" ]; } + +require_absent() { + # $1 = artifact base URL (no extension); $2 = display name. + if remote_exists "$1"; then + echo "ERROR: $2 already exists in the immutable repo." >&2 + echo " Delete $2 (and its .md5/.sha1/.asc) from the repo, then re-run." >&2 + exit 1 + fi +} + +# 5) Deploy the POM (+ signature side artifact) to the remote repository +POM_URL="$REPO_BASE/$ARTIFACT_ID-$VERSION.pom" +require_absent "$POM_URL" "$ARTIFACT_ID-$VERSION.pom" +mvn -q -s "$TMP_SETTINGS" deploy:deploy-file \ + -Dfile="$POM_ABS" \ + -DgroupId="$GROUP_ID" \ + -DartifactId="$ARTIFACT_ID" \ + -Dversion="$VERSION" \ + -Dpackaging=pom \ + -Dfiles="${POM_ABS}.asc" \ + -Dtypes=pom.asc \ + -Dclassifiers= \ + -Durl="$REPO_URL" \ + -DrepositoryId="$REPO_ID" +echo "deployed: $ARTIFACT_ID-$VERSION.pom" + +# 6) Deploy each platform JAR (+ signature side artifact) under its classifier +for c in "${CLASSIFIERS[@]}"; do + f="$ROOT/$DIR/libusb4java-$VERSION-$c.jar" + JAR_URL="$REPO_BASE/$ARTIFACT_ID-$VERSION-$c.jar" + require_absent "$JAR_URL" "$ARTIFACT_ID-$VERSION-$c.jar" + mvn -q -s "$TMP_SETTINGS" deploy:deploy-file \ + -Dfile="$f" \ + -DgroupId="$GROUP_ID" \ + -DartifactId="$ARTIFACT_ID" \ + -Dversion="$VERSION" \ + -Dpackaging=jar \ + -Dclassifier="$c" \ + -DgeneratePom=false \ + -Dfiles="$f.asc" \ + -Dtypes=jar.asc \ + -Dclassifiers="$c" \ + -Durl="$REPO_URL" \ + -DrepositoryId="$REPO_ID" + echo "deployed: libusb4java-$VERSION-$c" +done + +echo "Done: deployed libusb4java $VERSION (pom + ${#CLASSIFIERS[@]} classifiers) to repo id=${REPO_ID}" diff --git a/ci/libusb_build.sh b/ci/libusb_build.sh index 648c67d..91b7f80 100755 --- a/ci/libusb_build.sh +++ b/ci/libusb_build.sh @@ -1,7 +1,7 @@ #!/bin/bash # Download + extract libusb $VERSION source into the workspace # Sourced by the per-platform deps_*.sh scripts. After sourcing, these are set: -# LIBUSB_VERSION libusb version to build (single source of truth: workflow VERSION) +# LIBUSB_VERSION libusb version to build (single source of truth: workflow VERSION) # LIBUSB_BUILD_DIR workspace dir that holds the source tree # LIBUSB_PREFIX install prefix the platform build script must install into # LIBUSB_SRC extracted source root ($LIBUSB_BUILD_DIR/libusb-$LIBUSB_VERSION) diff --git a/dists/README.md b/dists/README.md deleted file mode 100644 index 6d15955..0000000 --- a/dists/README.md +++ /dev/null @@ -1,11 +0,0 @@ -This directory contains the build scripts used by the usb4java CI server to -automatically build the native libraries shipped with usb4java. - -If you want to build your own native library for a platform which is not -supported by usb4java out-of-the-box then this might be the wrong place for -you. Follow the instructions in the README.md file in the root directory of -the project instead. - -The bundle script can be used to create a distribution bundle ready to be -uploaded to Sonatype Nexus. It requires already build and deployed SNAPSHOT -versions of all the native JARs. diff --git a/dists/bundle b/dists/bundle deleted file mode 100755 index 85a9ae8..0000000 --- a/dists/bundle +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -# Exit on errors -set -e - -# Go to project root directory -cd "$(dirname $0)/.." - -# Get version from pom.xml -VERSION=$(sed -nE '0,//s/.*(.*?)<\/version>.*/\1/p' pom.xml) - -# Determine SNAPSHOT version -SNAPSHOT_VERSION=$(echo $VERSION | sed s/-SNAPSHOT//)-SNAPSHOT - -# Prepare bundle directory -rm -rf target/bundle/ -mkdir -p target/bundle - -# Download latest snapshot platform JARs -PLATFORMS=" - linux-x86 - linux-x86-64 - linux-arm - linux-armel - linux-aarch64 - win32-x86 - win32-x86-64 - darwin-x86-64 - darwin-aarch64 -" -for PLATFORM in $PLATFORMS -do - mvn dependency:copy -Dartifact=org.usb4java:libusb4java:$SNAPSHOT_VERSION:jar:$PLATFORM \ - -DoutputDirectory=target/bundle/ -Dmdep.stripVersion=true - mv target/bundle/libusb4java-$PLATFORM.jar target/bundle/libusb4java-$VERSION-$PLATFORM.jar -done - -# Copy pom to bundle directory -cp pom.xml target/bundle/libusb4java-$VERSION.pom - -# Sign all files -for FILE in target/bundle/* -do - gpg -a --detach-sig $FILE -done - -# Create bundle JAR file -cd target/bundle -jar cf ../libusb4java-$VERSION-bundle.jar * diff --git a/dists/darwin/build b/dists/darwin/build deleted file mode 100755 index a11de9e..0000000 --- a/dists/darwin/build +++ /dev/null @@ -1,96 +0,0 @@ -#1/bin/bash -# ============================================================================ -# Build script for Mac OS X. -# -# The script automatically compiles the binary for x86-64 and aarch64. -# Then it creates the corresponding JAR file in the target folder containing -# both architecture builds. -# The libusb sources are pulled from the GitHub tag matching the configured -# version. -# -# Requirements: cmake, make, curl, jar -# ============================================================================ - -# Fail on all errors -set -e - -# Software versions -LIBUSB_VERSION=1.0.28 - -# Determine OS -OS=darwin - -# Determine directories -cd "$(dirname $0)/../.." -PROJECT_DIR="$(pwd)" -TARGET_DIR="$PROJECT_DIR/target" -JAR_FILE=$TARGET_DIR/libusb4java-$OS.jar - -# Download libusb from GitHub and unzip -DOWNLOAD_DIR="$TARGET_DIR/downloads" - -# Clean up target directory -rm -rf "$TARGET_DIR" - -# Create download directory if not already present -mkdir -p "$DOWNLOAD_DIR" - -LIBUSB_TARBALL="v$LIBUSB_VERSION.zip" -LIBUSB_SOURCE=https://github.com/libusb/libusb/archive/$LIBUSB_TARBALL -LIBUSB_TARGET="$DOWNLOAD_DIR/$LIBUSB_TARBALL" -if [ ! -f "$LIBUSB_TARGET" ] -then - curl -C - -o "$LIBUSB_TARGET.download" -L "$LIBUSB_SOURCE" - mv -f "$LIBUSB_TARGET.download" "$LIBUSB_TARGET" -fi - -build_architecture () { - - local ARCH_ID=$1 - local ARCH=$2 - echo "Building for platform $OS-$ARCH" - local BUILD_DIR="$TARGET_DIR/build/darwin-$ARCH" - local ROOT_DIR="$BUILD_DIR/root" - - # Standard compiler and linker flags - local CFLAGS="-I$ROOT_DIR/include -arch $ARCH" - local LDFLAGS="-L$ROOT_DIR/lib" - - # Export compiler and linker flags - export CFLAGS LDFLAGS - - # Unzip libusb - mkdir -p "$BUILD_DIR" - cd "$BUILD_DIR" - unzip "$LIBUSB_TARGET" - mv "$BUILD_DIR/libusb-$LIBUSB_VERSION" "$BUILD_DIR/libusb" - cd "$BUILD_DIR/libusb" - - # Build libusb - autoreconf -i - ./configure --disable-shared --enable-static --with-pic --prefix="$ROOT_DIR" --host=$ARCH - make install-strip - - # Build libusb4java - mkdir -p "$BUILD_DIR/libusb4java" - cd "$BUILD_DIR/libusb4java" - PKG_CONFIG_PATH="$ROOT_DIR/lib/pkgconfig" cmake "$PROJECT_DIR" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="" \ - -DCMAKE_OSX_ARCHITECTURES=$ARCH \ - -DLibUsb_USE_STATIC_LIBS=true - make install/strip DESTDIR="$ROOT_DIR" - - # Create the JAR file - mkdir -p "$BUILD_DIR/classes/org/usb4java/$OS-$ARCH_ID" - cp "$ROOT_DIR/lib/libusb4java.dylib" "$BUILD_DIR/classes/org/usb4java/$OS-$ARCH_ID" - - if [ -f "$JAR_FILE" ]; then - jar uf "$JAR_FILE" -C "$BUILD_DIR/classes" org - else - jar cf "$JAR_FILE" -C "$BUILD_DIR/classes" org - fi -} - -build_architecture x86-64 x86_64 -build_architecture aarch64 arm64 diff --git a/dists/linux/Dockerfile b/dists/linux/Dockerfile deleted file mode 100644 index 695b9b5..0000000 --- a/dists/linux/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -ARG DOCKER_ARCH -FROM $DOCKER_ARCH/debian:bookworm - -ARG OS_ARCH -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$OS_ARCH - -ENV LIBUSB_VERSION=1.0.28 -ENV EUDEV_VERSION=3.2.14 - -# Copy optional qemu binaries -ARG ARCH -COPY target/build/linux-$ARCH/qemu* /usr/bin/ - -# Install debian updates -RUN apt update && apt upgrade -y - -# Install required debian packages -RUN apt install -y gnome-icon-theme gcc cmake curl gperf bzip2 openjdk-17-jdk - -# Install eudev -RUN mkdir -p /tmp/eudev; \ - cd /tmp/eudev; \ - curl -L https://github.com/eudev-project/eudev/releases/download/v$EUDEV_VERSION/eudev-$EUDEV_VERSION.tar.gz | tar xvz --strip-components 1; \ - ./configure \ - --disable-shared \ - --enable-static \ - --with-pic \ - --enable-split-usr \ - --disable-manpages \ - --disable-kmod \ - --disable-selinux \ - --disable-blkid \ - --prefix=/usr/local; \ - make install-strip; \ - rm -rf /tmp/eudev - -# Install libusb -RUN mkdir -p /tmp/libusb; \ - cd /tmp/libusb; \ - curl -L https://github.com/libusb/libusb/releases/download/v$LIBUSB_VERSION/libusb-$LIBUSB_VERSION.tar.bz2 | tar xvj --strip-components 1; \ - ./configure \ - --disable-shared \ - --enable-static \ - --with-pic \ - --prefix=/usr/local; \ - make install-strip; \ - rm -rf /tmp/libusb diff --git a/dists/linux/Dockerfile.arm b/dists/linux/Dockerfile.arm deleted file mode 100644 index 20db99e..0000000 --- a/dists/linux/Dockerfile.arm +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -FROM debian:stretch - -ENV LIBUSB_VERSION=1.0.24 - -# Install debian updates -RUN apt-get update && apt-get upgrade -y - -# Install required debian packages -RUN apt-get install -y cmake curl gperf bzip2 gcj-6-jdk git - -# Install Raspberry Pi tools -RUN cd /opt; \ - git clone --depth 1 https://github.com/raspberrypi/tools - -# Install eudev -RUN mkdir -p /tmp/eudev; \ - cd /tmp/eudev; \ - curl -L http://dev.gentoo.org/~blueness/eudev/eudev-3.2.6.tar.gz | tar xvz --strip-components 1; \ - export PATH=/opt/tools/arm-bcm2708/arm-linux-gnueabihf/bin:$PATH; \ - ./configure \ - --host=arm-linux-gnueabihf \ - --disable-shared \ - --enable-static \ - --with-pic \ - --enable-split-usr \ - --disable-manpages \ - --disable-kmod \ - --disable-selinux \ - --disable-blkid \ - --prefix=/usr/local; \ - make install-strip; \ - rm -rf /tmp/eudev - -# Install libusb -RUN mkdir -p /tmp/libusb; \ - cd /tmp/libusb; \ - curl -L https://github.com/libusb/libusb/releases/download/v$LIBUSB_VERSION/libusb-$LIBUSB_VERSION.tar.bz2 | tar xvj --strip-components 1; \ - export PATH=/opt/tools/arm-bcm2708/arm-linux-gnueabihf/bin:$PATH; \ - export CFLAGS=-I/usr/local/include; \ - export CPPFLAGS=-I/usr/local/include; \ - export LDFLAGS=-L/usr/local/lib; \ - ./configure \ - --host=arm-linux-gnueabihf \ - --disable-shared \ - --enable-static \ - --with-pic \ - --prefix=/usr/local; \ - make install-strip; \ - rm -rf /tmp/libusb diff --git a/dists/linux/README.md b/dists/linux/README.md deleted file mode 100644 index cd28f2f..0000000 --- a/dists/linux/README.md +++ /dev/null @@ -1,86 +0,0 @@ -Linux Build -=========== - -This build script automatically compiles the native libusb4java library for the given architecture. It is primarily -written to be used on a X86-64 Debian machine but may work on other systems as well. - -The first build for a specific architecture takes a long time because a matching Docker image is created first. This -image is based on Debian Stretch and is filled with all necessary tools and libraries to build libusb4java. The -Docker image is cached so the next build for the same architecture will be much faster. - - -## Requirements - -The following packages must be installed before running the build script: - - # apt install binfmt-support qemu-user-static - -[Docker] must be installed by following the official installation instructions. - -After installing Docker it is recommended to put your user into the docker group and logout and in again to apply the -change. Then you are able to use docker without root privileges. - - -## Parameters - -The first parameter of the build script defines the target platform architecture. This is for example `x86`, `x86-64`, -`arm` or `aarch64`. The architecture naming convention of usb4java follows the one of the [Java Native Access] project. - -The second parameter is optional and defines the static qemu binary which is necessary for cross compiling. - - -## Example usages - -Build a X86 (32 bit) library on a X86 or X86-64 host system: - - $ ./build x86 - -Build a X86-64 library on a X86-64 host system: - - $ ./build x86-64 - -Build a ARM-HF (32 bit) library: - - $ ./build arm /usr/bin/qemu-arm-static - -Build a AARCH64 (ARM 64 Bit) library: - - $ ./build aarch64 /usr/bin/qemu-aarch64-static - -In theory this works for many more architectures as long as there is a Debian Stretch docker image for this -architecture and the architecture is supported by qemu. New entries in the architecture mapping in the build script -might be needed in case the java architecture name differs from the Debian architecture name in the docker library. - - -## Some notes about Docker - -### Disable bridge networking - -If you don't need Docker for anything else and you don't like Docker's default behavior of creating bridge networking -devices and firewall rules then you might want to disable all this by creating the config file `/etc/docker/daemon.json` -with the following content: - - { - "bridge": "none", - "iptables": false, - "ip-masq": false, - "ip-forward": false - } - -Run `sudo systemctl restart docker` to apply the changes. The libusb4java build script uses host networking which -doesn't need bridge network devices. - - -### Cleaning up - -All the created Docker images uses a lot of disk space. You can remove them with `docker system prune -a`. - - -## Known issues - -While the build script is able to create a binary for the ARM architecture this will not work on a Raspberry -Pi 1. Would be nice to get it running, I tried for days, but I didn't succeed. That's why there is a special build -script for ARM which uses the Raspberry Pi cross compiler toolchain. - -[Java Native Access]: https://github.com/java-native-access/jna/tree/master/dist/ -[Docker]: https://docs.docker.com/install/linux/docker-ce/debian/ diff --git a/dists/linux/build b/dists/linux/build deleted file mode 100755 index c2db50b..0000000 --- a/dists/linux/build +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -# Exit on errors -set -e - -# Go to base directory -cd $(dirname $0)/../.. - -# Show syntax help when called with wrong number of parameters -if [ $# -lt 1 ] || [ $# -gt 2 ] -then - echo "Syntax: $0 ARCH [QEMU]" - exit 1 -fi - -# Fetch CLI arguments and create some helper variables -ARCH=$1 -QEMU=$2 -OS=linux -TARGET=target -BUILD=$TARGET/build/$OS-$ARCH - -# Map specified architecture to a debian docker image architecture -case $ARCH in - x86-64) - DOCKER_ARCH=amd64 - OS_ARCH=amd64 - ;; - x86) - DOCKER_ARCH=i386 - OS_ARCH=i386 - ;; - aarch64) - DOCKER_ARCH=arm64v8 - OS_ARCH=arm64 - ;; - arm) - DOCKER_ARCH=arm32v7 - OS_ARCH=armhf - ;; - armel) - DOCKER_ARCH=arm32v5 - OS_ARCH=armel - ;; - *) - DOCKER_ARCH=$ARCH - OS_ARCH=$ARCH - ;; -esac - -# Create build directory -mkdir -p $BUILD - -# Copy qemu binary to build directory if specified -if [ "$QEMU" != "" ] -then - cp -f $QEMU $BUILD/ -else - # Dummy file to keep COPY in Dockerfile happy - touch $BUILD/qemu-none -fi - -# Build docker image -docker build . \ - --network host \ - -f dists/linux/Dockerfile \ - --build-arg ARCH=$ARCH \ - --build-arg DOCKER_ARCH=$DOCKER_ARCH \ - --build-arg OS_ARCH=$OS_ARCH \ - -t usb4java-build-$ARCH - -# Compile libusb4java in docker image -docker run \ - -u $(id -u $USER):$(id -g $USER) \ - --network host \ - --rm \ - -v $(pwd):/workspace \ - usb4java-build-$ARCH \ - /bin/bash -c " - cd /workspace/$BUILD; - cmake ../../.. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX='' \ - -DLibUsb_LIBRARIES='/usr/local/lib/libusb-1.0.a;/usr/local/lib/libudev.a' \ - -DLibUsb_LDFLAGS='-pthread -lrt'; - make install/strip DESTDIR=/workspace/$BUILD - " - -# Create the JAR file -mkdir -p "$BUILD/classes/org/usb4java/$OS-$ARCH" -cp "$BUILD/lib/libusb4java.so" "$BUILD/classes/org/usb4java/$OS-$ARCH" -jar cf "$TARGET/libusb4java-$OS-$ARCH.jar" -C "$BUILD/classes" org diff --git a/dists/linux/build-all b/dists/linux/build-all deleted file mode 100755 index 911f0d5..0000000 --- a/dists/linux/build-all +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -# Exit on errors -set -e - -# Go to base directory of linux build scripts -cd $(dirname $0) - -# Build X86 library -./build x86 - -# Build X86-64 library -./build x86-64 - -# Build ARM 64-bit library (ARMv8 and higher) -./build aarch64 - -# Build ARM 32-bit library (ARMv7 and higher) -./build arm - -# Build ARM 32-bit library (ARMv4T and higher) -./build armel diff --git a/dists/linux/build-arm b/dists/linux/build-arm deleted file mode 100755 index 4652bbe..0000000 --- a/dists/linux/build-arm +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2018 Klaus Reimer -# See LICENSE.md for licensing information. -# - -# Exit on errors -set -e - -# Go to base directory -cd $(dirname $0)/../.. - -# Create some helper variables -TARGET=target -BUILD=$TARGET/build/linux-arm-rpt - -# Create build directory -mkdir -p $BUILD - -# Build docker image -docker build . \ - --network host \ - -f dists/linux/Dockerfile.arm \ - -t usb4java-build-arm-rpt - -# Compile libusb4java in docker image -docker run \ - -u $(id -u $USER):$(id -g $USER) \ - --network host \ - --rm \ - -v $(pwd):/workspace \ - usb4java-build-arm-rpt \ - /bin/bash -c " - cd /workspace/$BUILD; - export PATH=/opt/tools/arm-bcm2708/arm-linux-gnueabihf/bin:$PATH; - JAVA_HOME=/usr/lib/jvm/java-gcj-6 cmake ../../.. \ - -DCMAKE_SYSTEM_NAME=Linux \ - -DCMAKE_SYSTEM_PROCESSOR=arm \ - -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX='' \ - -DLibUsb_LIBRARIES='/usr/local/lib/libusb-1.0.a;/usr/local/lib/libudev.a' \ - -DLibUsb_LDFLAGS='-pthread -lrt'; - make install/strip DESTDIR=/workspace/$BUILD - " - -# Create the JAR file -mkdir -p "$BUILD/classes/org/usb4java/linux-arm" -cp "$BUILD/lib/libusb4java.so" "$BUILD/classes/org/usb4java/linux-arm" -jar cf "$TARGET/libusb4java-linux-arm.jar" -C "$BUILD/classes" org diff --git a/dists/win32/build-all.bat b/dists/win32/build-all.bat deleted file mode 100644 index 1a0ebda..0000000 --- a/dists/win32/build-all.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -rem Variables - General -for %%I in ("%~dp0.") do set "SCRIPT_DIR=%%~fI" -set "BUILD_BAT=%SCRIPT_DIR%\build.bat" - -rem Variables - Visual Studio -set "VSWHERE_EXE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -set "VSWHERE_OPTIONS=-latest -property installationPath -format value" -for /f "delims=" %%i in ('"%VSWHERE_EXE%" %VSWHERE_OPTIONS%') do set "VS_PATH=%%i" -set "VSDEVCMD_BAT=%VS_PATH%\Common7\Tools\VsDevCmd.bat" - -rem Main -cmd /c ""%VSDEVCMD_BAT%" && "%BUILD_BAT%"" -cmd /c ""%VSDEVCMD_BAT%" -host_arch=amd64 -arch=amd64 && set "PLATFORM=x64" && "%BUILD_BAT%"" \ No newline at end of file diff --git a/dists/win32/build.bat b/dists/win32/build.bat deleted file mode 100644 index 0dcaa73..0000000 --- a/dists/win32/build.bat +++ /dev/null @@ -1,96 +0,0 @@ -@echo off -rem ====================================================================== -rem Build script for Windows. -rem -rem Execute the script inside the Visual Studio Command line prompt for -rem 64 bit or 32 bit. The script automatically compiles the binary for -rem the corresponding platform and creates the JAR file in the target -rem folder. -rem -rem Dependencies: cmake, curl, jar and 7z must be callable via PATH. -rem Visual Studio 2017 Build Tools must be installed. -rem ====================================================================== - -rem ---------------------------------------------------------------------- -rem Setup variables -rem ---------------------------------------------------------------------- - -set LIBUSB_VERSION=1.0.28 - -set CURRENT=%cd% -set PROJECT_DIR=%~dp0..\.. -set OS=win32 -if /i "%Platform%" == "x64" ( - set ARCH=x86-64 - set LIBUSB_ARCH=MS64 -) else ( - set ARCH=x86 - set LIBUSB_ARCH=MS32 -) -set TARGET_DIR=%PROJECT_DIR%\target -set BUILD_DIR=%TARGET_DIR%\build\%OS%-%ARCH% -set ROOT_DIR=%BUILD_DIR%\root - - -rem -rem Compile libusb. -rem We do this manually because we need the /MT option and the provided -rem build script unfortunately only works with an old Windows DDK instead -rem of using Visual Studio. -rem - -set LIBUSB_NAME=libusb-%LIBUSB_VERSION% -set LIBUSB_COMPRESSED_ARCHIVE=%LIBUSB_NAME%.tar.bz2 -set LIBUSB_ARCHIVE=v%LIBUSB_VERSION%.zip -mkdir "%ROOT_DIR%" -cd "%ROOT_DIR% -curl -L -o "%LIBUSB_ARCHIVE%" https://github.com/libusb/libusb/archive/%LIBUSB_ARCHIVE% || goto :error -7z -y x "%LIBUSB_ARCHIVE%" || goto :error -cd "%LIBUSB_NAME%" -mkdir build -cd build -cl /DHAVE_STRUCT_TIMESPEC /nologo /c /MT /I..\libusb /I..\msvc ..\libusb\*.c ..\libusb\os\windows*.c ..\libusb\os\*windows.c -lib /nologo /out:libusb.lib *.obj - - -rem ---------------------------------------------------------------------- -rem Build libusb4java -rem ---------------------------------------------------------------------- - -mkdir "%BUILD_DIR%" -cd "%BUILD_DIR%" - -cmake "%PROJECT_DIR%" -G "NMake Makefiles" ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_PREFIX="" ^ - -DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG" ^ - -DLibUsb_INCLUDE_DIRS="%ROOT_DIR%\%LIBUSB_NAME%\libusb" ^ - -DLibUsb_LIBRARIES="%ROOT_DIR%\%LIBUSB_NAME%\build\libusb.lib" || goto :error -nmake || goto :error -nmake install DESTDIR="%ROOT_DIR%" || goto :error - - -rem ---------------------------------------------------------------------- -rem Create the JAR file -rem ---------------------------------------------------------------------- - -mkdir "classes\org\usb4java\%OS%-%ARCH%" -copy "%ROOT_DIR%\lib\usb4java.dll" classes\org\usb4java\%OS%-%ARCH%\libusb4java.dll || goto :error -jar cf "%TARGET_DIR%\libusb4java-%OS%-%ARCH%.jar" -C classes org || goto :error - - -rem ---------------------------------------------------------------------- -rem Clean up and go back to original directory -rem ---------------------------------------------------------------------- - -cd "%CURRENT%" -goto :end - -:error -set ERRORCODE=%errorlevel% -echo Failed with error #%ERRORCODE% -cd "%CURRENT%" -exit /b %ERRORCODE% - -:end -echo Finished diff --git a/pom.xml b/pom.xml index 51decde..a336a68 100644 --- a/pom.xml +++ b/pom.xml @@ -2,17 +2,17 @@ 4.0.0 - com.github.developersu + ru.redrise libusb4java pom libusb4java 1.0.30 - https://github.com/developersu/libusb4java/ + https://redrise.ru/ Libusb native JNI builds used by usb4java 2026 developersu - https://github.com/developersu/ + https://redrise.ru/ @@ -29,7 +29,7 @@ Klaus Reimer k@ailis.de - Developer + usb4java Team Developer +1 http://www.ailis.de/~k/ @@ -39,7 +39,7 @@ Luca Longinotti l@longi.li - Developer + usb4java Team Developer +1 http://l.longi.li/ @@ -48,7 +48,7 @@ developersu Dmitry Isaenko - CI pipeline maintainer + Standalone CI pipeline maintainer +3 http://redrise.ru/ @@ -73,54 +73,35 @@ - 3.0.5 + 3.6.3 - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - org.apache.maven.plugins maven-clean-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-deploy-plugin - 3.0.0-M1 + 3.2.0 org.apache.maven.plugins maven-install-plugin - 3.0.0-M1 + 3.1.2 org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-site-plugin - 3.7.1 + maven-deploy-plugin + 3.1.2 - + - jitpack.io - https://jitpack.io + redrise + Redrise Release Repository + https://repo.redrise.ru/releases/ - + From 31ec9bf6ebdcb86826e200aecb567e57fc58974d Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 16 Oct 2026 05:27:51 +0300 Subject: [PATCH 80/81] readme up --- README.md | 77 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 94656f9..9f41609 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,63 @@ -This is for of https://github.com/usb4java/libusb4java -Statically-linked JNI wrapper for libusb used by usb4java. +Fork of the https://github.com/usb4java/libusb4java +Statically-linked JNI wrapper for libusb used by usb4java +### Usage ```java - - - org.usb4jav - usb4java - 1.3.0 - - + + org.usb4java - libusb4java - - - compile - + usb4java + 1.3.0 + + + org.usb4java + libusb4java + + + compile + - - ru.redrise - libusb4java - 1.0.30 - + + ru.redrise + libusb4java + linux-x86-64 + 1.0.30 + compile + + + ru.redrise + libusb4java + win32-x86-64 + 1.0.30 + compile + + + ru.redrise + libusb4java + linux-arm + 1.0.30 + compile + + + ru.redrise + libusb4java + linux-aarch64 + 1.0.30 + compile + + + ru.redrise + libusb4java + darwin-x86-64 + 1.0.30 + compile + + + ru.redrise + libusb4java + darwin-aarch64 + 1.0.30 + compile + + ``` From bfe9723859563e46d08f5d0a232c6d13ed01f872 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 16 Oct 2026 05:30:24 +0300 Subject: [PATCH 81/81] readme up+1 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f41609..e481c67 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ Fork of the https://github.com/usb4java/libusb4java + Statically-linked JNI wrapper for libusb used by usb4java ### Usage @@ -7,7 +8,7 @@ Statically-linked JNI wrapper for libusb used by usb4java org.usb4java usb4java - 1.3.0 + 1.3.0 org.usb4java