Skip to content

Commit

Permalink
Release aarch64-apple-darwin binary (#829)
Browse files Browse the repository at this point in the history
We started getting more Mac M1 and M2 users, and it's while it's
possible to run the x86_64-apple-darwin version, and we're not sure if
it's causing network issues.

Since the prerequisites of doing this got release in
https://github.com/joseluisq/rust-linux-darwin-builder/releases/tag/v1.65.0
this is relatively easy to do now.

Closes #610
  • Loading branch information
markmandel authored Oct 18, 2023
1 parent 56c54f3 commit bda6e65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ gcloud_mount_args := -v $(build_path)/.config/gcloud:/root/.config/gcloud

cargo_build_x86_64_linux := build --release --target x86_64-unknown-linux-gnu
cargo_build_x86_64_apple := build --release --target x86_64-apple-darwin
cargo_build_aarch64-apple := build --release --target aarch64-apple-darwin
cargo_build_x86_64_windows := build --release --target x86_64-pc-windows-gnu

# _____ _
Expand Down Expand Up @@ -144,19 +145,21 @@ else
--entrypoint=cargo $(BUILD_IMAGE_TAG) $(cargo_build_x86_64_windows)
endif

# Build binary for x86_64-apple-darwin
# Build binary for x86_64-apple-darwin and aarch64-apple-darwin
# Use BUILD_LOCAL=1 to build through local cargo rather than through the build container.
build-macos-binary:
ifdef BUILD_LOCAL
cargo $(cargo_build_x86_64_apple)
cargo $(cargo_build_aarch64-apple)
else
docker run --rm -v $(project_path):/workspace -w /workspace \
-v $(CARGO_HOME)/registry:/root/.cargo/registry \
-e "CARGO_TARGET_DIR=$(CARGO_TARGET_DIR)" \
-e "CC=o64-clang" -e "CXX=o64-clang++" \
-e "PROTOC=/opt/protoc/bin/protoc" \
joseluisq/rust-linux-darwin-builder:$(rust_toolchain) \
sh -c "/workspace/build/darwin-builder/setup.sh && cargo $(cargo_build_x86_64_apple) --no-default-features"
sh -c "/workspace/build/darwin-builder/setup.sh && cargo $(cargo_build_x86_64_apple) --no-default-features && \
CC=oa64-clang CXX=oa64-clang++ LIBZ_SYS_STATIC=1 cargo $(cargo_build_aarch64-apple) --no-default-features"
endif

# Build container image.
Expand Down
1 change: 1 addition & 0 deletions build/darwin-builder/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ unzip protoc.zip
popd
/opt/protoc/bin/protoc --version
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin

0 comments on commit bda6e65

Please sign in to comment.