Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cross compile builds for s390x and ppc on azure ci #13

Merged
merged 1 commit into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ main() {
CARGO="$(builder)"

# Test a normal debug build.
if is_arm || is_aarch64; then
if is_arm || is_aarch64 || is_ppc64le; then
"$CARGO" build --target "$TARGET" --release --features 'pcre2'
# pcre2 is not supported on s390x
# https://github.com/zherczeg/sljit/issues/89
elif is_s390x; then
"$CARGO" build --release --target=$TARGET
else
# Technically, MUSL builds will force PCRE2 to get statically compiled,
# but we also want PCRE2 statically build for macOS binaries.
Expand All @@ -38,14 +42,14 @@ main() {
# sanity check the file type
file target/"$TARGET"/release/rg

# Apparently tests don't work on arm, so just bail now. I guess we provide
# ARM releases on a best effort basis?
if is_arm || is_aarch64 || is_arm64; then
# Apparently tests don't work on arm, s390x and ppc64le so just bail now. I guess we provide
# ARM, ppc64le and s390x releases on a best effort basis?
if is_arm || is_aarch64 || is_arm64 || is_ppc64le || is_s390x; then
return 0
fi

# Run tests for ripgrep and all sub-crates.
PCRE2_SYS_STATIC=1 "$CARGO" test --target "$TARGET" --release --verbose --all --features 'pcre2'
}

main
main
18 changes: 0 additions & 18 deletions build/build_ppc.sh

This file was deleted.

18 changes: 0 additions & 18 deletions build/build_s390x.sh

This file was deleted.

10 changes: 9 additions & 1 deletion build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ install_linux_dependencies() {
if is_aarch64; then
sudo apt-get install gcc-aarch64-linux-gnu
fi

if is_ppc64le; then
sudo apt-get install -y gcc-powerpc64le-linux-gnu
fi

if is_s390x; then
sudo apt-get install -y gcc-s390x-linux-gnu
fi
}

configure_cargo() {
Expand Down Expand Up @@ -89,4 +97,4 @@ main() {
configure_cargo
}

main
main
18 changes: 17 additions & 1 deletion build/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ jobs:
- template: windows.yml
parameters:
target: aarch64-pc-windows-msvc
- job: ppc64le
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: linux.yml
parameters:
target: powerpc64le-unknown-linux-gnu
- job: s390x
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: linux.yml
parameters:
target: s390x-unknown-linux-gnu
- job: publish
pool:
vmImage: 'ubuntu-16.04'
Expand All @@ -87,6 +101,8 @@ jobs:
- win_64
- win_32
- win_arm64
- ppc64le
- s390x
steps:
- template: publish.yml

Expand All @@ -96,4 +112,4 @@ trigger:
- main
tags:
include:
- v*
- v*
28 changes: 27 additions & 1 deletion build/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ architecture() {
aarch64-apple-darwin)
echo arm64
;;
powerpc64le-unknown-linux-gnu)
echo ppc64le
;;
s390x-unknown-linux-gnu)
echo s390x
;;
*)
die "architecture: unexpected target $TARGET"
;;
Expand All @@ -52,6 +58,12 @@ gcc_prefix() {
aarch64)
echo aarch64-linux-gnu-
;;
ppc64le)
echo powerpc64le-linux-gnu-
;;
s390x)
echo s390x-linux-gnu-
;;
*)
return
;;
Expand Down Expand Up @@ -107,6 +119,20 @@ is_arm64() {
esac
}

is_ppc64le() {
case "$(architecture)" in
ppc64le) return 0 ;;
*) return 1 ;;
esac
}

is_s390x() {
case "$(architecture)" in
s390x) return 0 ;;
*) return 1 ;;
esac
}

is_linux() {
case "$AGENT_OS" in
Linux) return 0 ;;
Expand All @@ -128,4 +154,4 @@ builder() {
else
echo "cargo"
fi
}
}