Skip to content

Commit

Permalink
Merge pull request #1038 from snowp/arm-support
Browse files Browse the repository at this point in the history
support resolving arm triplet with bazel
  • Loading branch information
dtolnay committed Apr 19, 2022
2 parents d89e362 + b433f9a commit 3b30338
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/bazel/vendor.bzl
Expand Up @@ -17,13 +17,19 @@ def _impl(repository_ctx):
root_lockfile = repository_ctx.path("workspace/Cargo.lock")
_copy_file(repository_ctx, src = vendor_lockfile, dst = root_lockfile)

is_mac = "mac" in repository_ctx.os.name
is_arm = "arm" in getattr(repository_ctx.os, "arch", "")
# Figure out which version of cargo to use.
if repository_ctx.attr.target_triple:
target_triple = repository_ctx.attr.target_triple
elif "mac" in repository_ctx.os.name:
target_triple = "x86_64-apple-darwin"
elif is_mac and is_arm:
target_triple = "aarch64-apple-darwin"
elif is_mac:
target_triple = "x86_64-apple-darwin"
elif "windows" in repository_ctx.os.name:
target_triple = "x86_64-pc-windows-msvc"
elif is_arm:
target_triple = "aarch64-unknown-linux-gnu"
else:
target_triple = "x86_64-unknown-linux-gnu"

Expand Down

0 comments on commit 3b30338

Please sign in to comment.