Initial commit of newLISP.
[newlisp.git] / guiserver / newlisp-gs.nsi
blob0dee195fd7165389f8eb7d75e21ac754f8e8fdb7
1 ; newlisp-gs.nsi
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ; The name of the installer
6 Name "newLISP-GS"
8 ; The file to write
9 OutFile "c:\lutz\newLISP\newlisp-9303-win-gs-114.exe"
11 ; The default installation directory
12 InstallDir $PROGRAMFILES\newlisp
14 ; The text to prompt the user to enter a directory
15 DirText "This will install the newLISP-GS 1.14 and newLISP 9.3.3 on your computer." \
17 ;;;;;;;;;;;;;;;;;;;;;; subroutines for PATH change in Win32 environment ;;;;;;;;;;;;;;
18 !verbose 3
19 !include "WinMessages.NSH"
20 !verbose 4
22 ; AddToPath - Adds the given dir to the search path.
23 ; Input - head of the stack
24 ; Note - Win9x systems requires reboot
26 Function AddToPath
27 Exch $0
28 Push $1
29 Push $2
30 Push $3
32 # don't add if the path doesn't exist
33 IfFileExists "$0\*.*" "" AddToPath_done
35 ReadEnvStr $1 PATH
36 Push "$1;"
37 Push "$0;"
38 Call StrStr
39 Pop $2
40 StrCmp $2 "" "" AddToPath_done
41 Push "$1;"
42 Push "$0\;"
43 Call StrStr
44 Pop $2
45 StrCmp $2 "" "" AddToPath_done
46 GetFullPathName /SHORT $3 $0
47 Push "$1;"
48 Push "$3;"
49 Call StrStr
50 Pop $2
51 StrCmp $2 "" "" AddToPath_done
52 Push "$1;"
53 Push "$3\;"
54 Call StrStr
55 Pop $2
56 StrCmp $2 "" "" AddToPath_done
58 Call IsNT
59 Pop $1
60 StrCmp $1 1 AddToPath_NT
61 ; Not on NT
62 StrCpy $1 $WINDIR 2
63 FileOpen $1 "$1\autoexec.bat" a
64 FileSeek $1 -1 END
65 FileReadByte $1 $2
66 IntCmp $2 26 0 +2 +2 # DOS EOF
67 FileSeek $1 -1 END # write over EOF
68 FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
69 FileClose $1
70 SetRebootFlag true
71 Goto AddToPath_done
73 AddToPath_NT:
74 ReadRegStr $1 HKCU "Environment" "PATH"
75 StrCpy $2 $1 1 -1 # copy last char
76 StrCmp $2 ";" 0 +2 # if last char == ;
77 StrCpy $1 $1 -1 # remove last char
78 StrCmp $1 "" AddToPath_NTdoIt
79 StrCpy $0 "$1;$0"
80 AddToPath_NTdoIt:
81 WriteRegExpandStr HKCU "Environment" "PATH" $0
82 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
84 AddToPath_done:
85 Pop $3
86 Pop $2
87 Pop $1
88 Pop $0
89 FunctionEnd
91 ; RemoveFromPath - Remove a given dir from the path
92 ; Input: head of the stack
94 Function un.RemoveFromPath
95 Exch $0
96 Push $1
97 Push $2
98 Push $3
99 Push $4
100 Push $5
101 Push $6
103 IntFmt $6 "%c" 26 # DOS EOF
105 Call un.IsNT
106 Pop $1
107 StrCmp $1 1 unRemoveFromPath_NT
108 ; Not on NT
109 StrCpy $1 $WINDIR 2
110 FileOpen $1 "$1\autoexec.bat" r
111 GetTempFileName $4
112 FileOpen $2 $4 w
113 GetFullPathName /SHORT $0 $0
114 StrCpy $0 "SET PATH=%PATH%;$0"
115 Goto unRemoveFromPath_dosLoop
117 unRemoveFromPath_dosLoop:
118 FileRead $1 $3
119 StrCpy $5 $3 1 -1 # read last char
120 StrCmp $5 $6 0 +2 # if DOS EOF
121 StrCpy $3 $3 -1 # remove DOS EOF so we can compare
122 StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
123 StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
124 StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
125 StrCmp $3 "" unRemoveFromPath_dosLoopEnd
126 FileWrite $2 $3
127 Goto unRemoveFromPath_dosLoop
128 unRemoveFromPath_dosLoopRemoveLine:
129 SetRebootFlag true
130 Goto unRemoveFromPath_dosLoop
132 unRemoveFromPath_dosLoopEnd:
133 FileClose $2
134 FileClose $1
135 StrCpy $1 $WINDIR 2
136 Delete "$1\autoexec.bat"
137 CopyFiles /SILENT $4 "$1\autoexec.bat"
138 Delete $4
139 Goto unRemoveFromPath_done
141 unRemoveFromPath_NT:
142 ReadRegStr $1 HKCU "Environment" "PATH"
143 StrCpy $5 $1 1 -1 # copy last char
144 StrCmp $5 ";" +2 # if last char != ;
145 StrCpy $1 "$1;" # append ;
146 Push $1
147 Push "$0;"
148 Call un.StrStr ; Find $0; in $1
149 Pop $2 ; pos of our dir
150 StrCmp $2 "" unRemoveFromPath_done
151 ; else, it is in path
152 # $0 - path to add
153 # $1 - path var
154 StrLen $3 "$0;"
155 StrLen $4 $2
156 StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
157 StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
158 StrCpy $3 $5$6
160 StrCpy $5 $3 1 -1 # copy last char
161 StrCmp $5 ";" 0 +2 # if last char == ;
162 StrCpy $3 $3 -1 # remove last char
164 WriteRegExpandStr HKCU "Environment" "PATH" $3
165 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
167 unRemoveFromPath_done:
168 Pop $6
169 Pop $5
170 Pop $4
171 Pop $3
172 Pop $2
173 Pop $1
174 Pop $0
175 FunctionEnd
177 ###########################################
178 # Utility Functions #
179 ###########################################
181 ; IsNT
182 ; no input
183 ; output, top of the stack = 1 if NT or 0 if not
185 ; Usage:
186 ; Call IsNT
187 ; Pop $R0
188 ; ($R0 at this point is 1 or 0)
190 !macro IsNT un
191 Function ${un}IsNT
192 Push $0
193 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
194 StrCmp $0 "" 0 IsNT_yes
195 ; we are not NT.
196 Pop $0
197 Push 0
198 Return
200 IsNT_yes:
201 ; NT!!!
202 Pop $0
203 Push 1
204 FunctionEnd
205 !macroend
206 !insertmacro IsNT ""
207 !insertmacro IsNT "un."
209 ; StrStr
210 ; input, top of stack = string to search for
211 ; top of stack-1 = string to search in
212 ; output, top of stack (replaces with the portion of the string remaining)
213 ; modifies no other variables.
215 ; Usage:
216 ; Push "this is a long ass string"
217 ; Push "ass"
218 ; Call StrStr
219 ; Pop $R0
220 ; ($R0 at this point is "ass string")
222 !macro StrStr un
223 Function ${un}StrStr
224 Exch $R1 ; st=haystack,old$R1, $R1=needle
225 Exch ; st=old$R1,haystack
226 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
227 Push $R3
228 Push $R4
229 Push $R5
230 StrLen $R3 $R1
231 StrCpy $R4 0
232 ; $R1=needle
233 ; $R2=haystack
234 ; $R3=len(needle)
235 ; $R4=cnt
236 ; $R5=tmp
237 loop:
238 StrCpy $R5 $R2 $R3 $R4
239 StrCmp $R5 $R1 done
240 StrCmp $R5 "" done
241 IntOp $R4 $R4 + 1
242 Goto loop
243 done:
244 StrCpy $R1 $R2 "" $R4
245 Pop $R5
246 Pop $R4
247 Pop $R3
248 Pop $R2
249 Exch $R1
250 FunctionEnd
251 !macroend
252 !insertmacro StrStr ""
253 !insertmacro StrStr "un."
255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end subroutines for PATH change ====================
257 LicenseText License
258 LicenseData c:\newlisp\COPYING
260 ComponentText Select components
262 ShowInstDetails show
264 ; The stuff to install
265 Section "newLISP program (required) and DLL"
266 CreateDirectory $INSTDIR\guiserver
267 CreateDirectory $INSTDIR\modules
268 CreateDirectory $INSTDIR\util
269 ; Set output path to the installation directories.
271 SetOutPath $INSTDIR
272 File "c:\newlisp\newlisp.exe"
273 File "c:\newlisp\newlisp.dll"
274 File "c:\newlisp\md5-checksums.txt"
275 File "c:\newlisp\newlisp_manual.html"
276 File "c:\newlisp\newlisp_index.html"
277 File "c:\newlisp\manual_frame.html"
278 File "c:\newlisp\CodePatterns.html"
279 File "c:\newlisp\newLISPdoc.html"
280 File "c:\newlisp\newLISP-9.3-Release.html"
281 File "c:\newlisp\COPYING"
282 File "c:\newlisp\guiserver.lsp"
283 File "c:\newlisp\guiserver.jar"
284 File "c:\newlisp\newlisp-edit.lsp"
285 File "c:\newlisp\newlisp-win.ico"
287 SetOutPath $INSTDIR\guiserver
288 File "c:\newlisp\guiserver\index.html"
289 File "c:\newlisp\guiserver\guiserver.lsp.html"
290 File "c:\newlisp\guiserver\allfonts-demo.lsp"
291 File "c:\newlisp\guiserver\animation-demo.lsp"
292 File "c:\newlisp\guiserver\border-layout-demo.lsp"
293 File "c:\newlisp\guiserver\button-demo.lsp"
294 File "c:\newlisp\guiserver\clipboard-demo.lsp"
295 File "c:\newlisp\guiserver\cursor-demo.lsp"
296 File "c:\newlisp\guiserver\drag-demo.lsp"
297 File "c:\newlisp\guiserver\font-demo.lsp"
298 File "c:\newlisp\guiserver\frameless-demo.lsp"
299 File "c:\newlisp\guiserver\html-demo.lsp"
300 File "c:\newlisp\guiserver\image-demo.lsp"
301 File "c:\newlisp\guiserver\mouse-demo.lsp"
302 File "c:\newlisp\guiserver\move-resize-demo.lsp"
303 File "c:\newlisp\guiserver\pinballs-demo.lsp"
304 File "c:\newlisp\guiserver\properties-demo.lsp"
305 File "c:\newlisp\guiserver\rotation-demo.lsp"
306 File "c:\newlisp\guiserver\shapes-demo.lsp"
307 File "c:\newlisp\guiserver\sound-demo.lsp"
308 File "c:\newlisp\guiserver\stroke-demo.lsp"
309 File "c:\newlisp\guiserver\tabs-demo.lsp"
310 File "c:\newlisp\guiserver\textrot-demo.lsp"
311 File "c:\newlisp\guiserver\widgets-demo.lsp"
312 File "c:\newlisp\guiserver\word-count.lsp"
313 File "c:\newlisp\guiserver\uppercase.lsp"
315 SetOutPath $INSTDIR\modules
316 File "c:\newlisp\modules\cgi.lsp"
317 File "c:\newlisp\modules\crypto.lsp"
318 File "c:\newlisp\modules\ftp.lsp"
319 File "c:\newlisp\modules\gmp.lsp"
320 File "c:\newlisp\modules\infix.lsp"
321 File "c:\newlisp\modules\mysql.lsp"
322 File "c:\newlisp\modules\mysql5.lsp"
323 File "c:\newlisp\modules\odbc.lsp"
324 File "c:\newlisp\modules\pop3.lsp"
325 File "c:\newlisp\modules\postscript.lsp"
326 File "c:\newlisp\modules\smtp.lsp"
327 File "c:\newlisp\modules\sqlite3.lsp"
328 File "c:\newlisp\modules\stat.lsp"
329 File "c:\newlisp\modules\unix.lsp"
330 File "c:\newlisp\modules\xmlrpc-client.lsp"
331 File "c:\newlisp\modules\zlib.lsp"
333 SetOutPath $INSTDIR\util
334 File "c:\newlisp\util\httpd-conf.lsp"
335 File "c:\newlisp\util\link.lsp"
336 File "c:\newlisp\util\newlisp.vim"
337 File "c:\newlisp\util\newlispdoc"
338 File "c:\newlisp\util\syntax.cgi"
340 SetOutPath $INSTDIR
342 ; Write the installation path into the registry
343 WriteRegStr HKLM SOFTWARE\newLISP "Install_Dir" "$INSTDIR"
345 ; Write the uninstall keys for Windows
346 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\newLISP" "DisplayName" "newLISP (remove only)"
347 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\newLISP" "UninstallString" '"$INSTDIR\uninstall.exe"'
349 WriteUninstaller "uninstall.exe"
350 ; make menu in startmenus
351 CreateDirectory "$SMPROGRAMS\newLISP"
352 CreateShortCut "$SMPROGRAMS\newLISP\newLISP.lnk" "$INSTDIR\newlisp.exe" "" "$INSTDIR\newlisp.exe" 0
353 CreateShortCut "$SMPROGRAMS\newLISP\Manual and Reference.lnk" "$INSTDIR\manual_frame.html" "" "$INSTDIR\manual_frame.html" 0
354 CreateShortCut "$SMPROGRAMS\newLISP\GS Manual and Reference.lnk" "$INSTDIR\guiserver\index.html" "" "$INSTDIR\guiserver\index.html" 0
355 #CreateShortCut "$SMPROGRAMS\newLISP\CodePatterns.lnk" "$INSTDIR\guiserver\CodePatterns.html" "" "$INSTDIR\guiserver\CodePatterns.html" 0
356 CreateShortCut "$SMPROGRAMS\newLISP\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
357 CreateShortCut "$SMPROGRAMS\newLISP\newLISP-GS.lnk" "$INSTDIR\guiserver.jar" "47011 newlisp-edit.lsp /local/newLISP128.png" "$INSTDIR\newlisp-win.ico" 0
358 CreateShortCut "$DESKTOP\newLISP-GS.lnk" "$INSTDIR\guiserver.jar" "47011 newlisp-edit.lsp /local/newLISP128.png" "$INSTDIR\newlisp-win.ico" 0
360 SectionEnd ; end the section
362 Section "Add to path"
363 Push $INSTDIR
364 Call AddToPath
365 SectionEnd
367 ; uninstall stuff
369 UninstallText "This will uninstall newLISP. Hit next to continue."
371 ; special uninstall section.
372 Section "Uninstall"
374 ; remove registry keys
375 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\newLISP"
376 DeleteRegKey HKLM SOFTWARE\newLISP
378 ; remove files
379 Delete $INSTDIR\newlisp.exe
380 Delete $INSTDIR\newlisp.dll
381 Delete $INSTDIR\util\httpd-conf.lsp
382 Delete $INSTDIR\util\link.lsp
383 Delete $INSTDIR\util\newlispdoc
384 Delete $INSTDIR\util\newlisp.vim
385 Delete $INSTDIR\util\syntax.cgi
386 Delete $INSTDIR\md5-checksums.txt
387 Delete $INSTDIR\newlisp_manual.html
388 Delete $INSTDIR\newlisp_index.html
389 Delete $INSTDIR\manual_frame.html
390 Delete $INSTDIR\CodePatterns.html
391 Delete $INSTDIR\newLISPdoc.html
392 Delete $INSTDIR\newLISP-9.3-Release.html
393 Delete $INSTDIR\COPYING
394 Delete $INSTDIR\newlisp.vim
395 Delete $INSTDIR\httpd-conf.lsp
396 Delete $INSTDIR\guiserver.lsp
397 Delete $INSTDIR\guiserver.jar
398 Delete $INSTDIR\newlisp-edit.lsp
399 Delete $INSTDIR\newlisp-win.ico
401 Delete $INSTDIR\guiserver\index.html
402 Delete $INSTDIR\guiserver\guiserver.lsp.html
403 Delete $INSTDIR\guiserver\allfonts-demo.lsp
404 Delete $INSTDIR\guiserver\animation-demo.lsp
405 Delete $INSTDIR\guiserver\border-layout-demo.lsp
406 Delete $INSTDIR\guiserver\button-demo.lsp
407 Delete $INSTDIR\guiserver\clipboard-demo.lsp
408 Delete $INSTDIR\guiserver\cursor-demo.lsp
409 Delete $INSTDIR\guiserver\drag-demo.lsp
410 Delete $INSTDIR\guiserver\font-demo.lsp
411 Delete $INSTDIR\guiserver\frameless-demo.lsp
412 Delete $INSTDIR\guiserver\html-demo.lsp
413 Delete $INSTDIR\guiserver\image-demo.lsp
414 Delete $INSTDIR\guiserver\mouse-demo.lsp
415 Delete $INSTDIR\guiserver\move-resize-demo.lsp
416 Delete $INSTDIR\guiserver\pinballs-demo.lsp
417 Delete $INSTDIR\guiserver\properties-demo.lsp
418 Delete $INSTDIR\guiserver\rotation-demo.lsp
419 Delete $INSTDIR\guiserver\shapes-demo.lsp
420 Delete $INSTDIR\guiserver\sound-demo.lsp
421 Delete $INSTDIR\guiserver\stroke-demo.lsp
422 Delete $INSTDIR\guiserver\tabs-demo.lsp
423 Delete $INSTDIR\guiserver\textrot-demo.lsp
424 Delete $INSTDIR\guiserver\widgets-demo.lsp
425 Delete $INSTDIR\guiserver\word-count.lsp
426 Delete $INSTDIR\guiserver\uppercase.lsp
428 Delete $INSTDIR\modules\cgi.lsp
429 Delete $INSTDIR\modules\crypto.lsp
430 Delete $INSTDIR\modules\ftp.lsp
431 Delete $INSTDIR\modules\gmp.lsp
432 Delete $INSTDIR\modules\infix.lsp
433 Delete $INSTDIR\modules\mysql.lsp
434 Delete $INSTDIR\modules\mysql5.lsp
435 Delete $INSTDIR\modules\odbc.lsp
436 Delete $INSTDIR\modules\pop3.lsp
437 Delete $INSTDIR\modules\postscript.lsp
438 Delete $INSTDIR\modules\smtp.lsp
439 Delete $INSTDIR\modules\sqlite3.lsp
440 Delete $INSTDIR\modules\stat.lsp
441 Delete $INSTDIR\modules\unix.lsp
442 Delete $INSTDIR\modules\xmlrpc-client.lsp
443 Delete $INSTDIR\modules\zlib.lsp
444 ; remove start menu entries
445 Delete "$DESKTOP\newLISP-GS.lnk"
446 Delete "$SMPROGRAMS\newLISP-GS.lnk"
447 Delete "$SMPROGRAMS\newLISP\*.*"
448 RMDir "$SMPROGRAMS\newLISP"
450 ; remove uninstaller, links and install dir
451 Delete $INSTDIR\uninstall.exe
452 RMDir "$INSTDIR\guiserver"
453 RMDir "$INSTDIR\modules"
454 RMDir "$INSTDIR\util"
455 RMDir "$INSTDIR"
457 Push $INSTDIR
458 Call un.RemoveFromPath
460 SectionEnd
462 ; eof