1 # sdcc.nsi - NSIS installer script for SDCC
3 # Copyright (c) 2003-2006 Borut Razem
5 # This file is part of sdcc.
7 # This software is provided 'as-is', without any express or implied
8 # warranty. In no event will the authors be held liable for any damages
9 # arising from the use of this software.
11 # Permission is granted to anyone to use this software for any purpose,
12 # including commercial applications, and to alter it and redistribute it
13 # freely, subject to the following restrictions:
15 # 1. The origin of this software must not be misrepresented; you must not
16 # claim that you wrote the original software. If you use this software
17 # in a product, an acknowledgment in the product documentation would be
18 # appreciated but is not required.
19 # 2. Altered source versions must be plainly marked as such, and must not be
20 # misrepresented as being the original software.
21 # 3. This notice may not be removed or altered from any source distribution.
24 # borut.razem@siol.net
26 # How to create WIN32 setup.exe
28 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd.zip
29 # to a clean directory (the option to create directories should be enabled).
30 # A sub directory sdcc is created (referenced as PKGDIR in continuation).
31 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
32 # (this file) from the sdcc Subversion snapshot to the PKGDIR directory
33 # - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
34 # rename it to COPYING.TXT and convert file COPYING to DOS format:
35 # unix2dos COPYING.TXT
36 # - run NSIS installer from PKGDIR directory:
37 # "c:\Program Files\NSIS\makensis.exe" sdcc.nsi
38 # - A setup file setup.exe is created in PKGDIR directory.
39 # Rename it to sdcc_yyyymmdd_setup.exe and upload it
40 # to sdcc download repository at sourceforge.net
43 # How to upload secc setup.exe tosourceforge.net
45 # Execute following commands from the cmd prompt:
46 # - sftp sdcc.sourceforge.net
47 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
48 # - put sdcc_yyyymmdd_setup.exe
54 SetCompressor /SOLID lzma
58 !define DEV_ROOT "${SDCC_ROOT}"
60 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
61 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
63 InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
64 InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
65 InstType "Compact (Bin, ucSim, SDCDB, Doc)"
67 ;--------------------------------
70 Var MUI_STARTMENUPAGE_VARIABLE
72 ;--------------------------------
73 !define MUI_ABORTWARNING
75 !insertmacro MUI_PAGE_WELCOME
76 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
77 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SDCC"
78 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
79 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
80 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
81 !define MUI_STARTMENUPAGE_NODISABLE
82 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
83 !insertmacro MUI_PAGE_COMPONENTS
84 !insertmacro MUI_PAGE_DIRECTORY
85 !insertmacro MUI_PAGE_INSTFILES
86 !insertmacro MUI_PAGE_FINISH
88 !insertmacro MUI_UNPAGE_INSTFILES
90 !insertmacro MUI_LANGUAGE "English"
95 InstallDir "$PROGRAMFILES\SDCC"
97 ShowUnInstDetails show
100 ;Uninstall the old version, if present
101 ReadRegStr $R0 HKLM \
102 "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
106 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
107 "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
108 previous version or 'Cancel' to cancel this upgrade." \
113 ; Run the uninstaller
115 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
117 ;IfErrors no_remove_uninstaller
118 ; ;You can either use Delete /REBOOTOK in the uninstaller or add some code
119 ; ;here to remove to remove the uninstaller. Use a registry key to check
120 ; ;whether the user has chosen to uninstall. If you are using an uninstaller
121 ; ;components page, make sure all sections are uninstalled.
122 ;no_remove_uninstaller:
127 ; Install the new version
128 MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
135 SetOutPath "$INSTDIR"
137 File "${SDCC_ROOT}\COPYING.TXT"
140 Section "SDCC application files"
142 SetOutPath "$INSTDIR\bin"
143 File "${SDCC_ROOT}\bin\as-gbz80.exe"
144 File "${SDCC_ROOT}\bin\as-hc08.exe"
145 File "${SDCC_ROOT}\bin\as-z80.exe"
146 File "${SDCC_ROOT}\bin\asx8051.exe"
147 File "${SDCC_ROOT}\bin\aslink.exe"
148 File "${SDCC_ROOT}\bin\link-gbz80.exe"
149 File "${SDCC_ROOT}\bin\link-hc08.exe"
150 File "${SDCC_ROOT}\bin\link-z80.exe"
151 File "${SDCC_ROOT}\bin\makebin.exe"
152 File "${SDCC_ROOT}\bin\packihx.exe"
153 File "${SDCC_ROOT}\bin\sdcc.exe"
154 File "${SDCC_ROOT}\bin\sdcclib.exe"
155 File "${SDCC_ROOT}\bin\sdcpp.exe"
156 File "${SDCC_ROOT}\bin\readline5.dll"
159 Section "ucSim application files"
161 SetOutPath "$INSTDIR\bin"
162 File "${SDCC_ROOT}\bin\s51.exe"
163 File "${SDCC_ROOT}\bin\savr.exe"
164 File "${SDCC_ROOT}\bin\shc08.exe"
165 File "${SDCC_ROOT}\bin\sz80.exe"
168 Section "SDCDB files"
170 File "${SDCC_ROOT}\bin\sdcdb.exe"
171 File "${SDCC_ROOT}\bin\sdcdb.el"
172 File "${SDCC_ROOT}\bin\sdcdbsrc.el"
175 Section "SDCC documentation"
177 SetOutPath "$INSTDIR\doc"
179 File /r "${SDCC_ROOT}\doc\*"
181 File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
182 File "${SDCC_ROOT}\doc\README.TXT"
186 Section "SDCC include files"
188 SetOutPath "$INSTDIR\include\asm\default"
189 File "${DEV_ROOT}\include\asm\default\features.h"
190 SetOutPath "$INSTDIR\include\asm\ds390"
191 File "${DEV_ROOT}\include\asm\ds390\features.h"
192 SetOutPath "$INSTDIR\include\asm\gbz80"
193 File "${DEV_ROOT}\include\asm\gbz80\features.h"
194 SetOutPath "$INSTDIR\include\asm\mcs51"
195 File "${DEV_ROOT}\include\asm\mcs51\features.h"
196 SetOutPath "$INSTDIR\include\asm\pic"
197 File "${DEV_ROOT}\include\asm\pic\features.h"
198 SetOutPath "$INSTDIR\include\asm\pic16"
199 File "${DEV_ROOT}\include\asm\pic16\features.h"
200 SetOutPath "$INSTDIR\include\asm\z80"
201 File "${DEV_ROOT}\include\asm\z80\features.h"
202 SetOutPath "$INSTDIR\include\hc08"
203 File "${DEV_ROOT}\include\hc08\*.h"
204 SetOutPath "$INSTDIR\include\mcs51"
205 File "${DEV_ROOT}\include\mcs51\*.h"
206 SetOutPath "$INSTDIR\include\pic"
207 File "${DEV_ROOT}\include\pic\*.h"
208 File "${DEV_ROOT}\include\pic\*.txt"
209 File "${DEV_ROOT}\include\pic\*.inc"
210 SetOutPath "$INSTDIR\include\pic16"
211 File "${DEV_ROOT}\include\pic16\*.h"
212 SetOutPath "$INSTDIR\include\z80"
213 File "${DEV_ROOT}\include\z80\*.h"
214 SetOutPath "$INSTDIR\include"
215 File "${DEV_ROOT}\include\*.h"
218 Section "SDCC DS390 library"
220 SetOutPath "$INSTDIR\lib\ds390"
221 File "${DEV_ROOT}\lib\ds390\*.rel"
222 File "${DEV_ROOT}\lib\ds390\*.lib"
225 Section "SDCC DS400 library"
227 SetOutPath "$INSTDIR\lib\ds400"
228 File "${DEV_ROOT}\lib\ds400\*.rel"
229 File "${DEV_ROOT}\lib\ds400\*.lib"
232 Section "SDCC GBZ80 library"
234 SetOutPath "$INSTDIR\lib\gbz80"
235 File "${DEV_ROOT}\lib\gbz80\*.o"
236 File "${DEV_ROOT}\lib\gbz80\*.lib"
239 Section "SDCC Z80 library"
241 SetOutPath "$INSTDIR\lib\z80"
242 File "${DEV_ROOT}\lib\z80\*.o"
243 File "${DEV_ROOT}\lib\z80\*.lib"
246 Section "SDCC small model library"
248 SetOutPath "$INSTDIR\lib\small"
249 File "${DEV_ROOT}\lib\small\*.rel"
250 File "${DEV_ROOT}\lib\small\*.lib"
253 Section "SDCC medium model library"
255 SetOutPath "$INSTDIR\lib\medium"
256 File "${DEV_ROOT}\lib\medium\*.rel"
257 File "${DEV_ROOT}\lib\medium\*.lib"
260 Section "SDCC large model library"
262 SetOutPath "$INSTDIR\lib\large"
263 File "${DEV_ROOT}\lib\large\*.rel"
264 File "${DEV_ROOT}\lib\large\*.lib"
267 Section "SDCC small-stack-auto model library"
269 SetOutPath "$INSTDIR\lib\small-stack-auto"
270 File "${DEV_ROOT}\lib\small-stack-auto\*.rel"
271 File "${DEV_ROOT}\lib\small-stack-auto\*.lib"
274 Section "SDCC HC08 library"
276 SetOutPath "$INSTDIR\lib\hc08"
277 File "${DEV_ROOT}\lib\hc08\*.rel"
278 File "${DEV_ROOT}\lib\hc08\*.lib"
281 Section "SDCC PIC16 library"
283 SetOutPath "$INSTDIR\lib\pic16"
284 File "${DEV_ROOT}\lib\pic16\*.o"
285 File "${DEV_ROOT}\lib\pic16\*.lib"
288 Section "SDCC PIC library"
290 SetOutPath "$INSTDIR\lib\pic"
291 File "${DEV_ROOT}\lib\pic\*.lib"
294 Section "SDCC library sources"
296 SetOutPath "$INSTDIR\lib\src\ds390\examples"
297 File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
299 SetOutPath "$INSTDIR\lib\src\ds390"
300 File "${DEV_ROOT}\lib\src\ds390\*.c"
301 # File "${DEV_ROOT}\lib\src\ds390\Makefile"
303 SetOutPath "$INSTDIR\lib\src\ds400"
304 File "${DEV_ROOT}\lib\src\ds400\*.c"
305 # File "${DEV_ROOT}\lib\src\ds400\Makefile"
307 SetOutPath "$INSTDIR\lib\src\gbz80"
308 File "${DEV_ROOT}\lib\src\gbz80\*.c"
309 File "${DEV_ROOT}\lib\src\gbz80\*.s"
310 # File "${DEV_ROOT}\lib\src\gbz80\Makefile"
312 SetOutPath "$INSTDIR\lib\src\z80"
313 File "${DEV_ROOT}\lib\src\z80\*.c"
314 File "${DEV_ROOT}\lib\src\z80\*.s"
315 # File "${DEV_ROOT}\lib\src\z80\Makefile"
317 SetOutPath "$INSTDIR\lib\src\hc08"
318 File "${DEV_ROOT}\lib\src\hc08\*.c"
319 # File "${DEV_ROOT}\lib\src\hc08\Makefile"
321 SetOutPath "$INSTDIR\lib\src\mcs51"
322 File "${DEV_ROOT}\lib\src\mcs51\*.asm"
323 # File "${DEV_ROOT}\lib\src\mcs51\Makefile"
325 SetOutPath "$INSTDIR\lib\src\small"
326 # File "${DEV_ROOT}\lib\src\small\Makefile"
328 SetOutPath "$INSTDIR\lib\src\medium"
329 # File "${DEV_ROOT}\lib\src\medium\Makefile"
331 SetOutPath "$INSTDIR\lib\src\large"
332 # File "${DEV_ROOT}\lib\src\large\Makefile"
334 SetOutPath "$INSTDIR\lib\src\pic"
335 # File "${DEV_ROOT}\lib\src\pic\configure"
336 # File "${DEV_ROOT}\lib\src\pic\configure.in"
337 # File "${DEV_ROOT}\lib\src\pic\GPL"
338 # File "${DEV_ROOT}\lib\src\pic\LGPL"
339 # File "${DEV_ROOT}\lib\src\pic\Makefile"
340 # File "${DEV_ROOT}\lib\src\pic\Makefile.common"
341 # File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
342 # File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
343 # File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
344 # File "${DEV_ROOT}\lib\src\pic\NEWS"
345 # File "${DEV_ROOT}\lib\src\pic\README"
346 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
347 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
349 SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
350 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
351 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
352 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
353 # File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
355 SetOutPath "$INSTDIR\lib\src\pic\libdev"
356 File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
357 # File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
359 SetOutPath "$INSTDIR\lib\src\pic\libm"
360 File "${DEV_ROOT}\lib\src\pic\libm\*.c"
362 SetOutPath "$INSTDIR\lib\src\pic16"
363 # File "${DEV_ROOT}\lib\src\pic16\configure"
364 # File "${DEV_ROOT}\lib\src\pic16\configure.in"
365 # File "${DEV_ROOT}\lib\src\pic16\COPYING"
366 # File "${DEV_ROOT}\lib\src\pic16\Makefile"
367 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
368 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
369 # File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
370 # File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
371 # File "${DEV_ROOT}\lib\src\pic16\pics.all"
372 # File "${DEV_ROOT}\lib\src\pic16\pics.build"
373 # File "${DEV_ROOT}\lib\src\pic16\README"
375 SetOutPath "$INSTDIR\lib\src\pic16\debug"
376 # File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
378 SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
379 # File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
380 File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
382 SetOutPath "$INSTDIR\lib\src\pic16\libc"
383 # File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
385 SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
386 File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
387 # File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
389 SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
390 File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
391 # File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
393 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
394 File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
395 # File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
397 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
398 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
399 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
400 # File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
402 SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
403 File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
404 # File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
406 SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
407 File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
408 # File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
410 SetOutPath "$INSTDIR\lib\src\pic16\libdev"
411 File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
412 # File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
414 SetOutPath "$INSTDIR\lib\src\pic16\libio"
415 File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
416 # File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
418 SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
419 File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
420 # File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
422 SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
423 File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
424 # File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
426 SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
427 File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
428 # File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
430 SetOutPath "$INSTDIR\lib\src\pic16\libm"
431 File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
432 # File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
434 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
435 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
437 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
438 File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
439 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
441 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
442 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
443 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
444 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
446 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
447 File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
448 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
450 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
451 File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
452 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
454 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
455 File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
456 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
458 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
459 File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
460 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
462 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
463 File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
464 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
466 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
467 File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
469 SetOutPath "$INSTDIR\lib\src\pic16\startup"
470 File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
471 # File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
472 # File "${DEV_ROOT}\lib\src\pic16\startup\README"
474 SetOutPath "$INSTDIR\lib\src"
475 File "${DEV_ROOT}\lib\src\*.c"
479 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
480 CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
481 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk" "$INSTDIR\sdcc.url"
482 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
483 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
484 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
485 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT"
486 !insertmacro MUI_STARTMENU_WRITE_END
490 WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
494 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
495 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
496 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
497 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
498 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
499 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
500 WriteUninstaller "$INSTDIR\uninstall.exe"
504 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to add $INSTDIR\bin to the PATH?" IDNO +3
510 ;;;; Uninstaller code ;;;;
513 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
517 Function un.onUninstSuccess
519 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
523 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
525 Delete "$INSTDIR\sdcc.url"
527 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "NSIS:StartMenuDir"
528 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
530 Delete "$INSTDIR\uninstall.exe"
531 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
532 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
533 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
534 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
535 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk"
537 Delete "$INSTDIR\lib\src\large\Makefile"
539 Delete "$INSTDIR\lib\src\medium\Makefile"
541 Delete "$INSTDIR\lib\src\small\Makefile"
543 Delete "$INSTDIR\lib\src\mcs51\*.asm"
544 Delete "$INSTDIR\lib\src\mcs51\Makefile"
545 Delete "$INSTDIR\lib\src\mcs51\README"
547 Delete "$INSTDIR\lib\src\hc08\*.c"
548 Delete "$INSTDIR\lib\src\hc08\hc08.lib"
549 Delete "$INSTDIR\lib\src\hc08\Makefile"
551 Delete "$INSTDIR\lib\src\z80\*.c"
552 Delete "$INSTDIR\lib\src\z80\*.s"
553 Delete "$INSTDIR\lib\src\z80\z80.lib"
554 Delete "$INSTDIR\lib\src\z80\README"
555 Delete "$INSTDIR\lib\src\z80\Makefile"
557 Delete "$INSTDIR\lib\src\gbz80\*.c"
558 Delete "$INSTDIR\lib\src\gbz80\*.s"
559 Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
560 Delete "$INSTDIR\lib\src\gbz80\README"
561 Delete "$INSTDIR\lib\src\gbz80\Makefile"
563 Delete "$INSTDIR\lib\src\ds390\*.c"
564 Delete "$INSTDIR\lib\src\ds390\libds390.lib"
565 Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
566 Delete "$INSTDIR\lib\src\ds390\Makefile"
567 Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
569 Delete "$INSTDIR\lib\src\ds400\*.c"
570 Delete "$INSTDIR\lib\src\ds400\libds400.lib"
571 Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
572 Delete "$INSTDIR\lib\src\ds400\Makefile"
574 Delete "$INSTDIR\lib\src\*.c"
576 Delete "$INSTDIR\lib\pic\*.o"
577 Delete "$INSTDIR\lib\pic\*.lib"
579 Delete "$INSTDIR\lib\pic16\*.o"
580 Delete "$INSTDIR\lib\pic16\*.lib"
582 Delete "$INSTDIR\lib\hc08\*.rel"
583 Delete "$INSTDIR\lib\hc08\*.lib"
585 Delete "$INSTDIR\lib\z80\*.o"
586 Delete "$INSTDIR\lib\z80\*.lib"
588 Delete "$INSTDIR\lib\small\*.rel"
589 Delete "$INSTDIR\lib\small\*.lib"
591 Delete "$INSTDIR\lib\medium\*.rel"
592 Delete "$INSTDIR\lib\medium\*.lib"
594 Delete "$INSTDIR\lib\large\*.rel"
595 Delete "$INSTDIR\lib\large\*.lib"
597 Delete "$INSTDIR\lib\small-stack-auto\*.rel"
598 Delete "$INSTDIR\lib\small-stack-auto\*.lib"
600 Delete "$INSTDIR\lib\gbz80\*.o"
601 Delete "$INSTDIR\lib\gbz80\*.lib"
603 Delete "$INSTDIR\lib\ds390\*.rel"
604 Delete "$INSTDIR\lib\ds390\*.lib"
606 Delete "$INSTDIR\lib\ds400\*.rel"
607 Delete "$INSTDIR\lib\ds400\*.lib"
609 Delete "$INSTDIR\include\asm\z80\*.h"
610 Delete "$INSTDIR\include\asm\pic16\*.h"
611 Delete "$INSTDIR\include\asm\pic\*.h"
612 Delete "$INSTDIR\include\asm\mcs51\*.h"
613 Delete "$INSTDIR\include\asm\gbz80\*.h"
614 Delete "$INSTDIR\include\asm\ds390\*.h"
615 Delete "$INSTDIR\include\asm\default\*.h"
616 Delete "$INSTDIR\include\z80\*.h"
617 Delete "$INSTDIR\include\pic\*.h"
618 Delete "$INSTDIR\include\pic\*.txt"
619 Delete "$INSTDIR\include\pic\*.inc"
620 Delete "$INSTDIR\include\pic16\*.h"
621 Delete "$INSTDIR\include\mcs51\*.h"
622 Delete "$INSTDIR\include\hc08\*.h"
623 Delete "$INSTDIR\include\*.h"
626 Delete "$INSTDIR\doc\README.TXT"
627 Delete "$INSTDIR\doc\ChangeLog_head.txt"
630 Delete "$INSTDIR\bin\as-gbz80.exe"
631 Delete "$INSTDIR\bin\as-hc08.exe"
632 Delete "$INSTDIR\bin\as-z80.exe"
633 Delete "$INSTDIR\bin\asx8051.exe"
634 Delete "$INSTDIR\bin\aslink.exe"
635 Delete "$INSTDIR\bin\link-gbz80.exe"
636 Delete "$INSTDIR\bin\link-hc08.exe"
637 Delete "$INSTDIR\bin\link-z80.exe"
638 Delete "$INSTDIR\bin\makebin.exe"
639 Delete "$INSTDIR\bin\packihx.exe"
640 Delete "$INSTDIR\bin\sdcc.exe"
641 Delete "$INSTDIR\bin\sdcclib.exe"
642 Delete "$INSTDIR\bin\sdcpp.exe"
643 Delete "$INSTDIR\bin\readline5.dll"
646 Delete "$INSTDIR\bin\s51.exe"
647 Delete "$INSTDIR\bin\savr.exe"
648 Delete "$INSTDIR\bin\shc08.exe"
649 Delete "$INSTDIR\bin\sz80.exe"
651 Delete "$INSTDIR\bin\sdcdb.exe"
652 Delete "$INSTDIR\bin\sdcdb.el"
653 Delete "$INSTDIR\bin\sdcdbsrc.el"
655 Delete "$INSTDIR\COPYING.TXT"
656 Delete "$INSTDIR\sdcc.ico"
658 RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
660 RMDir /r "$INSTDIR\lib\src\pic"
661 RMDir /r "$INSTDIR\lib\src\pic16"
662 RMDir "$INSTDIR\lib\src\small"
663 RMDir "$INSTDIR\lib\src\medium"
664 RMDir "$INSTDIR\lib\src\large"
665 RMDir "$INSTDIR\lib\src\mcs51"
666 RMDir "$INSTDIR\lib\src\z80"
667 RMDir "$INSTDIR\lib\src\gbz80"
668 RMDir "$INSTDIR\lib\src\ds390\examples"
669 RMDir "$INSTDIR\lib\src\ds390"
670 RMDir "$INSTDIR\lib\src\ds400"
671 RMDir "$INSTDIR\lib\src\hc08"
672 RMDir "$INSTDIR\lib\src"
674 RMDir "$INSTDIR\lib\pic"
675 RMDir "$INSTDIR\lib\pic16"
676 RMDir "$INSTDIR\lib\z80"
677 RMDir "$INSTDIR\lib\small"
678 RMDir "$INSTDIR\lib\medium"
679 RMDir "$INSTDIR\lib\large"
680 RMDir "$INSTDIR\lib\small-stack-auto"
681 RMDir "$INSTDIR\lib\gbz80"
682 RMDir "$INSTDIR\lib\ds390"
683 RMDir "$INSTDIR\lib\ds400"
684 RMDir "$INSTDIR\lib\hc08"
687 RMDir "$INSTDIR\include\asm\z80"
688 RMDir "$INSTDIR\include\asm\pic16"
689 RMDir "$INSTDIR\include\asm\pic"
690 RMDir "$INSTDIR\include\asm\mcs51"
691 RMDir "$INSTDIR\include\asm\gbz80"
692 RMDir "$INSTDIR\include\asm\ds390"
693 RMDir "$INSTDIR\include\asm\default"
694 RMDir "$INSTDIR\include\asm"
695 RMDir "$INSTDIR\include\z80"
696 RMDir "$INSTDIR\include\pic"
697 RMDir "$INSTDIR\include\pic16"
698 RMDir "$INSTDIR\include\mcs51"
699 RMDir "$INSTDIR\include\hc08"
700 RMDir "$INSTDIR\include"
703 RMDir /r "$INSTDIR\doc"
713 Call un.RemoveFromPath
718 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
719 ; Path Manipulation functions ;
720 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
723 !include "WinMessages.nsh"
726 ; AddToPath - Adds the given dir to the search path.
727 ; Input - head of the stack
728 ; Note - Win9x systems requires reboot
737 ; don't add if the path doesn't exist
738 IfFileExists $0 "" AddToPath_done
743 ; Not on NT: read PATH from environment variable
746 ; On NT: read PATH from registry
747 ReadRegStr $1 HKCU "Environment" "PATH"
752 StrCmp $2 "" "" AddToPath_done
757 StrCmp $2 "" "" AddToPath_done
758 GetFullPathName /SHORT $3 $0
763 StrCmp $2 "" "" AddToPath_done
768 StrCmp $2 "" "" AddToPath_done
770 StrCmp $4 1 AddToPath_NT
773 FileOpen $1 "$1\autoexec.bat" a
776 IntCmp $2 26 0 +2 +2 ; DOS EOF
777 FileSeek $1 -1 END ; write over EOF
778 FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
784 ReadRegStr $1 HKCU "Environment" "PATH"
785 StrCpy $2 $1 1 -1 ; copy last char
786 StrCmp $2 ";" 0 +2 ; if last char == ;
787 StrCpy $1 $1 -1 ; remove last char
788 StrCmp $1 "" AddToPath_NTdoIt
791 WriteRegExpandStr HKCU "Environment" "PATH" $0
792 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
802 ; RemoveFromPath - Remove a given dir from the path
803 ; Input: head of the stack
805 Function un.RemoveFromPath
814 IntFmt $6 "%c" 26 ; DOS EOF
818 StrCmp $1 1 unRemoveFromPath_NT
821 FileOpen $1 "$1\autoexec.bat" r
824 GetFullPathName /SHORT $0 $0
825 StrCpy $0 "SET PATH=%PATH%;$0"
826 Goto unRemoveFromPath_dosLoop
828 unRemoveFromPath_dosLoop:
830 StrCpy $5 $3 1 -1 ; read last char
831 StrCmp $5 $6 0 +2 ; if DOS EOF
832 StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
833 StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
834 StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
835 StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
836 StrCmp $3 "" unRemoveFromPath_dosLoopEnd
838 Goto unRemoveFromPath_dosLoop
839 unRemoveFromPath_dosLoopRemoveLine:
841 Goto unRemoveFromPath_dosLoop
843 unRemoveFromPath_dosLoopEnd:
847 Delete "$1\autoexec.bat"
848 CopyFiles /SILENT $4 "$1\autoexec.bat"
850 Goto unRemoveFromPath_done
853 ReadRegStr $1 HKCU "Environment" "PATH"
854 StrCpy $5 $1 1 -1 ; copy last char
855 StrCmp $5 ";" +2 ; if last char != ;
856 StrCpy $1 "$1;" ; append ;
859 Call un.StrStr ; Find `$0;` in $1
860 Pop $2 ; pos of our dir
861 StrCmp $2 "" unRemoveFromPath_done
862 ; else, it is in path
867 StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
868 StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
871 StrCpy $5 $3 1 -1 ; copy last char
872 StrCmp $5 ";" 0 +2 ; if last char == ;
873 StrCpy $3 $3 -1 ; remove last char
876 ; New PATH not empty: update the registry
877 WriteRegExpandStr HKCU "Environment" "PATH" $3
879 ; New PATH empty: remove from the registry
880 DeleteRegValue HKCU "Environment" "PATH"
881 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
883 unRemoveFromPath_done:
893 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
894 ; Utility Functions ;
895 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
899 ; output, top of the stack = 1 if NT or 0 if not
904 ; ($R0 at this point is 1 or 0)
909 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
910 StrCmp $0 "" 0 IsNT_yes
923 !insertmacro IsNT "un."
926 ; input, top of stack = string to search for
927 ; top of stack-1 = string to search in
928 ; output, top of stack (replaces with the portion of the string remaining)
929 ; modifies no other variables.
932 ; Push "this is a long ass string"
936 ; ($R0 at this point is "ass string")
940 Exch $R1 ; st=haystack,old$R1, $R1=needle
941 Exch ; st=old$R1,haystack
942 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
954 StrCpy $R5 $R2 $R3 $R4
960 StrCpy $R1 $R2 "" $R4
968 !insertmacro StrStr ""
969 !insertmacro StrStr "un."