1 # sdcc.nsi - NSIS installer script for SDCC
3 # Copyright (c) 2003-2009 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-rrrr.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 it to DOS format:
35 # unix2dos COPYING.txt
36 # - copy readline5.dll to PKGDIR/bin/readline5.dll
37 # - run NSIS installer from PKGDIR directory:
38 # "c:\Program Files\NSIS\makensis.exe" -DVER_MAJOR=<SDCC_VER_MAJOR> -DVER_MINOR=<SDCC_VER_MINOR> -DVER_REVISION=<SDCC_VER_DEVEL> -DVER_BUILD=<SDCC_REVISION> sdcc.nsi
39 # replace <VER_XXX> with the appropriate values, for example for SDCC 2.7.4:
40 # <SDCC_VER_MAJOR> = 2
41 # <SDCC_VER_MINOR> = 7
42 # <SDCC_VER_DEVEL> = 4
43 # replace <SDCC_REVISION> with the current svn revision number
44 # - A setup file setup.exe is created in PKGDIR directory.
45 # Rename it to sdcc-yyyymmdd-rrrr-setup.exe and upload it
46 # to sdcc download repository at sourceforge.net
49 # How to create WIN32 release setup.exe package
51 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
52 # to a clean directory (the option to create directories should be enabled).
53 # A sub directory sdcc is created (referenced as PKGDIR in continuation).
54 # - remove the PKGDIR/doc/ directory
55 # - unpack sdcc-doc-yyyymmdd-rrrr.zip to the PKGDIR/doc directory
56 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
57 # (this file) from the sdcc Subversion snapshot to the PKGDIR directory
58 # - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
59 # rename it to COPYING.txt and convert it to DOS format:
60 # unix2dos COPYING.txt
61 # - copy readline5.dll to PKGDIR/bin/readline5.dll
62 # - run NSIS installer from PKGDIR directory:
63 # "c:\Program Files\NSIS\makensis.exe" -DFULL_DOC -DVER_MAJOR=<VER_MAJOR> -DVER_MINOR=<VER_MINOR> -DVER_REVISION=<VER_PATCH> -DVER_BUILD=<REVISION> sdcc.nsi
64 # - A setup file setup.exe is created in PKGDIR directory.
65 # Rename it to sdcc-x.x.x-setup.exe and upload it
66 # to sdcc download repository at sourceforge.net
68 # How to upload secc setup.exe tosourceforge.net
70 # Execute following commands from the cmd prompt:
71 # - sftp sdcc.sourceforge.net
72 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
73 # - put sdcc_yyyymmdd_setup.exe
76 # For debugging define -DSDCC.DEBUG command line option
78 ;--------------------------------
89 !define SDCC.PushStr "!insertmacro MACRO_SDCC_PushStr"
90 !macro MACRO_SDCC_PushStr NAME
91 StrCpy $SDCC.StrStack4 $SDCC.StrStack3
92 StrCpy $SDCC.StrStack3 $SDCC.StrStack2
93 StrCpy $SDCC.StrStack2 $SDCC.StrStack1
94 StrCpy $SDCC.StrStack1 $SDCC.StrStack0
95 StrCpy $SDCC.StrStack0 $SDCC.FunctionName
96 StrCpy $SDCC.FunctionName "${NAME}"
99 !define SDCC.PopStr "!insertmacro MACRO_SDCC_PopStr"
100 !macro MACRO_SDCC_PopStr
101 StrCpy $SDCC.FunctionName $SDCC.StrStack0
102 StrCpy $SDCC.StrStack0 $SDCC.StrStack1
103 StrCpy $SDCC.StrStack1 $SDCC.StrStack2
104 StrCpy $SDCC.StrStack2 $SDCC.StrStack3
105 StrCpy $SDCC.StrStack3 $SDCC.StrStack4
109 !define DebugMsg "!insertmacro MACRO_SDCC_DebugMsg"
110 !macro MACRO_SDCC_DebugMsg MSG
112 MessageBox MB_OK "*** $SDCC.FunctionName: ${MSG} ***"
116 !define Function "!insertmacro MACRO_SDCC_Function"
117 !macro MACRO_SDCC_Function NAME
120 ${SDCC.PushStr} ${NAME}
124 !define FunctionEnd "!insertmacro MACRO_SDCC_FunctionEnd"
125 !macro MACRO_SDCC_FunctionEnd
132 !define Section "!insertmacro MACRO_SDCC_Section"
133 !macro MACRO_SDCC_Section NAME ID
134 Section "${NAME}" "${ID}"
136 ${SDCC.PushStr} "${NAME}"
140 !define UnselectedSection "!insertmacro MACRO_SDCC_UnselectedSection"
141 !macro MACRO_SDCC_UnselectedSection NAME ID
142 Section /o ${NAME} ${ID}
144 ${SDCC.PushStr} "${NAME}"
148 !define SectionEnd "!insertmacro MACRO_SDCC_SectionEnd"
149 !macro MACRO_SDCC_SectionEnd
157 !define PRODUCT_NAME "SDCC"
160 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
161 !define PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}"
163 !define PRODUCT_VERSION "XX.XX"
166 SetCompressor /SOLID lzma
168 !define SDCC_ROOT "."
170 !define DEV_ROOT "${SDCC_ROOT}"
173 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog.txt" = 0
175 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
177 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
179 InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
180 InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
181 InstType "Compact (Bin, ucSim, SDCDB, Doc)"
183 ;--------------------------------
186 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
187 !define UNINST_ROOT_KEY HKLM
188 !define SDCC_ROOT_KEY HKLM
190 ;--------------------------------
194 !include WordFunc.nsh
199 ;--------------------------------
202 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
203 !insertmacro VersionCompare
206 ;--------------------------------
209 Var SDCC.PathToRemove
211 ;--------------------------------
215 !define MUI_ABORTWARNING
216 !define MUI_ICON ".\sdcc.ico"
219 !insertmacro MUI_PAGE_WELCOME
222 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.txt"
224 ; Uninstall/reinstall page
225 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
226 Page custom SDCC.PageReinstall SDCC.PageLeaveReinstall
230 !define MUI_STARTMENUPAGE_DEFAULTFOLDER ${PRODUCT_NAME}
231 !define MUI_STARTMENUPAGE_REGISTRY_ROOT ${UNINST_ROOT_KEY}
232 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
233 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
234 !define MUI_STARTMENUPAGE_NODISABLE
235 Var MUI_STARTMENUPAGE_VARIABLE
236 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
239 !define MUI_COMPONENTSPAGE_SMALLDESC
240 !insertmacro MUI_PAGE_COMPONENTS
243 !insertmacro MUI_PAGE_DIRECTORY
246 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "SDCC.InstFilesLeave"
247 !insertmacro MUI_PAGE_INSTFILES
249 ${Function} SDCC.InstFilesLeave
250 ; Remove old path if reinstallation
251 ${If} $SDCC.PathToRemove != ""
252 ${DebugMsg} "removing path $SDCC.PathToRemove"
253 Push $SDCC.PathToRemove
254 Call SDCC.RemoveFromPath
258 ; Finish page - add to path
259 !define MUI_FINISHPAGE_TEXT "Confirm the checkbox if you want to add SDCC binary directory to the PATH environment variable"
260 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Add $INSTDIR\bin to the PATH"
261 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION SDCC.AddBinToPath
262 !define MUI_FINISHPAGE_SHOWREADME
263 !define MUI_FINISHPAGE_BUTTON "Next"
264 !insertmacro MUI_PAGE_FINISH
266 ; Finish page - reboot
267 !insertmacro MUI_PAGE_FINISH
269 ${Function} SDCC.AddBinToPath
271 ${DebugMsg} "adding path $INSTDIR\bin"
277 !insertmacro MUI_UNPAGE_CONFIRM
278 !insertmacro MUI_UNPAGE_INSTFILES
279 !insertmacro MUI_UNPAGE_FINISH
282 !insertmacro MUI_LANGUAGE "English"
284 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
287 InstallDir "$PROGRAMFILES\SDCC"
288 ;;;;ShowInstDetails show
289 ;;;;ShowUnInstDetails show
293 ${DebugMsg} "Pre INSTDIR = $INSTDIR"
295 !ifndef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
296 ; Old unistallation method
297 ; Uninstall the old version, if present
298 ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
301 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
302 "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
303 previous version or 'Cancel' to cancel this upgrade." \
308 ; Run the uninstaller
315 ; Install the new version
316 MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
321 ; If the registry key exists it is an uninstallation or reinstallation:
322 ; take the old installation directory
325 ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
328 StrCpy $SDCC.PathToRemove "$INSTDIR\bin"
333 ${DebugMsg} "Post INSTDIR = $INSTDIR"
336 ${Function} un.onInit
338 ${DebugMsg} "Pre INSTDIR = $INSTDIR"
341 ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
347 ${DebugMsg} "Post INSTDIR = $INSTDIR"
351 ${Section} -Common SECCOMMON
352 SetOutPath "$INSTDIR"
354 File "${SDCC_ROOT}\COPYING.txt"
357 ${Section} "SDCC application files" SEC01
359 SetOutPath "$INSTDIR\bin"
360 File "${SDCC_ROOT}\bin\as-gbz80.exe"
361 File "${SDCC_ROOT}\bin\as-hc08.exe"
362 File "${SDCC_ROOT}\bin\as-z80.exe"
363 File "${SDCC_ROOT}\bin\asx8051.exe"
364 File "${SDCC_ROOT}\bin\aslink.exe"
365 File "${SDCC_ROOT}\bin\asranlib.exe"
366 File "${SDCC_ROOT}\bin\link-gbz80.exe"
367 File "${SDCC_ROOT}\bin\link-hc08.exe"
368 File "${SDCC_ROOT}\bin\link-z80.exe"
369 File "${SDCC_ROOT}\bin\makebin.exe"
370 File "${SDCC_ROOT}\bin\packihx.exe"
371 File "${SDCC_ROOT}\bin\sdcc.exe"
372 File "${SDCC_ROOT}\bin\sdcclib.exe"
373 File "${SDCC_ROOT}\bin\sdcpp.exe"
374 File "${SDCC_ROOT}\bin\readline5.dll"
377 ${Section} "ucSim application files" SEC02
379 SetOutPath "$INSTDIR\bin"
380 File "${SDCC_ROOT}\bin\s51.exe"
381 File "${SDCC_ROOT}\bin\savr.exe"
382 File "${SDCC_ROOT}\bin\shc08.exe"
383 File "${SDCC_ROOT}\bin\sz80.exe"
386 ${Section} "SDCDB files" SEC03
388 File "${SDCC_ROOT}\bin\sdcdb.exe"
389 File "${SDCC_ROOT}\bin\sdcdb.el"
390 File "${SDCC_ROOT}\bin\sdcdbsrc.el"
393 ${Section} "SDCC documentation" SEC04
395 SetOutPath "$INSTDIR\doc"
397 File /r "${SDCC_ROOT}\doc\*"
399 File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
400 File "${SDCC_ROOT}\doc\README.TXT"
404 ${Section} "SDCC include files" SEC05
406 SetOutPath "$INSTDIR\include\asm\default"
407 File "${DEV_ROOT}\include\asm\default\features.h"
408 SetOutPath "$INSTDIR\include\asm\ds390"
409 File "${DEV_ROOT}\include\asm\ds390\features.h"
410 SetOutPath "$INSTDIR\include\asm\gbz80"
411 File "${DEV_ROOT}\include\asm\gbz80\features.h"
412 SetOutPath "$INSTDIR\include\asm\mcs51"
413 File "${DEV_ROOT}\include\asm\mcs51\features.h"
414 SetOutPath "$INSTDIR\include\asm\pic"
415 File "${DEV_ROOT}\include\asm\pic\features.h"
416 SetOutPath "$INSTDIR\include\asm\pic16"
417 File "${DEV_ROOT}\include\asm\pic16\features.h"
418 SetOutPath "$INSTDIR\include\asm\z80"
419 File "${DEV_ROOT}\include\asm\z80\features.h"
420 SetOutPath "$INSTDIR\include\hc08"
421 File "${DEV_ROOT}\include\hc08\*.h"
422 SetOutPath "$INSTDIR\include\mcs51"
423 File "${DEV_ROOT}\include\mcs51\*.h"
424 SetOutPath "$INSTDIR\include\pic"
425 File "${DEV_ROOT}\include\pic\*.h"
426 File "${DEV_ROOT}\include\pic\*.txt"
427 File "${DEV_ROOT}\include\pic\*.inc"
428 SetOutPath "$INSTDIR\include\pic16"
429 File "${DEV_ROOT}\include\pic16\*.h"
430 File "${DEV_ROOT}\include\pic16\*.txt"
431 SetOutPath "$INSTDIR\include\z80"
432 File "${DEV_ROOT}\include\z80\*.h"
433 SetOutPath "$INSTDIR\include"
434 File "${DEV_ROOT}\include\*.h"
437 ${Section} "SDCC DS390 library" SEC06
439 SetOutPath "$INSTDIR\lib\ds390"
440 File "${DEV_ROOT}\lib\ds390\*.*"
443 ${Section} "SDCC DS400 library" SEC07
445 SetOutPath "$INSTDIR\lib\ds400"
446 File "${DEV_ROOT}\lib\ds400\*.*"
449 ${Section} "SDCC GBZ80 library" SEC08
451 SetOutPath "$INSTDIR\lib\gbz80"
452 File "${DEV_ROOT}\lib\gbz80\*.*"
455 ${Section} "SDCC Z80 library" SEC09
457 SetOutPath "$INSTDIR\lib\z80"
458 File "${DEV_ROOT}\lib\z80\*.*"
461 ${Section} "SDCC small model library" SEC10
463 SetOutPath "$INSTDIR\lib\small"
464 File "${DEV_ROOT}\lib\small\*.*"
467 ${Section} "SDCC medium model library" SEC11
469 SetOutPath "$INSTDIR\lib\medium"
470 File "${DEV_ROOT}\lib\medium\*.*"
473 ${Section} "SDCC large model library" SEC12
475 SetOutPath "$INSTDIR\lib\large"
476 File "${DEV_ROOT}\lib\large\*.*"
479 ${Section} "SDCC small-stack-auto model library" SEC13
481 SetOutPath "$INSTDIR\lib\small-stack-auto"
482 File "${DEV_ROOT}\lib\small-stack-auto\*.*"
485 ${Section} "SDCC HC08 library" SEC14
487 SetOutPath "$INSTDIR\lib\hc08"
488 File "${DEV_ROOT}\lib\hc08\*.*"
491 ${Section} "SDCC PIC16 library" SEC15
493 SetOutPath "$INSTDIR\lib\pic16"
494 File "${DEV_ROOT}\lib\pic16\*.o"
495 File "${DEV_ROOT}\lib\pic16\*.lib"
498 ${Section} "SDCC PIC library" SEC16
500 SetOutPath "$INSTDIR\lib\pic"
501 File "${DEV_ROOT}\lib\pic\*.lib"
504 ${Section} "SDCC library sources" SEC17
506 SetOutPath "$INSTDIR\lib\src\ds390\examples"
507 File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
509 SetOutPath "$INSTDIR\lib\src\ds390"
510 File "${DEV_ROOT}\lib\src\ds390\*.c"
511 # File "${DEV_ROOT}\lib\src\ds390\Makefile"
513 SetOutPath "$INSTDIR\lib\src\ds400"
514 File "${DEV_ROOT}\lib\src\ds400\*.c"
515 # File "${DEV_ROOT}\lib\src\ds400\Makefile"
517 SetOutPath "$INSTDIR\lib\src\gbz80"
518 File "${DEV_ROOT}\lib\src\gbz80\*.c"
519 File "${DEV_ROOT}\lib\src\gbz80\*.s"
520 # File "${DEV_ROOT}\lib\src\gbz80\Makefile"
522 SetOutPath "$INSTDIR\lib\src\z80"
523 File "${DEV_ROOT}\lib\src\z80\*.s"
524 # File "${DEV_ROOT}\lib\src\z80\Makefile"
526 SetOutPath "$INSTDIR\lib\src\hc08"
527 File "${DEV_ROOT}\lib\src\hc08\*.c"
528 # File "${DEV_ROOT}\lib\src\hc08\Makefile"
530 SetOutPath "$INSTDIR\lib\src\mcs51"
531 File "${DEV_ROOT}\lib\src\mcs51\*.asm"
532 # File "${DEV_ROOT}\lib\src\mcs51\Makefile"
534 SetOutPath "$INSTDIR\lib\src\small"
535 # File "${DEV_ROOT}\lib\src\small\Makefile"
537 SetOutPath "$INSTDIR\lib\src\medium"
538 # File "${DEV_ROOT}\lib\src\medium\Makefile"
540 SetOutPath "$INSTDIR\lib\src\large"
541 # File "${DEV_ROOT}\lib\src\large\Makefile"
543 SetOutPath "$INSTDIR\lib\src\pic"
544 # File "${DEV_ROOT}\lib\src\pic\configure"
545 # File "${DEV_ROOT}\lib\src\pic\configure.in"
546 # File "${DEV_ROOT}\lib\src\pic\GPL"
547 # File "${DEV_ROOT}\lib\src\pic\LGPL"
548 # File "${DEV_ROOT}\lib\src\pic\Makefile"
549 # File "${DEV_ROOT}\lib\src\pic\Makefile.common"
550 # File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
551 # File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
552 # File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
553 # File "${DEV_ROOT}\lib\src\pic\NEWS"
554 # File "${DEV_ROOT}\lib\src\pic\README"
555 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
556 File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
558 SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
559 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
560 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
561 File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
562 # File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
564 SetOutPath "$INSTDIR\lib\src\pic\libdev"
565 File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
566 # File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
568 SetOutPath "$INSTDIR\lib\src\pic\libm"
569 File "${DEV_ROOT}\lib\src\pic\libm\*.c"
571 SetOutPath "$INSTDIR\lib\src\pic16"
572 # File "${DEV_ROOT}\lib\src\pic16\configure"
573 # File "${DEV_ROOT}\lib\src\pic16\configure.in"
574 # File "${DEV_ROOT}\lib\src\pic16\COPYING"
575 # File "${DEV_ROOT}\lib\src\pic16\Makefile"
576 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
577 # File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
578 # File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
579 # File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
580 # File "${DEV_ROOT}\lib\src\pic16\pics.all"
581 # File "${DEV_ROOT}\lib\src\pic16\pics.build"
582 # File "${DEV_ROOT}\lib\src\pic16\README"
584 SetOutPath "$INSTDIR\lib\src\pic16\debug"
585 # File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
587 SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
588 # File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
589 File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
591 SetOutPath "$INSTDIR\lib\src\pic16\libc"
592 # File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
594 SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
595 File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
596 # File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
598 SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
599 File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
600 # File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
602 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
603 File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
604 # File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
606 SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
607 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
608 File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
609 # File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
611 SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
612 File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
613 # File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
615 SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
616 File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
617 # File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
619 SetOutPath "$INSTDIR\lib\src\pic16\libdev"
620 File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
621 # File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
623 SetOutPath "$INSTDIR\lib\src\pic16\libio"
624 File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
625 # File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
627 SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
628 File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
629 # File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
631 SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
632 File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
633 # File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
635 SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
636 File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
637 # File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
639 SetOutPath "$INSTDIR\lib\src\pic16\libm"
640 File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
641 # File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
643 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
644 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
646 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
647 File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
648 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
650 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
651 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
652 File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
653 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
655 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
656 File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
657 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
659 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
660 File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
661 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
663 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
664 File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
665 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
667 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
668 File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
669 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
671 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
672 File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
673 # File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
675 SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
676 File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
678 SetOutPath "$INSTDIR\lib\src\pic16\startup"
679 File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
680 # File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
681 # File "${DEV_ROOT}\lib\src\pic16\startup\README"
683 SetOutPath "$INSTDIR\lib\src"
684 File "${DEV_ROOT}\lib\src\*.c"
687 ;--------------------------------
691 LangString DESC_SEC01 ${LANG_ENGLISH} "SDCC application files"
692 LangString DESC_SEC02 ${LANG_ENGLISH} "ucSim application files"
693 LangString DESC_SEC03 ${LANG_ENGLISH} "SDCDB files"
694 LangString DESC_SEC04 ${LANG_ENGLISH} "SDCC documentation"
695 LangString DESC_SEC05 ${LANG_ENGLISH} "SDCC include files"
696 LangString DESC_SEC06 ${LANG_ENGLISH} "SDCC DS390 library"
697 LangString DESC_SEC07 ${LANG_ENGLISH} "SDCC DS400 library"
698 LangString DESC_SEC08 ${LANG_ENGLISH} "SDCC GBZ80 library"
699 LangString DESC_SEC09 ${LANG_ENGLISH} "SDCC Z80 library"
700 LangString DESC_SEC10 ${LANG_ENGLISH} "SDCC small model library"
701 LangString DESC_SEC11 ${LANG_ENGLISH} "SDCC medium model library"
702 LangString DESC_SEC12 ${LANG_ENGLISH} "SDCC large model library"
703 LangString DESC_SEC13 ${LANG_ENGLISH} "SDCC small-stack-auto model library"
704 LangString DESC_SEC14 ${LANG_ENGLISH} "SDCC HC08 library"
705 LangString DESC_SEC15 ${LANG_ENGLISH} "SDCC PIC16 library"
706 LangString DESC_SEC16 ${LANG_ENGLISH} "SDCC PIC library"
707 LangString DESC_SEC17 ${LANG_ENGLISH} "SDCC library sources"
709 ;Assign language strings to sections
710 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
711 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC01)
712 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC02)
713 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_SEC03)
714 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_SEC04)
715 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $(DESC_SEC05)
716 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $(DESC_SEC06)
717 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $(DESC_SEC07)
718 !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $(DESC_SEC08)
719 !insertmacro MUI_DESCRIPTION_TEXT ${SEC09} $(DESC_SEC09)
720 !insertmacro MUI_DESCRIPTION_TEXT ${SEC10} $(DESC_SEC10)
721 !insertmacro MUI_DESCRIPTION_TEXT ${SEC11} $(DESC_SEC11)
722 !insertmacro MUI_DESCRIPTION_TEXT ${SEC12} $(DESC_SEC12)
723 !insertmacro MUI_DESCRIPTION_TEXT ${SEC13} $(DESC_SEC13)
724 !insertmacro MUI_DESCRIPTION_TEXT ${SEC14} $(DESC_SEC14)
725 !insertmacro MUI_DESCRIPTION_TEXT ${SEC15} $(DESC_SEC15)
726 !insertmacro MUI_DESCRIPTION_TEXT ${SEC16} $(DESC_SEC16)
727 !insertmacro MUI_DESCRIPTION_TEXT ${SEC17} $(DESC_SEC17)
728 !insertmacro MUI_FUNCTION_DESCRIPTION_END
729 ;--------------------------------
731 ${Section} -Icons SECICONS
732 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
733 CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
734 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
736 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\sdccman.pdf" "" "$INSTDIR\sdcc.ico" "" "" "" ""
737 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
738 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
740 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
741 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
743 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.txt"
744 !insertmacro MUI_STARTMENU_WRITE_END
747 ${Section} -INI SECINI
748 WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
750 WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url" "InternetShortcut" "URL" "http://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/ChangeLog"
754 ${Section} -PostInstall SECPOSTINSTALL
755 WriteRegStr ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "" $INSTDIR
756 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
757 WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor" "${VER_MAJOR}"
758 WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor" "${VER_MINOR}"
759 WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision" "${VER_REVISION}"
760 WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild" "${VER_BUILD}"
763 WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
764 WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
765 WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
766 WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "sdcc.sourceforge.net"
767 WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "http://sdcc.sourceforge.net/"
768 WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "http://sdcc.sourceforge.net/"
769 WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
771 WriteUninstaller "$INSTDIR\uninstall.exe"
775 ;;;; Uninstaller code ;;;;
777 ${Section} Uninstall SECUNINSTALL
778 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
780 ${DebugMsg} "removing path $INSTDIR\bin"
782 Call un.SDCC.RemoveFromPath
785 DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
786 DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
788 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
789 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
791 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url"
792 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk"
794 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
795 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
796 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url"
798 RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
800 Delete "$INSTDIR\lib\src\large\Makefile"
802 Delete "$INSTDIR\lib\src\medium\Makefile"
804 Delete "$INSTDIR\lib\src\small\Makefile"
806 Delete "$INSTDIR\lib\src\mcs51\*.asm"
807 Delete "$INSTDIR\lib\src\mcs51\Makefile"
808 Delete "$INSTDIR\lib\src\mcs51\README"
810 Delete "$INSTDIR\lib\src\hc08\*.c"
811 Delete "$INSTDIR\lib\src\hc08\hc08.lib"
812 Delete "$INSTDIR\lib\src\hc08\Makefile"
814 Delete "$INSTDIR\lib\src\z80\*.s"
815 Delete "$INSTDIR\lib\src\z80\z80.lib"
816 Delete "$INSTDIR\lib\src\z80\README"
817 Delete "$INSTDIR\lib\src\z80\Makefile"
819 Delete "$INSTDIR\lib\src\gbz80\*.c"
820 Delete "$INSTDIR\lib\src\gbz80\*.s"
821 Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
822 Delete "$INSTDIR\lib\src\gbz80\README"
823 Delete "$INSTDIR\lib\src\gbz80\Makefile"
825 Delete "$INSTDIR\lib\src\ds390\*.c"
826 Delete "$INSTDIR\lib\src\ds390\libds390.lib"
827 Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
828 Delete "$INSTDIR\lib\src\ds390\Makefile"
829 Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
831 Delete "$INSTDIR\lib\src\ds400\*.c"
832 Delete "$INSTDIR\lib\src\ds400\libds400.lib"
833 Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
834 Delete "$INSTDIR\lib\src\ds400\Makefile"
836 Delete "$INSTDIR\lib\src\*.c"
838 Delete "$INSTDIR\lib\pic\*.lib"
840 Delete "$INSTDIR\lib\pic16\*.o"
841 Delete "$INSTDIR\lib\pic16\*.lib"
843 Delete "$INSTDIR\lib\hc08\*.lib"
845 Delete "$INSTDIR\lib\z80\*.o"
846 Delete "$INSTDIR\lib\z80\*.lib"
848 Delete "$INSTDIR\lib\small\*.lib"
850 Delete "$INSTDIR\lib\medium\*.lib"
852 Delete "$INSTDIR\lib\large\*.lib"
854 Delete "$INSTDIR\lib\small-stack-auto\*.lib"
856 Delete "$INSTDIR\lib\gbz80\*.lib"
858 Delete "$INSTDIR\lib\ds390\*.lib"
860 Delete "$INSTDIR\lib\ds400\*.lib"
862 Delete "$INSTDIR\include\asm\z80\*.h"
863 Delete "$INSTDIR\include\asm\pic16\*.h"
864 Delete "$INSTDIR\include\asm\pic\*.h"
865 Delete "$INSTDIR\include\asm\mcs51\*.h"
866 Delete "$INSTDIR\include\asm\gbz80\*.h"
867 Delete "$INSTDIR\include\asm\ds390\*.h"
868 Delete "$INSTDIR\include\asm\default\*.h"
869 Delete "$INSTDIR\include\z80\*.h"
870 Delete "$INSTDIR\include\pic\*.h"
871 Delete "$INSTDIR\include\pic\*.txt"
872 Delete "$INSTDIR\include\pic\*.inc"
873 Delete "$INSTDIR\include\pic16\*.h"
874 Delete "$INSTDIR\include\pic16\*.txt"
875 Delete "$INSTDIR\include\mcs51\*.h"
876 Delete "$INSTDIR\include\hc08\*.h"
877 Delete "$INSTDIR\include\*.h"
880 Delete "$INSTDIR\doc\README.TXT"
881 Delete "$INSTDIR\doc\ChangeLog_head.txt"
884 Delete "$INSTDIR\bin\as-gbz80.exe"
885 Delete "$INSTDIR\bin\as-hc08.exe"
886 Delete "$INSTDIR\bin\as-z80.exe"
887 Delete "$INSTDIR\bin\asx8051.exe"
888 Delete "$INSTDIR\bin\aslink.exe"
889 Delete "$INSTDIR\bin\asranlib.exe"
890 Delete "$INSTDIR\bin\link-gbz80.exe"
891 Delete "$INSTDIR\bin\link-hc08.exe"
892 Delete "$INSTDIR\bin\link-z80.exe"
893 Delete "$INSTDIR\bin\makebin.exe"
894 Delete "$INSTDIR\bin\packihx.exe"
895 Delete "$INSTDIR\bin\sdcc.exe"
896 Delete "$INSTDIR\bin\sdcclib.exe"
897 Delete "$INSTDIR\bin\sdcpp.exe"
898 Delete "$INSTDIR\bin\readline5.dll"
901 Delete "$INSTDIR\bin\s51.exe"
902 Delete "$INSTDIR\bin\savr.exe"
903 Delete "$INSTDIR\bin\shc08.exe"
904 Delete "$INSTDIR\bin\sz80.exe"
906 Delete "$INSTDIR\bin\sdcdb.exe"
907 Delete "$INSTDIR\bin\sdcdb.el"
908 Delete "$INSTDIR\bin\sdcdbsrc.el"
910 Delete "$INSTDIR\COPYING.txt"
911 Delete "$INSTDIR\sdcc.ico"
912 Delete "$INSTDIR\uninstall.exe"
914 RMDir /r "$INSTDIR\lib\src\pic"
915 RMDir /r "$INSTDIR\lib\src\pic16"
916 RMDir "$INSTDIR\lib\src\small"
917 RMDir "$INSTDIR\lib\src\medium"
918 RMDir "$INSTDIR\lib\src\large"
919 RMDir "$INSTDIR\lib\src\mcs51"
920 RMDir "$INSTDIR\lib\src\z80"
921 RMDir "$INSTDIR\lib\src\gbz80"
922 RMDir "$INSTDIR\lib\src\ds390\examples"
923 RMDir "$INSTDIR\lib\src\ds390"
924 RMDir "$INSTDIR\lib\src\ds400"
925 RMDir "$INSTDIR\lib\src\hc08"
926 RMDir "$INSTDIR\lib\src"
928 RMDir "$INSTDIR\lib\pic"
929 RMDir "$INSTDIR\lib\pic16"
930 RMDir "$INSTDIR\lib\z80"
931 RMDir "$INSTDIR\lib\small"
932 RMDir "$INSTDIR\lib\medium"
933 RMDir "$INSTDIR\lib\large"
934 RMDir "$INSTDIR\lib\small-stack-auto"
935 RMDir "$INSTDIR\lib\gbz80"
936 RMDir "$INSTDIR\lib\ds390"
937 RMDir "$INSTDIR\lib\ds400"
938 RMDir "$INSTDIR\lib\hc08"
941 RMDir "$INSTDIR\include\asm\z80"
942 RMDir "$INSTDIR\include\asm\pic16"
943 RMDir "$INSTDIR\include\asm\pic"
944 RMDir "$INSTDIR\include\asm\mcs51"
945 RMDir "$INSTDIR\include\asm\gbz80"
946 RMDir "$INSTDIR\include\asm\ds390"
947 RMDir "$INSTDIR\include\asm\default"
948 RMDir "$INSTDIR\include\asm"
949 RMDir "$INSTDIR\include\z80"
950 RMDir "$INSTDIR\include\pic"
951 RMDir "$INSTDIR\include\pic16"
952 RMDir "$INSTDIR\include\mcs51"
953 RMDir "$INSTDIR\include\hc08"
954 RMDir "$INSTDIR\include"
957 RMDir /r "$INSTDIR\doc"
965 ;;;; SetAutoClose true
968 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
969 ; Path Manipulation functions ;
970 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
973 !include "WinMessages.nsh"
976 ; AddToPath - Adds the given dir to the search path.
977 ; Input - head of the stack
978 ; Note - Win9x systems requires reboot
980 ${Function} SDCC.AddToPath
987 ; don't add if the path doesn't exist
988 ${If} ${FileExists} $0
992 ; Not on NT: read PATH from environment variable
995 ; On NT: read PATH from registry
996 ReadRegStr $1 HKCU "Environment" "PATH"
999 ${StrStr} $2 "$1;" "$0;"
1001 ${StrStr} $2 "$1;" "$0\;"
1003 GetFullPathName /SHORT $3 $0
1004 ${StrStr} $2 "$1;" "$3;"
1006 ${StrStr} $2 "$1;" "$03\;"
1011 FileOpen $1 "$1\autoexec.bat" a
1014 ${If} $2 = 26 ; DOS EOF
1015 FileSeek $1 -1 END ; write over EOF
1017 ${DebugMsg} "adding line $\r$\nSET PATH=%PATH%;$3$\r$\n"
1018 FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
1020 ${DebugMsg} "SetRebootFlag true"
1023 ;System PATH variable is at:
1024 ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1025 ReadRegStr $1 HKCU "Environment" "PATH"
1026 StrCpy $2 $1 1 -1 ; copy last char
1027 ${If} $2 == ";" ; if last char == ;
1028 StrCpy $1 $1 -1 ; remove last char
1033 WriteRegExpandStr HKCU "Environment" "PATH" $0
1034 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1049 ; RemoveFromPath - Remove a given dir from the path
1050 ; Input: head of the stack
1052 !macro SDCC.RemoveFromPath un
1053 ${Function} ${un}SDCC.RemoveFromPath
1062 IntFmt $6 "%c" 26 ; DOS EOF
1069 FileOpen $1 "$1\autoexec.bat" r
1072 GetFullPathName /SHORT $0 $0
1073 StrCpy $0 "SET PATH=%PATH%;$0"
1076 ; copy all lines except the line containing "SET PATH=%PATH%;$0"
1077 ; from autoexec.bat to the temporary file
1081 StrCpy $5 $3 1 -1 ; read last char
1082 ${If} $5 == $6 ; if DOS EOF
1083 StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
1085 ${If} $3 != "$0$\r$\n"
1086 ${AndIf} $3 != "$0$\n"
1091 ; This is the line I'm looking for:
1093 ${DebugMsg} "removing line $0"
1094 ${DebugMsg} "SetRebootFlag true"
1103 Delete "$1\autoexec.bat"
1104 CopyFiles /SILENT $4 "$1\autoexec.bat"
1107 ;System PATH variable is at:
1108 ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1109 ReadRegStr $1 HKCU "Environment" "PATH"
1110 StrCpy $5 $1 1 -1 ; copy last char
1111 ${If} $5 != ";" ; if last char != ;
1112 StrCpy $1 "$1;" ; append ;
1116 Call ${un}StrStr ; Find `$0;` in $1
1117 Pop $2 ; pos of our dir
1124 StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
1125 StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
1128 StrCpy $5 $3 1 -1 ; copy last char
1129 ${If} $5 == ";" ; if last char == ;
1130 StrCpy $3 $3 -1 ; remove last char
1133 ; New PATH not empty: update the registry
1134 WriteRegExpandStr HKCU "Environment" "PATH" $3
1136 ; New PATH empty: remove from the registry
1137 DeleteRegValue HKCU "Environment" "PATH"
1139 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1152 !insertmacro SDCC.RemoveFromPath ""
1153 !insertmacro SDCC.RemoveFromPath "un."
1155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1156 ; Utility Functions ;
1157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1161 ; output, top of the stack = 1 if NT or 0 if not
1166 ; ($R0 at this point is 1 or 0)
1169 ${Function} ${un}SDCC.IsNT
1171 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
1183 !insertmacro SDCC.IsNT ""
1184 !insertmacro SDCC.IsNT "un."
1186 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1187 ; Uninstall/Reinstall page functions ;
1188 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1190 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
1192 Var ReinstallPageCheck
1194 ${Function} SDCC.PageReinstall
1196 ReadRegStr $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" ""
1199 ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1205 ReadRegDWORD $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor"
1206 ReadRegDWORD $R1 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor"
1207 ReadRegDWORD $R2 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision"
1208 ReadRegDWORD $R3 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild"
1209 StrCpy $R0 $R0.$R1.$R2.$R3
1211 ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
1213 StrCpy $R1 "${PRODUCT_NAME} ${PRODUCT_VERSION} is already installed. Select the operation you want to perform and click Next to continue."
1214 StrCpy $R2 "Add/Reinstall components"
1215 StrCpy $R3 "Uninstall ${PRODUCT_NAME}"
1216 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
1219 StrCpy $R1 "An older version of ${PRODUCT_NAME} is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
1220 StrCpy $R2 "Uninstall before installing"
1221 StrCpy $R3 "Do not uninstall"
1222 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1225 StrCpy $R1 "A newer version of ${PRODUCT_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
1226 StrCpy $R2 "Uninstall before installing"
1227 StrCpy $R3 "Do not uninstall"
1228 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1234 nsDialogs::Create /NOUNLOAD 1018
1236 ${NSD_CreateLabel} 0 0 100% 24u $R1
1239 ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
1241 ${NSD_OnClick} $R2 SDCC.PageReinstallUpdateSelection
1243 ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
1245 ${NSD_OnClick} $R3 SDCC.PageReinstallUpdateSelection
1247 ${If} $ReinstallPageCheck != 2
1248 SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
1250 SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
1257 ${Function} SDCC.PageReinstallUpdateSelection
1261 ${NSD_GetState} $R2 $R1
1263 ${If} $R1 == ${BST_CHECKED}
1264 StrCpy $ReinstallPageCheck 1
1266 StrCpy $ReinstallPageCheck 2
1271 ${Function} SDCC.PageLeaveReinstall
1273 ${NSD_GetState} $R2 $R1
1275 ${DebugMsg} "R0 = $R0, R1 = $R1, R2 = $R2"
1287 ReadRegStr $R1 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1293 ; Uninstall only: uninstaller should be removed
1295 ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1299 ; Uninstal & Reinstall: uninstaller will be rewritten
1301 ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1302 ExecWait '$R1 _?=$INSTDIR'
1311 !endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD