[Cmake-commits] [cmake-commits] david.cole committed CPack.Info.plist.in 1.5 1.6 NSIS.template.in 1.26 1.27 CPack.distribution.dist.in NONE 1.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jun 17 11:39:27 EDT 2008
Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv23549/Modules
Modified Files:
CPack.Info.plist.in NSIS.template.in
Added Files:
CPack.distribution.dist.in
Log Message:
ENH: Add patch for feature request #6847 - CPack components for NSIS and PackageMaker installers. Thanks to Doug Gregor for all the hard work involved with implementing this patch! Also added new test CPackComponents that is conditionally executed only when NSIS or PackageMaker installer builders are available.
Index: NSIS.template.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/NSIS.template.in,v
retrieving revision 1.26
retrieving revision 1.27
diff -C 2 -d -r1.26 -r1.27
*** NSIS.template.in 13 May 2008 20:57:49 -0000 1.26
--- NSIS.template.in 17 Jun 2008 15:39:25 -0000 1.27
***************
*** 37,85 ****
;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@
! ;--------------------------------
! ; determine admin versus local install
! ; Is install for "AllUsers" or "JustMe"?
! ; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
! ; This function is used for the very first "custom page" of the installer.
! ; This custom page does not show up visibly, but it executes prior to the
! ; first visible page and sets up $INSTDIR properly...
! ; Choose different default installation folder based on SV_ALLUSERS...
! ; "Program Files" for AllUsers, "My Documents" for JustMe...
! Function .onInit
! StrCpy $SV_ALLUSERS "JustMe"
! StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
ClearErrors
! UserInfo::GetName
! IfErrors noLM
! Pop $0
! UserInfo::GetAccountType
! Pop $1
! StrCmp $1 "Admin" 0 +3
! SetShellVarContext all
! ;MessageBox MB_OK 'User "$0" is in the Admin group'
! StrCpy $SV_ALLUSERS "AllUsers"
! Goto done
! StrCmp $1 "Power" 0 +3
! SetShellVarContext all
! ;MessageBox MB_OK 'User "$0" is in the Power Users group'
! StrCpy $SV_ALLUSERS "AllUsers"
! Goto done
!
! noLM:
! StrCpy $SV_ALLUSERS "AllUsers"
! ;Get installation folder from registry if available
!
! done:
! StrCmp $SV_ALLUSERS "AllUsers" 0 +2
! StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
! StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
! !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
! noOptionsPage:
! FunctionEnd
;--------------------------------
--- 37,140 ----
;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+ !include Sections.nsh
+
+ ;--- Component support macros: ---
+ ; The code for the add/remove functionality is from:
+ ; http://nsis.sourceforge.net/Add/Remove_Functionality
+ ; It has been modified slightly and extended to provide
+ ; inter-component dependencies.
+ Var AR_SecFlags
+ Var AR_RegFlags
+ @CPACK_NSIS_SECTION_SELECTED_VARS@
! ; Loads the "selected" flag for the section named SecName into the
! ; variable VarName.
! !macro LoadSectionSelectedIntoVar SecName VarName
! SectionGetFlags ${${SecName}} $${VarName}
! IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
! !macroend
! ; Loads the value of a variable... can we get around this?
! !macro LoadVar VarName
! IntOp $R0 0 + $${VarName}
! !macroend
+ !macro InitSection SecName
+ ; This macro reads component installed flag from the registry and
+ ;changes checked state of the section on the components page.
+ ;Input: section index constant name specified in Section command.
+
ClearErrors
! ;Reading component status from registry
! ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" "Installed"
! IfErrors "default_${SecName}"
! ;Status will stay default if registry value not found
! ;(component was never installed)
! IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
! SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
! IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
! IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
! ;Writing modified flags
! SectionSetFlags ${${SecName}} $AR_SecFlags
!
! "default_${SecName}:"
! !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
! !macroend
!
! !macro FinishSection SecName
! ; This macro reads section flag set by user and removes the section
! ;if it is not selected.
! ;Then it writes component installed flag to registry
! ;Input: section index constant name specified in Section command.
!
! SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
! ;Checking lowest bit:
! IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
! IntCmp $AR_SecFlags 1 "leave_${SecName}"
! ;Section is not selected:
! ;Calling Section uninstall macro and writing zero installed flag
! !insertmacro "Remove_${${SecName}}"
! WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" \
! "Installed" 0
! Goto "exit_${SecName}"
!
! "leave_${SecName}:"
! ;Section is selected:
! WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" \
! "Installed" 1
!
! "exit_${SecName}:"
! !macroend
!
! !macro RemoveSection SecName
! ; This macro is used to call section's Remove_... macro
! ;from the uninstaller.
! ;Input: section index constant name specified in Section command.
!
! !insertmacro "Remove_${${SecName}}"
! !macroend
! ; Determine whether the selection of SecName changed
! !macro MaybeSelectionChanged SecName
! !insertmacro LoadVar ${SecName}_selected
! SectionGetFlags ${${SecName}} $R1
! IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
!
! ; See if the status has changed:
! IntCmp $R0 $R1 "${SecName}_unchanged"
! !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
!
! IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
! !insertmacro "Deselect_required_by_${SecName}"
! goto "${SecName}_unchanged"
!
! "${SecName}_was_selected:"
! !insertmacro "Select_${SecName}_depends"
!
! "${SecName}_unchanged:"
! !macroend
! ;--- End of Add/Remove macros ---
;--------------------------------
***************
*** 88,92 ****
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
!
;--------------------------------
; path functions
--- 143,147 ----
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
!
;--------------------------------
; path functions
***************
*** 290,294 ****
FunctionEnd
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Uninstall sutff
--- 345,348 ----
***************
*** 408,414 ****
--- 462,477 ----
;--------------------------------
+ ; Installation types
+ @CPACK_NSIS_INSTALLATION_TYPES@
+
+ ;--------------------------------
+ ; Component sections
+ @CPACK_NSIS_COMPONENT_SECTIONS@
+
+ ;--------------------------------
; Define some macro setting for the gui
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
@CPACK_NSIS_INSTALLER_ICON_CODE@
+ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
;--------------------------------
***************
*** 426,429 ****
--- 489,494 ----
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+ @CPACK_NSIS_PAGE_COMPONENTS@
+
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
***************
*** 447,460 ****
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
-
;--------------------------------
;Installer Sections
! Section "Installer Section" InstSection
!
;Use the entire tree produced by the INSTALL target. Keep the
;list of directories here in sync with the RMDir commands below.
SetOutPath "$INSTDIR"
! File /r "${INST_DIR}\*.*"
;Store installation folder
--- 512,523 ----
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
;--------------------------------
;Installer Sections
! Section "-Core installation"
;Use the entire tree produced by the INSTALL target. Keep the
;list of directories here in sync with the RMDir commands below.
SetOutPath "$INSTDIR"
! @CPACK_NSIS_FULL_INSTALL@
;Store installation folder
***************
*** 475,479 ****
Push "$INSTDIR\Uninstall.exe"
Call ConditionalAddToRegisty
!
; Optional registration
Push "DisplayIcon"
--- 538,543 ----
Push "$INSTDIR\Uninstall.exe"
Call ConditionalAddToRegisty
! Push "ModifyPath"
!
; Optional registration
Push "DisplayIcon"
***************
*** 521,525 ****
SectionEnd
! Section "Add to path"
Push $INSTDIR\bin
;Read a value from an InstallOptions INI file
--- 585,589 ----
SectionEnd
! Section "-Add to path"
Push $INSTDIR\bin
;Read a value from an InstallOptions INI file
***************
*** 533,537 ****
SectionEnd
-
;--------------------------------
; Create custom pages
--- 597,600 ----
***************
*** 565,568 ****
--- 628,651 ----
done:
+
+ FunctionEnd
+
+ ;--- Add/Remove callback functions: ---
+ !macro SectionList MacroName
+ ;This macro used to perform operation on multiple sections.
+ ;List all of your components in following manner here.
+ @CPACK_NSIS_COMPONENT_SECTION_LIST@
+ !macroend
+
+ Section -FinishComponents
+ ;Removes unselected components and writes component status to registry
+ !insertmacro SectionList "FinishSection"
+ SectionEnd
+ ;--- End of Add/Remove callback functions ---
+
+ ;--------------------------------
+ ; Component dependencies
+ Function .onSelChange
+ !insertmacro SectionList MaybeSelectionChanged
FunctionEnd
***************
*** 602,605 ****
--- 685,691 ----
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+ ; Removes all optional components
+ !insertmacro SectionList "RemoveSection"
+
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
***************
*** 648,650 ****
--- 734,782 ----
SectionEnd
+ ;--------------------------------
+ ; determine admin versus local install
+ ; Is install for "AllUsers" or "JustMe"?
+ ; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+ ; This function is used for the very first "custom page" of the installer.
+ ; This custom page does not show up visibly, but it executes prior to the
+ ; first visible page and sets up $INSTDIR properly...
+ ; Choose different default installation folder based on SV_ALLUSERS...
+ ; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+ Function .onInit
+ ; Reads components status for registry
+ !insertmacro SectionList "InitSection"
+ StrCpy $SV_ALLUSERS "JustMe"
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+
+ noLM:
+ StrCpy $SV_ALLUSERS "AllUsers"
+ ;Get installation folder from registry if available
+
+ done:
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +2
+ StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+ noOptionsPage:
+ FunctionEnd
--- NEW FILE: CPack.distribution.dist.in ---
<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion="1.0">
<title>@CPACK_PACKAGE_NAME@</title>
<options allow-external-scripts="no" customize="allow" rootVolumeOnly="false"></options>
@CPACK_PACKAGEMAKER_CHOICES@
</installer-gui-script>
Index: CPack.Info.plist.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPack.Info.plist.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** CPack.Info.plist.in 26 Dec 2007 21:57:13 -0000 1.5
--- CPack.Info.plist.in 17 Jun 2008 15:39:25 -0000 1.6
***************
*** 33,37 ****
<real>0.10000000149011612</real>
<key>CFBundleIdentifier</key>
! <string>com. at CPACK_PACKAGE_VENDOR@. at CPACK_PACKAGE_NAME@. at CPACK_PACKAGE_VERSION@</string>
</dict>
</plist>
--- 33,37 ----
<real>0.10000000149011612</real>
<key>CFBundleIdentifier</key>
! <string>com. at CPACK_PACKAGE_VENDOR@. at CPACK_PACKAGE_NAME@. at CPACK_PACKAGE_VERSION@@CPACK_MODULE_VERSION_SUFFIX@</string>
</dict>
</plist>
More information about the Cmake-commits
mailing list