Skip to content

Commit 919115e

Browse files
committed
fix: add musl cross-compilation tools for ARM targets
- Install musl-tools for musl targets on ARM runners - Set CC and linker environment variables for aarch64-musl target - Set CC environment variable for armv7-musl target - Fix shellcheck issues with string comparisons - This fixes zstd-sys build errors for musl targets
1 parent c5dcb46 commit 919115e

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,39 @@ jobs:
7676
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
7777
restore-keys: cargo-registry
7878
- name: Install cross-compilation tools
79-
if: contains(matrix.target, 'armv7')
79+
if: contains(matrix.runs-on, 'arm') && (contains(matrix.target, 'armv7') || contains(matrix.target, 'musl'))
8080
run: |
8181
sudo apt-get update
82-
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
83-
- name: Setup Rust target
82+
# For ARMv7 targets
83+
case "${{matrix.target}}" in
84+
*armv7*)
85+
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
86+
;;
87+
esac
88+
# For musl targets
89+
case "${{matrix.target}}" in
90+
*musl*)
91+
sudo apt-get install -y musl-tools
92+
;;
93+
esac
94+
- name: Setup Rust target and linkers
8495
run: |
8596
rustup target add ${{matrix.target}}
86-
if [[ "${{matrix.target}}" == "armv7-unknown-linux-gnueabi" ]]; then
87-
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV"
88-
elif [[ "${{matrix.target}}" == "armv7-unknown-linux-musleabi" ]]; then
89-
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABI_LINKER=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV"
90-
fi
97+
# Set linkers for cross-compilation
98+
case "${{matrix.target}}" in
99+
armv7-unknown-linux-gnueabi)
100+
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV"
101+
;;
102+
armv7-unknown-linux-musleabi)
103+
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABI_LINKER=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV"
104+
echo "CC_armv7_unknown_linux_musleabi=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV"
105+
;;
106+
aarch64-unknown-linux-musl)
107+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> "$GITHUB_ENV"
108+
echo "CC_aarch64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"
109+
echo "CC=musl-gcc" >> "$GITHUB_ENV"
110+
;;
111+
esac
91112
- name: build-tarball
92113
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
93114
with:

scripts/build-tarball.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ linux-arm*)
7070
;;
7171
esac
7272

73-
features="rustls,rustls-native-roots,self_update,vfox/vendored-lua"
73+
features="rustls,rustls-native-roots,self_update,vfox/vendored-lua,openssl/vendored"
7474

7575
cargo build --profile=serious --target "$RUST_TRIPLE" --no-default-features --features "$features"
7676
mkdir -p dist/mise/bin

0 commit comments

Comments
 (0)