Skip to content

Commit

Permalink
Enhancing the Verilator installation script:
Browse files Browse the repository at this point in the history
    - Added set -e to stop the script on errors
    - Refactored variable names for better clarity
    - Fixed the order of git clone and git checkout commands
    - Added explicit installation messages
  • Loading branch information
bi262934 committed Jan 30, 2025
1 parent 9ca5849 commit 8a40ca9
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions ci/install-verilator.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# usage: ./install-verilator.sh <version> <output-dir>

#!/bin/bash
set -e # Stop script on error

if [ ! -e "$2/verilator-$1/bin/verilator" ]; then
echo "Installing Verilator..."
cd $2
git clone https://github.com/verilator/verilator.git
unset VERILATOR_ROOT
mv verilator/ verilator-$1/
git checkout $1
# copy scripts
VERILATOR_VERSION=$1
INSTALL_DIR=$2

# full path of the installation directory
VERILATOR_DIR="$INSTALL_DIR/verilator-$VERILATOR_VERSION"

if [ ! -e "$VERILATOR_DIR/bin/verilator" ]; then
echo "Installing Verilator $VERILATOR_VERSION..."
mkdir -p $INSTALL_DIR
cd $INSTALL_DIR

# Clone and build in the verilator toolchain directory
git clone https://github.com/verilator/verilator.git $VERILATOR_DIR
cd $VERILATOR_DIR
git checkout $VERILATOR_VERSION

# Generate the configuration script
autoconf
./configure --prefix="$2/verilator-$1"
./configure --prefix="$VERILATOR_DIR"
make -j$(nproc)
cd ..
make install

echo "Verilator successfully installed in $VERILATOR_DIR"
else
echo "Using Verilator from cached directory."
echo "Verilator $VERILATOR_VERSION is already installed in $VERILATOR_DIR"
fi

0 comments on commit 8a40ca9

Please sign in to comment.