From 4a6f9ea1d851bd97dc47d519574752c9081d6781 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 30 Sep 2021 11:38:40 +0900 Subject: [PATCH] chore: build for aarch64-unknown-linux-musl --- build/main.yml | 8 ++++++++ build/package.sh | 11 +++++------ build/utils.sh | 26 +++++++++++++------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/build/main.yml b/build/main.yml index 5a422df..eaae6de 100644 --- a/build/main.yml +++ b/build/main.yml @@ -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 @@ -74,6 +81,7 @@ jobs: - linux_32 - linux_arm - linux_aarch64 + - linux_aarch64_musl - macOS - macOS_arm64 - win_64 diff --git a/build/package.sh b/build/package.sh index 8d3bab7..2a31fdb 100755 --- a/build/package.sh +++ b/build/package.sh @@ -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" diff --git a/build/utils.sh b/build/utils.sh index e0cda3f..a7e515e 100755 --- a/build/utils.sh +++ b/build/utils.sh @@ -32,6 +32,9 @@ architecture() { aarch64-unknown-linux-gnu) echo aarch64 ;; + aarch64-unknown-linux-musl) + echo aarch64-musl + ;; aarch64-apple-darwin) echo arm64 ;; @@ -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 ;; @@ -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