File evolution-debug.nsi of Package mingw32-evolution-installer

!define PRODUCT_NAME "Evolution"
!define PRODUCT_VERSION "${EVOLUTION_VERSION}"
!define PRODUCT_RELEASE "${EVOLUTION_RELEASE}"
!define PRODUCT_WEB_SITE "http://projects.gnome.org/evolution/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME} Debug Symbols (x86)"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

SetCompressor lzma

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "x64.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${EVOLUTION_SOURCE_DIR}/evolution.ico"
!define MUI_UNICON "${EVOLUTION_SOURCE_DIR}/evolution.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${EVOLUTION_SOURCE_DIR}/evo-debug-nsis.bmp"

RequestExecutionLevel admin

Function .onInit
  ;Are we running x64 system
  ${If} ${RunningX64}
    ${EnableX64FSRedirection}
  ${EndIf}
  ;Can this user install programs?
  ClearErrors
  UserInfo::GetName
  IfErrors enough_rights # Win9x - no need to care about admin or not admin
  Pop $0
  UserInfo::GetAccountType
  Pop $1
  StrCmp $1 "Admin" enough_rights
  StrCmp $1 "Guest" not_enough_rights
  StrCmp $1 "User" not_enough_rights
  StrCmp $1 "Power" enough_rights
  MessageBox MB_OK "Unknown error.$\r$\nThe installation of ${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols will abort."
  Abort "${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols installation aborted"
 not_enough_rights:
  MessageBox MB_OK "User $0 does not have enough rights$\r$\nto install programs on this computer."
  Abort "${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols installation aborted"
 enough_rights:
  	# The installation can continue
FunctionEnd

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Evolution"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION} Debug Symbols"
OutFile "Evolution-${PRODUCT_VERSION}-${PRODUCT_RELEASE}-debug-setup.exe"
InstallDir "$PROGRAMFILES\Evolution"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
  SetShellVarContext all
  SetOutPath "$INSTDIR\bin"
  SetOverwrite try
  File "${EVOLUTION_SYSTEM_DIR}/bin/gdb.exe"
  File "${EVOLUTION_SYSTEM_DIR}/bin/*.exe.debug"
  File "${EVOLUTION_SYSTEM_DIR}/bin/*.dll.debug"
  SetOutPath "$INSTDIR\lib\enchant"
  File "${EVOLUTION_SYSTEM_DIR}/lib/enchant/*.dll.debug"
  SetOutPath "$INSTDIR\lib\evolution\2.32\modules"
  File "${EVOLUTION_SYSTEM_DIR}/lib/evolution/2.32/modules/*.dll.debug"
  SetOutPath "$INSTDIR\lib\evolution\2.32\plugins"
  File "${EVOLUTION_SYSTEM_DIR}/lib/evolution/2.32/plugins/*.dll.debug"
  SetOutPath "$INSTDIR\lib\evolution-data-server-1.2\camel-providers"
  File "${EVOLUTION_SYSTEM_DIR}/lib/evolution-data-server-1.2/camel-providers/*.dll.debug"
  SetOutPath "$INSTDIR\lib\evolution-data-server-1.2\extensions"
  File "${EVOLUTION_SYSTEM_DIR}/lib/evolution-data-server-1.2/extensions/*.dll.debug"
  SetOutPath "$INSTDIR\lib\GConf-dbus\2"
  File "${EVOLUTION_SYSTEM_DIR}/lib/GConf-dbus/2/*.dll.debug"
  SetOutPath "$INSTDIR\lib\gtk-2.0\2.10.0\engines"
  File "${EVOLUTION_SYSTEM_DIR}/lib/gtk-2.0/2.10.0/engines/*.dll.debug"
  SetOutPath "$INSTDIR\lib\gtk-2.0\modules"
  File "${EVOLUTION_SYSTEM_DIR}/lib/gtk-2.0/modules/*.dll.debug"
  SetOutPath "$INSTDIR\libexec"
  File "${EVOLUTION_SYSTEM_DIR}/libexec/*.exe.debug"
  SetOutPath "$INSTDIR\libexec\evolution\2.32"
  File "${EVOLUTION_SYSTEM_DIR}/libexec/evolution/2.32/*.exe.debug"
SectionEnd

Section -Post
  SetShellVarContext all
  WriteUninstaller "$INSTDIR\evo-debug-uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\evo-debug-uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\evo-debug-uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
SectionEnd


Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
  ;Are we running x64 system
  ${If} ${RunningX64}
    ${EnableX64FSRedirection}
  ${EndIf}
  ;Can this user install programs?
  ClearErrors
  UserInfo::GetName
  IfErrors enough_rights # Win9x - no need to care about admin or not admin
  Pop $0
  UserInfo::GetAccountType
  Pop $1
  StrCmp $1 "Admin" enough_rights
  StrCmp $1 "Guest" not_enough_rights
  StrCmp $1 "User" not_enough_rights
  StrCmp $1 "Power" enough_rights
  MessageBox MB_OK "Unknown error.$\r$\nThe installation of ${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols will abort."
  Abort "${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols installation aborted"
 not_enough_rights:
  MessageBox MB_OK "User $0 does not have enough rights$\r$\nto install programs on this computer."
  Abort "${PRODUCT_NAME}-${PRODUCT_VERSION} debug symbols installation aborted"
 enough_rights:
  	# The installation can continue
  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

Section Uninstall
  SetShellVarContext all
  !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
  Delete "$INSTDIR\libexec\*.exe.debug"
  Delete "$INSTDIR\libexec\evolution\2.32\*.exe.debug"
  Delete "$INSTDIR\lib\gtk-2.0\modules\*.dll.debug"
  Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.dll.debug"
  Delete "$INSTDIR\lib\GConf-dbus\2\*.dll.debug"
  Delete "$INSTDIR\lib\evolution-data-server-1.2\extensions\*.dll.debug"
  Delete "$INSTDIR\lib\evolution-data-server-1.2\camel-providers\*.dll.debug"
  Delete "$INSTDIR\lib\evolution\2.32\plugins\*.dll.debug"
  Delete "$INSTDIR\lib\evolution\2.32\modules\*.dll.debug"
  Delete "$INSTDIR\lib\enchant\*.dll.debug"
  Delete "$INSTDIR\bin\*.dll.debug"
  Delete "$INSTDIR\bin\*.exe.debug"
  Delete "$INSTDIR\bin\gdb.exe"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true

  Delete "$INSTDIR\evo-debug-uninst.exe"
SectionEnd
openSUSE Build Service is sponsored by