Skip to content

Commit

Permalink
toolchain: abort if old toolchain is found in PATH
Browse files Browse the repository at this point in the history
JIRA: CI-377
  • Loading branch information
xvuko committed Nov 21, 2023
1 parent be0f83e commit 6d44728
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions toolchain/build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ declare -A TOOLCHAN_TO_PHOENIX_TARGETS=(
[sparc-phoenix]="sparcv8leon3-gr716 sparcv8leon3-gr712rc"
)

if [ -z "$1" ] || [ -z "${TOOLCHAN_TO_PHOENIX_TARGETS[$1]}" ]; then
TARGET="$1"
BUILD_ROOT="$2"

if [ -z "$TARGET" ] || [ -z "${TOOLCHAN_TO_PHOENIX_TARGETS[$TARGET]}" ]; then
echo "Missing or invalid target provided! Abort."
echo "officially supported targets:"
printf "%s\n" "${!TOOLCHAN_TO_PHOENIX_TARGETS[@]}"
exit 1
fi

PHOENIX_TARGETS="${TOOLCHAN_TO_PHOENIX_TARGETS[$1]}"
PHOENIX_TARGETS="${TOOLCHAN_TO_PHOENIX_TARGETS[$TARGET]}"

if [ -z "$2" ]; then
if [ -z "$BUILD_ROOT" ]; then
echo "No toolchain install path provided! Abort."
exit 1
fi

if [ "${2:0:1}" != "/" ]; then
if [ "${BUILD_ROOT:0:1}" != "/" ]; then
echo "Path must not be relative."
exit 1
fi
Expand All @@ -51,15 +54,19 @@ if [[ -v CC || -v CFLAGS || -v LIBS || -v CPPFLAGS || -v CXX || -v CXXFLAGS || -
exit 1
fi

if command -v "${TARGET}-gcc" > /dev/null; then
echo "Command \"${TARGET}-gcc\" found in PATH. Abort."
echo "Make sure to to remove existing toolchain from PATH"
exit 1
fi

# old legacy versions of the compiler:
#BINUTILS=binutils-2.28
#GCC=gcc-7.1.0

BINUTILS=binutils-2.34
GCC=gcc-9.5.0

TARGET="$1"
BUILD_ROOT="$2"
TOOLCHAIN_PREFIX="${BUILD_ROOT}/${TARGET}"
SYSROOT="${TOOLCHAIN_PREFIX}/${TARGET}"
MAKEFLAGS="-j9 -s"
Expand Down

0 comments on commit 6d44728

Please sign in to comment.