-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancing the Verilator installation script:
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |