CVS: packaging installopts_associations.ini,NONE,1.1 mspgcc-base.nsh,1.2,1.3 mspgcc-full-install.nsi,1.8,1.9

Chris Liechti <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/packaging
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16616/packaging

Modified Files:
	mspgcc-base.nsh mspgcc-full-install.nsi 
Added Files:
	installopts_associations.ini 
Log Message:
- fix some minor errors in the uninstaller
- ask to remove examples folder completly if delete fails after removing all the files we've put on the disk
- move the question for the file assiciations to a separate page instead of the compontents
- ask for the startmenu folder

--- NEW FILE: installopts_associations.ini ---
[Settings]
NumFields=3

[Field 1]
Type=CheckBox
Left=21
Top=53
Right=271
Bottom=63
Text=Associate .a43 to mspgcc
State=1

[Field 2]
Type=CheckBox
Left=21
Top=71
Right=271
Bottom=81
Text=Associate .elf to mspgcc
State=1

[Field 3]
Type=Label
Left=21
Top=18
Right=287
Bottom=53
Text=If file associations are set, operations like "JTAG Download", "Convert to TI-Text" or "Convert to IHex" are possible with the context menu in the Windows Explorer.

Index: mspgcc-base.nsh
===================================================================
RCS file: /cvsroot/mspgcc/packaging/mspgcc-base.nsh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- mspgcc-base.nsh	30 Dec 2005 04:48:56 -0000	1.2
+++ mspgcc-base.nsh	4 Jan 2006 00:09:55 -0000	1.3
@@ -15,6 +15,13 @@
 !define MUI_UNICON "mspgcc.ico"
 
 ;--------------------------------
+;Variables
+
+  Var MUI_TEMP
+  Var STARTMENU_FOLDER
+  Var INI_VALUE
+
+;--------------------------------
 ;Interface Settings
 
   !define MUI_ABORTWARNING
@@ -30,6 +37,12 @@
   
   !define MUI_COMPONENTSPAGE_SMALLDESC
   !define MUI_FINISHPAGE_NOAUTOCLOSE
+
+  ;Start Menu Folder Page Configuration
+  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
+  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT}" 
+  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+
 ;--------------------------------
 ;Pages
 
@@ -37,7 +50,9 @@
   !insertmacro MUI_PAGE_LICENSE "licence.txt"
   !insertmacro MUI_PAGE_COMPONENTS
   !insertmacro MUI_PAGE_DIRECTORY
+  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
   !insertmacro MUI_PAGE_INSTFILES
+  Page custom FileAssociationsCustomPage
   !insertmacro MUI_PAGE_FINISH
   
   !insertmacro MUI_UNPAGE_WELCOME
@@ -61,7 +76,9 @@
 ;--------------------------------
 ;Reserve Files
   
-;~ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+  ReserveFile "installopts_associations.ini"
+  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
 ;~ !insertmacro MUI_RESERVEFILE_SPECIALINI
 ;~ !insertmacro MUI_RESERVEFILE_SPECIALBITMAP
 
@@ -88,6 +105,7 @@
 
 
 Function AddPath
+  ClearErrors
   # Add the program directory to the search path, if necessary 
   ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
   IfErrors no_path_to_change

Index: mspgcc-full-install.nsi
===================================================================
RCS file: /cvsroot/mspgcc/packaging/mspgcc-full-install.nsi,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -d -r1.8 -r1.9
--- mspgcc-full-install.nsi	30 Dec 2005 16:01:24 -0000	1.8
+++ mspgcc-full-install.nsi	4 Jan 2006 00:09:55 -0000	1.9
@@ -17,8 +17,54 @@
 Name ${PRODUCT}
 
 #----------------------------------------------------------------------------
+
+Function .onInit
+ 
+  ReadRegStr $R0 HKLM \
+  "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" \
+  "UninstallString"
+  StrCmp $R0 "" done
+ 
+  MessageBox MB_YESNOCANCEL|MB_ICONQUESTION \
+  "${PRODUCT} is already installed. $\n$\nClick `YES` to remove the \
+  previous version, `NO` to install anyway or 'CANCEL' to abort this upgrade." \
+  /SD IDYES IDYES uninst IDNO skip_uninst
+  Abort
+  
+;Run the uninstaller
+uninst:
+  ClearErrors
+  ; Copy the uninstaller to a temp location
+  GetTempFileName $0
+  CopyFiles $R0 $0
+  ;Start the uninstaller using the option to not copy itself
+  ExecWait '$0 _?=$INSTDIR'
+ 
+  IfErrors no_remove_uninstaller
+    ; In most cases the uninstall is successful at this point.
+    ; You may also consider using 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.
+    goto done
+  no_remove_uninstaller:
+    MessageBox MB_ICONEXCLAMATION \
+    "Unable to remove previous version of ${PRODUCT}"
+    Abort
+  
+done:
+  ; remove the copied uninstaller
+  Delete '$0'
+skip_uninst:
+
+    !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installopts_associations.ini"
+
+FunctionEnd
+
+
+#----------------------------------------------------------------------------
 InstType "Full"
 InstType "without make and cygwin"
+#   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
 
 
 SubSection "Make utilities & libs" SecMakeAndLibs
@@ -89,23 +135,28 @@
     SectionEnd
 SubSectionEnd
 
-SubSection "Documentation" SecDoc
+SubSection "Documentation" SecDocs
     Section "Documentation" SecDocsSub
         SectionIn 1 2
         !include "msp430-docs-install.nsh"
         SetOutPath $INSTDIR\docs
         File "${SRCDIR}\stamp.txt"
-        CreateDirectory "$SMPROGRAMS\mspgcc"
-        CreateShortCut "$SMPROGRAMS\mspgcc\mspgcc-manual.lnk" "$INSTDIR\docs\mspgcc-manual.pdf" "" "$INSTDIR\docs\mspgcc-manual.pdf" 0
-        CreateShortCut "$SMPROGRAMS\mspgcc\mspgcc-faq.lnk"    "$INSTDIR\docs\mspgcc-faq.pdf"    "" "$INSTDIR\docs\mspgcc-faq.pdf" 0
-        CreateShortCut "$SMPROGRAMS\mspgcc\Documentation.lnk"        "$INSTDIR\docs"                   "" "$INSTDIR\docs" 0
+        !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+        CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\mspgcc-manual.lnk" "$INSTDIR\docs\mspgcc-manual.pdf" "" "$INSTDIR\docs\mspgcc-manual.pdf" 0
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\mspgcc-faq.lnk"    "$INSTDIR\docs\mspgcc-faq.pdf"    "" "$INSTDIR\docs\mspgcc-faq.pdf" 0
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Documentation.lnk"        "$INSTDIR\docs"                   "" "$INSTDIR\docs" 0
+        !insertmacro MUI_STARTMENU_WRITE_END
+        
     SectionEnd
 
     Section "Examples" SecExamples
         SectionIn 1 2
         !include "msp430-examples-install.nsh"
-        CreateDirectory "$SMPROGRAMS\mspgcc"
-        CreateShortCut "$SMPROGRAMS\mspgcc\examples.lnk"    "$INSTDIR\examples"    "" "$INSTDIR\examples" 0
+        !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+        CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\examples.lnk"    "$INSTDIR\examples"    "" "$INSTDIR\examples" 0
+        !insertmacro MUI_STARTMENU_WRITE_END
     SectionEnd
 SubSectionEnd
 
@@ -153,9 +204,11 @@
     File "LICENSE-msp430-jtag.txt"
     SetOutPath "$INSTDIR"
     
-    CreateDirectory "$SMPROGRAMS\mspgcc"
-    CreateShortCut "$SMPROGRAMS\mspgcc\msp430-gdbproxy.lnk" "$INSTDIR\bin\msp430-gdbproxy.exe" "--port=3333 msp430" "$INSTDIR\gdbproxy.exe" 0
-    CreateShortCut "$SMPROGRAMS\mspgcc\msp430-gdbproxy-debug.lnk" "$INSTDIR\bin\msp430-gdbproxy.exe" "--port=3333 --debug --debug msp430" "$INSTDIR\gdbproxy.exe" 0
+    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+    CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\msp430-gdbproxy.lnk" "$INSTDIR\bin\msp430-gdbproxy.exe" "--port=3333 msp430" "$INSTDIR\msp430-gdbproxy.exe" 0
+    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\msp430-gdbproxy-debug.lnk" "$INSTDIR\bin\msp430-gdbproxy.exe" "--port=3333 --debug --debug msp430" "$INSTDIR\msp430-gdbproxy.exe" 0
+    !insertmacro MUI_STARTMENU_WRITE_END
 SectionEnd
 
 SubSection "GiveIO (required for Windows NT, 2000 and XP only))" SecGiveio
@@ -187,10 +240,12 @@
       StrCmp $0 1 need_giveio_2
       Goto skip_giveio_2
     need_giveio_2:
-      CreateDirectory "$SMPROGRAMS\mspgcc\GiveIO"
-      CreateShortCut "$SMPROGRAMS\mspgcc\GiveIO\Status Giveio Service.lnk" "$INSTDIR\giveio\status_giveio.bat" "" "$INSTDIR\giveio\status_giveio.bat" 0
-      CreateShortCut "$SMPROGRAMS\mspgcc\GiveIO\Install Giveio Service.lnk" "$INSTDIR\giveio\install_giveio.bat" "" "$INSTDIR\giveio\install_giveio.bat" 0
-      CreateShortCut "$SMPROGRAMS\mspgcc\GiveIO\Remove Giveio Service.lnk" "$INSTDIR\giveio\remove_giveio.bat" "" "$INSTDIR\giveio\remove_giveio.bat" 0
+      !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+      CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER\GiveIO"
+      CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GiveIO\Status Giveio Service.lnk" "$INSTDIR\giveio\status_giveio.bat" "" "$INSTDIR\giveio\status_giveio.bat" 0
+      CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GiveIO\Install Giveio Service.lnk" "$INSTDIR\giveio\install_giveio.bat" "" "$INSTDIR\giveio\install_giveio.bat" 0
+      CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GiveIO\Remove Giveio Service.lnk" "$INSTDIR\giveio\remove_giveio.bat" "" "$INSTDIR\giveio\remove_giveio.bat" 0
+      !insertmacro MUI_STARTMENU_WRITE_END
     skip_giveio_2:
     
     SectionEnd
@@ -218,12 +273,23 @@
     Call AddPath
 SectionEnd
 
+#----------------------------------------------------------------------------
+# this is the handler for a custom menu page.
+# 1. show page
+# 2. if next was pressed ("success"), check the ini file and do the selected
+#    file associations
 
-; OPTIONAL
-Section "Associate .a43 with mspgcc" SecAssociateA43
-    SectionIn 1 2
+Function FileAssociationsCustomPage ;FunctionName defined with Page command
+    !insertmacro MUI_HEADER_TEXT "Set mspgcc File Associations" ""
+    !insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "installopts_associations.ini"
+    Pop $R0 ;Get the return value
+    StrCmp $R0 "success" 0 skip_associations
+    
+    ;Read a value from an InstallOptions INI file
+    !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "installopts_associations.ini" "Field 1" "State"
+    StrCmp $INI_VALUE "1" 0 skip_a43
     ; Write the mspgcc.downloader Keys
-    WriteRegStr HKCR "mspgcc.ihexfile" "" "MSP430 ihex binary"
+    WriteRegStr HKCR "mspgcc.ihexfile" "" "MSP430 IHex binary"
     WriteRegStr HKCR "mspgcc.ihexfile\DefaultIcon" "" "$INSTDIR\bin\msp430-downloader.exe"
     WriteRegStr HKCR "mspgcc.ihexfile\shell\open" "" "JTAG Download"
     WriteRegStr HKCR "mspgcc.ihexfile\shell\open\command" "" "$INSTDIR\bin\msp430-downloader.exe $\"%1$\""
@@ -232,11 +298,10 @@
     ; Write File Associations
     WriteRegStr HKCR ".a43" "" "mspgcc.ihexfile"
     WriteRegStr HKCR ".a43" "Content Type" "application/octet-stream"
-SectionEnd
+skip_a43:
 
-; OPTIONAL
-Section "Associate .elf with mspgcc" SecAssociateELF
-    SectionIn 1 2
+    !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "installopts_associations.ini" "Field 2" "State"
+    StrCmp $INI_VALUE "1" 0 skip_elf
     #select command processor, used in the registry settings below
     Call IsNT
     Pop $0
@@ -248,7 +313,7 @@
 cmd_done:
 
     ; Write the mspgcc.downloader Keys
-    WriteRegStr HKCR "mspgcc.elffile" "" "MSP430 elf binary"
+    WriteRegStr HKCR "mspgcc.elffile" "" "MSP430 ELF binary"
     WriteRegStr HKCR "mspgcc.elffile\DefaultIcon" "" "$INSTDIR\bin\msp430-downloader.exe"
     WriteRegStr HKCR "mspgcc.elffile\shell\open" "" "JTAG Download"
     WriteRegStr HKCR "mspgcc.elffile\shell\open\command" "" "$INSTDIR\bin\msp430-downloader.exe $\"%1$\""
@@ -256,15 +321,19 @@
     WriteRegStr HKCR "mspgcc.elffile\shell\cihex\command" "" "$INSTDIR\bin\msp430-objcopy -O ihex $\"%1$\" $\"%1.a43$\" "
     WriteRegStr HKCR "mspgcc.elffile\shell\ctotitext" "" "Convert to TI-Text"
     WriteRegStr HKCR "mspgcc.elffile\shell\ctotitext\command" "" "$INSTDIR\bin\ihex2titext $\"%1$\" -o $\"%1.txt$\""
-    WriteRegStr HKCR "mspgcc.elffile\shell\listing" "" "Generate listing"
+    WriteRegStr HKCR "mspgcc.elffile\shell\listing" "" "Generate listing with msp430-objdump"
     WriteRegStr HKCR "mspgcc.elffile\shell\listing\command" "" "$0 /c $INSTDIR\bin\msp430-objdump -dSt $\"%1$\" > $\"%1.lst$\""
     ; Write File Associations
     WriteRegStr HKCR ".elf" "" "mspgcc.elffile"
     WriteRegStr HKCR ".elf" "Content Type" "application/octet-stream"
-SectionEnd
+skip_elf:
+skip_associations:
+FunctionEnd
+
 
 
-#----------------------------------------------------------------------------
+
+#============================================================================
 
 Section "Uninstall"
     #binutils
@@ -295,15 +364,21 @@
     #libc etc
     !include "msp430-libc-uninstall.nsh"
     Delete "$INSTDIR\docs\README-msp430-libc.txt"
+    #addon libs
+    !include "msp430-libraries-uninstall.nsh"
     #examples
+    ClearErrors
     !include "msp430-examples-uninstall.nsh"
-    Delete "$SMPROGRAMS\mspgcc\examples.lnk"
+    IfErrors 0 examples_cont
+    MessageBox MB_YESNO|MB_DEFBUTTON2 \
+        "The examples folder could not be removed. Probably because there are build files left.$\n$\n\
+        Should the folder be deleted?$\n(Press 'NO' if you have placed your own work in that folder or if you are unsure.)" \
+        IDNO examples_cont
+    RMdir /r "$INSTDIR\examples"
+examples_cont:
     #docs
     !include "msp430-docs-uninstall.nsh"
-    Delete "$INSTDIR\stamp.txt"
-    Delete "$SMPROGRAMS\mspgcc\msp430-manual.lnk"
-    Delete "$SMPROGRAMS\mspgcc\msp430-faq.lnk"
-    Delete "$SMPROGRAMS\mspgcc\Documentation.lnk"
+    Delete "$INSTDIR\docs\stamp.txt"
 
     #jtag and bsl
     Delete "$INSTDIR\bin\msp430-gdbproxy.exe"
@@ -337,8 +412,6 @@
     Delete "$INSTDIR\docs\LICENSE-msp430-bsl.txt"
     RMDir  "$INSTDIR\docs"
     
-    Delete "$SMPROGRAMS\mspgcc\msp430-gdbproxy.lnk"
-
     #giveio
 ;~       Call un.IsNT
 ;~       Pop $0
@@ -354,10 +427,22 @@
     Delete "$INSTDIR\giveio\status_giveio.bat"
     Delete "$INSTDIR\giveio\README.txt"
     RMDir  "$INSTDIR\giveio"
-    Delete "$SMPROGRAMS\mspgcc\GiveIO\Status Giveio Service.lnk"
-    Delete "$SMPROGRAMS\mspgcc\GiveIO\Install Giveio Service.lnk"
-    Delete "$SMPROGRAMS\mspgcc\GiveIO\Remove Giveio Service.lnk"
-    RMDir  "$SMPROGRAMS\mspgcc\GiveIO"
+    
+    # - - - - - startmenu
+    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+    Delete "$SMPROGRAMS\$MUI_TEMP\msp430-gdbproxy.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\msp430-gdbproxy-debug.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\mspgcc-manual.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\mspgcc-faq.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\Documentation.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\examples.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\GiveIO\Status Giveio Service.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\GiveIO\Install Giveio Service.lnk"
+    Delete "$SMPROGRAMS\$MUI_TEMP\GiveIO\Remove Giveio Service.lnk"
+    RMDir  "$SMPROGRAMS\$MUI_TEMP\GiveIO"
+    RMDir  "$SMPROGRAMS\$MUI_TEMP"
+
+;     DeleteRegKey ${MUI_STARTMENUPAGE_REGISTRY_ROOT} ${MUI_STARTMENUPAGE_REGISTRY_KEY}
     
     #support
     Delete "$INSTDIR\bin\cygwin1.dll"
@@ -385,8 +470,8 @@
     # MUST REMOVE UNINSTALLER, too
     Delete "$INSTDIR\${PRODUCT}-uninstall.exe"
     #finalize
-    RMDir  "$SMPROGRAMS\mspgcc"
     RMDir  "$INSTDIR\bin"
+    RMDir  "$INSTDIR\msp430"
     RMDir  "$INSTDIR"
     
     # remove registry keys
@@ -396,6 +481,8 @@
 
 SectionEnd
 
+#----------------------------------------------------------------------------
+
 
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
   !insertmacro MUI_DESCRIPTION_TEXT ${SecBinutils}      "The GNU binutils package, version 2.14, for the MSP430. This includes the assember, linker, and librarian."
@@ -408,8 +495,6 @@
   !insertmacro MUI_DESCRIPTION_TEXT ${SecLibraries}     "Several add-on libraries for the MSP430. libmspgcc, libcommandline, libspi"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecGdb}           "The GNU command line debugger (GDB) for the MSP430."
   !insertmacro MUI_DESCRIPTION_TEXT ${SecDownloader}    "gdbproxy, msp430-jtag, msp430-bsl. Interface to the MSP430 FET JTAG tool and BSL."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecAssociateA43}  "Assign file extensions to the msp430-downloader tool"
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecAssociateELF}  "Assign file extensions to the msp430-downloader tool"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecGiveio}        "A parallel port access driver for Windows NT, 2000 and XP (needed for the JTAG adaptor). Note: this is NOT needed for Windows 95, 98 or Me."
   !insertmacro MUI_DESCRIPTION_TEXT ${SecMakeAndLibs}   "The GNU make utilities - make, diff, patch, rm, mv, mkdir, cp and the cygwin libraries."
   !insertmacro MUI_DESCRIPTION_TEXT ${SecMake}          "The GNU make utilities - make, diff, patch, rm, mv, mkdir, cp."



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.