static-toolbox/build/02_install_build_compiler.sh

33 lines
709 B
Bash
Raw Permalink Normal View History

2021-04-19 09:55:27 +00:00
#!/bin/bash
2022-10-05 10:49:27 +00:00
function die(){
echo "$1"
exit 1
}
2021-04-19 09:55:27 +00:00
if [ $# -ne 1 ];then
echo "Missing arch"
exit 1
fi
2022-10-05 10:43:36 +00:00
ARCH="${1}"
2021-04-19 09:55:27 +00:00
case $ARCH in
2021-04-19 13:43:19 +00:00
x86_64|i686|aarch64)
ARCH="${ARCH}-linux-musl"
;;
x86)
ARCH="i686-linux-musl"
;;
arm)
ARCH="arm-linux-musleabihf"
;;
2021-04-19 09:55:27 +00:00
*)
2021-04-19 13:43:19 +00:00
echo "Invalid arch ${ARCH}"
exit 1
;;
2021-04-19 09:55:27 +00:00
esac
HOST=http://musl.cc
2022-10-05 10:49:27 +00:00
echo "Fetching ${HOST}/${ARCH}-cross.tgz"
2021-04-19 09:55:27 +00:00
cd /
2022-10-05 10:49:27 +00:00
curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz || die "Failed to download build compiler package"
tar -xf ${ARCH}-cross.tgz || die "Failed to extract build compiler package"
rm ${ARCH}-cross.tgz || die "Failed to remove build compiler package"