diff options
Diffstat (limited to 'Windows')
-rw-r--r-- | Windows/MinGW+MSYS.md | 27 | ||||
-rw-r--r-- | Windows/NSISplugins/CPUFeatures.2013-02-26.zip | bin | 0 -> 92286 bytes | |||
-rw-r--r-- | Windows/NSISplugins/EnVar_plugin.zip | bin | 0 -> 33630 bytes | |||
-rw-r--r-- | Windows/NSISplugins/Nsis7z_19.00.7z | bin | 0 -> 461078 bytes | |||
-rw-r--r-- | Windows/NSISplugins/ZipDLL (1).zip | bin | 0 -> 379356 bytes | |||
-rw-r--r-- | Windows/README.md | 107 | ||||
-rw-r--r-- | Windows/installnghdl.nsi | 190 | ||||
-rw-r--r-- | Windows/sources/MSYS.7z | bin | 0 -> 8449807 bytes | |||
-rw-r--r-- | Windows/sources/ghdl.7z | bin | 0 -> 10968564 bytes | |||
-rw-r--r-- | Windows/sources/mingw64.7z | bin | 0 -> 16720325 bytes |
10 files changed, 324 insertions, 0 deletions
diff --git a/Windows/MinGW+MSYS.md b/Windows/MinGW+MSYS.md new file mode 100644 index 0000000..d2f682a --- /dev/null +++ b/Windows/MinGW+MSYS.md @@ -0,0 +1,27 @@ +# MinGW + MSYS - Build environment for Ngspice on Windows +> MSYS provides a Linux like shell and all the utilities required during the configure-make-make install process of Ngspice on Windows. + +> MinGW provides the GCC compiler required to build the Ngspice executable. + +[Download MinGW (unmodified)](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z)\ +[Download MSYS (unmodified)](https://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/MSYS-20111123.zip/download) + +**Reduced versions of MinGW and MSYS for NGHDL can be found in this repository under `sources/` folder.** + +## Usage of MinGW + MSYS +1. Add `/mingw64/bin/` and `/mingw64/msys/bin` to the path so that all the utilities are able to find each other. +2. Open Windows command prompt at the location you want to use `MinGW + MSYS`. +3. Execute the command to launch `bash` provided by MSYS at this location. + ```sh + > pathtoMSYS/bin/bash.exe + ``` + 4. This comand launches bash in the CMD window which can then be used as `BASH shell`, with commands similar to Linux. + + +## Reduction of MinGW + MSYS +> Originally MinGW and MSYS are provided for a large variety of development scenarios which are not required by NGHDL, causing size overheads in the final distribution. + +1. To remove unrequired parts of MSYS and MinGW, a trial and error based approach is to be followed. + +2. To start, both utilities should be reduced to the bare minimum required components which can be noted by studying the Ngspice configure file `(/ngspice/configure)`. +The rest of the utilities are to added by accessing the errors in the logs provided during the configure-make-make install process. diff --git a/Windows/NSISplugins/CPUFeatures.2013-02-26.zip b/Windows/NSISplugins/CPUFeatures.2013-02-26.zip Binary files differnew file mode 100644 index 0000000..2f701d8 --- /dev/null +++ b/Windows/NSISplugins/CPUFeatures.2013-02-26.zip diff --git a/Windows/NSISplugins/EnVar_plugin.zip b/Windows/NSISplugins/EnVar_plugin.zip Binary files differnew file mode 100644 index 0000000..cdee545 --- /dev/null +++ b/Windows/NSISplugins/EnVar_plugin.zip diff --git a/Windows/NSISplugins/Nsis7z_19.00.7z b/Windows/NSISplugins/Nsis7z_19.00.7z Binary files differnew file mode 100644 index 0000000..78d88ab --- /dev/null +++ b/Windows/NSISplugins/Nsis7z_19.00.7z diff --git a/Windows/NSISplugins/ZipDLL (1).zip b/Windows/NSISplugins/ZipDLL (1).zip Binary files differnew file mode 100644 index 0000000..f5c4fc0 --- /dev/null +++ b/Windows/NSISplugins/ZipDLL (1).zip diff --git a/Windows/README.md b/Windows/README.md new file mode 100644 index 0000000..f63e717 --- /dev/null +++ b/Windows/README.md @@ -0,0 +1,107 @@ +NGHDL Installer (Windows OS)
+====
+
+
+It contains all the documenation for making NGHDL executable (using PyInstaller) and packging for eSim Installation Script on Windows 7 and above.
+
+
+## NGHDL Executable:
+
+1. Download and install "Python-3.5.2", "Git For Windows". Use "Git Bash" for all following shell commands.
+
+ Reference - https://gitforwindows.org/
+
+2. Add alias to python.exe in Git shell:
+
+ $ alias python='winpty python.exe' #Need to be done for each new shell created
+
+3. Download `virtualenv` package as:
+
+ $ pip install virtualenv
+
+4. Create a virtual environment as:
+
+ $ python -m virtualenv nghdl
+
+5. Activate the virtual environment as:
+
+ $ source nghdl/Scripts/activate
+
+6. Install all Python dependencies for NGHDL within the virtual environment as:
+
+ - Install PyInstaller, SetupTools through pip :
+
+ $ pip install pyinstaller
+ $ pip install --upgrade 'setuptools<45.0.0'
+
+ - Install PyQt4 through pip (Reference - https://stackoverflow.com/questions/22640640/how-to-install-pyqt4-on-windows-using-pip) :
+
+ $ pip install --upgrade 'sip<5.0.0'
+ $ pip install <wheel_package_of_PyQt4>
+
+ Download PyQt4 Wheel from - [https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4]
+ Where cp37 represents the Python version i.e. 3.7.x and so on
+
+ > Note :
+ - If there are any issues regarding loading of DLL files, refer : https://stackoverflow.com/questions/2738879/cannot-import-pyqt4-qtgui
+ - If above step works, then goto step 7.
+
+7. Test whether only NGHDL dependencies are available or not:
+
+ $ pip freeze
+
+> Note : Following dependencies should be available -
+> - PyQt4
+> - sip
+> - altgraph
+> - future
+> - pefile
+> - pyinstaller
+> - pywin32-ctypes
+
+
+8. Create spec file as:
+
+ $ pyi-makespec --onefile -n nghdl <path_to_nghdl>/src/ngspice_ghdl.py
+
+9. Create onefile executable using pyinstaller as:
+
+ $ pyinstaller -F --clean nghdl.spec
+
+10. Verify whether all NGHDL `src` files (`*.py`) have been included in `Analysis-00.toc` file under the build folder generated by PyInstaller.
+11. nghdl.exe is generated at the dist folder.
+
+
+
+## How to package NGHDL with eSim ?
+
+1. Place the nghdl.exe generated from the above process at the location /nghdl/src/
+
+2. Delete all python files (files ending in .py) at /nghdl/src/
+
+3. Remove the following files at /nghdl/
+ - .gitignore
+ - GHDLside.md
+ - Workflow.md
+
+4. Place **nghdl** folder containing `src folder`, `Example folder` & `LICENSE` under folder named eSim/
+
+5. Final directory structure should be:
+- eSim/nghdl/Example
+- eSim/nghdl/src
+- eSim/nghdl/LICENSE
+
+6. Compress the `eSim` folder from step 4 in 7z format (Make sure that there is folder named `eSim` inside this compressed file) and name it as `nghdl-src.7z`.\
+(7z compression tool can be downloaded from - https://www.7-zip.org/download.html )
+
+7. ALong with `nghdl-src.7z` from step 5, place the following 7z files at the installer folder for eSim.
+(these can be obtained under *sources/* folder in the repository )
+- ghdl.7z
+- MSYS.7z
+- mingw64.7z
+
+- ngspice-nghdl.7z ( this file can be obtained by decompressing `ngspice-nghdl.tar.xz` file present at `master branch` of this repository and recompressing using 7z tool)
+
+8. Place the script `installnghdl.nsi` at the eSim installer location.
+
+9. Follow the rest of the instructions for packging eSim [https://github.com/FOSSEE/eSim/tree/installers/Windows] and compile the NSI script (`esim-setup-script.nsi` file). Now only use the generated installer for distribution.
diff --git a/Windows/installnghdl.nsi b/Windows/installnghdl.nsi new file mode 100644 index 0000000..2d5de99 --- /dev/null +++ b/Windows/installnghdl.nsi @@ -0,0 +1,190 @@ +!include "CPUFeatures.nsh"
+!include "zipdll.nsh"
+
+;-----------------------------------------------------------------------------------------
+; String replacement function
+!define StrRep "!insertmacro StrRep"
+!macro StrRep output string old new
+ Push `${string}`
+ Push `${old}`
+ Push `${new}`
+ !ifdef __UNINSTALL__
+ Call un.StrRep
+ !else
+ Call StrRep
+ !endif
+ Pop ${output}
+!macroend
+
+!macro Func_StrRep un
+ Function ${un}StrRep
+ Exch $R2 ;new
+ Exch 1
+ Exch $R1 ;old
+ Exch 2
+ Exch $R0 ;string
+ Push $R3
+ Push $R4
+ Push $R5
+ Push $R6
+ Push $R7
+ Push $R8
+ Push $R9
+
+ StrCpy $R3 0
+ StrLen $R4 $R1
+ StrLen $R6 $R0
+ StrLen $R9 $R2
+ loop:
+ StrCpy $R5 $R0 $R4 $R3
+ StrCmp $R5 $R1 found
+ StrCmp $R3 $R6 done
+ IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
+ Goto loop
+ found:
+ StrCpy $R5 $R0 $R3
+ IntOp $R8 $R3 + $R4
+ StrCpy $R7 $R0 "" $R8
+ StrCpy $R0 $R5$R2$R7
+ StrLen $R6 $R0
+ IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
+ Goto loop
+ done:
+
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Push $R0
+ Push $R1
+ Pop $R0
+ Pop $R1
+ Pop $R0
+ Pop $R2
+ Exch $R1
+ FunctionEnd
+!macroend
+!insertmacro Func_StrRep ""
+!insertmacro Func_StrRep "un."
+;-----------------------------------------------------------------------------------------
+
+;-----------------------------------------------------------------------------------------
+; NGHDL installation macro
+Section "nghdl-loadsource"
+ SetOutPath $EXEDIR
+
+ File "ghdl.7z"
+ File "mingw64.7z"
+ File "MSYS.7z"
+ File "nghdl-src.7z"
+ File "ngspice-nghdl.7z"
+SectionEnd
+
+Section "nghdl-src"
+ SetOutPath $INSTDIR
+ Nsis7z::ExtractWithDetails "$EXEDIR\nghdl-src.7z" "Extracting NGHDL %s..."
+ EnVar::SetHKLM
+ DetailPrint "EnVar::SetHKLM"
+ EnVar::AddValue "Path" "$INSTDIR\eSim\nghdl\src"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+ Delete "$EXEDIR\nghdl-src.7z"
+SectionEnd
+
+Section "nghdl-mingw"
+ SetOutPath $INSTDIR
+ Nsis7z::ExtractWithDetails "$EXEDIR\mingw64.7z" "Extracting MinGW %s..."
+ EnVar::SetHKLM
+ EnVar::AddValue "Path" "$INSTDIR\mingw64\bin"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+ Delete "$EXEDIR\mingw64.7z"
+SectionEnd
+
+Section "nghdl-msys"
+ SetOutPath $INSTDIR\mingw64
+ Nsis7z::ExtractWithDetails "$EXEDIR\MSYS.7z" "Extracting MSYS %s..."
+ EnVar::SetHKLM
+ EnVar::AddValue "Path" "$INSTDIR\mingw64\msys\bin"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+ Delete "$EXEDIR\MSYS.7z"
+SectionEnd
+
+Section "nghdl-GHDL"
+ SetOutPath $INSTDIR\mingw64
+ Nsis7z::ExtractWithDetails "$EXEDIR\ghdl.7z" "Extracting GHDL %s..."
+ EnVar::SetHKLM
+ EnVar::AddValue "Path" "$INSTDIR\mingw64\GHDL\bin"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+ Delete "$EXEDIR\ghdl.7z"
+SectionEnd
+
+Section "envar-refresh"
+ ReadEnvStr $R0 "PATH"
+ StrCpy $R0 "$R0;$INSTDIR\eSim\nghdl\src;$INSTDIR\mingw64\bin;$INSTDIR\mingw64\msys\bin;$INSTDIR\mingw64\GHDL\bin;"
+ System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("PATH", R0).r0'
+SectionEnd
+
+
+Section "nghdl-installNgspice"
+ SetOutPath $INSTDIR
+ Nsis7z::ExtractWithDetails "$EXEDIR\ngspice-nghdl.7z" "Extracting GHDL %s..."
+
+ CopyFiles $INSTDIR\eSim\nghdl\src\outitf.c $INSTDIR\ngspice-nghdl\src\frontend
+
+ CopyFiles $INSTDIR\mingw64\x86_64-w64-mingw32\lib\libws2_32.a $INSTDIR\eSim\nghdl\src\ghdlserver
+
+ SetOutPath $INSTDIR\ngspice-nghdl
+ CreateDirectory $INSTDIR\ngspice-nghdl\release
+ SetOutPath $INSTDIR\ngspice-nghdl\release
+
+ Var /GLOBAL shellpath
+ Var /GLOBAL shellpath1
+ Var /GLOBAL cpucores
+
+ ${CPUFeatures.GetCount} $cpucores
+
+ StrCpy $shellpath $INSTDIR
+
+ ${StrRep} '$shellpath1' '$shellpath' '\' '/'
+
+ FileOpen $0 "$INSTDIR\ngspice-nghdl\release\installngspice.sh" w
+ FileWrite $0 `../configure --with-wingui --enable-xspice --disable-debug --prefix=$shellpath1/ngspice-nghdl/install_dir --exec-prefix=$shellpath1/ngspice-nghdl/install_dir &&$\n`
+ FileWrite $0 `make -j$cpucores &&$\n`
+ FileWrite $0 `make install$\n`
+ FileClose $0
+
+ nsExec::ExecToLog "$INSTDIR\mingw64\msys\bin\bash.exe installngspice.sh"
+ Delete "$EXEDIR\ngspice-nghdl.7z"
+ Delete $INSTDIR\ngspice-nghdl\release\installngspice.sh
+
+ SetOutPath $INSTDIR
+
+ EnVar::SetHKLM
+ EnVar::AddValue "Path" "$INSTDIR\ngspice-nghdl\install_dir\bin"
+ Pop $0
+ DetailPrint "EnVar::AddValue returned=|$0|"
+
+SectionEnd
+
+Section "nghdl-config.ini"
+ CreateDirectory $PROFILE\.nghdl
+ FileOpen $0 "$PROFILE\.nghdl\config.ini" w
+ FileWrite $0 `[NGSPICE]$\n`
+ FileWrite $0 `NGSPICE_HOME = $INSTDIR\ngspice-nghdl$\n`
+ FileWrite $0 `DIGITAL_MODEL = %(NGSPICE_HOME)s\src\xspice\icm\ghdl$\n`
+ FileWrite $0 `RELEASE = %(NGSPICE_HOME)s\release$\n`
+ FileWrite $0 `[SRC]$\n`
+ FileWrite $0 `SRC_HOME = $INSTDIR\eSim\nghdl$\n`
+ FileWrite $0 `LICENSE = %(SRC_HOME)s\LICENSE$\n`
+ FileWrite $0 `[COMPILER]$\n`
+ FileWrite $0 `MSYS_HOME = $INSTDIR\mingw64\msys\bin$\n`
+ FileClose $0
+SectionEnd
+
+;-------------------------------------------------------------------------------------
diff --git a/Windows/sources/MSYS.7z b/Windows/sources/MSYS.7z Binary files differnew file mode 100644 index 0000000..c113d5f --- /dev/null +++ b/Windows/sources/MSYS.7z diff --git a/Windows/sources/ghdl.7z b/Windows/sources/ghdl.7z Binary files differnew file mode 100644 index 0000000..f403f6e --- /dev/null +++ b/Windows/sources/ghdl.7z diff --git a/Windows/sources/mingw64.7z b/Windows/sources/mingw64.7z Binary files differnew file mode 100644 index 0000000..41b0a98 --- /dev/null +++ b/Windows/sources/mingw64.7z |