From 5ec2a74bcedd99d9f2c06e72e539c8a603a86a68 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Thu, 7 Jan 2021 07:28:54 +0530 Subject: updated Ngspice installation and upgradation process --- Ngspice_Version_Change.md | 50 +++++++++++++++++++++++++++++---------- Windows/sources/ngspice-nghdl.7z | Bin 0 -> 6709844 bytes 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 Windows/sources/ngspice-nghdl.7z diff --git a/Ngspice_Version_Change.md b/Ngspice_Version_Change.md index 8f3fda1..8adbd91 100644 --- a/Ngspice_Version_Change.md +++ b/Ngspice_Version_Change.md @@ -1,10 +1,12 @@ # Changes for Ngspice version upgrade -1. Manually add the GHDL server close patch (header files and `close_server` function at the appropriate location) in the `outitf.c` which comes with the new Ngspice version. +1. Download the source code for the new Ngspice version and rename its top-level directory as `ngspice-nghdl`. -> Note: Compare with previous version of NGHDL `outitf.c` file for applying the patch. +2. Manually add the GHDL server close patch (Necessary C headers and `close_server` function at the appropriate location) in the `outitf.c` which comes with the new Ngspice version. -2. Call this function `close_server()` in `outitf.c` before the line: + > Note: Intelligently compare with previous version of NGHDL `outitf.c` file for applying the patch. + +3. Call this function `close_server()` in `outitf.c` before the line: ```c fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount); @@ -16,12 +18,11 @@ occurring in following two functions of `outitf.c` (may not be same in the futur and ```c static void plotEnd(runDesc *run) -``` -> Note: -> 1. Do not replace old `outitf.c` with the `outitf.c` in the new Ngspice version. -> 2. Make sure to maintain OS independence of the code, that is same code file for Windows and Linux. +``` -3. Similarly, manually add patch for identification of Mingw and linking of `libws2_32.a` to `makedefs.in` at *`/ngspice/src/xspice/icm`* **after the line `LIBS = -lm`** (important) +4. Replace the old `outitf.c` at `src` directory of `master` branch of `nghdl` repository with this newly patched version of `outitf.c` file. + +5. Similarly, manually add following patch for identification of Mingw and linking of `libws2_32.a` to `makedefs.in` at *`ngspice-nghdl/src/xspice/icm`* **after the line `LIBS = -lm`** (important) ```make ISMINGW = $(shell uname | grep -c "MINGW64") ifeq ($(ISMINGW), 1) @@ -39,7 +40,7 @@ and endif ``` -4. Add patch for linking `libws2_32.a` in Windows OS at `Makefile.in` at *`/ngspice/src/`* by modifying the line: +6. Add patch for linking `libws2_32.a` in Windows OS at `Makefile.in` at *`ngspice-nghdl/src/`* by modifying the line: ```make @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi ``` @@ -48,7 +49,7 @@ To @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi -lws2_32 ``` -5. Add GHDL codemodel to the spinit.in file at *`/ngspice/src/`* as an addition to the section: +7. Add GHDL codemodel to the spinit.in file at *`ngspice-nghdl/src/`* as an addition to the section: ```make * The other codemodels ``` @@ -56,7 +57,7 @@ with the line: ```make @XSPICEINIT@ codemodel @pkglibdir@/ghdl.cm ``` -and in `GNUmakefile.in` at *`/ngspice/src/xspice/icm`* by replacing the line: +and in `GNUmakefile.in` at *`ngspice-nghdl/src/xspice/icm`* by replacing the line: ```make CMDIRS = spice2poly digital analog xtradev xtraevt table ``` @@ -65,4 +66,29 @@ with CMDIRS = spice2poly digital analog xtradev xtraevt table ghdl ``` -6. Create a **`ghdl` folder** with two empty files named `modpath.lst` and `udnpath.lst` at the location *`/ngspice/src/xspice/icm/`* +8. Create a **`ghdl` directory** with two empty files named `modpath.lst` and `udnpath.lst` at the location *`ngspice-nghdl/src/xspice/icm/`* + +> Note: For Ubuntu OS, now compress this new version of Ngspice to `ngspice-nghdl.tar.xz` file and replace the existing older tar file at the `master` branch of this repository. + + +## Following procedures are specific only to Windows OS: + +9. Now build and generate Ngspice executable on Windows OS with the following command in a bash shell: + +```console + $ mkdir release + $ mkdir install_dir + $ cd release + $ ../configure --with-wingui --enable-xspice --disable-debug --prefix=/ngspice-nghdl/install_dir --exec-prefix=/ngspice-nghdl/install_dir + $ make + $ make install +``` +> Note: MSYS + MinGW environment must be setup before building Ngspice. Refer this [documentation](Windows/MinGW+MSYS.md) for the same. + +10. Move the generated ghdl code model from `ngspice-nghdl/release/src/xspice/icm/ghdl.cm` to the `ngspice-nghdl/lib/ngspice/` directory. + +11. Download Ngspice which is readily available to be used directly on Windows OS. Now, intelligently merge this downloaded version with the built version (from step 9) except the `ngspice-nghdl/bin` directory. + +12. Extract the `ngspice-nghdl.7z` from `Windows/sources/` directory of `installers` branch of this repository. Make the directory structure of the merged version (from step 10) similar to that of this extacted older version. + +13. Now, compress this new structured version of Ngspice to a `.7z` format and replace the existing older `ngspice-nghdl.7z` at `Windows/sources/` directory of `installers` branch of this repository. diff --git a/Windows/sources/ngspice-nghdl.7z b/Windows/sources/ngspice-nghdl.7z new file mode 100644 index 0000000..b396af1 Binary files /dev/null and b/Windows/sources/ngspice-nghdl.7z differ -- cgit From de95e1550c835e9a2b99597b6b9b43adc23d1f2a Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Thu, 7 Jan 2021 07:30:59 +0530 Subject: added nghdl installer scripts --- Windows/installnghdl.nsi | 190 ----------------------------------------- Windows/nghdl-setup-script.nsi | 190 +++++++++++++++++++++++++++++++++++++++++ Windows/nghdl.spec | 33 +++++++ 3 files changed, 223 insertions(+), 190 deletions(-) delete mode 100644 Windows/installnghdl.nsi create mode 100644 Windows/nghdl-setup-script.nsi create mode 100644 Windows/nghdl.spec diff --git a/Windows/installnghdl.nsi b/Windows/installnghdl.nsi deleted file mode 100644 index 2d5de99..0000000 --- a/Windows/installnghdl.nsi +++ /dev/null @@ -1,190 +0,0 @@ -!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/nghdl-setup-script.nsi b/Windows/nghdl-setup-script.nsi new file mode 100644 index 0000000..a9807af --- /dev/null +++ b/Windows/nghdl-setup-script.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 Ngspice %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 $INSTDIR\ngspice-nghdl\release\installngspice.sh + Delete "$EXEDIR\ngspice-nghdl.7z" + + SetOutPath $INSTDIR + + EnVar::SetHKLM + EnVar::AddValue "Path" "$INSTDIR\ngspice-nghdl\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/nghdl.spec b/Windows/nghdl.spec new file mode 100644 index 0000000..23ebcbc --- /dev/null +++ b/Windows/nghdl.spec @@ -0,0 +1,33 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + + +a = Analysis(['src\\ngspice_ghdl.py'], + pathex=['C:\\Users\\admin\\Desktop\\FOSSEE-eSim\\nghdl-build'], + binaries=[], + datas=[], + hiddenimports=[], + 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 ) -- cgit From eb5e69f8ebf2b0eaedbd142d286fbd845d181c58 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Thu, 7 Jan 2021 20:44:29 +0530 Subject: Update Ngspice_Version_Change.md --- Ngspice_Version_Change.md | 122 +++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/Ngspice_Version_Change.md b/Ngspice_Version_Change.md index 8adbd91..afab85a 100644 --- a/Ngspice_Version_Change.md +++ b/Ngspice_Version_Change.md @@ -8,87 +8,87 @@ 3. Call this function `close_server()` in `outitf.c` before the line: -```c - fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount); -``` -occurring in following two functions of `outitf.c` (may not be same in the future): -```c - static void fileEnd(runDesc *run) -``` -and -```c - static void plotEnd(runDesc *run) -``` + ```c + fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount); + ``` + occurring in following two functions of `outitf.c` (may not be same in the future): + ```c + static void fileEnd(runDesc *run) + ``` + and + ```c + static void plotEnd(runDesc *run) + ``` 4. Replace the old `outitf.c` at `src` directory of `master` branch of `nghdl` repository with this newly patched version of `outitf.c` file. 5. Similarly, manually add following patch for identification of Mingw and linking of `libws2_32.a` to `makedefs.in` at *`ngspice-nghdl/src/xspice/icm`* **after the line `LIBS = -lm`** (important) -```make - ISMINGW = $(shell uname | grep -c "MINGW64") - ifeq ($(ISMINGW), 1) - LIBS = -lm -lws2_32 - endif - - ISMINGW = $(shell uname | grep -c "MINGW32") - ifeq ($(ISMINGW), 1) - LIBS = -lm -lws2_32 - endif - - ISMINGW = $(shell uname | grep -c "MSYS") - ifeq ($(ISMINGW), 1) - LIBS = -lm -lws2_32 - endif -``` + ```make + ISMINGW = $(shell uname | grep -c "MINGW64") + ifeq ($(ISMINGW), 1) + LIBS = -lm -lws2_32 + endif + + ISMINGW = $(shell uname | grep -c "MINGW32") + ifeq ($(ISMINGW), 1) + LIBS = -lm -lws2_32 + endif + + ISMINGW = $(shell uname | grep -c "MSYS") + ifeq ($(ISMINGW), 1) + LIBS = -lm -lws2_32 + endif + ``` 6. Add patch for linking `libws2_32.a` in Windows OS at `Makefile.in` at *`ngspice-nghdl/src/`* by modifying the line: -```make - @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi -``` -To -```make - @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi -lws2_32 -``` + ```make + @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi + ``` + To + ```make + @WINGUI_TRUE@am__append_19 = -lpsapi -lShlwapi -lws2_32 + ``` 7. Add GHDL codemodel to the spinit.in file at *`ngspice-nghdl/src/`* as an addition to the section: -```make - * The other codemodels -``` -with the line: -```make - @XSPICEINIT@ codemodel @pkglibdir@/ghdl.cm -``` -and in `GNUmakefile.in` at *`ngspice-nghdl/src/xspice/icm`* by replacing the line: -```make - CMDIRS = spice2poly digital analog xtradev xtraevt table -``` -with -```make - CMDIRS = spice2poly digital analog xtradev xtraevt table ghdl -``` + ```make + * The other codemodels + ``` + with the line: + ```make + @XSPICEINIT@ codemodel @pkglibdir@/ghdl.cm + ``` + and in `GNUmakefile.in` at *`ngspice-nghdl/src/xspice/icm`* by replacing the line: + ```make + CMDIRS = spice2poly digital analog xtradev xtraevt table + ``` + with + ```make + CMDIRS = spice2poly digital analog xtradev xtraevt table ghdl + ``` 8. Create a **`ghdl` directory** with two empty files named `modpath.lst` and `udnpath.lst` at the location *`ngspice-nghdl/src/xspice/icm/`* -> Note: For Ubuntu OS, now compress this new version of Ngspice to `ngspice-nghdl.tar.xz` file and replace the existing older tar file at the `master` branch of this repository. + > Note: For Ubuntu OS, now compress this new version of Ngspice to `ngspice-nghdl.tar.xz` file and replace the existing older tar file at the `master` branch of this repository. ## Following procedures are specific only to Windows OS: 9. Now build and generate Ngspice executable on Windows OS with the following command in a bash shell: -```console - $ mkdir release - $ mkdir install_dir - $ cd release - $ ../configure --with-wingui --enable-xspice --disable-debug --prefix=/ngspice-nghdl/install_dir --exec-prefix=/ngspice-nghdl/install_dir - $ make - $ make install -``` -> Note: MSYS + MinGW environment must be setup before building Ngspice. Refer this [documentation](Windows/MinGW+MSYS.md) for the same. + ```console + $ mkdir release + $ mkdir install_dir + $ cd release + $ ../configure --with-wingui --enable-xspice --disable-debug --prefix=/ngspice-nghdl/install_dir --exec-prefix=/ngspice-nghdl/install_dir + $ make + $ make install + ``` + > Note: MSYS + MinGW environment must be setup before building Ngspice. Refer this [documentation](Windows/MinGW+MSYS.md) for the same. 10. Move the generated ghdl code model from `ngspice-nghdl/release/src/xspice/icm/ghdl.cm` to the `ngspice-nghdl/lib/ngspice/` directory. -11. Download Ngspice which is readily available to be used directly on Windows OS. Now, intelligently merge this downloaded version with the built version (from step 9) except the `ngspice-nghdl/bin` directory. +11. Download Ngspice which is readily available to be used directly on Windows OS. Now, intelligently merge this downloaded version with the built version (from step 10) except the `ngspice-nghdl/bin` directory. -12. Extract the `ngspice-nghdl.7z` from `Windows/sources/` directory of `installers` branch of this repository. Make the directory structure of the merged version (from step 10) similar to that of this extacted older version. +12. Extract the `ngspice-nghdl.7z` from `Windows/sources/` directory of `installers` branch of this repository. Make the directory structure of the merged version (from step 11) similar to that of this extacted older version. 13. Now, compress this new structured version of Ngspice to a `.7z` format and replace the existing older `ngspice-nghdl.7z` at `Windows/sources/` directory of `installers` branch of this repository. -- cgit From 91efdb04217204a5af41d1cb6e4ca71f70ab6a89 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Thu, 7 Jan 2021 20:47:29 +0530 Subject: updated packaging instructions --- Windows/README.md | 79 ++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/Windows/README.md b/Windows/README.md index f63e717..c01c147 100644 --- a/Windows/README.md +++ b/Windows/README.md @@ -1,13 +1,15 @@ NGHDL Installer (Windows OS) ==== +It contains all the documentation for making NGHDL executable (using PyInstaller) and packging NGHDL for Windows 7 and above. -It contains all the documenation for making NGHDL executable (using PyInstaller) and packging for eSim Installation Script on Windows 7 and above. +> Note: Do not develop NGHDL on Windows OS. Work only with `installers` branch on Windows OS and do development on Linux OS. +> Reference : https://stackoverflow.com/questions/37672886/cannot-get-rid-of-unstaged-files-in-git-on-my-local ## NGHDL Executable: -1. Download and install "Python-3.5.2", "Git For Windows". Use "Git Bash" for all following shell commands. +1. Download and install "Python-3.6.8", "Git For Windows". Use "Git Bash" for all following shell commands. Ensure that `tcl/tk` (`tkinter`) is also installed with Python as it is required by `matplotlib` dependency Reference - https://gitforwindows.org/ @@ -27,38 +29,20 @@ It contains all the documenation for making NGHDL executable (using PyInstaller) $ source nghdl/Scripts/activate -6. Install all Python dependencies for NGHDL within the virtual environment as: - - - Install PyInstaller, SetupTools through pip : +6. Install the Python dependencies `PyInstaller`, `SetupTools`, `PyQt5` through pip for NGHDL within the virtual environment: $ 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 - - 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. + $ pip install setuptools + $ pip install PyQt5 7. Test whether only NGHDL dependencies are available or not: $ pip freeze -> Note : Following dependencies should be available - -> - PyQt4 -> - sip -> - altgraph -> - future -> - pefile +> Note: Following Python packages for NGHDL along with their dependencies should be available - +> - PyQt5 +> - PyQt5-sip > - pyinstaller -> - pywin32-ctypes - 8. Create spec file as: @@ -69,39 +53,40 @@ It contains all the documenation for making NGHDL executable (using PyInstaller) $ 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/ +1. Take the `master` branch of NGHDL. Rename the folder to `nghdl`. -3. Remove the following files at /nghdl/ - - .gitignore +2. Place the NGHDL executable (`nghdl.exe`) at the location `nghdl/src/`. Also, remove following files from the `nghdl` folder: + - `.git` folder + - python files from `nghdl/src` folder + - .gitignore - GHDLside.md - Workflow.md + - ngspice-nghdl.tar.xz (Move it outside the folder as it is required later on) -4. Place **nghdl** folder containing `src folder`, `Example folder` & `LICENSE` under folder named eSim/ +3. Place this **nghdl** folder containing `src` folder, `Example` folder, `LICENSE` file and `README.md` under folder named `eSim`. -5. Final directory structure should be: -- eSim/nghdl/Example -- eSim/nghdl/src -- eSim/nghdl/LICENSE +4. Final directory structure should be: + - eSim/nghdl/Example + - eSim/nghdl/src + - eSim/nghdl/LICENSE + - eSim/nghdl/README.md -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 ) +5. 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 +6. Along with `nghdl-src.7z` from step 5, place the following 7z files at the installer folder for eSim: + - ghdl.7z + - MSYS.7z + - mingw64.7z + - ngspice-nghdl.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) +> Note: These compressed files can be obtained under *Windows/sources/* folder of NGHDL's `installers` branch -8. Place the script `installnghdl.nsi` at the eSim installer location. +7. Place the script `nghdl-setup-script.nsi` at the eSim's installer folder. -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. +8. Follow rest of the [instructions](https://github.com/FOSSEE/eSim/tree/installers/Windows/README.md) for packaging eSim. -- cgit