From 6955e2253c4dadead449731c2a954b0836c80dce Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Mon, 21 Feb 2022 18:06:10 +0530
Subject: refactor: Updated Ngspice and NGHDL contexts

---
 Ubuntu/install-nghdl.sh | 43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

(limited to 'Ubuntu/install-nghdl.sh')

diff --git a/Ubuntu/install-nghdl.sh b/Ubuntu/install-nghdl.sh
index f9a8968..ab7bcb4 100755
--- a/Ubuntu/install-nghdl.sh
+++ b/Ubuntu/install-nghdl.sh
@@ -18,7 +18,7 @@
 #      REVISION: Tuesday 02 February 2022 01:35
 #==========================================================
 
-ngspice="ngspice-nghdl"
+nghdl="nghdl-simulator"
 ghdl="ghdl-0.37"
 verilator="verilator-4.210"
 llvm_version="9"
@@ -145,40 +145,39 @@ function installVerilator
 }
 
 
-function installNgspice
+function installNGHDL
 {
 
-    echo "Installing Ngspice........................................"
+    echo "Installing NGHDL........................................"
 
-    # Extracting Ngspice to Home Directory
+    # Extracting NGHDL to Home Directory
     cd $src_dir
-    tar -xJf $ngspice.tar.xz -C $HOME 
-    
-    echo "Ngspice extracted sucessfully to $HOME"
-    # Change to ngspice-nghdl directory
-    cd $HOME/$ngspice
+    tar -xJf $nghdl-source.tar.xz -C $HOME
+    mv $HOME/$nghdl-source $HOME/$nghdl
+
+    echo "NGHDL extracted sucessfully to $HOME"
+    # Change to nghdl directory
+    cd $HOME/$nghdl
     # Make local install directory
     mkdir -p install_dir
     # Make release directory for build
     mkdir -p release
     # Change to release directory
     cd release
-    echo "Configuring Ngspice........."
+    echo "Configuring NGHDL..........."
     sleep 2
     
     chmod +x ../configure
-    ../configure --enable-xspice --disable-debug  --prefix=$HOME/$ngspice/install_dir/ --exec-prefix=$HOME/$ngspice/install_dir/
+    ../configure --enable-xspice --disable-debug  --prefix=$HOME/$nghdl/install_dir/ --exec-prefix=$HOME/$nghdl/install_dir/
             
     # Adding patch to Ngspice base code
-    cp $src_dir/src/outitf.c $HOME/$ngspice/src/frontend
-    cp $src_dir/src/verilated.o $HOME/$ngspice/release/src/xspice/icm/
+    # cp $src_dir/src/outitf.c $HOME/$nghdl/src/frontend
 
     make -j$(nproc)
     make install
 
     # Make it executable
-    sudo chmod 755 $HOME/$ngspice/install_dir/bin/ngspice
-    sudo chmod 777 -R $HOME/$ngspice/
+    sudo chmod 755 $HOME/$nghdl/install_dir/bin/ngspice
     
     set +e 		# Temporary disable exit on error
     trap "" ERR # Do not trap on error of any command
@@ -186,7 +185,7 @@ function installNgspice
     echo "Removing previously installed Ngspice (if any)"    
     sudo apt-get purge -y ngspice
 
-    echo "Ngspice installed sucessfully"
+    echo "NGHDL installed sucessfully"
     echo "Adding softlink for the installed Ngspice"
 
     # Add symlink to the path
@@ -195,15 +194,15 @@ function installNgspice
     set -e 		# Re-enable exit on error
     trap error_exit ERR
 
-    sudo ln -sf $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
-    echo "Added softlink for Ngspice..."
+    sudo ln -sf $HOME/$nghdl/install_dir/bin/ngspice /usr/bin/ngspice
+    echo "Added softlink for Ngspice....."
 
 }
 
 
 function createConfigFile
 {
-    
+
     # Creating config.ini file and adding configuration information
     # Check if config file is present
     if [ -d $config_dir ];then
@@ -236,7 +235,7 @@ function createSoftLink
     fi
     
     sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
-    echo "Added softlink for NGHDL..."
+    echo "Added softlink for NGHDL....."
 
     cd $pwd
 
@@ -274,12 +273,12 @@ if [ $option == "--install" ];then
     fi
     installGHDL
     installVerilator
-    installNgspice
+    installNGHDL
     createConfigFile
     createSoftLink
 
 elif [ $option == "--uninstall" ];then
-    sudo rm -rf $HOME/ngspice-nghdl $HOME/.nghdl /usr/share/kicad/library/eSim_Nghdl.lib /usr/local/bin/nghdl /usr/bin/ngspice
+    sudo rm -rf $HOME/$nghdl $HOME/.nghdl /usr/share/kicad/library/eSim_Nghdl.lib /usr/local/bin/nghdl /usr/bin/ngspice
 
     echo "Removing GHDL......................"
     cd $ghdl/
-- 
cgit