summaryrefslogtreecommitdiff
path: root/Windows/esim-setup-script.nsi
blob: a4456c7df37ef3822fa0c0f77a781857866c90c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
;NSIS Modern User Interface
;Start Menu Folder Selection Example Script
;Modified by Fahim Khan, Saurabh Bansode
;Made by eSim Team, FOSSEE, IIT Bombay

;--------------------------------
;Include Modern UI

 !include "MUI2.nsh"
 !include "ZipDLL.nsh"
 !include "EnvVarUpdate.nsh"
 !include "x64.nsh"
;--------------------------------

;General

;Name and file
	;Name "eSim"
	;OutFile "eSim-Installer.exe"
	
!define PRODUCT_NAME "eSim"
!define PRODUCT_VERSION "1.1.2"
!define PRODUCT_PUBLISHER "FOSSEE"
!define PRODUCT_WEB_SITE "http://fossee.in"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
	
  
;Default installation folder
  InstallDir "C:\"
  
;Get installation folder from registry if available
  InstallDirRegKey HKLM "Software\eSim" ""

;Request application privileges for Windows Vista
  RequestExecutionLevel admin
  
;--------------------------------
;Variables
  Var StartMenuFolder
 
;--------------------------------
;Interface Settings
  !define MUI_ABORTWARNING
  !define Python_HOME "C:\Python33"
;--------------------------------

;Pages
  
  
  !insertmacro MUI_PAGE_LICENSE "LICENSE.rtf"
  !insertmacro MUI_PAGE_COMPONENTS
  !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-Installer.exe"


;Installer Sections
Section "Ngspice circuit simulator" SecDummy

  SetOutPath "$INSTDIR"
  
;ADD YOUR OWN FILES HERE...
;ZipDLL::extractall "$EXEDIR\spice.zip" "C:\"
;ZipDLL::extractall "$EXEDIR\six.zip" "C:\Python33"
;ZipDLL::extractall "$EXEDIR\dateutil.zip" "C:\Python33"
;ZipDLL::extractall "$EXEDIR\eSim.zip" "$INSTDIR\"

CopyFiles "$EXEDIR\spice" "C:\"
CopyFiles "$EXEDIR\six" "C:\Python33"
CopyFiles "$EXEDIR\dateutil" "C:\Python33"
CopyFiles "$EXEDIR\eSim" "$INSTDIR\"

;Copying Folder to install directory
SetOutPath "$INSTDIR\eSim"
;File /nonfatal /a /r "eSim\"



;Store installation folder
  WriteRegStr HKLM "Software\eSim" "" $INSTDIR
  
  
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    
;Create shortcuts
  ;create desktop shortcut
  CreateShortCut "$DESKTOP\eSim.lnk" "$INSTDIR\eSim\esim.bat" "" "$EXEDIR\logo.ico" "" SW_SHOWMINIMIZED
  
  !insertmacro MUI_STARTMENU_WRITE_END
 
SectionEnd

Section -Prerequisites
  ;SetOutPath $INSTDIR\Prerequisites
  
  MessageBox MB_OK "Installing Python" 
      ExecWait '"msiexec" /i "$EXEDIR\dependencies\python-3.3.0.msi"'
	  
  ;Setting Environment Variable for Python
  
  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "C:\Python33"
  
	
  
  MessageBox MB_OK "Installing PyQT4" 
      ExecWait "$EXEDIR\dependencies\PyQt4-4.10.4-gpl-Py3.3-Qt4.8.5-x32.exe"
  
 
	  
  MessageBox MB_OK "Installing Matplotlib" 
      ExecWait "$EXEDIR\dependencies\matplotlib-1.4.0.win32-py3.3.exe"
	  
  MessageBox MB_OK "Installing Numpy"
	  ExecWait "$EXEDIR\dependencies\numpy-1.9.0-win32-superpack-python3.3.exe"	  
	  
 ; MessageBox MB_OK "Installing Python-dateutil"
	;  ExecWait '"whlexec" /i "$EXEDIR\dependencies\python_dateutil-2.6.0-py2.py3-none-any.whl"'
	  
 ; MessageBox MB_OK "Installing dateutil for matplotlib"
	;  ExecWait "$EXEDIR\dependencies\python-dateutil-2.2.win32-py2.7.exe"
	  
; MessageBox MB_OK "Installing six for matplotlib"
;	  ExecWait '"whlexec" /i "$EXEDIR\dependencies\six-1.12.0-py2.py3-none-any.whl"'

 MessageBox MB_OK "Installing pyparsing for matplotlib"
	  ExecWait "$EXEDIR\dependencies\pyparsing-2.0.2.win32-py3.3.exe"
	 
 
 
  MessageBox MB_OK "Installing KiCad"
  ExecWait "$EXEDIR\dependencies\kicad-4.0.7-i686.exe"
  Goto endActiveSync
  endActiveSync:
 
  
  ${If} ${RunningX64}
		${EnvVarUpdate} $0 "PATH" "A" "HKLM" "C:\Program Files (x86)\KiCad\bin"
		CopyFiles "$EXEDIR\dependencies\library\*.lib" "C:\Program Files (x86)\KiCad\share\library"
		CopyFiles "$EXEDIR\dependencies\library\*.dcm" "C:\Program Files (x86)\KiCad\share\library"
		CopyFiles "$EXEDIR\dependencies\template\kicad.pro" "C:\Program Files (x86)\KiCad\share\template"
		
		CopyFiles "$EXEDIR\dependencies\library\*.lib" "C:\Program Files (x86)\KiCad\share\kicad\library"
		CopyFiles "$EXEDIR\dependencies\library\*.dcm" "C:\Program Files (x86)\KiCad\share\kicad\library"
		CopyFiles "$EXEDIR\dependencies\template\kicad.pro" "C:\Program Files (x86)\KiCad\share\kicad\template"
 ${Else}
		${EnvVarUpdate} $0 "PATH" "A" "HKLM" "C:\Program Files\KiCad\bin"
		CopyFiles "$EXEDIR\dependencies\library\*.lib" "C:\Program Files\KiCad\share\library"
		CopyFiles "$EXEDIR\dependencies\library\*.dcm" "C:\Program Files\KiCad\share\library"
		CopyFiles "$EXEDIR\dependencies\template\kicad.pro" "C:\Program Files\KiCad\share\template"
		
		CopyFiles "$EXEDIR\dependencies\library\*.lib" "C:\Program Files\KiCad\share\kicad\library"
		CopyFiles "$EXEDIR\dependencies\library\*.dcm" "C:\Program Files\KiCad\share\kicad\library"
		CopyFiles "$EXEDIR\dependencies\template\kicad.pro" "C:\Program Files\KiCad\share\kicad\template"
 ${EndIf}    
 
 ;Setting Env Variable for ngspice 
 ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "C:\spice\bin"
 
 
 
 
 SectionEnd
 
 Section -AdditionalIcons
  SetOutPath $INSTDIR
  CreateDirectory "$SMPROGRAMS\eSim"
  CreateShortCut "$SMPROGRAMS\eSim\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.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



  

  Delete "$INSTDIR\uninst.exe"
  ;Delete "$INSTDIR\eSim"
  

  Delete "$SMPROGRAMS\eSim\Uninstall.lnk"
  
  ${If} ${RunningX64}
		${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "C:\Program Files (x86)\KiCad\bin"
		
 ${Else}
		${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "C:\Program Files\KiCad\bin"
		
 ${EndIf}    
 
 ;Setting Env Variable for ngspice 
 ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "C:\spice\bin"

  RMDir "$SMPROGRAMS\eSim"
  RMDir /r "$INSTDIR\"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  SetAutoClose true
SectionEnd
 
 ;Descriptions

  ;Language strings
  ;LangString DESC_SecDummy ${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 ${SecDummy} $(DESC_SecDummy)
 ; !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
;--------------------------------