XT Toolchain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

#!/usr/bin/env bash
# PROJECT: XTchain
# LICENSE: See the COPYING.md in the top level directory
# FILE: scripts/xtchain
# DESCRIPTION: XTchain Entry Script
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
# Check if script launched as root
if [ "$(whoami)" = "root" ]; then
echo "This script cannot be run as root!"
exit 1
# Get the absolute path to the XTchain
export XTCDIR="$(realpath $(dirname ${0}))"
# Read the XTchain version
export XTCVER="$(cat ${XTCDIR}/Version)"
# Load the library
source ${XTCDIR}/lib/xtchain/xtclib
# Set the target architecture
: ${TARGET:=${1}}
: ${TARGET:=amd64}
# Save the source directory
export SRCDIR="${2:-${PWD}}"
# Make sure the compiler flags are clean
export HOST=
export CFLAGS=
export CXXFLAGS=
export LDFLAGS=
# Update PATH
export PATH="${XTCDIR}/bin:${PATH}"
# Display banner
# Invoke shell with fancy prompt
export PFMAT1="\[\033[0;1;97;44m\]"
export PFMAT2="\[\033[0;34;104m\]"
export PFMAT3="\[\033[0;1;97;104m\]"
export PFMAT4="\[\033[0;94;49m\]"
export PFMAT5="\[\033[1;38;5;74m\]"
export PROMPT="\n${PFMAT1} XT Toolchain ${PFMAT2}${PFMAT3} \w ${PFMAT4}${PFMAT5} "
bash --rcfile <(echo 'source ~/.bashrc && export PS1="${PROMPT}" && cd ${SRCDIR}')