* support/scripts/sdcc.nsi: added asranlib.exe to the install package
[fw/sdcc] / support / scripts / sdcc.nsi
index fa5cd340059a252b4b4580d260682bfcbf8b3489..35622c858c9fb5c5fbdfe4e21dd24bb74d56757d 100644 (file)
@@ -93,7 +93,7 @@
   StrCpy $SDCC.StrStack2 $SDCC.StrStack1
   StrCpy $SDCC.StrStack1 $SDCC.StrStack0
   StrCpy $SDCC.StrStack0 $SDCC.FunctionName
-  StrCpy $SDCC.FunctionName ${NAME}
+  StrCpy $SDCC.FunctionName "${NAME}"
 !macroend
 
 !define SDCC.PopStr "!insertmacro MACRO_SDCC_PopStr"
@@ -219,7 +219,7 @@ Var SDCC.PathToRemove
 !insertmacro MUI_PAGE_WELCOME
 
 ; License page
-!insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
+!insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.txt"
 
 ; Uninstall/reinstall page
 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
@@ -255,10 +255,15 @@ ${Function} SDCC.InstFilesLeave
   ${EndIf}
 ${FunctionEnd}
 
-; Finish page
+; 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
@@ -271,6 +276,7 @@ ${FunctionEnd}
 ; Uninstaller pages
 !insertmacro MUI_UNPAGE_CONFIRM
 !insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
 
 ; Language files
 !insertmacro MUI_LANGUAGE "English"
@@ -345,7 +351,7 @@ ${FunctionEnd}
 ${Section} -Common SECCOMMON
   SetOutPath "$INSTDIR"
   File ".\sdcc.ico"
-  File "${SDCC_ROOT}\COPYING.TXT"
+  File "${SDCC_ROOT}\COPYING.txt"
 ${SectionEnd}
 
 ${Section} "SDCC application files" SEC01
@@ -356,6 +362,7 @@ ${Section} "SDCC application files" SEC01
   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"
@@ -420,6 +427,7 @@ ${Section} "SDCC include files" SEC05
   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"
@@ -521,7 +529,6 @@ ${Section} "SDCC library sources" SEC17
 #  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"
 
@@ -742,7 +749,7 @@ ${Section} -Icons SECICONS
   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" "" "" "" ""
 !endif
-  CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT" 
+  CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.txt"
 !insertmacro MUI_STARTMENU_WRITE_END
 ${SectionEnd}
 
@@ -779,6 +786,14 @@ ${SectionEnd}
 ${Section} Uninstall SECUNINSTALL
   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
 
+  ${DebugMsg} "removing path $INSTDIR\bin"
+  Push "$INSTDIR\bin"
+  Call un.SDCC.RemoveFromPath
+
+; Clean the registry
+  DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+  DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
+
   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
 !ifdef FULL_DOC
@@ -805,7 +820,6 @@ ${Section} Uninstall SECUNINSTALL
   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"
@@ -875,6 +889,7 @@ ${Section} Uninstall SECUNINSTALL
   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"
@@ -889,6 +904,7 @@ ${Section} Uninstall SECUNINSTALL
   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"
@@ -909,7 +925,7 @@ ${Section} Uninstall SECUNINSTALL
   Delete "$INSTDIR\bin\sdcdb.el"
   Delete "$INSTDIR\bin\sdcdbsrc.el"
 
-  Delete "$INSTDIR\COPYING.TXT"
+  Delete "$INSTDIR\COPYING.txt"
   Delete "$INSTDIR\sdcc.ico"
   Delete "$INSTDIR\uninstall.exe"
 
@@ -964,14 +980,6 @@ ${Section} Uninstall SECUNINSTALL
   RMDir "$INSTDIR\bin"
 
   RMDir "$INSTDIR"
-
-  ${DebugMsg} "removing path $INSTDIR\bin"
-  Push "$INSTDIR\bin"
-  Call un.SDCC.RemoveFromPath
-
-; Clean the registry
-  DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
-  DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
 ;;;;  SetAutoClose true
 ${SectionEnd}
 
@@ -1024,8 +1032,10 @@ ${Function} SDCC.AddToPath
               ${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:
@@ -1098,6 +1108,8 @@ ${Function} ${un}SDCC.RemoveFromPath
       ${Else}
         ; This is the line I'm looking for:
         ; don't copy it
+        ${DebugMsg} "removing line $0"
+        ${DebugMsg} "SetRebootFlag true"
         SetRebootFlag true
         Goto nextLine
       ${EndIf}
@@ -1295,11 +1307,17 @@ ${Function} SDCC.PageLeaveReinstall
   ;Run uninstaller
   HideWindow
 
-  ClearErrors
-  ExecWait '$R1'
-
   ${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