SAIFIINDUSTRIES's picture
Add batch 5 (Luthiraa_TALOS-V2, dawsonjon_fpu, The-OpenROAD-Project_OpenROAD-flow-scripts, antonblanchard_microwatt, alexforencich_verilog-i2c)
784ee2c verified
Raw History Blame Contribute Delete
1.65 kB
#!/usr/bin/env bash
set -euo pipefail
# allow this script to be invoked from any folder
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ "$OSTYPE" == "darwin"* ]] && [[ $EUID -eq 0 ]]; then
echo "Do NOT run this script with sudo on macOS"
exit 1
fi
if [[ "$OSTYPE" != "darwin"* ]] && [[ $EUID -ne 0 ]]; then
echo "This script must be run with sudo on Linux"
exit 1
fi
tmpfile=$(mktemp)
# any error messages from this command will stand out
# more clearly when run as a separate command rather than
# being piped
git submodule status --recursive > "$tmpfile"
if grep -q "^-" "$tmpfile"; then
if [[ "$OSTYPE" == "darwin"* ]]; then
git submodule update --init --recursive
else
sudo -u $SUDO_USER git submodule update --init --recursive
fi
elif grep -q "^+" "$tmpfile"; then
# Make it easy for users who are not hacking ORFS to do the right thing,
# run with current submodules, at the cost of having ORFS
# hackers disable this test manually when hacking setup.sh
echo "Submodules are not up to date, run 'git submodule update --recursive' and try again"
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ ! -d "$DIR/.venv" ]]; then
echo "Creating Python virtual environment at $DIR/.venv"
python3 -m venv "$DIR/.venv"
fi
echo "Activating virtual environment"
source "$DIR/.venv/bin/activate"
python -m pip install --upgrade pip
fi
"$DIR/etc/DependencyInstaller.sh" -base
if [[ "$OSTYPE" == "darwin"* ]]; then
"$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
else
sudo -u $SUDO_USER "$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
fi