Skip to content

Commit 7967085

Browse files
ci: fix aarch64-linux-gnu cross compilation (#682)
## 📺 PR Description <!-- summary of the change + which issue is fixed if applicable. --> ## Checklist <!-- a quick pass through the following items to make sure you haven't forgotten anything --> - [ ] my commits **and PR title** follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format - [ ] if this is a new feature, I have added tests to consolidate the feature and prevent regressions - [ ] if this is a bug fix, I have added a test that reproduces the bug (if applicable) - [ ] I have added a reasonable amount of documentation to the code where appropriate
1 parent 63342af commit 7967085

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/cd.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
prerelease: false
3636
bodyFile: BODY.md
3737
publish-release:
38-
name: Publishing for ${{ matrix.os }}
38+
name: Publishing for ${{ matrix.target }}
3939
runs-on: ${{ matrix.os }}
4040
strategy:
4141
fail-fast: false
@@ -227,7 +227,29 @@ jobs:
227227
cp man/tv.1 "$DEPLOY_DIR/"
228228
- name: Build release binary
229229
shell: bash
230-
run: "# Add cargo bin to PATH for this step\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nversion=\"${{ github.ref_name }}\"\nDEB_NAME=\"tv-$version-${{ matrix.target }}.deb\"\nDEB_DIR=\"target/${{ matrix.target }}/debian\"\n\n# Build the actual binary\n# if aarch64, we need to install the cross compiler since we're running x86_64\nif [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then\n sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu\n \n cargo deb --profile deb --target ${{ matrix.target }} -o \"$DEB_DIR/$DEB_NAME\" \\\n --cargo-build cross \\\n -- --no-default-features --features zero-copy,simd,fancy\nelse\n cargo deb --profile deb --target ${{ matrix.target }} -o \"$DEB_DIR/$DEB_NAME\"\nfi\n\necho \"DEB_DIR=$DEB_DIR\" >> $GITHUB_ENV\necho \"DEB_NAME=$DEB_NAME\" >> $GITHUB_ENV\n"
230+
run: |
231+
# Add cargo bin to PATH for this step
232+
export PATH="$HOME/.cargo/bin:$PATH"
233+
234+
version="${{ github.ref_name }}"
235+
DEB_NAME="tv-$version-${{ matrix.target }}.deb"
236+
DEB_DIR="target/${{ matrix.target }}/debian"
237+
238+
# Build the actual binary
239+
# if aarch64, we need to install the cross compiler since we're running x86_64
240+
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
241+
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross
242+
243+
# Set up cross-compilation environment
244+
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
245+
export AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar
246+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
247+
fi
248+
249+
cargo deb --profile deb --target ${{ matrix.target }} -o "$DEB_DIR/$DEB_NAME"
250+
251+
echo "DEB_DIR=$DEB_DIR" >> $GITHUB_ENV
252+
echo "DEB_NAME=$DEB_NAME" >> $GITHUB_ENV
231253
- name: Create sha256 sum of deb file
232254
shell: bash
233255
run: |

0 commit comments

Comments
 (0)