summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrahulp132020-02-20 16:11:56 +0530
committerrahulp132020-02-20 16:11:56 +0530
commit295534960d75ac94c5f50fd9a6a3cecfc48c0f12 (patch)
treec497e49f5638cb4f1fcdb5d12ef13e74ccd1a95e
parent73ac34b39b95356f49ca833b071e7cb5c9f6a25f (diff)
downloadnghdl-295534960d75ac94c5f50fd9a6a3cecfc48c0f12.tar.gz
nghdl-295534960d75ac94c5f50fd9a6a3cecfc48c0f12.tar.bz2
nghdl-295534960d75ac94c5f50fd9a6a3cecfc48c0f12.zip
packaging with pyinstaller
-rwxr-xr-xDebian/Ubuntu 14.04/install-nghdl.sh19
-rwxr-xr-xDebian/Ubuntu 16.04+/install-nghdl.sh7
-rw-r--r--Debian/nghdl.spec32
-rw-r--r--Debian/readme.md68
-rw-r--r--readme.md5
5 files changed, 111 insertions, 20 deletions
diff --git a/Debian/Ubuntu 14.04/install-nghdl.sh b/Debian/Ubuntu 14.04/install-nghdl.sh
index 9de831f..d4439cd 100755
--- a/Debian/Ubuntu 14.04/install-nghdl.sh
+++ b/Debian/Ubuntu 14.04/install-nghdl.sh
@@ -14,7 +14,7 @@
# NOTES: ---
# AUTHOR: Fahim Khan, Rahul Paknikar
# ORGANIZATION: eSim, FOSSEE group at IIT Bombay
-# CREATED: Wednesday 22 January 2020 16:30
+# CREATED: Friday 14 February 2020 16:30
# REVISION: ---
#===============================================================================
@@ -33,6 +33,8 @@ timestamp=`echo $sysdate|awk '{print $3"_"$2"_"$6"_"$4 }'`
function installDependency
{
+ echo "Installing dependencies for ghdl-0.36 LLVM................"
+
echo "Installing Make..........................................."
sudo apt install -y make
if [ $? -ne 0 ]; then
@@ -116,7 +118,7 @@ function installDependency
exit 1
fi
else
- echo "GHDL already exists..."
+ echo "GHDL already exists....."
echo "Leaving ghdl-0.36 LLVM installation"
fi
@@ -136,7 +138,7 @@ function installNgspice
cd $src_dir
tar -xJf $ngspice.tar.xz -C $HOME
if [ "$?" == 0 ];then
- echo "Ngspice extracted sucessfuly to $HOME "
+ echo "Ngspice extracted sucessfuly to $HOME"
#change to ngspice-nghdl directory
cd $HOME/$ngspice
#Make local install directory
@@ -162,7 +164,7 @@ function installNgspice
echo "Adding softlink for the installed Ngspice....."
sudo rm /usr/bin/ngspice
- sudo ln -s $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
+ sudo ln -sf $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
if [ $? -ne 0 ];then
echo "Failed to add Ngspice softlink............"
echo "Remove earlier installations at /usr/bin/ngspice and try again..."
@@ -172,11 +174,9 @@ function installNgspice
sudo chmod 755 /usr/bin/ngspice
echo "Added softlink for Ngspice"
fi
-
else
echo "There was some error while installing Ngspice"
fi
-
else
echo "Unable to extract Ngspice tar file"
exit 1;
@@ -216,10 +216,10 @@ function createSoftLink
if [[ -L nghdl ]];then
echo "Symlink was already present"
sudo unlink nghdl
- sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
+ sudo ln -sf $src_dir/src/nghdl nghdl
else
echo "Creating symlink"
- sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
+ sudo ln -sf $src_dir/src/nghdl nghdl
if [ $? -ne 0 ];then
echo "Failed to add NGHDL softlink"
echo "Remove earlier installations at /usr/local/bin/nghdl and try again..."
@@ -263,11 +263,10 @@ if [ $option == "--install" ];then
createSoftLink
elif [ $option == "--uninstall" ];then
- echo "Removing NGHDL....................."
sudo rm -rf $HOME/ngspice-nghdl $HOME/.nghdl /usr/share/kicad/library/eSim_Nghdl.lib /usr/local/bin/nghdl /usr/bin/ngspice
echo "Removing libxaw7-dev..............."
sudo apt purge -y libxaw7-dev
- echo "Removing GHDL............."
+ echo "Removing GHDL......................"
sudo rm -rf /usr/local/bin/ghdl /usr/local/bin/ghdl1-llvm /usr/local/lib/ghdl /usr/local/lib/libghdlvpi.so /usr/local/include/vpi_user.h
echo "Removing GNAT......................"
sudo apt purge -y gnat
diff --git a/Debian/Ubuntu 16.04+/install-nghdl.sh b/Debian/Ubuntu 16.04+/install-nghdl.sh
index 274d09c..f319d46 100755
--- a/Debian/Ubuntu 16.04+/install-nghdl.sh
+++ b/Debian/Ubuntu 16.04+/install-nghdl.sh
@@ -164,7 +164,7 @@ function installNgspice
echo "Adding softlink for the installed Ngspice....."
sudo rm /usr/bin/ngspice
- sudo ln -s $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
+ sudo ln -sf $HOME/$ngspice/install_dir/bin/ngspice /usr/bin/ngspice
if [ $? -ne 0 ];then
echo "Failed to add Ngspice softlink............"
echo "Remove earlier installations at /usr/bin/ngspice and try again..."
@@ -216,10 +216,10 @@ function createSoftLink
if [[ -L nghdl ]];then
echo "Symlink was already present"
sudo unlink nghdl
- sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
+ sudo ln -sf $src_dir/src/nghdl nghdl
else
echo "Creating symlink"
- sudo ln -sf $src_dir/src/ngspice_ghdl.py nghdl
+ sudo ln -sf $src_dir/src/nghdl nghdl
if [ $? -ne 0 ];then
echo "Failed to add NGHDL softlink"
echo "Remove earlier installations at /usr/local/bin/nghdl and try again..."
@@ -263,7 +263,6 @@ if [ $option == "--install" ];then
createSoftLink
elif [ $option == "--uninstall" ];then
- echo "Removing NGHDL....................."
sudo rm -rf $HOME/ngspice-nghdl $HOME/.nghdl /usr/share/kicad/library/eSim_Nghdl.lib /usr/local/bin/nghdl /usr/bin/ngspice
echo "Removing libxaw7-dev..............."
sudo apt purge -y libxaw7-dev
diff --git a/Debian/nghdl.spec b/Debian/nghdl.spec
new file mode 100644
index 0000000..61f3fa8
--- /dev/null
+++ b/Debian/nghdl.spec
@@ -0,0 +1,32 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+block_cipher = None
+
+a = Analysis(['nghdl/src/ngspice_ghdl.py'],
+ pathex=['/home/rahul/Music'],
+ binaries=[],
+ datas=[],
+ hiddenimports=['PyQt4.sip'],
+ hookspath=[],
+ runtime_hooks=[],
+ excludes=[],
+ win_no_prefer_redirects=False,
+ win_private_assemblies=False,
+ cipher=block_cipher,
+ noarchive=False)
+pyz = PYZ(a.pure, a.zipped_data,
+ cipher=block_cipher)
+exe = EXE(pyz,
+ a.scripts,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ [],
+ name='nghdl',
+ debug=False,
+ bootloader_ignore_signals=False,
+ strip=False,
+ upx=True,
+ upx_exclude=[],
+ runtime_tmpdir=None,
+ console=True )
diff --git a/Debian/readme.md b/Debian/readme.md
index 629ef92..e35bcb2 100644
--- a/Debian/readme.md
+++ b/Debian/readme.md
@@ -1,12 +1,72 @@
-Ubuntu Installer Documentation
+NGHDL Installer (Ubuntu)
====
-It contains all the documenation for installers on Ubuntu 14.04 and above.
-Separate installers are required to resolve dependencies only of GHDL and are mentioned below.
+It contains all the documenation for making NGHDL executable (using PyInstaller) and NGHDL Installation Script on Ubuntu 14.04 and above.
+Separate installers are required to resolve dependencies only for GHDL and are mentioned below.
-## Differences in Ubuntu 14.04, Ubuntu 16.04 and above installers:
+## NGDHL EXECUTABLE:
+
+1. Download `virtualenv` package as:
+
+ $ pip install virtualenv
+
+2. Create a virtual environment as:
+
+ $ virtualenv -p /usr/bin/python3 nghdl
+
+3. Activate the virtual environment as:
+
+ $ source nghdl/bin/activate
+
+4. Install all Python dependencies for eSim within the virtual environment as:
+
+ $ pip install pyinstaller
+ $ pip install --upgrade 'setuptools<45.0.0'
+ $ sudo apt install build-essential python3-dev libqt4-dev qt4-dev-tools
+ $ mkdir nghdl/build
+ $ cd nghdl/build/
+ $ wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.12.3/PyQt4_gpl_x11-4.12.3.tar.gz
+ $ wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.21/sip-4.19.21.tar.gz
+ $ tar xzvf sip-4.19.21.tar.gz
+ $ tar xvzf PyQt4_gpl_x11-4.12.3.tar.gz
+ $ cd sip-4.19.21/
+ $ python configure.py --sip-module PyQt4.sip
+ $ make
+ $ make install
+ $ cd ../PyQt4_gpl_x11-4.12.3/
+ $ python configure.py
+ $ make
+ $ make install
+
+5. Now uninstall PyQt4, sip, matplotlib, numpy, dateutil and cycler globally (if any).
+
+6. Test whether only nghdl dependencies are available or not:
+
+ $ pip freeze
+
+> Note : Following dependencies should be available -
+> - PyQt4
+> - sip
+
+7. Create spec file as:
+
+ $ pyi-makespec --onefile <path_to_nghdl>/src/ngspice_ghdl.py
+
+8. Add `PyQt4.sip` as hiddenimports in the generated spec file.
+
+9. Change the `exe` name field to `nghdl` in the generated spec file.
+
+10. Create onefile executable using pyinstaller as:
+
+ $ pyinstaller -F --clean Application.spec
+
+11. Verify whether all `*.py` files have been included in `Analysis-00.toc` file under the build folder generated by PyInstaller.
+
+
+
+## Differences in Ubuntu 14.04, Ubuntu 16.04 and above installers (w.r.t GHDL):
1. Dependency on gnat :
- Ubuntu 14.04 : gnat (v4.6)
- Ubuntu 16.04 : gnat-5 (v5.4)
diff --git a/readme.md b/readme.md
index 20f4553..b86b7c3 100644
--- a/readme.md
+++ b/readme.md
@@ -7,8 +7,9 @@ It contains all the documenation for making installations on various platforms.
## How to package NGHDL with eSim?
1. Add GHDL executable and the corresponding installer for the target OS in the `nghdl` folder.
-> Note : Instructions on how to generate GHDL executable and distribute it are provided under
-> respective target OS directory.
+> Note : Instructions on how to generate NGHDL executable and distribute it along with GHDL are
+> provided under respective target OS directory.
2. Rename `nghdl` folder as `nghdl-master` and compress it to `.zip` format.
+
3. Place this compressed file in `eSim-<version>` folder.