summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul P2022-09-17 23:31:03 +0530
committerGitHub2022-09-17 23:31:03 +0530
commit070d42d0fab1f9310bbef7ceacb66b6a8ff9afe1 (patch)
tree6dfbef069ef069e5969d6a93fc41bc0a6b8c3e8e
parent963e87ab8548a8f250a22180dd20b5dedcd10f42 (diff)
parent9e5a67c12180c74bcbc9c8e17156961bb1488234 (diff)
downloadeSim-070d42d0fab1f9310bbef7ceacb66b6a8ff9afe1.tar.gz
eSim-070d42d0fab1f9310bbef7ceacb66b6a8ff9afe1.tar.bz2
eSim-070d42d0fab1f9310bbef7ceacb66b6a8ff9afe1.zip
Merge pull request #220 from rahulp13/installers
SKY130 install scripts
-rwxr-xr-xUbuntu/README.md1
-rwxr-xr-xUbuntu/install-eSim-sky130.sh449
-rwxr-xr-xUbuntu/install-eSim.sh6
-rw-r--r--Windows/README.md1
-rw-r--r--Windows/esim-setup-script-sky130.nsi414
5 files changed, 865 insertions, 6 deletions
diff --git a/Ubuntu/README.md b/Ubuntu/README.md
index 3363fa01..a493c68c 100755
--- a/Ubuntu/README.md
+++ b/Ubuntu/README.md
@@ -14,6 +14,7 @@ It contains the documentation to package eSim for Ubuntu OS.
3. Add the eSim executable (if available) in `eSim-<version>` folder. Also, remove following files from this folder:
- `.git` folder
+ - `.github` folder
- `code` folder
- `src` folder (Applicable only if eSim executable is used)
- conf.py
diff --git a/Ubuntu/install-eSim-sky130.sh b/Ubuntu/install-eSim-sky130.sh
new file mode 100755
index 00000000..856a631d
--- /dev/null
+++ b/Ubuntu/install-eSim-sky130.sh
@@ -0,0 +1,449 @@
+#!/bin/bash
+#===============================================================================
+# FILE: install-eSim.sh
+#
+# USAGE: ./install-eSim.sh --install
+# OR
+# ./install-eSim.sh --uninstall
+#
+# DESCRIPTION: Installation script for eSim EDA Suite
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, Rahul Paknikar, Saurabh Bansode, Sumanto Kar
+# ORGANIZATION: eSim Team, FOSSEE, IIT Bombay
+# CREATED: Wednesday 15 July 2015 15:26
+# REVISION: Tuesday 13 September 2022 23:50
+#===============================================================================
+
+# All variables goes here
+config_dir="$HOME/.esim"
+config_file="config.ini"
+eSim_Home=`pwd`
+ngspiceFlag=0
+
+## All Functions goes here
+
+error_exit() {
+ echo -e "\n\nError! Kindly resolve above error(s) and try again."
+ echo -e "\nAborting Installation...\n"
+}
+
+
+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 "[eSim]" >> $config_dir/$config_file
+ echo "eSim_HOME = $eSim_Home" >> $config_dir/$config_file
+ echo "LICENSE = %(eSim_HOME)s/LICENSE" >> $config_dir/$config_file
+ echo "KicadLib = %(eSim_HOME)s/library/kicadLibrary.tar.xz" >> $config_dir/$config_file
+ echo "IMAGES = %(eSim_HOME)s/images" >> $config_dir/$config_file
+ echo "VERSION = %(eSim_HOME)s/VERSION" >> $config_dir/$config_file
+ echo "MODELICA_MAP_JSON = %(eSim_HOME)s/library/ngspicetoModelica/Mapping.json" >> $config_dir/$config_file
+
+}
+
+
+function installNghdl
+{
+
+ echo "Installing NGHDL..........................."
+ unzip -o nghdl.zip
+ cd nghdl/
+ chmod +x install-nghdl.sh
+
+ # Do not trap on error of any command. Let NGHDL script handle its own errors.
+ trap "" ERR
+
+ ./install-nghdl.sh --install # Install NGHDL
+
+ # Set trap again to error_exit function to exit on errors
+ trap error_exit ERR
+
+ ngspiceFlag=1
+ cd ../
+
+}
+
+
+
+function installSky130Pdk
+{
+
+ echo "Installing SKY130 PDK......................"
+
+ #Extract SKY130 PDK
+ tar -xJf library/sky130_fd_pr.tar.xz
+
+ # Remove any previous sky130-fd-pdr instance, if any
+ sudo rm -rf /usr/share/local/sky130_fd_pr
+
+ #Copy SKY130 library
+ echo "Copying SKY130 PDK........................."
+
+ sudo mkdir -p /usr/share/local/
+ sudo mv sky130_fd_pr /usr/share/local/
+
+ #Change ownership from root to the user
+ sudo chown -R $USER:$USER /usr/share/local/sky130_fd_pr/
+
+}
+
+
+function installKicad
+{
+
+ echo "Installing KiCad..........................."
+
+ #sudo add-apt-repository ppa:js-reynaud/ppa-kicad
+ kicadppa="reynaud/kicad-4"
+ findppa=$(grep -h -r "^deb.*$kicadppa*" /etc/apt/sources.list* > /dev/null 2>&1 || test $? = 1)
+ if [ -z "$findppa" ]; then
+ echo "Adding KiCad-4 PPA to local apt-repository"
+ if [[ $(lsb_release -rs) == 20.* ]]; then
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 83FBAD2D910F124E
+ sudo add-apt-repository --yes "deb [trusted=yes] http://ppa.launchpad.net/js-reynaud/kicad-4/ubuntu bionic main"
+ sudo touch /etc/apt/preferences.d/preferences
+ echo "Package: kicad" | sudo tee -a /etc/apt/preferences.d/preferences > /dev/null
+ echo "Pin: version 4.0.7*" | sudo tee -a /etc/apt/preferences.d/preferences > /dev/null
+ echo "Pin-Priority: 501" | sudo tee -a /etc/apt/preferences.d/preferences > /dev/null
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3B4FE6ACC0B21F32
+ sudo add-apt-repository --yes "deb http://archive.ubuntu.com/ubuntu/ bionic main universe"
+ else
+ sudo add-apt-repository --yes ppa:js-reynaud/kicad-4
+ fi
+ else
+ echo "KiCad-4 is available in synaptic"
+ fi
+
+ sudo apt-get install -y --no-install-recommends kicad=4.0.7*
+ if [[ $(lsb_release -rs) == 20.* ]]; then
+ sudo add-apt-repository -ry "deb http://archive.ubuntu.com/ubuntu/ bionic main universe"
+ fi
+
+}
+
+
+function installDependency
+{
+
+ set +e # Temporary disable exit on error
+ trap "" ERR # Do not trap on error of any command
+
+ #Update apt repository
+ echo "Updating apt index files..................."
+ sudo apt-get update
+
+ set -e # Re-enable exit on error
+ trap error_exit ERR
+
+ echo "Installing Xterm..........................."
+ sudo apt-get install -y xterm
+
+ echo "Installing Psutil.........................."
+ sudo apt-get install -y python3-psutil
+
+ echo "Installing PyQt5..........................."
+ sudo apt-get install -y python3-pyqt5
+
+ echo "Installing Matplotlib......................"
+ sudo apt-get install -y python3-matplotlib
+
+ echo "Installing Distutils......................."
+ sudo apt-get install -y python3-distutils
+
+ # Install NgVeri Depedencies
+ echo "Installing Pip3............................"
+ sudo apt install -y python3-pip
+
+ echo "Installing Watchdog........................"
+ pip3 install watchdog
+
+ echo "Installing Hdlparse........................"
+ pip3 install hdlparse
+
+ echo "Installing Makerchip......................."
+ pip3 install makerchip-app
+
+ echo "Installing SandPiper Saas.................."
+ pip3 install sandpiper-saas
+
+}
+
+
+function copyKicadLibrary
+{
+
+ if [ -d ~/.config/kicad ];then
+ echo "kicad folder already exists"
+ else
+ echo ".config/kicad does not exist"
+ mkdir ~/.config/kicad
+ fi
+
+ # Dump KiCad config path
+ echo "$HOME/.config/kicad" > $eSim_Home/library/supportFiles/kicad_config_path.txt
+
+ #Copy fp-lib-table for switching modes
+ cp -r library/supportFiles/fp-lib-table ~/.config/kicad/
+ cp -r library/supportFiles/fp-lib-table-online ~/.config/kicad/
+ echo "fp-lib-table copied in the directory"
+
+ #Extract custom KiCad Library
+ tar -xJf library/kicadLibrary.tar.xz
+
+ #Copy KiCad libraries
+ echo "Copying KiCad libraries...................."
+
+ sudo cp -r kicadLibrary/library /usr/share/kicad/
+ sudo cp -r kicadLibrary/modules /usr/share/kicad/
+ sudo cp -r kicadLibrary/template/* /usr/share/kicad/template/
+
+ #Copy KiCad library made for eSim
+ sudo cp -r kicadLibrary/kicad_eSim-Library/* /usr/share/kicad/library/
+
+ # Full path of 'kicad.pro file'
+ KICAD_PRO="/usr/share/kicad/template/kicad.pro"
+ KICAD_ORIGINAL="/usr/share/kicad/template/kicad.pro.original"
+
+ if [ -f "$KICAD_ORIGINAL" ];then
+ echo "kicad.pro.original file found"
+ sudo cp -rv kicadLibrary/template/kicad.pro ${KICAD_PRO}
+ else
+ echo "Making copy of original file"
+ sudo cp -rv ${KICAD_PRO}{,.original}
+ sudo cp -rv kicadLibrary/template/kicad.pro ${KICAD_PRO}
+ fi
+
+ set +e # Temporary disable exit on error
+ trap "" ERR # Do not trap on error of any command
+
+ # Remove extracted KiCad Library - not needed anymore
+ rm -rf kicadLibrary
+
+ set -e # Re-enable exit on error
+ trap error_exit ERR
+
+ #Change ownership from Root to the User
+ sudo chown -R $USER:$USER /usr/share/kicad/library/
+
+}
+
+
+function createDesktopStartScript
+{
+ # Generating new esim-start.sh
+ echo '#!/bin/bash' > esim-start.sh
+ echo "cd $eSim_Home/src/frontEnd" >> esim-start.sh
+ echo "python3 Application.py" >> esim-start.sh
+
+ # Make it executable
+ sudo chmod 755 esim-start.sh
+ # Copy esim start script
+ sudo cp -vp esim-start.sh /usr/bin/esim
+ # Remove local copy of esim start script
+ rm esim-start.sh
+
+ # Generating esim.desktop file
+ echo "[Desktop Entry]" > esim.desktop
+ echo "Version=1.0" >> esim.desktop
+ echo "Name=eSim" >> esim.desktop
+ echo "Comment=EDA Tool" >> esim.desktop
+ echo "GenericName=eSim" >> esim.desktop
+ echo "Keywords=eda-tools" >> esim.desktop
+ echo "Exec=esim %u" >> esim.desktop
+ echo "Terminal=true" >> esim.desktop
+ echo "X-MultipleArgs=false" >> esim.desktop
+ echo "Type=Application" >> esim.desktop
+ getIcon="$config_dir/logo.png"
+ echo "Icon=$getIcon" >> esim.desktop
+ echo "Categories=Development;" >> esim.desktop
+ echo "MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;" >> esim.desktop
+ echo "StartupNotify=true" >> esim.desktop
+
+ # Make esim.desktop file executable
+ sudo chmod 755 esim.desktop
+ # Copy desktop icon file to share applications
+ sudo cp -vp esim.desktop /usr/share/applications/
+ # Copy desktop icon file to Desktop
+ cp -vp esim.desktop $HOME/Desktop/
+
+ set +e # Temporary disable exit on error
+ trap "" ERR # Do not trap on error of any command
+
+ # Make esim.desktop file as trusted application
+ gio set $HOME/Desktop/esim.desktop "metadata::trusted" true
+ # Set Permission and Execution bit
+ chmod a+x $HOME/Desktop/esim.desktop
+
+ # Remove local copy of esim.desktop file
+ rm esim.desktop
+
+ set -e # Re-enable exit on error
+ trap error_exit ERR
+
+ # Copying logo.png to .esim directory to access as icon
+ cp -vp images/logo.png $config_dir
+
+}
+
+
+####################################################################
+# MAIN START FROM HERE #
+####################################################################
+
+### Checking if file is passsed as argument to script
+
+if [ "$#" -eq 1 ];then
+ option=$1
+else
+ echo "USAGE : "
+ echo "./install-eSim.sh --install"
+ echo "./install-eSim.sh --uninstall"
+ exit 1;
+fi
+
+## Checking flags
+
+if [ $option == "--install" ];then
+
+ set -e # Set exit option immediately on error
+ set -E # inherit ERR trap by shell functions
+
+ # Trap on function error_exit before exiting on error
+ trap error_exit ERR
+
+
+ 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 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
+ createConfigFile
+ installDependency
+ installKicad
+ copyKicadLibrary
+ installNghdl
+ installSky130Pdk
+ createDesktopStartScript
+
+ elif [ $getProxy == "n" -o $getProxy == "N" ];then
+ echo "Install without proxy"
+
+ # Calling functions
+ createConfigFile
+ installDependency
+ installKicad
+ copyKicadLibrary
+ installNghdl
+ installSky130Pdk
+ createDesktopStartScript
+
+ if [ $? -ne 0 ];then
+ echo -e "\n\n\nERROR: Unable to install required packages. Please check your internet connection.\n\n"
+ exit 0
+ fi
+
+ echo "-----------------eSim Installed Successfully-----------------"
+ echo "Type \"esim\" in Terminal to launch it"
+ echo "or double click on \"eSim\" icon placed on Desktop"
+
+ else
+ echo "Please select the right option"
+ exit 0
+ fi
+
+
+elif [ $option == "--uninstall" ];then
+ echo -n "Are you sure? It will remove eSim completely including KiCad, Makerchip and NGHDL along with their models and libraries (y/n):"
+ read getConfirmation
+ if [ $getConfirmation == "y" -o $getConfirmation == "Y" ];then
+ echo "Removing eSim............................"
+ sudo rm -rf $HOME/.esim $HOME/Desktop/esim.desktop /usr/bin/esim /usr/share/applications/esim.desktop
+ echo "Removing KiCad..........................."
+ sudo apt purge -y kicad
+ sudo rm -rf /usr/share/kicad
+ sudo rm -rf $HOME/.config/kicad
+ rm -f $eSim_Home/library/supportFiles/kicad_config_path.txt
+
+ if [[ $(lsb_release -rs) == 20.* ]]; then
+ sudo sed -i '/Package: kicad/{:label;N;/Pin-Priority: 501/!blabel};/Pin: version 4.0.7*/d' /etc/apt/preferences.d/preferences
+ fi
+
+ echo "Removing Makerchip......................."
+ pip3 uninstall -y hdlparse
+ pip3 uninstall -y makerchip-app
+ pip3 uninstall -y sandpiper-saas
+
+ echo "Removing SKY130 PDK......................"
+ sudo rm -R /usr/share/local/sky130_fd_pr
+
+ echo "Removing NGHDL..........................."
+ rm -rf library/modelParamXML/Nghdl/*
+ rm -rf library/modelParamXML/Ngveri/*
+ cd nghdl/
+ if [ $? -eq 0 ];then
+ chmod +x install-nghdl.sh
+ ./install-nghdl.sh --uninstall
+ cd ../
+ rm -rf nghdl
+ if [ $? -eq 0 ];then
+ echo -e "----------------eSim Uninstalled Successfully----------------"
+ else
+ echo -e "\nError while removing some files/directories in \"nghdl\". Please remove it manually"
+ fi
+ else
+ echo -e "\nCannot find \"nghdl\" directory. Please remove it manually"
+ fi
+
+ elif [ $getConfirmation == "n" -o $getConfirmation == "N" ];then
+ exit 0
+ else
+ echo "Please select the right option."
+ exit 0
+ fi
+
+else
+ echo "Please select the proper operation."
+ echo "--install"
+ echo "--uninstall"
+fi
diff --git a/Ubuntu/install-eSim.sh b/Ubuntu/install-eSim.sh
index b85b9815..3a6fa53f 100755
--- a/Ubuntu/install-eSim.sh
+++ b/Ubuntu/install-eSim.sh
@@ -153,12 +153,6 @@ function installDependency
echo "Installing SandPiper Saas.................."
pip3 install sandpiper-saas
- echo "Installing wget.................."
- pip3 install wget
-
- echo "Installing zipfile36.................."
- pip install zipfile36
-
}
diff --git a/Windows/README.md b/Windows/README.md
index e9cd8673..55fffc42 100644
--- a/Windows/README.md
+++ b/Windows/README.md
@@ -57,6 +57,7 @@ It contains all the documentation for making eSim executable (using PyInstaller)
2. Add eSim executable (`eSim.exe`) to the `eSim` folder. Also, remove following files from that folder:
- `.git` folder
+ - `.github` folder
- `code` folder
- `src` folder
- conf.py
diff --git a/Windows/esim-setup-script-sky130.nsi b/Windows/esim-setup-script-sky130.nsi
new file mode 100644
index 00000000..513650bb
--- /dev/null
+++ b/Windows/esim-setup-script-sky130.nsi
@@ -0,0 +1,414 @@
+;NSIS Modern User Interface
+;Start Menu Folder Selection Example Script
+;Modified by Fahim Khan, Saurabh Bansode, Rahul Paknikar - 14_09_2022
+;Made by eSim Team, FOSSEE, IIT Bombay
+
+;--------------------------------
+;Include Modern UI
+
+ !include "MUI2.nsh"
+ !include "ZipDLL.nsh"
+ !include "x64.nsh"
+;--------------------------------
+
+;--------------------------------
+; StrContains
+; This function does a case sensitive searches for an occurrence of a substring in a string.
+; It returns the substring if it is found.
+; Otherwise it returns null("").
+; Written by kenglish_hi
+; Adapted from StrReplace written by dandaman32
+
+
+Var STR_HAYSTACK
+Var STR_NEEDLE
+Var STR_CONTAINS_VAR_1
+Var STR_CONTAINS_VAR_2
+Var STR_CONTAINS_VAR_3
+Var STR_CONTAINS_VAR_4
+Var STR_RETURN_VAR
+
+Function StrContains
+ Exch $STR_NEEDLE
+ Exch 1
+ Exch $STR_HAYSTACK
+ ; Uncomment to debug
+ ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
+ StrCpy $STR_RETURN_VAR ""
+ StrCpy $STR_CONTAINS_VAR_1 -1
+ StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
+ StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
+ loop:
+ IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
+ StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
+ StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
+ StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
+ Goto loop
+ found:
+ StrCpy $STR_RETURN_VAR $STR_NEEDLE
+ Goto done
+ done:
+ Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
+ Exch $STR_RETURN_VAR
+FunctionEnd
+
+!macro _StrContainsConstructor OUT NEEDLE HAYSTACK
+ Push `${HAYSTACK}`
+ Push `${NEEDLE}`
+ Call StrContains
+ Pop `${OUT}`
+!macroend
+
+!define StrContains '!insertmacro "_StrContainsConstructor"'
+
+;--------------------------------
+
+
+;General
+
+!define PRODUCT_NAME "eSim"
+!define PRODUCT_VERSION "2.3"
+!define VERSION "2.3.0.0"
+!define PRODUCT_PUBLISHER "FOSSEE, IIT Bombay"
+!define PRODUCT_WEB_SITE "https://esim.fossee.in/"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+VIAddVersionKey "ProductName" "eSim"
+VIProductVersion "${VERSION}"
+VIFileVersion "${VERSION}"
+VIAddVersionKey "FileVersion" "${VERSION}"
+VIAddVersionKey "CompanyName" "FOSSEE, IIT Bombay"
+VIAddVersionKey "LegalCopyright" "Copyright (C) 2007 Free Software Foundation, Inc."
+VIAddVersionKey "FileDescription" "Installer for eSim EDA Suite"
+
+
+
+;Default installation folder
+ InstallDir "C:\FOSSEE"
+
+;Request application privileges for Admin Rights
+ RequestExecutionLevel admin
+
+;Get installation folder from registry if available
+ InstallDirRegKey HKLM "Software\eSim" ""
+
+!include LogicLib.nsh
+
+Function .onInit
+UserInfo::GetAccountType
+pop $0
+${If} $0 != "admin" ;Require admin rights on NT4+
+ MessageBox mb_iconstop "Administrator rights required!"
+ SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
+ Quit
+${EndIf}
+FunctionEnd
+
+;--------------------------------
+;Variables
+ Var StartMenuFolder
+
+;--------------------------------
+;Interface Settings
+ !define MUI_ABORTWARNING
+;--------------------------------
+
+;Pages
+
+ !insertmacro MUI_PAGE_LICENSE "LICENSE.rtf"
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ ;Start Menu Folder Page Configuration
+
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\eSim"
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+
+ !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
+
+ !insertmacro MUI_PAGE_INSTFILES
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English"
+
+;--------------------------------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "eSim-2.3_installer.exe"
+
+
+Function .onVerifyInstDir
+ ${StrContains} $0 "Program Files" $INSTDIR
+ StrCmp $0 "" notfound
+ MessageBox MB_ICONSTOP|MB_OK \
+ "Installation in 'Program Files' is not allowed, please choose another directory."
+ Abort
+ notfound:
+ ${StrContains} $0 " " $INSTDIR
+ StrCmp $0 "" PathGood
+ MessageBox MB_ICONSTOP|MB_OK \
+ "Installation path containing spaces is not allowed, please choose another directory."
+ Abort
+ PathGood:
+FunctionEnd
+
+
+;Installer Sections
+
+Section -NgspiceSim
+
+ ;Current section needs an additional "size_kb" kilobytes of disk space
+ ;AddSize 2726298
+ AddSize 1593968
+
+ SetOutPath "$EXEDIR"
+
+ File "eSim.7z"
+ File "logo.ico"
+ File "sky130_fd_pr.7z"
+
+ SetOutPath "$INSTDIR"
+
+ ;ADD YOUR OWN FILES HERE...
+ Nsis7z::ExtractWithDetails "$EXEDIR\eSim.7z" "Extracting eSim %s..."
+
+ ;Copying Folder to install directory
+ SetOutPath "$INSTDIR\eSim"
+ ;File /nonfatal /a /r "eSim\"
+
+ ;Store installation folder
+ WriteRegStr HKLM "Software\eSim" "" $INSTDIR
+
+ ;Create eSim config directory
+ CreateDirectory $INSTDIR\eSim\library\config\.esim
+ CopyFiles "$EXEDIR\logo.ico" "$INSTDIR\eSim\library\config\.esim"
+ FileOpen $0 "$INSTDIR\eSim\library\config\.esim\config.ini" w
+ FileWrite $0 `[eSim]$\n`
+ FileWrite $0 `eSim_HOME = $INSTDIR\eSim$\n`
+ FileWrite $0 `LICENSE = %(eSim_HOME)s\LICENSE.rtf$\n`
+ FileWrite $0 `KicadLib = %(eSim_HOME)s\library\kicadLibrary.zip$\n`
+ FileWrite $0 `IMAGES = %(eSim_HOME)s\images$\n`
+ FileWrite $0 `VERSION = %(eSim_HOME)s\VERSION$\n`
+ FileWrite $0 `MODELICA_MAP_JSON = %(eSim_HOME)s\library\ngspicetoModelica\Mapping.json$\n`
+ FileClose $0
+
+ ;Create eSim startup batch file
+ ;FileOpen $0 "$INSTDIR\eSim\eSim.bat" w
+ ;FileWrite $0 `@echo off$\n`
+ ;FileWrite $0 `set HOME=$PROFILE$\n`
+ ;FileWrite $0 `start eSim.exe$\n`
+ ;FileWrite $0 `cd /d %HOME%$\n`
+ ;FileClose $0
+
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+ ;Create shortcuts
+ ;create desktop shortcut
+ CreateShortCut "$PROFILE\..\Public\Desktop\eSim.lnk" "$INSTDIR\eSim\eSim.exe" "" "$INSTDIR\eSim\library\config\.esim\logo.ico" "" SW_SHOWMINIMIZED
+
+
+ SetOutPath "$INSTDIR\eSim\library"
+
+ Nsis7z::ExtractWithDetails "$EXEDIR\sky130_fd_pr.7z" "Extracting SkyWater SKY130 PDK %s..."
+
+ SetOutPath "$INSTDIR"
+
+ !insertmacro MUI_STARTMENU_WRITE_END
+
+ ;Remove not required files
+ Delete "$EXEDIR\eSim.7z"
+ Delete "$EXEDIR\logo.ico"
+ Delete "$EXEDIR\sky130_fd_pr.7z"
+SectionEnd
+
+
+Section -InstallKiCad
+
+ SetOutPath "$EXEDIR"
+ File "kicad-4.0.7-i686.exe"
+
+ SetOutPath "$INSTDIR"
+ SetDetailsPrint both
+ DetailPrint "Installing: KiCad......"
+ SetDetailsPrint listonly
+ ExecWait '"$EXEDIR\kicad-4.0.7-i686.exe" /S /D=$INSTDIR\KiCad'
+ SetDetailsPrint both
+
+ Goto endActiveSync
+ endActiveSync:
+
+ ;Remove not required files
+ Delete "$EXEDIR\kicad-4.0.7-i686.exe"
+ Delete "$PROFILE\..\Public\Desktop\KiCad.lnk"
+
+ EnVar::SetHKLM
+ EnVar::AddValue "Path" "$INSTDIR\KiCad\bin"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ ZipDLL::extractall "$INSTDIR\eSim\library\kicadLibrary.zip" "$INSTDIR\eSim\library\"
+
+ ;CopyFiles "$INSTDIR\eSim\library\kicadLibrary\library\*" "$INSTDIR\KiCad\share\kicad\library\"
+
+ ;Copy KiCad library made for eSim
+ CopyFiles "$INSTDIR\eSim\library\kicadLibrary\kicad_eSim-Library\*" "$INSTDIR\KiCad\share\kicad\library\"
+
+ CopyFiles "$INSTDIR\eSim\library\kicadLibrary\modules\*" "$INSTDIR\KiCad\share\kicad\modules\"
+
+ CopyFiles "$INSTDIR\eSim\library\kicadLibrary\template\*" "$INSTDIR\KiCad\share\kicad\template\"
+
+
+ ;Remove older KiCad config files (if any).
+ RMDir /r "$PROFILE\AppData\Roaming\kicad"
+
+ CreateDirectory "$PROFILE\AppData\Roaming\kicad"
+ CopyFiles "$INSTDIR\eSim\library\supportFiles\fp-lib-table" "$PROFILE\AppData\Roaming\kicad\"
+ CopyFiles "$INSTDIR\eSim\library\supportFiles\fp-lib-table-online" "$PROFILE\AppData\Roaming\kicad\"
+
+ FileOpen $0 "$INSTDIR\eSim\library\supportFiles\kicad_config_path.txt" w
+ FileWrite $0 `$PROFILE\AppData\Roaming\kicad$\n`
+ FileClose $0
+
+ ;Remove extracted KiCad Library - not needed anymore
+ RMDir /r "$INSTDIR\eSim\library\kicadLibrary"
+
+SectionEnd
+
+
+Section -AdditionalIcons
+
+ SetOutPath "$INSTDIR"
+ CreateDirectory "$SMPROGRAMS\eSim"
+ CreateShortCut "$SMPROGRAMS\eSim\Uninstall.lnk" "$INSTDIR\eSim\uninst-eSim.exe"
+
+SectionEnd
+
+
+!include "nghdl-setup-script.nsi"
+
+
+Section -InstallMakerchip
+
+ SetOutPath "$EXEDIR"
+ File "makerchip.7z"
+
+ SetOutPath $INSTDIR
+ Nsis7z::ExtractWithDetails "$EXEDIR\makerchip.7z" "Extracting Makerchip %s..."
+ CopyFiles "$INSTDIR\makerchip\*" "$INSTDIR\MSYS\mingw64\bin"
+
+ RMDir /r "$INSTDIR\makerchip"
+ Delete "$EXEDIR\makerchip.7z"
+
+SectionEnd
+
+
+Section -Post
+
+ WriteUninstaller "$INSTDIR\eSim\uninst-eSim.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\eSim\uninst-eSim.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+
+SectionEnd
+
+
+;Function un.onUninstSuccess
+; HideWindow
+; MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+;FunctionEnd
+
+Function un.onInit
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+ Abort
+FunctionEnd
+
+
+Section Uninstall
+
+ ; Set to HKLM
+ EnVar::SetHKLM
+
+ GetFullPathName $1 $INSTDIR\..\eSim\nghdl\src
+ EnVar::DeleteValue "Path" $1
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ GetFullPathName $1 $INSTDIR\..\MSYS\mingw64\bin
+ EnVar::DeleteValue "Path" $1
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ GetFullPathName $1 $INSTDIR\..\MSYS\usr\bin
+ EnVar::DeleteValue "Path" $1
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ ;GetFullPathName $1 $INSTDIR\..\mingw64\GHDL\bin
+ ;EnVar::DeleteValue "Path" $1
+ ;Pop $0
+ ;DetailPrint "EnVar::AddValue returned=|$0|"
+
+ GetFullPathName $1 $INSTDIR\..\nghdl-simulator\bin
+ EnVar::DeleteValue "Path" $1
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ RMDir /r "$INSTDIR\..\MSYS"
+ RMDir /r "$INSTDIR\..\nghdl-simulator"
+ RMDir /r "$INSTDIR\..\eSim\nghdl"
+
+ ;Note that in uninstaller code, $INSTDIR contains the directory where the uninstaller lies
+
+ Delete "$INSTDIR\uninst-eSim.exe"
+ Delete "$SMPROGRAMS\eSim\Uninstall.lnk"
+
+ ;Removing Env Variable for KiCad
+ GetFullPathName $1 $INSTDIR\..\KiCad\bin
+ EnVar::DeleteValue "Path" $1
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+ ;Remove KiCad config
+ RMDir /r "$PROFILE\AppData\Roaming\kicad"
+
+ ;Removing KiCad
+ ExecWait '"$INSTDIR\..\KiCad\uninstaller.exe" /S'
+
+ Goto endActiveSync
+
+ endActiveSync:
+
+ ;Removing eSim
+ RMDir /r "$INSTDIR\eSim\library\config\.esim"
+ RMDir /r "$INSTDIR\eSim\library\config\.nghdl"
+ RMDir /r "$INSTDIR\eSim\library\config"
+ RMDir "$SMPROGRAMS\eSim"
+ RMDir /r "$INSTDIR\..\eSim"
+ RMDir /r "$INSTDIR\..\KiCad"
+ Delete "$PROFILE\..\Public\Desktop\eSim.lnk"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ ;SetAutoClose true
+
+SectionEnd
+
+
+;Descriptions--------------------
+
+ ;Language strings
+ ;LangString DESC_NgspiceSim ${LANG_ENGLISH} "Ngspice is a mixed-level/mixed-signal circuit simulator. Its code is based on three open source software packages: Spice3f5, Cider1b1 and XSPICE. Ngspice is part of gEDA project, a full GPL'd suite of Electronic Design Automation tools."
+
+ ;Assign language strings to sections
+ ;!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ ;!insertmacro MUI_DESCRIPTION_TEXT ${NgspiceSim} $(DESC_NgspiceSim)
+ ;!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;--------------------------------