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, Doc, Lib, Src)"
64 InstType "Medium (Bin, Doc, Lib)"
65 InstType "Compact (Bin, 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\*.exe"
146 Section "SDCC documentation"
148 SetOutPath "$INSTDIR\doc"
150 File /r "${SDCC_ROOT}\doc\*"
152 File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
153 File "${SDCC_ROOT}\doc\README.TXT"
157 Section "SDCC include files"
159 SetOutPath "$INSTDIR\include\asm\default"
160 File "${DEV_ROOT}\include\asm\default\features.h"
161 SetOutPath "$INSTDIR\include\asm\ds390"
162 File "${DEV_ROOT}\include\asm\ds390\features.h"
163 SetOutPath "$INSTDIR\include\asm\gbz80"
164 File "${DEV_ROOT}\include\asm\gbz80\features.h"
165 SetOutPath "$INSTDIR\include\asm\mcs51"
166 File "${DEV_ROOT}\include\asm\mcs51\features.h"
167 SetOutPath "$INSTDIR\include\asm\pic"
168 File "${DEV_ROOT}\include\asm\pic\features.h"
169 SetOutPath "$INSTDIR\include\asm\pic16"
170 File "${DEV_ROOT}\include\asm\pic16\features.h"
171 SetOutPath "$INSTDIR\include\asm\z80"
172 File "${DEV_ROOT}\include\asm\z80\features.h"
173 SetOutPath "$INSTDIR\include\hc08"
174 File "${DEV_ROOT}\include\hc08\*.h"
175 SetOutPath "$INSTDIR\include\mcs51"
176 File "${DEV_ROOT}\include\mcs51\*.h"
177 SetOutPath "$INSTDIR\include\pic"
178 File "${DEV_ROOT}\include\pic\*.h"
179 File "${DEV_ROOT}\include\pic\*.txt"
180 File "${DEV_ROOT}\include\pic\*.inc"
181 SetOutPath "$INSTDIR\include\pic16"
182 File "${DEV_ROOT}\include\pic16\*.h"
183 SetOutPath "$INSTDIR\include\z80"
184 File "${DEV_ROOT}\include\z80\*.h"
185 SetOutPath "$INSTDIR\include"
186 File "${DEV_ROOT}\include\*.h"
189 Section "SDCC DS390 library"
191 SetOutPath "$INSTDIR\lib\ds390"
192 File "${DEV_ROOT}\lib\ds390\*.rel"
193 File "${DEV_ROOT}\lib\ds390\*.lib"
196 Section "SDCC DS400 library"
198 SetOutPath "$INSTDIR\lib\ds400"
199 File "${DEV_ROOT}\lib\ds400\*.rel"
200 File "${DEV_ROOT}\lib\ds400\*.lib"
203 Section "SDCC GBZ80 library"
205 SetOutPath "$INSTDIR\lib\gbz80"
206 File "${DEV_ROOT}\lib\gbz80\*.o"
207 File "${DEV_ROOT}\lib\gbz80\*.lib"
210 Section "SDCC Z80 library"
212 SetOutPath "$INSTDIR\lib\z80"
213 File "${DEV_ROOT}\lib\z80\*.o"
214 File "${DEV_ROOT}\lib\z80\*.lib"
217 Section "SDCC small model library"
219 SetOutPath "$INSTDIR\lib\small"
220 File "${DEV_ROOT}\lib\small\*.rel"
221 File "${DEV_ROOT}\lib\small\*.lib"
224 Section "SDCC medium model library"
226 SetOutPath "$INSTDIR\lib\medium"
227 File "${DEV_ROOT}\lib\medium\*.rel"
228 File "${DEV_ROOT}\lib\medium\*.lib"
231 Section "SDCC large model library"
233 SetOutPath "$INSTDIR\lib\large"
234 File "${DEV_ROOT}\lib\large\*.rel"
235 File "${DEV_ROOT}\lib\large\*.lib"
238 Section "SDCC small-stack-auto model library"
240 SetOutPath "$INSTDIR\lib\small-stack-auto"
241 File "${DEV_ROOT}\lib\small-stack-auto\*.rel"
242 File "${DEV_ROOT}\lib\small-stack-auto\*.lib"
245 Section "SDCC HC08 library"
247 SetOutPath "$INSTDIR\lib\hc08"
248 File "${DEV_ROOT}\lib\hc08\*.rel"
249 File "${DEV_ROOT}\lib\hc08\*.lib"
252 Section "SDCC PIC16 library"
254 SetOutPath "$INSTDIR\lib\pic16"
255 File "${DEV_ROOT}\lib\pic16\*.o"
256 File "${DEV_ROOT}\lib\pic16\*.lib"
259 Section "SDCC PIC library"
261 SetOutPath "$INSTDIR\lib\pic"
262 File "${DEV_ROOT}\lib\pic\*.lib"
265 Section "SDCC library sources"
267 SetOutPath "$INSTDIR\lib\src\ds390\examples"
268 File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
270 SetOutPath "$INSTDIR\lib\src\ds390"
271 File "${DEV_ROOT}\lib\src\ds390\*.c"
272 # File "${DEV_ROOT}\lib\src\ds390\Makefile"
274 SetOutPath "$INSTDIR\lib\src\ds400"
275 File "${DEV_ROOT}\lib\src\ds400\*.c"
276 # File "${DEV_ROOT}\lib\src\ds400\Makefile"
278 SetOutPath "$INSTDIR\lib\src\gbz80"
279 File "${DEV_ROOT}\lib\src\gbz80\*.c"
280 File "${DEV_ROOT}\lib\src\gbz80\*.s"
281 # File "${DEV_ROOT}\lib\src\gbz80\Makefile"
283 SetOutPath "$INSTDIR\lib\src\z80"
284 File "${DEV_ROOT}\lib\src\z80\*.c"
285 File "${DEV_ROOT}\lib\src\z80\*.s"
286 # File "${DEV_ROOT}\lib\src\z80\Makefile"
288 SetOutPath "$INSTDIR\lib\src\hc08"
289 File "${DEV_ROOT}\lib\src\hc08\*.c"
290 # File "${DEV_ROOT}\lib\src\hc08\Makefile"
292 SetOutPath "$INSTDIR\lib\src\mcs51"
293 File "${DEV_ROOT}\lib\src\mcs51\*.asm"
294 # File "${DEV_ROOT}\lib\src\mcs51\Makefile"
296 SetOutPath "$INSTDIR\lib\src\small"
297 # File "${DEV_ROOT}\lib\src\small\Makefile"
299 SetOutPath "$INSTDIR\lib\src\medium"
300 # File "${DEV_ROOT}\lib\src\medium\Makefile"
302 SetOutPath "$INSTDIR\lib\src\large"
303 # File "${DEV_ROOT}\lib\src\large\Makefile"
305 SetOutPath "$INSTDIR\lib\src\pic"
306 # File "${DEV_ROOT}\lib\src\pic\configure"
307 # File "${DEV_ROOT}\lib\src\pic\configure.in"
308 # File "${DEV_ROOT}\lib\src\pic\GPL"
309 # File "${DEV_ROOT}\lib\src\pic\LGPL"
310 # File "${DEV_ROOT}\lib\src\pic\Makefile"
311 # File "${DEV_ROOT}\lib\src\pic\Makefile.common"
312 # File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
313 # File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
314 # File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
315 # File "${DEV_ROOT}\lib\src\pic\NEWS"
316 # File "${DEV_ROOT}\lib\src\pic\README"
317 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
318 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
320 SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
321 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
322 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
323 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
324 # File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
326 SetOutPath "$INSTDIR\lib\src\pic\libdev"
327 File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
328 # File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
330 SetOutPath "$INSTDIR\lib\src\pic\libm"
331 File "${DEV_ROOT}\lib\src\pic\libm\*.c"
333 SetOutPath "$INSTDIR\lib\src\pic16"
334 # File "${DEV_ROOT}\lib\src\pic16\configure"
335 # File "${DEV_ROOT}\lib\src\pic16\configure.in"
336 # File "${DEV_ROOT}\lib\src\pic16\COPYING"
337 # File "${DEV_ROOT}\lib\src\pic16\Makefile"
338 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
339 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
340 # File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
341 # File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
342 # File "${DEV_ROOT}\lib\src\pic16\pics.all"
343 # File "${DEV_ROOT}\lib\src\pic16\pics.build"
344 # File "${DEV_ROOT}\lib\src\pic16\README"
346 SetOutPath "$INSTDIR\lib\src\pic16\debug"
347 # File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
349 SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
350 # File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
351 File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
353 SetOutPath "$INSTDIR\lib\src\pic16\libc"
354 # File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
356 SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
357 File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
358 # File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
360 SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
361 File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
362 # File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
364 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
365 File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
366 # File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
368 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
369 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
370 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
371 # File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
373 SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
374 File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
375 # File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
377 SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
378 File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
379 # File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
381 SetOutPath "$INSTDIR\lib\src\pic16\libdev"
382 File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
383 # File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
385 SetOutPath "$INSTDIR\lib\src\pic16\libio"
386 File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
387 # File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
389 SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
390 File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
391 # File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
393 SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
394 File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
395 # File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
397 SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
398 File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
399 # File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
401 SetOutPath "$INSTDIR\lib\src\pic16\libm"
402 File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
403 # File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
405 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
406 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
408 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
409 File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
410 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
412 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
413 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
414 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
415 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
417 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
418 File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
419 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
421 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
422 File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
423 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
425 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
426 File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
427 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
429 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
430 File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
431 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
433 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
434 File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
435 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
437 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
438 File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
440 SetOutPath "$INSTDIR\lib\src\pic16\startup"
441 File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
442 # File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
443 # File "${DEV_ROOT}\lib\src\pic16\startup\README"
445 SetOutPath "$INSTDIR\lib\src"
446 File "${DEV_ROOT}\lib\src\*.c"
450 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
451 CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
452 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk" "$INSTDIR\sdcc.url"
453 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
454 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
455 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
456 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT"
457 !insertmacro MUI_STARTMENU_WRITE_END
461 WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
465 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
466 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
467 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
468 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
469 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
470 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
471 WriteUninstaller "$INSTDIR\uninstall.exe"
475 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to add $INSTDIR\bin to the PATH?" IDNO +3
481 ;;;; Uninstaller code ;;;;
484 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
488 Function un.onUninstSuccess
490 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
494 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
496 Delete "$INSTDIR\sdcc.url"
498 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "NSIS:StartMenuDir"
499 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
501 Delete "$INSTDIR\uninstall.exe"
502 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
503 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
504 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
505 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
506 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk"
508 Delete "$INSTDIR\lib\src\large\Makefile"
510 Delete "$INSTDIR\lib\src\medium\Makefile"
512 Delete "$INSTDIR\lib\src\small\Makefile"
514 Delete "$INSTDIR\lib\src\mcs51\*.asm"
515 Delete "$INSTDIR\lib\src\mcs51\Makefile"
516 Delete "$INSTDIR\lib\src\mcs51\README"
518 Delete "$INSTDIR\lib\src\hc08\*.c"
519 Delete "$INSTDIR\lib\src\hc08\hc08.lib"
520 Delete "$INSTDIR\lib\src\hc08\Makefile"
522 Delete "$INSTDIR\lib\src\z80\*.c"
523 Delete "$INSTDIR\lib\src\z80\*.s"
524 Delete "$INSTDIR\lib\src\z80\z80.lib"
525 Delete "$INSTDIR\lib\src\z80\README"
526 Delete "$INSTDIR\lib\src\z80\Makefile"
528 Delete "$INSTDIR\lib\src\gbz80\*.c"
529 Delete "$INSTDIR\lib\src\gbz80\*.s"
530 Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
531 Delete "$INSTDIR\lib\src\gbz80\README"
532 Delete "$INSTDIR\lib\src\gbz80\Makefile"
534 Delete "$INSTDIR\lib\src\ds390\*.c"
535 Delete "$INSTDIR\lib\src\ds390\libds390.lib"
536 Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
537 Delete "$INSTDIR\lib\src\ds390\Makefile"
538 Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
540 Delete "$INSTDIR\lib\src\ds400\*.c"
541 Delete "$INSTDIR\lib\src\ds400\libds400.lib"
542 Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
543 Delete "$INSTDIR\lib\src\ds400\Makefile"
545 Delete "$INSTDIR\lib\src\*.c"
547 Delete "$INSTDIR\lib\pic\*.o"
548 Delete "$INSTDIR\lib\pic\*.lib"
550 Delete "$INSTDIR\lib\pic16\*.o"
551 Delete "$INSTDIR\lib\pic16\*.lib"
553 Delete "$INSTDIR\lib\hc08\*.rel"
554 Delete "$INSTDIR\lib\hc08\*.lib"
556 Delete "$INSTDIR\lib\z80\*.o"
557 Delete "$INSTDIR\lib\z80\*.lib"
559 Delete "$INSTDIR\lib\small\*.rel"
560 Delete "$INSTDIR\lib\small\*.lib"
562 Delete "$INSTDIR\lib\medium\*.rel"
563 Delete "$INSTDIR\lib\medium\*.lib"
565 Delete "$INSTDIR\lib\large\*.rel"
566 Delete "$INSTDIR\lib\large\*.lib"
568 Delete "$INSTDIR\lib\small-stack-auto\*.rel"
569 Delete "$INSTDIR\lib\small-stack-auto\*.lib"
571 Delete "$INSTDIR\lib\gbz80\*.o"
572 Delete "$INSTDIR\lib\gbz80\*.lib"
574 Delete "$INSTDIR\lib\ds390\*.rel"
575 Delete "$INSTDIR\lib\ds390\*.lib"
577 Delete "$INSTDIR\lib\ds400\*.rel"
578 Delete "$INSTDIR\lib\ds400\*.lib"
580 Delete "$INSTDIR\include\asm\z80\*.h"
581 Delete "$INSTDIR\include\asm\pic16\*.h"
582 Delete "$INSTDIR\include\asm\pic\*.h"
583 Delete "$INSTDIR\include\asm\mcs51\*.h"
584 Delete "$INSTDIR\include\asm\gbz80\*.h"
585 Delete "$INSTDIR\include\asm\ds390\*.h"
586 Delete "$INSTDIR\include\asm\default\*.h"
587 Delete "$INSTDIR\include\z80\*.h"
588 Delete "$INSTDIR\include\pic\*.h"
589 Delete "$INSTDIR\include\pic\*.txt"
590 Delete "$INSTDIR\include\pic\*.inc"
591 Delete "$INSTDIR\include\pic16\*.h"
592 Delete "$INSTDIR\include\mcs51\*.h"
593 Delete "$INSTDIR\include\hc08\*.h"
594 Delete "$INSTDIR\include\*.h"
597 Delete "$INSTDIR\doc\README.TXT"
598 Delete "$INSTDIR\doc\ChangeLog_head.txt"
601 Delete "$INSTDIR\bin\*.exe"
603 Delete "$INSTDIR\COPYING.TXT"
604 Delete "$INSTDIR\sdcc.ico"
606 RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
608 RMDir /r "$INSTDIR\lib\src\pic"
609 RMDir /r "$INSTDIR\lib\src\pic16"
610 RMDir "$INSTDIR\lib\src\small"
611 RMDir "$INSTDIR\lib\src\medium"
612 RMDir "$INSTDIR\lib\src\large"
613 RMDir "$INSTDIR\lib\src\mcs51"
614 RMDir "$INSTDIR\lib\src\z80"
615 RMDir "$INSTDIR\lib\src\gbz80"
616 RMDir "$INSTDIR\lib\src\ds390\examples"
617 RMDir "$INSTDIR\lib\src\ds390"
618 RMDir "$INSTDIR\lib\src\ds400"
619 RMDir "$INSTDIR\lib\src\hc08"
620 RMDir "$INSTDIR\lib\src"
622 RMDir "$INSTDIR\lib\pic"
623 RMDir "$INSTDIR\lib\pic16"
624 RMDir "$INSTDIR\lib\z80"
625 RMDir "$INSTDIR\lib\small"
626 RMDir "$INSTDIR\lib\medium"
627 RMDir "$INSTDIR\lib\large"
628 RMDir "$INSTDIR\lib\small-stack-auto"
629 RMDir "$INSTDIR\lib\gbz80"
630 RMDir "$INSTDIR\lib\ds390"
631 RMDir "$INSTDIR\lib\ds400"
632 RMDir "$INSTDIR\lib\hc08"
635 RMDir "$INSTDIR\include\asm\z80"
636 RMDir "$INSTDIR\include\asm\pic16"
637 RMDir "$INSTDIR\include\asm\pic"
638 RMDir "$INSTDIR\include\asm\mcs51"
639 RMDir "$INSTDIR\include\asm\gbz80"
640 RMDir "$INSTDIR\include\asm\ds390"
641 RMDir "$INSTDIR\include\asm\default"
642 RMDir "$INSTDIR\include\asm"
643 RMDir "$INSTDIR\include\z80"
644 RMDir "$INSTDIR\include\pic"
645 RMDir "$INSTDIR\include\pic16"
646 RMDir "$INSTDIR\include\mcs51"
647 RMDir "$INSTDIR\include\hc08"
648 RMDir "$INSTDIR\include"
651 RMDir /r "$INSTDIR\doc"
661 Call un.RemoveFromPath
666 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
667 ; Path Manipulation functions ;
668 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
671 !include "WinMessages.nsh"
674 ; AddToPath - Adds the given dir to the search path.
675 ; Input - head of the stack
676 ; Note - Win9x systems requires reboot
685 ; don't add if the path doesn't exist
686 IfFileExists $0 "" AddToPath_done
691 ; Not on NT: read PATH from environment variable
694 ; On NT: read PATH from registry
695 ReadRegStr $1 HKCU "Environment" "PATH"
700 StrCmp $2 "" "" AddToPath_done
705 StrCmp $2 "" "" AddToPath_done
706 GetFullPathName /SHORT $3 $0
711 StrCmp $2 "" "" AddToPath_done
716 StrCmp $2 "" "" AddToPath_done
718 StrCmp $4 1 AddToPath_NT
721 FileOpen $1 "$1\autoexec.bat" a
724 IntCmp $2 26 0 +2 +2 ; DOS EOF
725 FileSeek $1 -1 END ; write over EOF
726 FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
732 ReadRegStr $1 HKCU "Environment" "PATH"
733 StrCpy $2 $1 1 -1 ; copy last char
734 StrCmp $2 ";" 0 +2 ; if last char == ;
735 StrCpy $1 $1 -1 ; remove last char
736 StrCmp $1 "" AddToPath_NTdoIt
739 WriteRegExpandStr HKCU "Environment" "PATH" $0
740 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
750 ; RemoveFromPath - Remove a given dir from the path
751 ; Input: head of the stack
753 Function un.RemoveFromPath
762 IntFmt $6 "%c" 26 ; DOS EOF
766 StrCmp $1 1 unRemoveFromPath_NT
769 FileOpen $1 "$1\autoexec.bat" r
772 GetFullPathName /SHORT $0 $0
773 StrCpy $0 "SET PATH=%PATH%;$0"
774 Goto unRemoveFromPath_dosLoop
776 unRemoveFromPath_dosLoop:
778 StrCpy $5 $3 1 -1 ; read last char
779 StrCmp $5 $6 0 +2 ; if DOS EOF
780 StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
781 StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
782 StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
783 StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
784 StrCmp $3 "" unRemoveFromPath_dosLoopEnd
786 Goto unRemoveFromPath_dosLoop
787 unRemoveFromPath_dosLoopRemoveLine:
789 Goto unRemoveFromPath_dosLoop
791 unRemoveFromPath_dosLoopEnd:
795 Delete "$1\autoexec.bat"
796 CopyFiles /SILENT $4 "$1\autoexec.bat"
798 Goto unRemoveFromPath_done
801 ReadRegStr $1 HKCU "Environment" "PATH"
802 StrCpy $5 $1 1 -1 ; copy last char
803 StrCmp $5 ";" +2 ; if last char != ;
804 StrCpy $1 "$1;" ; append ;
807 Call un.StrStr ; Find `$0;` in $1
808 Pop $2 ; pos of our dir
809 StrCmp $2 "" unRemoveFromPath_done
810 ; else, it is in path
815 StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
816 StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
819 StrCpy $5 $3 1 -1 ; copy last char
820 StrCmp $5 ";" 0 +2 ; if last char == ;
821 StrCpy $3 $3 -1 ; remove last char
824 ; New PATH not empty: update the registry
825 WriteRegExpandStr HKCU "Environment" "PATH" $3
827 ; New PATH empty: remove from the registry
828 DeleteRegValue HKCU "Environment" "PATH"
829 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
831 unRemoveFromPath_done:
841 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
842 ; Utility Functions ;
843 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
847 ; output, top of the stack = 1 if NT or 0 if not
852 ; ($R0 at this point is 1 or 0)
857 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
858 StrCmp $0 "" 0 IsNT_yes
871 !insertmacro IsNT "un."
874 ; input, top of stack = string to search for
875 ; top of stack-1 = string to search in
876 ; output, top of stack (replaces with the portion of the string remaining)
877 ; modifies no other variables.
880 ; Push "this is a long ass string"
884 ; ($R0 at this point is "ass string")
888 Exch $R1 ; st=haystack,old$R1, $R1=needle
889 Exch ; st=old$R1,haystack
890 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
902 StrCpy $R5 $R2 $R3 $R4
908 StrCpy $R1 $R2 "" $R4
916 !insertmacro StrStr ""
917 !insertmacro StrStr "un."