|
5 | 5 | push: |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - build: |
| 8 | + build-linux: |
9 | 9 | strategy: |
10 | 10 | fail-fast: false |
11 | 11 | matrix: |
12 | | - os: [ ubuntu-24.04, ubuntu-22.04, macos-latest ] |
13 | | - runs-on: ${{ matrix.os }} |
14 | | - |
| 12 | + include: |
| 13 | + - { arch: x64, os: 24, runner: ubuntu-24.04 } |
| 14 | + - { arch: arm64, os: 24, runner: ubuntu-24.04-arm } |
| 15 | + - { arch: x64, os: 22, runner: ubuntu-22.04 } |
| 16 | + - { arch: arm64, os: 22, runner: ubuntu-22.04-arm } |
| 17 | + runs-on: ${{ matrix.runner }} |
15 | 18 | steps: |
16 | 19 | - name: Checkout |
17 | 20 | uses: actions/checkout@v4 |
18 | 21 |
|
19 | | - - name: Dependencies (Ubuntu) |
20 | | - if: runner.os == 'Linux' |
| 22 | + - name: Dependencies |
21 | 23 | run: | |
22 | 24 | sudo apt-get update |
23 | 25 | sudo apt-get install -y libxml2-dev libusb-1.0-0-dev |
24 | 26 |
|
25 | | - - name: Dependencies (macOS) |
26 | | - if: runner.os == 'macOS' |
| 27 | + - name: Build |
| 28 | + run: make |
| 29 | + |
| 30 | + - name: Package |
| 31 | + run: | |
| 32 | + mkdir dist |
| 33 | + cp `pkg-config --variable=libdir libusb-1.0`/libusb-1.0.so.0 dist |
| 34 | + chmod 0644 dist/* |
| 35 | + cp qdl dist |
| 36 | + patchelf --set-rpath '$ORIGIN' dist/qdl |
| 37 | +
|
| 38 | + - name: Upload artifact |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: qdl-binary-ubuntu-${{matrix.os}}-${{ matrix.arch }} |
| 42 | + path: dist/* |
| 43 | + |
| 44 | + |
| 45 | + build-mac: |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: |
| 49 | + include: |
| 50 | + - { sys: macos-14, arch: arm64 } |
| 51 | + - { sys: macos-13, arch: intel } |
| 52 | + runs-on: ${{ matrix.sys }} |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Dependencies |
27 | 59 | run: | |
28 | 60 | brew install libxml2 |
29 | | - brew install libusb |
30 | 61 |
|
31 | 62 | - name: Build |
32 | 63 | run: make |
| 64 | + |
| 65 | + - name: Package |
| 66 | + run: | |
| 67 | + set -x |
| 68 | + mkdir dist |
| 69 | + cp `pkg-config --variable=libdir libusb-1.0`/libusb-1.0.0.dylib dist |
| 70 | + cp `pkg-config --variable=libdir liblzma`/liblzma.5.dylib dist |
| 71 | + chmod 0644 dist/* |
| 72 | + cp qdl dist |
| 73 | +
|
| 74 | + if uname -a | grep -q arm64; then |
| 75 | + LIBUSB_DIR=/opt/homebrew/opt/libusb/lib |
| 76 | + LIBLZMA_DIR=/usr/lib |
| 77 | + else |
| 78 | + LIBUSB_DIR=/usr/local/opt/libusb/lib |
| 79 | + LIBLZMA_DIR=/usr/local/opt/xz/lib |
| 80 | + fi |
| 81 | +
|
| 82 | + install_name_tool -add_rpath @executable_path dist/qdl |
| 83 | + install_name_tool -change $LIBUSB_DIR/libusb-1.0.0.dylib @rpath/libusb-1.0.0.dylib dist/qdl |
| 84 | + install_name_tool -change $LIBLZMA_DIR/liblzma.5.dylib @rpath/liblzma.5.dylib dist/qdl |
| 85 | + otool -L dist/qdl |
| 86 | + dist/qdl || true |
| 87 | +
|
| 88 | + - name: Upload artifact |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: qdl-binary-macos-${{ matrix.arch }} |
| 92 | + path: dist/* |
| 93 | + |
| 94 | + build-windows: |
| 95 | + strategy: |
| 96 | + fail-fast: false |
| 97 | + matrix: |
| 98 | + include: |
| 99 | + - { sys: windows-latest, arch: x64 } |
| 100 | + - { sys: windows-11-arm, arch: arm64 } |
| 101 | + runs-on: ${{ matrix.sys }} |
| 102 | + |
| 103 | + steps: |
| 104 | + - name: Checkout |
| 105 | + uses: actions/checkout@v4 |
| 106 | + |
| 107 | + - name: Setup MSYS2 |
| 108 | + id: msys2 |
| 109 | + uses: msys2/setup-msys2@v2 |
| 110 | + with: |
| 111 | + msystem: MINGW64 |
| 112 | + install: > |
| 113 | + mingw-w64-x86_64-gcc |
| 114 | + mingw-w64-x86_64-make |
| 115 | + mingw-w64-x86_64-cmake |
| 116 | + mingw-w64-x86_64-pkg-config |
| 117 | + mingw-w64-x86_64-libxml2 |
| 118 | + mingw-w64-x86_64-libusb |
| 119 | +
|
| 120 | + - name: Build |
| 121 | + run: mingw32-make |
| 122 | + shell: msys2 {0} |
| 123 | + |
| 124 | + - name: Package |
| 125 | + shell: pwsh |
| 126 | + run: | |
| 127 | + $MSYS2_LOCATION = "${{ steps.msys2.outputs.msys2-location }}" |
| 128 | + $BIN_DIR = Join-Path $MSYS2_LOCATION "mingw64\bin" |
| 129 | + $DistDir = "dist" |
| 130 | + New-Item -ItemType Directory -Path $DistDir | Out-Null |
| 131 | +
|
| 132 | + Copy-Item (Join-Path $BIN_DIR "zlib1.dll") $DistDir |
| 133 | + Copy-Item (Join-Path $BIN_DIR "libxml2-2.dll") $DistDir |
| 134 | + Copy-Item (Join-Path $BIN_DIR "libusb-1.0.dll") $DistDir |
| 135 | + Copy-Item (Join-Path $BIN_DIR "liblzma-5.dll") $DistDir |
| 136 | + Copy-Item (Join-Path $BIN_DIR "libiconv-2.dll") $DistDir |
| 137 | +
|
| 138 | + Copy-Item "qdl.exe" $DistDir |
| 139 | +
|
| 140 | + - name: Upload artifact |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + with: |
| 143 | + name: qdl-binary-windows-${{ matrix.arch }} |
| 144 | + path: dist/* |
| 145 | + |
0 commit comments