summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrahulp132019-11-26 16:51:38 +0530
committerrahulp132019-11-26 16:51:38 +0530
commita18deb8e7595ae29a6a410834a841198a5ab8790 (patch)
tree79ea32d04a78d49fdc70aaf8e10481e39b9fc4f6
parent04d535a74420cfd6b757f9298ac6f5d4d3d30732 (diff)
downloadnghdl-a18deb8e7595ae29a6a410834a841198a5ab8790.tar.gz
nghdl-a18deb8e7595ae29a6a410834a841198a5ab8790.tar.bz2
nghdl-a18deb8e7595ae29a6a410834a841198a5ab8790.zip
update installer
-rwxr-xr-xinstall-nghdl.sh109
1 files changed, 36 insertions, 73 deletions
diff --git a/install-nghdl.sh b/install-nghdl.sh
index f14116e..a476ac9 100755
--- a/install-nghdl.sh
+++ b/install-nghdl.sh
@@ -15,7 +15,7 @@
# NOTES: ---
# AUTHOR: Fahim Khan, Rahul Paknikar
# ORGANIZATION: eSim, FOSSEE group at IIT Bombay
-# CREATED: Wednesday 23 October 2019 14:30
+# CREATED: Wednesday 26 November 2019 14:30
# REVISION: ---
#===============================================================================
@@ -40,17 +40,18 @@ function installDependency
echo "Installing dependencies for ghdl-0.36 LLVM......."
echo "Installing make.................................."
sudo apt-get install -y make
- echo "Installing gnat-5.................................."
+ echo "Installing gnat-5................................"
sudo apt-get install -y gnat-5
echo "Installing llvm.................................."
sudo apt-get install -y llvm
- echo "Installing clang.................................."
+ echo "Installing clang................................."
sudo apt-get install -y clang
- echo "Installing zlib1g-dev.................................."
+ echo "Installing zlib1g-dev............................"
sudo apt-get install -y zlib1g-dev
- echo "Installing xterm.................................."
+ echo "Installing xterm................................."
sudo apt-get install -y xterm
+ echo "Installing ghdl.................................."
grep -h "ghdl" /usr/local/bin/ghdl > /dev/null
if [ $? -ne 0 ]; then
tar -xzvf ghdl-0.36.tar.gz -C $HOME
@@ -66,7 +67,7 @@ function installDependency
echo "Installing ghdl-0.36 LLVM....."
sudo make install
echo "Removing unused part of ghdl-0.36 LLVM....."
- sudo rm -rf ../ghdl-0.36
+ sudo rm -rf ../ghdl-0.36
else
echo "Unable to extract ghdl-0.36 LLVM"
echo "Exiting installation"
@@ -93,11 +94,11 @@ function installDependency
function installNgspice
{
- echo "Installing ngspice..................................."
+ echo "Installing ngspice................................"
#Checking if ngspice-nghdl directory is already present in Home directory
if [ -d $HOME/$ngspice ];then
echo "$ngspice directory already exists at $HOME"
- echo "Leaving ngspice installation"
+ echo "Leaving ngspice installation.................."
else
#Extracting Ngspice to Home Directory
cd $src_dir
@@ -113,7 +114,7 @@ function installNgspice
#Change to release directory
cd release
echo "Installing Ngspice....."
- echo "------------------------------------"
+ echo "-----------------------------------------"
sleep 5
../configure --enable-xspice --disable-debug --prefix=$HOME/$ngspice/install_dir/ --exec-prefix=$HOME/$ngspice/install_dir/
@@ -131,9 +132,9 @@ function installNgspice
sudo ln -s $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
if [ "$?" == 0 ];then
- echo "failed to add softlink"
- echo "ngspice already installed at /usr/bin/ngspice..."
- echo "Remove earlier installations and try again..."
+ echo "Failed to add ngspice softlink"
+ echo "Remove earlier installations at /usr/bin/ngspice and try again..."
+ exit 1
else
echo "Added softlink for ngspice"
fi
@@ -142,24 +143,23 @@ function installNgspice
echo "There was some error in installing ngspice"
fi
-
else
echo "Unable to extract ngspice tar file"
exit 1;
fi
-
fi
+
}
function createConfigFile
{
+
#Creating config.ini file and adding configuration information
#Check if config file is present
if [ -d $config_dir ];then
rm $config_dir/$config_file && touch $config_dir/$config_file
else
mkdir $config_dir && touch $config_dir/$config_file
-
fi
echo "[NGSPICE]" >> $config_dir/$config_file
@@ -174,18 +174,26 @@ function createConfigFile
function createSoftLink
{
+
## Creating softlink
cd /usr/local/bin
if [[ -L nghdl ]];then
echo "Symlink was already present"
sudo unlink nghdl
sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
-
else
- echo "Creating synmlink"
+ echo "Creating symlink"
sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
+ if [ "$?" == 0 ];then
+ echo "Failed to add nghdl softlink"
+ echo "Remove earlier installations at /usr/local/bin/nghdl and try again..."
+ exit 1
+ else
+ echo "Added softlink for nghdl......"
+ fi
fi
cd $pwd
+
}
#####################################################################
@@ -198,67 +206,22 @@ if [ "$#" -eq 1 ];then
option=$1
else
echo "USAGE : "
- echo "./install.sh --install"
+ echo "./install-nghdl.sh --install"
exit 1;
fi
##Checking flags
-
if [ $option == "--install" ];then
- echo "Enter proxy details if you are connected to internet thorugh proxy"
-
- echo -n "Is your internet connection behind proxy? (y/n): "
- read getProxy
- if [ $getProxy == "y" -o $getProxy == "Y" ];then
- echo -n 'Proxy hostname :'
- read proxyHostname
-
- echo -n 'Proxy Port :'
- read proxyPort
-
- echo -n username@$proxyHostname:$proxyPort :
- read username
-
- echo -n 'Password :'
- read -s passwd
-
- unset http_proxy
- unset https_proxy
- unset HTTP_PROXY
- unset HTTPS_PROXY
- unset ftp_proxy
- unset FTP_PROXY
-
- export http_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
- export https_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
- export HTTP_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
- export HTTPS_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
- export ftp_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
- export FTP_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
-
- echo "Install with proxy"
- #Calling functions
- installDependency
- if [ $? -ne 0 ];then
- echo -e "\n\n\nERROR: Unable to install required packages. Please check your internet connection.\n\n"
- exit 0
- fi
- installNgspice
- createConfigFile
- createSoftLink
-
- elif [ $getProxy == "n" -o $getProxy == "N" ];then
- echo "Install without proxy"
-
- #Calling functions
- installDependency
- if [ $? -ne 0 ];then
- echo -e "\n\n\nERROR: Unable to install required packages. Please check your internet connection.\n\n"
- exit 0
- fi
- installNgspice
- createConfigFile
- createSoftLink
+
+ #Calling functions
+ installDependency
+ if [ $? -ne 0 ];then
+ echo -e "\n\n\nERROR: Unable to install required packages. Please check your internet connection.\n\n"
+ exit 0
+ fi
+ installNgspice
+ createConfigFile
+ createSoftLink
elif [ $option == "--uninstall" ];then
echo "Deleting Files............"