From 32c4c2bfb007c4f57189334b97fdbb0c922f2613 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Mon, 4 Apr 2022 16:14:55 +0200 Subject: [PATCH] Fix gprbuild selection for cross-compiled crates (#493) Co-authored-by: GHA --- scripts/gh-build-crate.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/gh-build-crate.sh b/scripts/gh-build-crate.sh index 4c901f7a..85d54c08 100755 --- a/scripts/gh-build-crate.sh +++ b/scripts/gh-build-crate.sh @@ -117,8 +117,13 @@ for file in $CHANGES; do # Install an Alire-provided gprbuild whenever there is a non-external gnat in solution if grep -iq 'gnat_' <<< $solution && ! grep -iq 'gnat_external' <<< $solution; then - echo "INSTALLING indexed gprbuild" - alr toolchain --select gprbuild + gnat_dep=$(grep -E -o '^ gnat_.*=\S*' <<< $solution | xargs) + gnat_dep=${gnat_dep:-gnat_native} + echo "INSTALLING indexed gprbuild compatible with $gnat_dep" + alr toolchain --select $gnat_dep gprbuild + # -E for regex, -o for only the matched part, xargs to trim space + # We must give both the gnat in the solution and gprbuild, so both are compatible + # Even if we default to gnat_native, that would select the appropriate gprbuild fi # Detect whether the crate is binary to skip build