|
34 | 34 | include:
|
35 | 35 | - target: aarch64-unknown-linux-gnu
|
36 | 36 | os: ubuntu-latest
|
37 |
| - ## I GIVE UP! For this target, OpenSSL needs to be cross compiled |
38 |
| - ## which is driven by openssl-sys crate's custom build script... |
39 |
| - ## Linux users with aarch64 (aka ARM64) using musl C lib can go fish (or build from source). |
40 |
| - # - target: aarch64-unknown-linux-musl |
41 |
| - # os: ubuntu-latest |
| 37 | + - target: aarch64-unknown-linux-musl |
| 38 | + os: ubuntu-latest |
42 | 39 | - target: x86_64-unknown-linux-gnu
|
43 | 40 | os: ubuntu-latest
|
44 | 41 | - target: x86_64-unknown-linux-musl
|
|
56 | 53 | - name: Install native OpenSSL on Linux
|
57 | 54 | if: runner.os == 'Linux' && !(startsWith(matrix.target, 'aarch64') || endsWith(matrix.target, 'musl'))
|
58 | 55 | run: sudo apt-get install -y pkg-config libssl-dev
|
59 |
| - - name: Install GCC for aarch64 (for cross-compiling openssl) |
60 |
| - if: runner.os == 'Linux' && startsWith(matrix.target, 'aarch64') |
61 |
| - run: | |
62 |
| - sudo apt-get update |
63 |
| - sudo apt-get install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu |
64 |
| - if [[ "${{matrix.target}}" == *musl ]]; then |
65 |
| - sudo apt-get install musl-dev musl-tools |
66 |
| - fi |
67 |
| - - name: Install musl-gcc (for compiling OpenSSL) |
68 |
| - if: matrix.target == 'x86_64-unknown-linux-musl' |
69 |
| - run: sudo apt-get install musl-tools |
70 | 56 |
|
71 | 57 | - name: Calculate openssl-vendored
|
72 | 58 | shell: bash
|
@@ -98,20 +84,20 @@ jobs:
|
98 | 84 | with:
|
99 | 85 | target: ${{ matrix.target }}
|
100 | 86 |
|
101 |
| - # problems with cross-compiling linux with musl |
102 |
| - - run: echo "RUSTFLAGS=-D warnings -C target-feature=+crt-static -C link-self-contained=yes" >> "${GITHUB_ENV}" |
103 |
| - if: contains(matrix.target, '-linux-musl') |
104 |
| - - run: | |
105 |
| - echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" |
106 |
| - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" |
107 |
| - if: matrix.target == 'aarch64-unknown-linux-musl' |
| 87 | + - name: Install cross (cargo cross compiler) |
| 88 | + if: matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64')) |
| 89 | + uses: taiki-e/install-action@v2 |
| 90 | + with: |
| 91 | + tool: cross |
108 | 92 |
|
109 |
| - - name: Build |
110 |
| - env: |
111 |
| - # problems with cross-compiling aarch64 linux with gnu |
112 |
| - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc |
| 93 | + - name: Build (native) |
| 94 | + if: ${{!(matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64')))}} |
113 | 95 | run: cargo build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ steps.is-openssl-vendored.outputs.enabled }}
|
114 | 96 |
|
| 97 | + - name: Build (cross) |
| 98 | + if: matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64')) |
| 99 | + run: cross build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ steps.is-openssl-vendored.outputs.enabled }} |
| 100 | + |
115 | 101 | - name: Prepare artifacts
|
116 | 102 | run: mv target/${{ matrix.target }}/release/cpp-linter${{ runner.os == 'Windows' && '.exe' || '' }} ./cpp-linter-${{ matrix.target }}${{ runner.os == 'Windows' && '.exe' || '' }}
|
117 | 103 | - name: Upload artifacts
|
|
0 commit comments