Skip to content

Commit 85369ad

Browse files
authored
Add aarch64-windows binaries to release artifacts (#1488)
Needed, for example, to fully develop wasi-sdk on aarch64-windows
1 parent ee3be3b commit 85369ad

File tree

3 files changed

+77
-25
lines changed

3 files changed

+77
-25
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,46 @@ jobs:
2222
include:
2323
- build: x86_64-linux
2424
os: ubuntu-latest
25+
env:
26+
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
27+
DOCKER_IMAGE: ./ci/docker/x86_64-linux/Dockerfile
28+
- build: aarch64-linux
29+
os: ubuntu-latest
30+
env:
31+
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
32+
DOCKER_IMAGE: ./ci/docker/aarch64-linux/Dockerfile
33+
2534
- build: x86_64-macos
2635
os: macos-latest
27-
target: x86_64-apple-darwin
36+
env:
37+
CARGO_BUILD_TARGET: x86_64-apple-darwin
38+
MACOSX_DEPLOYMENT_TARGET: 10.12
2839
- build: aarch64-macos
2940
os: macos-latest
30-
target: aarch64-apple-darwin
41+
env:
42+
CARGO_BUILD_TARGET: aarch64-apple-darwin
43+
MACOSX_DEPLOYMENT_TARGET: 10.12
44+
3145
- build: x86_64-windows
3246
os: windows-latest
33-
- build: aarch64-linux
34-
os: ubuntu-latest
35-
target: aarch64-unknown-linux-gnu
47+
env:
48+
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
49+
RUSTFLAGS: -Ctarget-feature=+crt-static
50+
- build: aarch64-windows
51+
os: windows-11-arm
52+
env:
53+
CARGO_BUILD_TARGET: aarch64-pc-windows-msvc
54+
RUSTFLAGS: -Ctarget-feature=+crt-static
55+
56+
env: ${{ matrix.env }}
3657
steps:
3758
- uses: actions/checkout@v4
3859
with:
3960
submodules: true
4061
- run: rustup update stable --no-self-update && rustup default stable
41-
- uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@v17.0.1
42-
with:
43-
name: ${{ matrix.build }}
44-
- run: |
45-
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
46-
rustup target add ${{ matrix.target }}
47-
if: matrix.target != ''
48-
- run: $CENTOS cargo build --release
49-
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
62+
- run: rustup target add $CARGO_BUILD_TARGET
63+
- run: ./ci/build-release-artifacts.sh
64+
- run: ./ci/build-tarballs.sh "${{ matrix.build }}"
5065
- uses: actions/upload-artifact@v4
5166
with:
5267
name: bins-${{ matrix.build }}

ci/build-release-artifacts.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# A script to build the release artifacts of this repository into the `target`
4+
# directory. Note that this script only produces the artifacts through Cargo and
5+
# doesn't package things up. That's intended for the `build-tarballs.sh` script.
6+
7+
set -ex
8+
9+
# If `$DOCKER_IMAGE` is set then run the build inside of that docker container
10+
# instead of on the host machine. In CI this uses `./ci/docker/*/Dockerfile` to
11+
# have precise glibc requirements for Linux platforms for example.
12+
if [ "$DOCKER_IMAGE" != "" ]; then
13+
if [ -f "$DOCKER_IMAGE" ]; then
14+
docker build --tag build-image --file $DOCKER_IMAGE ci/docker
15+
DOCKER_IMAGE=build-image
16+
fi
17+
18+
# Inherit the environment's rustc and env vars related to cargo/rust, and then
19+
# otherwise re-execute ourselves and we'll be missing `$DOCKER_IMAGE` in the
20+
# container so we'll continue below.
21+
exec docker run --interactive \
22+
--volume `pwd`:`pwd` \
23+
--volume `rustc --print sysroot`:/rust:ro \
24+
--workdir `pwd` \
25+
--interactive \
26+
--env-file <(env | grep 'CARGO\|RUST') \
27+
$DOCKER_IMAGE \
28+
bash -c "PATH=\$PATH:/rust/bin RUSTFLAGS=\"\$RUSTFLAGS \$EXTRA_RUSTFLAGS\" `pwd`/$0 $*"
29+
fi
30+
31+
# Default build flags for release artifacts. Leave debugging for
32+
# builds-from-source which have richer information anyway, and additionally the
33+
# CLI won't benefit from catching unwinds.
34+
export CARGO_PROFILE_RELEASE_STRIP=debuginfo
35+
export CARGO_PROFILE_RELEASE_PANIC=abort
36+
37+
exec cargo build --release

ci/build-tarballs.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -ex
44

55
platform=$1
6-
target=$2
6+
target=$CARGO_BUILD_TARGET
77

88
rm -rf tmp
99
mkdir tmp
@@ -15,16 +15,16 @@ bin_pkgname=wit-bindgen-$tag-$platform
1515
mkdir tmp/$bin_pkgname
1616
cp LICENSE-* README.md tmp/$bin_pkgname
1717

18-
fmt=tar
19-
if [ "$platform" = "x86_64-windows" ]; then
20-
cp target/release/wit-bindgen.exe tmp/$bin_pkgname
21-
fmt=zip
22-
elif [ "$target" = "" ]; then
23-
cp target/release/wit-bindgen tmp/$bin_pkgname
24-
else
25-
cp target/$target/release/wit-bindgen tmp/$bin_pkgname
26-
fi
27-
18+
case $platform in
19+
*-windows)
20+
fmt=zip
21+
cp target/$target/release/wit-bindgen.exe tmp/$bin_pkgname
22+
;;
23+
*)
24+
fmt=tar
25+
cp target/$target/release/wit-bindgen tmp/$bin_pkgname
26+
;;
27+
esac
2828

2929
mktarball() {
3030
dir=$1

0 commit comments

Comments
 (0)