# sdcc.nsi - NSIS installer script for SDCC
#
-# Copyright (c) 2003,2004 Borut Razem
+# Copyright (c) 2003-2009 Borut Razem
#
# This file is part of sdcc.
#
# How to create WIN32 setup.exe
#
-# - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd.zip
-# to a clean directory (the option to create directories should be enambled).
+# - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
+# to a clean directory (the option to create directories should be enabled).
# A sub directory sdcc is created (referenced as PKGDIR in continuation).
# - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
-# (this file) from the sdcc CVS snapshot to the PKGDIR directory
-# - copy file COPYING from the sdcc CVS snapshot to the PKGDIR directory,
-# rename it to COPYING.TXT and convert file COPYING to DOS format:
-# unix2dos COPYING.TXT
+# (this file) from the sdcc Subversion snapshot to the PKGDIR directory
+# - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
+# rename it to COPYING.txt and convert it to DOS format:
+# unix2dos COPYING.txt
+# - copy readline5.dll to PKGDIR/bin/readline5.dll
# - run NSIS installer from PKGDIR directory:
-# "c:\Program Files\NSIS\makensis.exe" sdcc.nsi
+# "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
+# replace <VER_XXX> with the appropriate values, for example for SDCC 2.7.4:
+# <SDCC_VER_MAJOR> = 2
+# <SDCC_VER_MINOR> = 7
+# <SDCC_VER_DEVEL> = 4
+# replace <SDCC_REVISION> with the current svn revision number
# - A setup file setup.exe is created in PKGDIR directory.
-# Rename it to sdcc_yyyymmdd_setup.exe and upload it
+# Rename it to sdcc-yyyymmdd-rrrr-setup.exe and upload it
# to sdcc download repository at sourceforge.net
#
#
+# How to create WIN32 release setup.exe package
+#
+# - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
+# to a clean directory (the option to create directories should be enabled).
+# A sub directory sdcc is created (referenced as PKGDIR in continuation).
+# - remove the PKGDIR/doc/ directory
+# - unpack sdcc-doc-yyyymmdd-rrrr.zip to the PKGDIR/doc directory
+# - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
+# (this file) from the sdcc Subversion snapshot to the PKGDIR directory
+# - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
+# rename it to COPYING.txt and convert it to DOS format:
+# unix2dos COPYING.txt
+# - copy readline5.dll to PKGDIR/bin/readline5.dll
+# - run NSIS installer from PKGDIR directory:
+# "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
+# - A setup file setup.exe is created in PKGDIR directory.
+# Rename it to sdcc-x.x.x-setup.exe and upload it
+# to sdcc download repository at sourceforge.net
+#
# How to upload secc setup.exe tosourceforge.net
#
# Execute following commands from the cmd prompt:
# - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
# - put sdcc_yyyymmdd_setup.exe
# - quit
+#
+# For debugging define -DSDCC.DEBUG command line option
+
+;--------------------------------
+; Debugging Macros
+
+!ifdef SDCC.DEBUG
+ Var SDCC.FunctionName
+ Var SDCC.StrStack0
+ Var SDCC.StrStack1
+ Var SDCC.StrStack2
+ Var SDCC.StrStack3
+ Var SDCC.StrStack4
+
+!define SDCC.PushStr "!insertmacro MACRO_SDCC_PushStr"
+!macro MACRO_SDCC_PushStr NAME
+ StrCpy $SDCC.StrStack4 $SDCC.StrStack3
+ StrCpy $SDCC.StrStack3 $SDCC.StrStack2
+ StrCpy $SDCC.StrStack2 $SDCC.StrStack1
+ StrCpy $SDCC.StrStack1 $SDCC.StrStack0
+ StrCpy $SDCC.StrStack0 $SDCC.FunctionName
+ StrCpy $SDCC.FunctionName "${NAME}"
+!macroend
+
+!define SDCC.PopStr "!insertmacro MACRO_SDCC_PopStr"
+!macro MACRO_SDCC_PopStr
+ StrCpy $SDCC.FunctionName $SDCC.StrStack0
+ StrCpy $SDCC.StrStack0 $SDCC.StrStack1
+ StrCpy $SDCC.StrStack1 $SDCC.StrStack2
+ StrCpy $SDCC.StrStack2 $SDCC.StrStack3
+ StrCpy $SDCC.StrStack3 $SDCC.StrStack4
+!macroend
+!endif
+
+!define DebugMsg "!insertmacro MACRO_SDCC_DebugMsg"
+!macro MACRO_SDCC_DebugMsg MSG
+ !ifdef SDCC.DEBUG
+ MessageBox MB_OK "*** $SDCC.FunctionName: ${MSG} ***"
+ !endif
+!macroend
+
+!define Function "!insertmacro MACRO_SDCC_Function"
+!macro MACRO_SDCC_Function NAME
+ Function "${NAME}"
+ !ifdef SDCC.DEBUG
+ ${SDCC.PushStr} ${NAME}
+ !endif
+!macroend
+
+!define FunctionEnd "!insertmacro MACRO_SDCC_FunctionEnd"
+!macro MACRO_SDCC_FunctionEnd
+ !ifdef SDCC.DEBUG
+ ${SDCC.PopStr}
+ !endif
+ FunctionEnd
+!macroend
+!define Section "!insertmacro MACRO_SDCC_Section"
+!macro MACRO_SDCC_Section NAME ID
+ Section "${NAME}" "${ID}"
+ !ifdef SDCC.DEBUG
+ ${SDCC.PushStr} "${NAME}"
+ !endif
+!macroend
+
+!define UnselectedSection "!insertmacro MACRO_SDCC_UnselectedSection"
+!macro MACRO_SDCC_UnselectedSection NAME ID
+ Section /o ${NAME} ${ID}
+ !ifdef SDCC.DEBUG
+ ${SDCC.PushStr} "${NAME}"
+ !endif
+!macroend
+
+!define SectionEnd "!insertmacro MACRO_SDCC_SectionEnd"
+!macro MACRO_SDCC_SectionEnd
+ !ifdef SDCC.DEBUG
+ ${SDCC.PopStr}
+ !endif
+ SectionEnd
+!macroend
-!include "MUI.nsh"
+
+!define PRODUCT_NAME "SDCC"
+
+; Version
+!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+ !define PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}"
+!else
+ !define PRODUCT_VERSION "XX.XX"
+!endif
SetCompressor /SOLID lzma
!define DEV_ROOT "${SDCC_ROOT}"
+!ifdef FULL_DOC
+!system "unix2dos ${SDCC_ROOT}\doc\ChangeLog.txt" = 0
+!else
!system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
+!endif
!system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
-InstType "Full (Bin, Doc, Lib, Src)"
-InstType "Medium (Bin, Doc, Lib)"
-InstType "Compact (Bin, Doc)"
+InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
+InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
+InstType "Compact (Bin, ucSim, SDCDB, Doc)"
;--------------------------------
-;Variables
+; Configuration
-Var MUI_STARTMENUPAGE_VARIABLE
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define UNINST_ROOT_KEY HKLM
+!define SDCC_ROOT_KEY HKLM
;--------------------------------
+; Header Files
+
+!include MUI2.nsh
+!include WordFunc.nsh
+!include StrFunc.nsh
+${StrStr}
+${UnStrStr}
+
+;--------------------------------
+; Functions
+
+!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+ !insertmacro VersionCompare
+!endif
+
+;--------------------------------
+; Variables
+
+Var SDCC.PathToRemove
+
+;--------------------------------
+; Configuration
+
+; MUI Settings
!define MUI_ABORTWARNING
+!define MUI_ICON ".\sdcc.ico"
+; Welcome page
!insertmacro MUI_PAGE_WELCOME
-!insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
-!define MUI_STARTMENUPAGE_DEFAULTFOLDER "SDCC"
-!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
-!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
+
+; License page
+!insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.txt"
+
+; Uninstall/reinstall page
+!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+Page custom SDCC.PageReinstall SDCC.PageLeaveReinstall
+!endif
+
+; StartMenu page
+!define MUI_STARTMENUPAGE_DEFAULTFOLDER ${PRODUCT_NAME}
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT ${UNINST_ROOT_KEY}
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
!define MUI_STARTMENUPAGE_NODISABLE
+Var MUI_STARTMENUPAGE_VARIABLE
!insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
+
+; Components page
+!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
+
+; Directory page
!insertmacro MUI_PAGE_DIRECTORY
+
+; Instfiles page
+!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "SDCC.InstFilesLeave"
!insertmacro MUI_PAGE_INSTFILES
+
+${Function} SDCC.InstFilesLeave
+ ; Remove old path if reinstallation
+ ${If} $SDCC.PathToRemove != ""
+ ${DebugMsg} "removing path $SDCC.PathToRemove"
+ Push $SDCC.PathToRemove
+ Call SDCC.RemoveFromPath
+ ${EndIf}
+${FunctionEnd}
+
+; Finish page - add to path
+!define MUI_FINISHPAGE_TEXT "Confirm the checkbox if you want to add SDCC binary directory to the PATH environment variable"
+!define MUI_FINISHPAGE_SHOWREADME_TEXT "Add $INSTDIR\bin to the PATH"
+!define MUI_FINISHPAGE_SHOWREADME_FUNCTION SDCC.AddBinToPath
+!define MUI_FINISHPAGE_SHOWREADME
+!define MUI_FINISHPAGE_BUTTON "Next"
!insertmacro MUI_PAGE_FINISH
+; Finish page - reboot
+!insertmacro MUI_PAGE_FINISH
+
+${Function} SDCC.AddBinToPath
+ ; Add new path
+ ${DebugMsg} "adding path $INSTDIR\bin"
+ Push "$INSTDIR\bin"
+ Call SDCC.AddToPath
+${FunctionEnd}
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+; Language files
!insertmacro MUI_LANGUAGE "English"
-Name "SDCC"
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
BrandingText ""
OutFile "setup.exe"
InstallDir "$PROGRAMFILES\SDCC"
-ShowInstDetails show
-ShowUnInstDetails show
-
-Function .onInit
- ;Uninstall the old version, if present
- ReadRegStr $R0 HKLM \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
- "UninstallString"
+;;;;ShowInstDetails show
+;;;;ShowUnInstDetails show
+
+
+${Function} .onInit
+ ${DebugMsg} "Pre INSTDIR = $INSTDIR"
+
+!ifndef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+ ; Old unistallation method
+ ; Uninstall the old version, if present
+ ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
StrCmp $R0 "" inst
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
uninst:
; Run the uninstaller
ClearErrors
- ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
-
- ;IfErrors no_remove_uninstaller
- ; ;You can either use Delete /REBOOTOK in the uninstaller or add some code
- ; ;here to remove to remove the uninstaller. Use a registry key to check
- ; ;whether the user has chosen to uninstall. If you are using an uninstaller
- ; ;components page, make sure all sections are uninstalled.
- ;no_remove_uninstaller:
+ ExecWait '$R0'
Goto done
inst:
Abort
done:
-FunctionEnd
+!else
+ ; If the registry key exists it is an uninstallation or reinstallation:
+ ; take the old installation directory
+ Push $R0
+
+ ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
+ ${IfNot} ${Errors}
+ StrCpy $INSTDIR $R0
+ StrCpy $SDCC.PathToRemove "$INSTDIR\bin"
+ ${EndIf}
+
+ Pop $R0
+!endif
+ ${DebugMsg} "Post INSTDIR = $INSTDIR"
+${FunctionEnd}
+
+${Function} un.onInit
+
+ ${DebugMsg} "Pre INSTDIR = $INSTDIR"
-Section -Common
+ Push $R0
+ ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
+ ${IfNot} ${Errors}
+ StrCpy $INSTDIR $R0
+ ${EndIf}
+ Pop $R0
+
+ ${DebugMsg} "Post INSTDIR = $INSTDIR"
+
+${FunctionEnd}
+
+${Section} -Common SECCOMMON
SetOutPath "$INSTDIR"
File ".\sdcc.ico"
- File "${SDCC_ROOT}\COPYING.TXT"
-SectionEnd
+ File "${SDCC_ROOT}\COPYING.txt"
+${SectionEnd}
-Section "SDCC application files"
+${Section} "SDCC application files" SEC01
SectionIn 1 2 3 RO
SetOutPath "$INSTDIR\bin"
- File "${SDCC_ROOT}\bin\*.exe"
-SectionEnd
+ File "${SDCC_ROOT}\bin\as-gbz80.exe"
+ File "${SDCC_ROOT}\bin\as-hc08.exe"
+ File "${SDCC_ROOT}\bin\as-z80.exe"
+ File "${SDCC_ROOT}\bin\asx8051.exe"
+ File "${SDCC_ROOT}\bin\aslink.exe"
+ File "${SDCC_ROOT}\bin\asranlib.exe"
+ File "${SDCC_ROOT}\bin\link-gbz80.exe"
+ File "${SDCC_ROOT}\bin\link-hc08.exe"
+ File "${SDCC_ROOT}\bin\link-z80.exe"
+ File "${SDCC_ROOT}\bin\makebin.exe"
+ File "${SDCC_ROOT}\bin\packihx.exe"
+ File "${SDCC_ROOT}\bin\sdcc.exe"
+ File "${SDCC_ROOT}\bin\sdcclib.exe"
+ File "${SDCC_ROOT}\bin\sdcpp.exe"
+ File "${SDCC_ROOT}\bin\readline5.dll"
+${SectionEnd}
+
+${Section} "ucSim application files" SEC02
+ SectionIn 1 2 3
+ SetOutPath "$INSTDIR\bin"
+ File "${SDCC_ROOT}\bin\s51.exe"
+ File "${SDCC_ROOT}\bin\savr.exe"
+ File "${SDCC_ROOT}\bin\shc08.exe"
+ File "${SDCC_ROOT}\bin\sz80.exe"
+${SectionEnd}
-Section "SDCC documentation"
+${Section} "SDCDB files" SEC03
+ SectionIn 1 2 3
+ File "${SDCC_ROOT}\bin\sdcdb.exe"
+ File "${SDCC_ROOT}\bin\sdcdb.el"
+ File "${SDCC_ROOT}\bin\sdcdbsrc.el"
+${SectionEnd}
+
+${Section} "SDCC documentation" SEC04
SectionIn 1 2 3
SetOutPath "$INSTDIR\doc"
+!ifdef FULL_DOC
+ File /r "${SDCC_ROOT}\doc\*"
+!else
File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
File "${SDCC_ROOT}\doc\README.TXT"
-SectionEnd
+!endif
+${SectionEnd}
-Section "SDCC include files"
+${Section} "SDCC include files" SEC05
SectionIn 1 2
SetOutPath "$INSTDIR\include\asm\default"
File "${DEV_ROOT}\include\asm\default\features.h"
File "${DEV_ROOT}\include\asm\gbz80\features.h"
SetOutPath "$INSTDIR\include\asm\mcs51"
File "${DEV_ROOT}\include\asm\mcs51\features.h"
+ SetOutPath "$INSTDIR\include\asm\pic"
+ File "${DEV_ROOT}\include\asm\pic\features.h"
SetOutPath "$INSTDIR\include\asm\pic16"
File "${DEV_ROOT}\include\asm\pic16\features.h"
SetOutPath "$INSTDIR\include\asm\z80"
File "${DEV_ROOT}\include\pic\*.inc"
SetOutPath "$INSTDIR\include\pic16"
File "${DEV_ROOT}\include\pic16\*.h"
+ File "${DEV_ROOT}\include\pic16\*.txt"
SetOutPath "$INSTDIR\include\z80"
File "${DEV_ROOT}\include\z80\*.h"
SetOutPath "$INSTDIR\include"
File "${DEV_ROOT}\include\*.h"
-SectionEnd
+${SectionEnd}
-Section "SDCC DS390 library"
+${Section} "SDCC DS390 library" SEC06
SectionIn 1 2
SetOutPath "$INSTDIR\lib\ds390"
- File "${DEV_ROOT}\lib\ds390\*.rel"
- File "${DEV_ROOT}\lib\ds390\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\ds390\*.*"
+${SectionEnd}
-Section "SDCC DS400 library"
+${Section} "SDCC DS400 library" SEC07
SectionIn 1 2
SetOutPath "$INSTDIR\lib\ds400"
- File "${DEV_ROOT}\lib\ds400\*.rel"
- File "${DEV_ROOT}\lib\ds400\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\ds400\*.*"
+${SectionEnd}
-Section "SDCC GBZ80 library"
+${Section} "SDCC GBZ80 library" SEC08
SectionIn 1 2
SetOutPath "$INSTDIR\lib\gbz80"
- File "${DEV_ROOT}\lib\gbz80\*.o"
- File "${DEV_ROOT}\lib\gbz80\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\gbz80\*.*"
+${SectionEnd}
-Section "SDCC Z80 library"
+${Section} "SDCC Z80 library" SEC09
SectionIn 1 2
SetOutPath "$INSTDIR\lib\z80"
- File "${DEV_ROOT}\lib\z80\*.o"
- File "${DEV_ROOT}\lib\z80\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\z80\*.*"
+${SectionEnd}
-Section "SDCC small model library"
+${Section} "SDCC small model library" SEC10
SectionIn 1 2
SetOutPath "$INSTDIR\lib\small"
- File "${DEV_ROOT}\lib\small\*.rel"
- File "${DEV_ROOT}\lib\small\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\small\*.*"
+${SectionEnd}
-Section "SDCC medium model library"
+${Section} "SDCC medium model library" SEC11
SectionIn 1 2
SetOutPath "$INSTDIR\lib\medium"
- File "${DEV_ROOT}\lib\medium\*.rel"
- File "${DEV_ROOT}\lib\medium\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\medium\*.*"
+${SectionEnd}
-Section "SDCC large model library"
+${Section} "SDCC large model library" SEC12
SectionIn 1 2
SetOutPath "$INSTDIR\lib\large"
- File "${DEV_ROOT}\lib\large\*.rel"
- File "${DEV_ROOT}\lib\large\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\large\*.*"
+${SectionEnd}
-Section "SDCC small-stack-auto model library"
+${Section} "SDCC small-stack-auto model library" SEC13
SectionIn 1 2
SetOutPath "$INSTDIR\lib\small-stack-auto"
- File "${DEV_ROOT}\lib\small-stack-auto\*.rel"
- File "${DEV_ROOT}\lib\small-stack-auto\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\small-stack-auto\*.*"
+${SectionEnd}
-Section "SDCC HC08 library"
+${Section} "SDCC HC08 library" SEC14
SectionIn 1 2
SetOutPath "$INSTDIR\lib\hc08"
- File "${DEV_ROOT}\lib\hc08\*.rel"
- File "${DEV_ROOT}\lib\hc08\*.lib"
-SectionEnd
+ File "${DEV_ROOT}\lib\hc08\*.*"
+${SectionEnd}
-Section "SDCC PIC16 library"
+${Section} "SDCC PIC16 library" SEC15
SectionIn 1 2
SetOutPath "$INSTDIR\lib\pic16"
File "${DEV_ROOT}\lib\pic16\*.o"
File "${DEV_ROOT}\lib\pic16\*.lib"
-SectionEnd
+${SectionEnd}
-Section "SDCC PIC library"
+${Section} "SDCC PIC library" SEC16
SectionIn 1 2
SetOutPath "$INSTDIR\lib\pic"
File "${DEV_ROOT}\lib\pic\*.lib"
-SectionEnd
+${SectionEnd}
-Section "SDCC library sources"
+${Section} "SDCC library sources" SEC17
SectionIn 1
SetOutPath "$INSTDIR\lib\src\ds390\examples"
File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
SetOutPath "$INSTDIR\lib\src\ds390"
File "${DEV_ROOT}\lib\src\ds390\*.c"
- File "${DEV_ROOT}\lib\src\ds390\Makefile"
- File "${DEV_ROOT}\lib\src\ds390\Makefile.dep"
+# File "${DEV_ROOT}\lib\src\ds390\Makefile"
SetOutPath "$INSTDIR\lib\src\ds400"
File "${DEV_ROOT}\lib\src\ds400\*.c"
- File "${DEV_ROOT}\lib\src\ds400\Makefile"
- File "${DEV_ROOT}\lib\src\ds400\Makefile.dep"
+# File "${DEV_ROOT}\lib\src\ds400\Makefile"
SetOutPath "$INSTDIR\lib\src\gbz80"
File "${DEV_ROOT}\lib\src\gbz80\*.c"
File "${DEV_ROOT}\lib\src\gbz80\*.s"
- File "${DEV_ROOT}\lib\src\gbz80\Makefile"
- File "${DEV_ROOT}\lib\src\gbz80\README"
+# File "${DEV_ROOT}\lib\src\gbz80\Makefile"
SetOutPath "$INSTDIR\lib\src\z80"
- File "${DEV_ROOT}\lib\src\z80\*.c"
File "${DEV_ROOT}\lib\src\z80\*.s"
- File "${DEV_ROOT}\lib\src\z80\Makefile"
- File "${DEV_ROOT}\lib\src\z80\README"
+# File "${DEV_ROOT}\lib\src\z80\Makefile"
SetOutPath "$INSTDIR\lib\src\hc08"
File "${DEV_ROOT}\lib\src\hc08\*.c"
- File "${DEV_ROOT}\lib\src\hc08\Makefile"
+# File "${DEV_ROOT}\lib\src\hc08\Makefile"
SetOutPath "$INSTDIR\lib\src\mcs51"
File "${DEV_ROOT}\lib\src\mcs51\*.asm"
- File "${DEV_ROOT}\lib\src\mcs51\Makefile"
- File "${DEV_ROOT}\lib\src\mcs51\README"
+# File "${DEV_ROOT}\lib\src\mcs51\Makefile"
SetOutPath "$INSTDIR\lib\src\small"
- File "${DEV_ROOT}\lib\src\small\Makefile"
+# File "${DEV_ROOT}\lib\src\small\Makefile"
SetOutPath "$INSTDIR\lib\src\medium"
- File "${DEV_ROOT}\lib\src\medium\Makefile"
+# File "${DEV_ROOT}\lib\src\medium\Makefile"
SetOutPath "$INSTDIR\lib\src\large"
- File "${DEV_ROOT}\lib\src\large\Makefile"
+# File "${DEV_ROOT}\lib\src\large\Makefile"
SetOutPath "$INSTDIR\lib\src\pic"
- File "${DEV_ROOT}\lib\src\pic\configure"
- File "${DEV_ROOT}\lib\src\pic\configure.in"
- File "${DEV_ROOT}\lib\src\pic\GPL"
- File "${DEV_ROOT}\lib\src\pic\LGPL"
- File "${DEV_ROOT}\lib\src\pic\Makefile"
- File "${DEV_ROOT}\lib\src\pic\Makefile.common"
- File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
- File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
- File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
- File "${DEV_ROOT}\lib\src\pic\NEWS"
- File "${DEV_ROOT}\lib\src\pic\README"
+# File "${DEV_ROOT}\lib\src\pic\configure"
+# File "${DEV_ROOT}\lib\src\pic\configure.in"
+# File "${DEV_ROOT}\lib\src\pic\GPL"
+# File "${DEV_ROOT}\lib\src\pic\LGPL"
+# File "${DEV_ROOT}\lib\src\pic\Makefile"
+# File "${DEV_ROOT}\lib\src\pic\Makefile.common"
+# File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
+# File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
+# File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
+# File "${DEV_ROOT}\lib\src\pic\NEWS"
+# File "${DEV_ROOT}\lib\src\pic\README"
File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
- File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
+# File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
SetOutPath "$INSTDIR\lib\src\pic\libdev"
File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
- File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
+# File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
+
+ SetOutPath "$INSTDIR\lib\src\pic\libm"
+ File "${DEV_ROOT}\lib\src\pic\libm\*.c"
SetOutPath "$INSTDIR\lib\src\pic16"
- File "${DEV_ROOT}\lib\src\pic16\configure"
- File "${DEV_ROOT}\lib\src\pic16\configure.in"
- File "${DEV_ROOT}\lib\src\pic16\COPYING"
- File "${DEV_ROOT}\lib\src\pic16\Makefile"
- File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
- File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
- File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
- File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
- File "${DEV_ROOT}\lib\src\pic16\pics.all"
- File "${DEV_ROOT}\lib\src\pic16\pics.build"
- File "${DEV_ROOT}\lib\src\pic16\README"
+# File "${DEV_ROOT}\lib\src\pic16\configure"
+# File "${DEV_ROOT}\lib\src\pic16\configure.in"
+# File "${DEV_ROOT}\lib\src\pic16\COPYING"
+# File "${DEV_ROOT}\lib\src\pic16\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
+# File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
+# File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
+# File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
+# File "${DEV_ROOT}\lib\src\pic16\pics.all"
+# File "${DEV_ROOT}\lib\src\pic16\pics.build"
+# File "${DEV_ROOT}\lib\src\pic16\README"
SetOutPath "$INSTDIR\lib\src\pic16\debug"
- File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
- File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
SetOutPath "$INSTDIR\lib\src\pic16\libc"
- File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
- File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
- File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
- File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libdev"
File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libio"
File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
- File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libm"
File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
- File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
+
+ SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
+ File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
SetOutPath "$INSTDIR\lib\src\pic16\startup"
File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
- File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
- File "${DEV_ROOT}\lib\src\pic16\startup\README"
+# File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
+# File "${DEV_ROOT}\lib\src\pic16\startup\README"
SetOutPath "$INSTDIR\lib\src"
File "${DEV_ROOT}\lib\src\*.c"
-SectionEnd
+${SectionEnd}
-Section -Icons
+;--------------------------------
+;Descriptions
+
+;Language strings
+LangString DESC_SEC01 ${LANG_ENGLISH} "SDCC application files"
+LangString DESC_SEC02 ${LANG_ENGLISH} "ucSim application files"
+LangString DESC_SEC03 ${LANG_ENGLISH} "SDCDB files"
+LangString DESC_SEC04 ${LANG_ENGLISH} "SDCC documentation"
+LangString DESC_SEC05 ${LANG_ENGLISH} "SDCC include files"
+LangString DESC_SEC06 ${LANG_ENGLISH} "SDCC DS390 library"
+LangString DESC_SEC07 ${LANG_ENGLISH} "SDCC DS400 library"
+LangString DESC_SEC08 ${LANG_ENGLISH} "SDCC GBZ80 library"
+LangString DESC_SEC09 ${LANG_ENGLISH} "SDCC Z80 library"
+LangString DESC_SEC10 ${LANG_ENGLISH} "SDCC small model library"
+LangString DESC_SEC11 ${LANG_ENGLISH} "SDCC medium model library"
+LangString DESC_SEC12 ${LANG_ENGLISH} "SDCC large model library"
+LangString DESC_SEC13 ${LANG_ENGLISH} "SDCC small-stack-auto model library"
+LangString DESC_SEC14 ${LANG_ENGLISH} "SDCC HC08 library"
+LangString DESC_SEC15 ${LANG_ENGLISH} "SDCC PIC16 library"
+LangString DESC_SEC16 ${LANG_ENGLISH} "SDCC PIC library"
+LangString DESC_SEC17 ${LANG_ENGLISH} "SDCC library sources"
+
+;Assign language strings to sections
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC01)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC02)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_SEC03)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_SEC04)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $(DESC_SEC05)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $(DESC_SEC06)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $(DESC_SEC07)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $(DESC_SEC08)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC09} $(DESC_SEC09)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC10} $(DESC_SEC10)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC11} $(DESC_SEC11)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC12} $(DESC_SEC12)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC13} $(DESC_SEC13)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC14} $(DESC_SEC14)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC15} $(DESC_SEC15)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC16} $(DESC_SEC16)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC17} $(DESC_SEC17)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+;--------------------------------
+
+${Section} -Icons SECICONS
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
- CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk" "$INSTDIR\sdcc.url"
CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
+!ifdef FULL_DOC
+ CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\sdccman.pdf" "" "$INSTDIR\sdcc.ico" "" "" "" ""
+ CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
+ CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
+!else
CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
- CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT"
+!endif
+ CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.txt"
!insertmacro MUI_STARTMENU_WRITE_END
-SectionEnd
-
-Section -INI
- WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
-SectionEnd
-
-Section -PostInstall
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
- WriteUninstaller "$INSTDIR\uninstall.exe"
-SectionEnd
+${SectionEnd}
+
+${Section} -INI SECINI
+ WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
+!ifdef FULL_DOC
+ WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url" "InternetShortcut" "URL" "http://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/ChangeLog"
+!endif
+${SectionEnd}
+
+${Section} -PostInstall SECPOSTINSTALL
+ WriteRegStr ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "" $INSTDIR
+!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+ WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor" "${VER_MAJOR}"
+ WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor" "${VER_MINOR}"
+ WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision" "${VER_REVISION}"
+ WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild" "${VER_BUILD}"
+!endif
+
+ WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
+ WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
+ WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
+ WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "sdcc.sourceforge.net"
+ WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "http://sdcc.sourceforge.net/"
+ WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "http://sdcc.sourceforge.net/"
+ WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
-Section -AddToPath
- MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to add $INSTDIR\bin to the PATH?" IDNO +3
- Push "$INSTDIR\bin"
- Call AddToPath
-SectionEnd
+ WriteUninstaller "$INSTDIR\uninstall.exe"
+${SectionEnd}
;;;; Uninstaller code ;;;;
-Function un.onInit
- MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
- Abort
-FunctionEnd
-
-Function un.onUninstSuccess
- HideWindow
- MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
-FunctionEnd
-
-Section Uninstall
+${Section} Uninstall SECUNINSTALL
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
- Delete "$INSTDIR\sdcc.url"
+ ${DebugMsg} "removing path $INSTDIR\bin"
+ Push "$INSTDIR\bin"
+ Call un.SDCC.RemoveFromPath
- DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "NSIS:StartMenuDir"
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
+; Clean the registry
+ DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
- Delete "$INSTDIR\uninstall.exe"
Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
+!ifdef FULL_DOC
+ Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url"
+ Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk"
+!endif
Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
- Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk"
+ Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url"
+
+ RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
Delete "$INSTDIR\lib\src\large\Makefile"
Delete "$INSTDIR\lib\src\hc08\hc08.lib"
Delete "$INSTDIR\lib\src\hc08\Makefile"
- Delete "$INSTDIR\lib\src\z80\*.c"
Delete "$INSTDIR\lib\src\z80\*.s"
Delete "$INSTDIR\lib\src\z80\z80.lib"
Delete "$INSTDIR\lib\src\z80\README"
Delete "$INSTDIR\lib\src\*.c"
- Delete "$INSTDIR\lib\pic\*.o"
Delete "$INSTDIR\lib\pic\*.lib"
Delete "$INSTDIR\lib\pic16\*.o"
Delete "$INSTDIR\lib\pic16\*.lib"
- Delete "$INSTDIR\lib\hc08\*.rel"
Delete "$INSTDIR\lib\hc08\*.lib"
Delete "$INSTDIR\lib\z80\*.o"
Delete "$INSTDIR\lib\z80\*.lib"
- Delete "$INSTDIR\lib\small\*.rel"
Delete "$INSTDIR\lib\small\*.lib"
- Delete "$INSTDIR\lib\medium\*.rel"
Delete "$INSTDIR\lib\medium\*.lib"
- Delete "$INSTDIR\lib\large\*.rel"
Delete "$INSTDIR\lib\large\*.lib"
- Delete "$INSTDIR\lib\small-stack-auto\*.rel"
Delete "$INSTDIR\lib\small-stack-auto\*.lib"
- Delete "$INSTDIR\lib\gbz80\*.o"
Delete "$INSTDIR\lib\gbz80\*.lib"
- Delete "$INSTDIR\lib\ds390\*.rel"
Delete "$INSTDIR\lib\ds390\*.lib"
- Delete "$INSTDIR\lib\ds400\*.rel"
Delete "$INSTDIR\lib\ds400\*.lib"
Delete "$INSTDIR\include\asm\z80\*.h"
Delete "$INSTDIR\include\asm\pic16\*.h"
+ Delete "$INSTDIR\include\asm\pic\*.h"
Delete "$INSTDIR\include\asm\mcs51\*.h"
Delete "$INSTDIR\include\asm\gbz80\*.h"
Delete "$INSTDIR\include\asm\ds390\*.h"
Delete "$INSTDIR\include\pic\*.txt"
Delete "$INSTDIR\include\pic\*.inc"
Delete "$INSTDIR\include\pic16\*.h"
+ Delete "$INSTDIR\include\pic16\*.txt"
Delete "$INSTDIR\include\mcs51\*.h"
Delete "$INSTDIR\include\hc08\*.h"
Delete "$INSTDIR\include\*.h"
+!ifndef FULL_DOC
Delete "$INSTDIR\doc\README.TXT"
Delete "$INSTDIR\doc\ChangeLog_head.txt"
-
- Delete "$INSTDIR\bin\*.exe"
-
- Delete "$INSTDIR\COPYING.TXT"
+!endif
+
+ Delete "$INSTDIR\bin\as-gbz80.exe"
+ Delete "$INSTDIR\bin\as-hc08.exe"
+ Delete "$INSTDIR\bin\as-z80.exe"
+ Delete "$INSTDIR\bin\asx8051.exe"
+ Delete "$INSTDIR\bin\aslink.exe"
+ Delete "$INSTDIR\bin\asranlib.exe"
+ Delete "$INSTDIR\bin\link-gbz80.exe"
+ Delete "$INSTDIR\bin\link-hc08.exe"
+ Delete "$INSTDIR\bin\link-z80.exe"
+ Delete "$INSTDIR\bin\makebin.exe"
+ Delete "$INSTDIR\bin\packihx.exe"
+ Delete "$INSTDIR\bin\sdcc.exe"
+ Delete "$INSTDIR\bin\sdcclib.exe"
+ Delete "$INSTDIR\bin\sdcpp.exe"
+ Delete "$INSTDIR\bin\readline5.dll"
+
+
+ Delete "$INSTDIR\bin\s51.exe"
+ Delete "$INSTDIR\bin\savr.exe"
+ Delete "$INSTDIR\bin\shc08.exe"
+ Delete "$INSTDIR\bin\sz80.exe"
+
+ Delete "$INSTDIR\bin\sdcdb.exe"
+ Delete "$INSTDIR\bin\sdcdb.el"
+ Delete "$INSTDIR\bin\sdcdbsrc.el"
+
+ Delete "$INSTDIR\COPYING.txt"
Delete "$INSTDIR\sdcc.ico"
-
- RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
+ Delete "$INSTDIR\uninstall.exe"
RMDir /r "$INSTDIR\lib\src\pic"
RMDir /r "$INSTDIR\lib\src\pic16"
RMDir "$INSTDIR\include\asm\z80"
RMDir "$INSTDIR\include\asm\pic16"
+ RMDir "$INSTDIR\include\asm\pic"
RMDir "$INSTDIR\include\asm\mcs51"
RMDir "$INSTDIR\include\asm\gbz80"
RMDir "$INSTDIR\include\asm\ds390"
RMDir "$INSTDIR\include\hc08"
RMDir "$INSTDIR\include"
+!ifdef FULL_DOC
+ RMDir /r "$INSTDIR\doc"
+!else
RMDir "$INSTDIR\doc"
+!endif
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR"
-
- Push "$INSTDIR\bin"
- Call un.RemoveFromPath
-
- SetAutoClose true
-SectionEnd
+;;;; SetAutoClose true
+${SectionEnd}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Path Manipulation functions ;
; Input - head of the stack
; Note - Win9x systems requires reboot
-Function AddToPath
+${Function} SDCC.AddToPath
Exch $0
Push $1
Push $2
Push $4
; don't add if the path doesn't exist
- IfFileExists $0 "" AddToPath_done
+ ${If} ${FileExists} $0
+ Call SDCC.IsNT
+ Pop $4
+ ${If} $4 != 1
+ ; Not on NT: read PATH from environment variable
+ ReadEnvStr $1 PATH
+ ${Else}
+ ; On NT: read PATH from registry
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ ${EndIf}
+
+ ${StrStr} $2 "$1;" "$0;"
+ ${If} $2 == ""
+ ${StrStr} $2 "$1;" "$0\;"
+ ${If} $2 == ""
+ GetFullPathName /SHORT $3 $0
+ ${StrStr} $2 "$1;" "$3;"
+ ${If} $2 == ""
+ ${StrStr} $2 "$1;" "$03\;"
+ ${If} $2 == ""
+ ${If} $4 != 1
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 -1 END
+ FileReadByte $1 $2
+ ${If} $2 = 26 ; DOS EOF
+ FileSeek $1 -1 END ; write over EOF
+ ${Endif}
+ ${DebugMsg} "adding line $\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileClose $1
+ ${DebugMsg} "SetRebootFlag true"
+ SetRebootFlag true
+ ${Else}
+ ;System PATH variable is at:
+ ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ StrCpy $2 $1 1 -1 ; copy last char
+ ${If} $2 == ";" ; if last char == ;
+ StrCpy $1 $1 -1 ; remove last char
+ ${Endif}
+ ${If} $1 != ""
+ StrCpy $0 "$1;$0"
+ ${Endif}
+ WriteRegExpandStr HKCU "Environment" "PATH" $0
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ ${Endif}
+ ${Endif}
+ ${Endif}
+ ${Endif}
+ ${Endif}
+ ${EndIf}
- Call IsNT
Pop $4
- StrCmp $4 1 +3
- ; Not on NT: read PATH from environment variable
- ReadEnvStr $1 PATH
- Goto +2
- ; On NT: read PATH from registry
- ReadRegStr $1 HKCU "Environment" "PATH"
- Push "$1;"
- Push "$0;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
- Push "$1;"
- Push "$0\;"
- Call StrStr
+ Pop $3
Pop $2
- StrCmp $2 "" "" AddToPath_done
- GetFullPathName /SHORT $3 $0
- Push "$1;"
- Push "$3;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
- Push "$1;"
- Push "$3\;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
-
- StrCmp $4 1 AddToPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" a
- FileSeek $1 -1 END
- FileReadByte $1 $2
- IntCmp $2 26 0 +2 +2 ; DOS EOF
- FileSeek $1 -1 END ; write over EOF
- FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
- FileClose $1
- SetRebootFlag true
- Goto AddToPath_done
-
- AddToPath_NT:
- ReadRegStr $1 HKCU "Environment" "PATH"
- StrCpy $2 $1 1 -1 ; copy last char
- StrCmp $2 ";" 0 +2 ; if last char == ;
- StrCpy $1 $1 -1 ; remove last char
- StrCmp $1 "" AddToPath_NTdoIt
- StrCpy $0 "$1;$0"
- AddToPath_NTdoIt:
- WriteRegExpandStr HKCU "Environment" "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- AddToPath_done:
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
+ Pop $1
+ Pop $0
+${FunctionEnd}
; RemoveFromPath - Remove a given dir from the path
; Input: head of the stack
-Function un.RemoveFromPath
+!macro SDCC.RemoveFromPath un
+${Function} ${un}SDCC.RemoveFromPath
Exch $0
Push $1
Push $2
IntFmt $6 "%c" 26 ; DOS EOF
- Call un.IsNT
+ Call ${un}SDCC.IsNT
Pop $1
- StrCmp $1 1 unRemoveFromPath_NT
+ ${If} $1 != 1
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
FileOpen $2 $4 w
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
- Goto unRemoveFromPath_dosLoop
- unRemoveFromPath_dosLoop:
- FileRead $1 $3
+ nextLine:
+ ; copy all lines except the line containing "SET PATH=%PATH%;$0"
+ ; from autoexec.bat to the temporary file
+ ClearErrors
+ FileRead $1 $3
+ ${IfNot} ${Errors}
StrCpy $5 $3 1 -1 ; read last char
- StrCmp $5 $6 0 +2 ; if DOS EOF
+ ${If} $5 == $6 ; if DOS EOF
StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
- StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
- StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
- StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
- StrCmp $3 "" unRemoveFromPath_dosLoopEnd
- FileWrite $2 $3
- Goto unRemoveFromPath_dosLoop
- unRemoveFromPath_dosLoopRemoveLine:
+ ${EndIf}
+ ${If} $3 != "$0$\r$\n"
+ ${AndIf} $3 != "$0$\n"
+ ${AndIf} $3 != "$0"
+ FileWrite $2 $3
+ Goto nextLine
+ ${Else}
+ ; This is the line I'm looking for:
+ ; don't copy it
+ ${DebugMsg} "removing line $0"
+ ${DebugMsg} "SetRebootFlag true"
SetRebootFlag true
- Goto unRemoveFromPath_dosLoop
-
- unRemoveFromPath_dosLoopEnd:
- FileClose $2
- FileClose $1
- StrCpy $1 $WINDIR 2
- Delete "$1\autoexec.bat"
- CopyFiles /SILENT $4 "$1\autoexec.bat"
- Delete $4
- Goto unRemoveFromPath_done
-
- unRemoveFromPath_NT:
+ Goto nextLine
+ ${EndIf}
+ ${EndIf}
+
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ ${Else}
+ ;System PATH variable is at:
+ ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
ReadRegStr $1 HKCU "Environment" "PATH"
StrCpy $5 $1 1 -1 ; copy last char
- StrCmp $5 ";" +2 ; if last char != ;
+ ${If} $5 != ";" ; if last char != ;
StrCpy $1 "$1;" ; append ;
+ ${EndIf}
Push $1
Push "$0;"
- Call un.StrStr ; Find `$0;` in $1
+ Call ${un}StrStr ; Find `$0;` in $1
Pop $2 ; pos of our dir
- StrCmp $2 "" unRemoveFromPath_done
- ; else, it is in path
+ ${If} $2 != ""
+ ; it is in path:
; $0 - path to add
; $1 - path var
StrLen $3 "$0;"
StrCpy $3 $5$6
StrCpy $5 $3 1 -1 ; copy last char
- StrCmp $5 ";" 0 +2 ; if last char == ;
+ ${If} $5 == ";" ; if last char == ;
StrCpy $3 $3 -1 ; remove last char
-
- StrCmp $3 "" +3
+ ${EndIf}
+ ${If} $3 != ""
; New PATH not empty: update the registry
WriteRegExpandStr HKCU "Environment" "PATH" $3
- Goto +2
+ ${Else}
; New PATH empty: remove from the registry
DeleteRegValue HKCU "Environment" "PATH"
+ ${EndIf}
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ ${Endif}
+ ${Endif}
- unRemoveFromPath_done:
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+${FunctionEnd}
+!macroend
+!insertmacro SDCC.RemoveFromPath ""
+!insertmacro SDCC.RemoveFromPath "un."
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Utility Functions ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Utility Functions ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; IsNT
; no input
; Pop $R0
; ($R0 at this point is 1 or 0)
-!macro IsNT un
-Function ${un}IsNT
- Push $0
- ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
- StrCmp $0 "" 0 IsNT_yes
- ; we are not NT.
- Pop $0
- Push 0
- Return
-
- IsNT_yes:
+!macro SDCC.IsNT un
+${Function} ${un}SDCC.IsNT
+ Push $R0
+ ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ ${If} $R0 == ""
+ ; we are not NT.
+ Pop $R0
+ Push 0
+ ${Else}
; NT!!!
- Pop $0
+ Pop $R0
Push 1
-FunctionEnd
+ ${EndIf}
+${FunctionEnd}
!macroend
-!insertmacro IsNT ""
-!insertmacro IsNT "un."
-
-; StrStr
-; input, top of stack = string to search for
-; top of stack-1 = string to search in
-; output, top of stack (replaces with the portion of the string remaining)
-; modifies no other variables.
-;
-; Usage:
-; Push "this is a long ass string"
-; Push "ass"
-; Call StrStr
-; Pop $R0
-; ($R0 at this point is "ass string")
-
-!macro StrStr un
-Function ${un}StrStr
-Exch $R1 ; st=haystack,old$R1, $R1=needle
- Exch ; st=old$R1,haystack
- Exch $R2 ; st=old$R1,old$R2, $R2=haystack
- Push $R3
- Push $R4
- Push $R5
- StrLen $R3 $R1
- StrCpy $R4 0
- ; $R1=needle
- ; $R2=haystack
- ; $R3=len(needle)
- ; $R4=cnt
- ; $R5=tmp
- loop:
- StrCpy $R5 $R2 $R3 $R4
- StrCmp $R5 $R1 done
- StrCmp $R5 "" done
- IntOp $R4 $R4 + 1
- Goto loop
-done:
- StrCpy $R1 $R2 "" $R4
- Pop $R5
- Pop $R4
- Pop $R3
+!insertmacro SDCC.IsNT ""
+!insertmacro SDCC.IsNT "un."
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall/Reinstall page functions ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
+
+Var ReinstallPageCheck
+
+${Function} SDCC.PageReinstall
+
+ ReadRegStr $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" ""
+
+ ${If} $R0 == ""
+ ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
+ ${If} $R0 == ""
+ Abort
+ ${EndIf}
+ ${EndIf}
+
+ ReadRegDWORD $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor"
+ ReadRegDWORD $R1 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor"
+ ReadRegDWORD $R2 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision"
+ ReadRegDWORD $R3 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild"
+ StrCpy $R0 $R0.$R1.$R2.$R3
+
+ ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
+ ${If} $R0 == 0
+ StrCpy $R1 "${PRODUCT_NAME} ${PRODUCT_VERSION} is already installed. Select the operation you want to perform and click Next to continue."
+ StrCpy $R2 "Add/Reinstall components"
+ StrCpy $R3 "Uninstall ${PRODUCT_NAME}"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
+ StrCpy $R0 "2"
+ ${ElseIf} $R0 == 1
+ 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."
+ StrCpy $R2 "Uninstall before installing"
+ StrCpy $R3 "Do not uninstall"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
+ StrCpy $R0 "1"
+ ${ElseIf} $R0 == 2
+ 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."
+ StrCpy $R2 "Uninstall before installing"
+ StrCpy $R3 "Do not uninstall"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
+ StrCpy $R0 "1"
+ ${Else}
+ Abort
+ ${EndIf}
+
+ nsDialogs::Create /NOUNLOAD 1018
+
+ ${NSD_CreateLabel} 0 0 100% 24u $R1
+ Pop $R1
+
+ ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
Pop $R2
- Exch $R1
-FunctionEnd
-!macroend
-!insertmacro StrStr ""
-!insertmacro StrStr "un."
+ ${NSD_OnClick} $R2 SDCC.PageReinstallUpdateSelection
+
+ ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
+ Pop $R3
+ ${NSD_OnClick} $R3 SDCC.PageReinstallUpdateSelection
+
+ ${If} $ReinstallPageCheck != 2
+ SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
+ ${Else}
+ SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
+ ${EndIf}
+
+ nsDialogs::Show
+
+${FunctionEnd}
+
+${Function} SDCC.PageReinstallUpdateSelection
+
+ Pop $R1
+
+ ${NSD_GetState} $R2 $R1
+
+ ${If} $R1 == ${BST_CHECKED}
+ StrCpy $ReinstallPageCheck 1
+ ${Else}
+ StrCpy $ReinstallPageCheck 2
+ ${EndIf}
+
+${FunctionEnd}
+
+${Function} SDCC.PageLeaveReinstall
+
+ ${NSD_GetState} $R2 $R1
+
+ ${DebugMsg} "R0 = $R0, R1 = $R1, R2 = $R2"
+
+ ${If} $R0 == "1"
+ ${AndIf} $R1 != "1"
+ Goto reinst_done
+ ${EndIf}
+
+ ${If} $R0 == "2"
+ ${AndIf} $R1 == 1
+ Goto reinst_done
+ ${EndIf}
+
+ ReadRegStr $R1 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
+
+ ;Run uninstaller
+ HideWindow
+
+ ${If} $R0 == "2"
+ ; Uninstall only: uninstaller should be removed
+ ClearErrors
+ ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
+ ExecWait '$R1'
+ Quit
+ ${Else}
+ ; Uninstal & Reinstall: uninstaller will be rewritten
+ ClearErrors
+ ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
+ ExecWait '$R1 _?=$INSTDIR'
+ ${EndIf}
+
+ BringToFront
+
+reinst_done:
+
+${FunctionEnd}
+
+!endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD