Skip to content

Commit

Permalink
Simplify detection of target triplet
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Mar 13, 2024
1 parent 3007c47 commit e0a45f6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions install-capi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,16 @@ while [ $# -gt 0 ]; do
done

if [ -z ${target+x} ]; then
if command -v gcc >/dev/null; then
target=$(gcc -dumpmachine)

case ${target} in
arm64-apple-darwin*) target=aarch64-apple-darwin;;
x86_64-*-linux-gnu | x86_64-linux-gnu | x86_64-*-linux) target=x86_64-unknown-linux-gnu;;
x86_64-apple-darwin*) target=x86_64-apple-darwin;;
*) echo "Error: target '${target}' unknown."; exit 1;;
esac
else
echo "Error: target unknown, try setting it manually with '--target'"
exit 1
fi
case $(uname -m):$(uname -s) in
arm64:Darwin)
target=aarch64-apple-darwin;;
x86_64:Darwin)
target=x86_64-apple-darwin;;
x86_64:Linux)
target=x86_64-unknown-linux-gnu;;
*)
echo "Error: unknown target, uname = '$(uname -a)'"
esac
fi

# if no prefix is given, prompt for one
Expand Down

0 comments on commit e0a45f6

Please sign in to comment.