diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index 8648a59b3..8ffa67ed7 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -316,7 +316,7 @@ fi # but a binary release of it should be available soon, removing the need to use opam. section_header "Installing/Updating Sail Compiler" STATUS="Sail Compiler" -OPAMROOTISOK=1 # Silence warnings about running opam as root +export OPAMROOTISOK=1 # Silence warnings about running opam as root cd "$RISCV" opam init -y --disable-sandboxing opam update -y @@ -330,7 +330,7 @@ echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated${ENDC}" section_header "Installing/Updating RISC-V Sail Model" STATUS="RISC-V Sail Model" if [[ ((! -e sail-riscv) && ($(git clone https://github.com/riscv/sail-riscv.git) || true)) || ($(cd sail-riscv; git fetch; git rev-parse HEAD) != $(cd sail-riscv; git rev-parse origin/master)) || (! -e $RISCV/bin/riscv_sim_RV32) ]]; then - eval $(opam config env) + eval "$(opam config env)" cd sail-riscv git reset --hard && git clean -f && git checkout master && git pull export OPAMCLI=2.0 # Sail is not compatible with opam 2.1 as of 4/16/24 @@ -388,7 +388,8 @@ if [ ! -e "${RISCV}"/site-setup.sh ]; then fi echo -e "${SUCCESS_COLOR}Site setup script successfully downloaded${ENDC}" else - echo -e "${OK_COLOR}Site setup script already exists. Not checking for updates to avoid overwritng modifications${ENDC}" + echo -e "${OK_COLOR}Site setup script already exists. Not checking for updates to avoid overwritng modifications." + echo -e "You may need to manually update it if there were changes upstream.${ENDC}" fi echo -e "${SUCCESS_COLOR}${BOLD}\n\nINSTALLATION SUCCESSFUL\n\n${ENDC}" diff --git a/setup.csh b/setup.csh index da617202c..e84c2362c 100755 --- a/setup.csh +++ b/setup.csh @@ -11,9 +11,9 @@ alias extend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) setenv \!:1 ${\!:1}:\!:2;ec alias prepend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) setenv \!:1 "\!:2":${\!:1};echo Added \!:2 to \!:1' # Path to RISC-V Tools -if ( -e /opt/riscv ) then +if ( -d /opt/riscv ) then setenv RISCV /opt/riscv -else if ( -e ~/riscv ) then +else if ( -d ~/riscv ) then setenv RISCV ~/riscv else # set the $RISCV directory here and remove the subsequent two lines @@ -30,6 +30,10 @@ echo '$WALLY set to ' ${WALLY} extend PATH $WALLY/bin # load site licenses and tool locations -source $RISCV/site-setup.csh +if ( -e "${RISCV}"/site-setup.csh ) then + source $RISCV/site-setup.csh +else + echo "site-setup.csh not found in \$RISCV directory. Rerun wally-toolchain-install.sh to automatically download it." +fi echo "setup done" diff --git a/setup.sh b/setup.sh index d8b511c6f..7d511588f 100644 --- a/setup.sh +++ b/setup.sh @@ -14,9 +14,9 @@ echo "Executing Wally setup.sh" # Path to RISC-V Tools -if [ -e /opt/riscv ]; then +if [ -d /opt/riscv ]; then export RISCV=/opt/riscv -elif [ -e ~/riscv ]; then +elif [ -d ~/riscv ]; then export RISCV=~/riscv else # set the $RISCV directory here and remove the subsequent two lines @@ -34,6 +34,10 @@ echo \$WALLY set to "${WALLY}" export PATH=$WALLY/bin:$PATH # load site licenses and tool locations -source "${RISCV}"/site-setup.sh +if [ -e "${RISCV}"/site-setup.sh ]; then + source "${RISCV}"/site-setup.sh +else + echo "site-setup.sh not found in \$RISCV directory. Rerun wally-toolchain-install.sh to automatically download it." +fi echo "setup done" diff --git a/site-setup.csh b/site-setup.csh index 428ebb30e..6ee000438 100644 --- a/site-setup.csh +++ b/site-setup.csh @@ -25,7 +25,12 @@ extend LD_LIBRARY_PATH $RISCV/lib64 extend PATH $RISCV/bin # Activate riscv-python Virtual Environment -source "$RISCV"/riscv-python/bin/activate.csh +if ( -e "$RISCV"/riscv-python/bin/activate ) then + source "$RISCV"/riscv-python/bin/activate.csh +else + echo "Python virtual environment not found. Rerun wally-toolchain-install.sh to automatically create it." + exit 1 +fi # environment variables needed for RISCV-DV setenv RISCV_GCC `which riscv64-unknown-elf-gcc` # Copy this as it is diff --git a/site-setup.sh b/site-setup.sh index 4750e039d..768fc6013 100755 --- a/site-setup.sh +++ b/site-setup.sh @@ -27,7 +27,14 @@ export LD_LIBRARY_PATH=$RISCV/lib:$RISCV/lib64:$LD_LIBRARY_PATH export PATH=$PATH:$RISCV/bin # Activate riscv-python Virtual Environment -source "$RISCV"/riscv-python/bin/activate + +if [ -e "$RISCV"/riscv-python/bin/activate ]; then + source "$RISCV"/riscv-python/bin/activate +else + echo "Python virtual environment not found. Rerun wally-toolchain-install.sh to automatically create it." + exit 1 +fi + # environment variables needed for RISCV-DV export RISCV_GCC=$(which riscv64-unknown-elf-gcc) # Copy this as it is