-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivate_env.sh
56 lines (44 loc) · 1.44 KB
/
activate_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "You must source this script: \$ source $0" >&2
exit 1
fi
echo "Activating BoxLambda tools environments."
echo "Note: This script should be sourced from a boxlambda workspace root directory. Different boxlambda workspaces may share the same environment."
if [[ "$#" > 0 && "$1" == "-h" ]]
then
echo "$0 [-h] [-r]"
echo "-h: Show help."
return 1
fi
if [ -d tools ]; then
echo "Tools directory found."
else
echo "Tools directory not found. Please source boxlambda_setup.sh to set up the workspace."
return 1;
fi
if which vivado ; then
echo "Vivado found."
else
echo "Vivado not found. Please install Vivado and add it to your path."
fi
echo "Activate OSS CAD Suite Environment..."
_ORIG_PS1="${PS1}"
if source ./tools/oss-cad-suite/environment ; then
echo "OK"
else
echo "OSS CAD Suite activation failed. Aborting..."
return 1
fi
#Tweaking the prompt
if [ -n "${ZSH_VERSION-}" ] ; then
autoload -U colors && colors
PS1="%{$fg[magenta]%}(BoxLambda-`git rev-parse --abbrev-ref HEAD`)%{$reset_color%}${_ORIG_PS1}"
else
PS1="\[\033[1;35m\](BoxLambda-`git rev-parse --abbrev-ref HEAD`)\[\033[0m\]${_ORIG_PS1}"
fi
export PS1
echo "Updating PATH..."
export BOXLAMBDA_WORKSPACE=`pwd`
export PATH=$BOXLAMBDA_WORKSPACE/tools:$BOXLAMBDA_WORKSPACE/tools/riscv32-boxlambda-elf/bin:$BOXLAMBDA_WORKSPACE/scripts:$PATH
echo "Done. Enter 'deactivate' to deactivate the environment."