Skip to content

Commit

Permalink
Merge pull request #12 from microsoft/robo/fix_musl_aarch64
Browse files Browse the repository at this point in the history
chore: build for aarch64-unknown-linux-musl
  • Loading branch information
roblourens authored Sep 30, 2021
2 parents 186f293 + 4a6f9ea commit 34599b8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
8 changes: 8 additions & 0 deletions build/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:
- template: linux.yml
parameters:
target: aarch64-unknown-linux-gnu
- job: linux_aarch64_musl
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: linux.yml
parameters:
target: aarch64-unknown-linux-musl
- job: macOS
pool:
vmImage: macOS-latest
Expand Down Expand Up @@ -74,6 +81,7 @@ jobs:
- linux_32
- linux_arm
- linux_aarch64
- linux_aarch64_musl
- macOS
- macOS_arm64
- win_64
Expand Down
11 changes: 5 additions & 6 deletions build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ mk_tarball() {
pushd ..
this_tag=`git tag -l --contains HEAD`
popd

local name="ripgrep-${this_tag}-${TARGET}.tar.gz"
# When cross-compiling, use the right `strip` tool on the binary.
local gcc_prefix="$(gcc_prefix)"

local name="ripgrep-${this_tag}-${TARGET}.tar.gz"

# Copy the ripgrep binary and strip it.
"${gcc_prefix}strip" "target/$TARGET/release/rg"
if [ -n "${gcc_prefix}" ]; then
# Copy the ripgrep binary and strip it.
"${gcc_prefix}strip" "target/$TARGET/release/rg"
fi

tar czvf "$OUT_DIR/$name" -C ./target/$TARGET/release rg
echo "##vso[task.setvariable variable=Name]$name"
Expand Down
26 changes: 13 additions & 13 deletions build/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ architecture() {
aarch64-unknown-linux-gnu)
echo aarch64
;;
aarch64-unknown-linux-musl)
echo aarch64-musl
;;
aarch64-apple-darwin)
echo arm64
;;
Expand Down Expand Up @@ -90,6 +93,13 @@ is_aarch64() {
esac
}

is_aarch64_musl() {
case "$(architecture)" in
aarch64-musl) return 0 ;;
*) return 1 ;;
esac
}

is_arm64() {
case "$(architecture)" in
arm64) return 0 ;;
Expand All @@ -112,19 +122,9 @@ is_osx() {
}

builder() {
if is_musl && is_x86_64; then
# IMPORTANT - put this back when building anything past 11.0.1
# set -u
# D=$(mktemp -d)
# git clone https://github.com/rust-embedded/cross.git "$D"
# cd "$D"
# curl -O -L "https://gist.githubusercontent.com/nickbabcock/c7bdc8e5974ed9956abf46ffd7dc13ff/raw/e211bc17ea88e505003ad763fac7060b4ac1d8d0/patch"
# git apply patch
# cargo install --path .
# rm -rf "$D"
# echo "cross"

echo "cargo"
if is_musl && is_aarch64_musl; then
cargo install cross
echo "cross"
else
echo "cargo"
fi
Expand Down

0 comments on commit 34599b8

Please sign in to comment.