Blame env-builder-data/build/script/packet/synfigstudio-nsis.files/synfigstudio.nsi

a8518c
;--------------------------------
a8518c
; Requires files:
a8518c
;   config.nsh
a8518c
;   files-install.nsh
4d9b8b
;   files-ffmpeg-install.nsh
4d9b8b
;   files-examples-install.nsh
a8518c
;   files-uninstall.nsh
a8518c
a8518c
; Defines which will set by 'config.nsh':
21fb9b
;   PK_NAME          - XxxxxXxxxx               - name without spaces 
4d9b8b
;   PK_DIR_NAME      - Xxxxx Xxxxx              - dir name, may be with spaces 
21fb9b
;   PK_NAME_FULL     - Xxxxx Xxxxxxxxxx         - full name, may be with spaces
21fb9b
;   PK_ARCH          - XX                       - architecture, 32 or 64
21fb9b
;   PK_VERSION       - X.X                      - first two numbers of version
21fb9b
;   PK_VERSION_FULL  - X.X.X-xxxxx-xxxxx        - full version, without spaces 
21fb9b
;   PK_EXECUTABLE    - xxx\XxxxXxxx-xxx_xxx.exe - subpath to executable file 
21fb9b
;   PK_ICON          - xxx\XxxxXxxx-xxx_xxx.ico - subpath to icon file (may be *.exe)
21fb9b
;   PK_DOCUMENT_ICON - xxx\XxxxXxxx-xxx_xxx.ico - subpath to icon file for associated documents
4d9b8b
;   PK_LICENSE       - xxxxxxxx\xxxxxxx-xxx.txt - subpath to license file
a8518c
a8518c
!include "config.nsh"
a8518c
a8518c
;--------------------------------
a8518c
a8518c
!include "MUI2.nsh"
a8518c
a8518c
;--------------------------------
a8518c
a8518c
; The name of the installer
a8518c
Name "${PK_NAME_FULL} ${PK_VERSION_FULL}"
a8518c
a8518c
; The file to write
a8518c
OutFile "${PK_NAME}-${PK_VERSION_FULL}.exe"
a8518c
a8518c
; The default installation directory and registry
4d9b8b
InstallDir "$PROGRAMFILES${PK_ARCH}\${PK_DIR_NAME}"
a8518c
a8518c
; Request application privileges for Windows Vista
77a621
RequestExecutionLevel admin
a8518c
a8518c
!define MUI_ABORTWARNING
a8518c
a8518c
!define SHCNE_ASSOCCHANGED 0x8000000
a8518c
!define SHCNF_IDLIST 0
a8518c
a8518c
!define PRODUCT_REG_KEY "Software\${PK_NAME}"
a8518c
!define PRODUCT_UNINSTALL_KEY  "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PK_NAME}"
a8518c
!define PRODUCT_UNINSTALL_EXE  "uninstall-${PK_NAME}.exe"
a8518c
a8518c
;--------------------------------
a8518c
a8518c
; Pages
a8518c
4d9b8b
!insertmacro MUI_PAGE_LICENSE ".\${PK_LICENSE}"
a8518c
!insertmacro MUI_PAGE_COMPONENTS
a8518c
!insertmacro MUI_PAGE_DIRECTORY
a8518c
!insertmacro MUI_PAGE_INSTFILES
a8518c
a8518c
!insertmacro MUI_UNPAGE_CONFIRM
a8518c
!insertmacro MUI_UNPAGE_INSTFILES
a8518c
389552
!insertmacro MUI_LANGUAGE "English"
389552
a8518c
;--------------------------------
a8518c
; Installer
a8518c
;--------------------------------
a8518c
a8518c
Section "${PK_NAME_FULL} (required)"
a8518c
  SetRegView ${PK_ARCH}
a8518c
a8518c
  SectionIn RO
a8518c
a8518c
  SetOutPath "$INSTDIR"
a8518c
  !include "files-install.nsh"
a8518c
  
a8518c
  WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
a8518c
  WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "${PK_VERSION_FULL}"
a8518c
a8518c
  ; Write the uninstall keys for Windows
a8518c
  WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "${PK_NAME_FULL}"
a8518c
  WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "${PK_VERSION_FULL}"
a8518c
  WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
a8518c
  WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
a8518c
  WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
a8518c
a8518c
  WriteRegStr HKCR ".sif" "" "Synfig.Composition"
a8518c
  WriteRegStr HKCR ".sif" "Content Type" "image/x-sif"
a8518c
  WriteRegStr HKCR ".sif" "PerceivedType" "image"
a8518c
a8518c
  WriteRegStr HKCR ".sifz" "" "Synfig.Composition"
a8518c
  WriteRegStr HKCR ".sifz" "Content Type" "image/x-sifz"
a8518c
  WriteRegStr HKCR ".sifz" "PerceivedType" "image"
a8518c
a8518c
  WriteRegStr HKCR ".sfg" "" "Synfig.Composition"
a8518c
  WriteRegStr HKCR ".sfg" "Content Type" "image/x-sfg"
a8518c
  WriteRegStr HKCR ".sfg" "PerceivedType" "image"
a8518c
	
a8518c
  WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
21fb9b
  WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\${PK_DOCUMENT_ICON}"
a8518c
  WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
21fb9b
  WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\${PK_EXECUTABLE} "%1"'
a8518c
a8518c
  System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
a8518c
a8518c
  SetOutPath "$INSTDIR"
a8518c
  WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
a8518c
SectionEnd
a8518c
a8518c
; Optional section (can be disabled by the user)
a8518c
Section "FFMpeg"
a8518c
  SetOutPath "$INSTDIR"
a8518c
  !include "files-ffmpeg-install.nsh"
a8518c
SectionEnd
a8518c
a8518c
; Optional section (can be disabled by the user)
a8518c
Section "Examples"
a8518c
  SetOutPath "$INSTDIR"
a8518c
  !include "files-examples-install.nsh"
a8518c
SectionEnd
a8518c
a8518c
; Optional section (can be disabled by the user)
a8518c
Section "Start Menu Shortcuts"
a8518c
  SetRegView ${PK_ARCH}
a8518c
a8518c
  SetOutPath "$INSTDIR\bin"
a8518c
a8518c
  SetShellVarContext All
aefcfb
  CreateDirectory "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit"
aefcfb
  CreateShortCut "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\Uninstall ${PK_NAME_FULL}.lnk" "$INSTDIR\uninstall-${PK_NAME}.exe" "" "$INSTDIR\uninstall-${PK_NAME}.exe" 0
aefcfb
  CreateShortCut "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\${PK_NAME_FULL}.lnk" "$INSTDIR\${PK_EXECUTABLE}" "" "$INSTDIR\${PK_ICON}" 0
aefcfb
  CreateShortCut "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\${PK_NAME_FULL} (Debug Console).lnk" "$INSTDIR\${PK_EXECUTABLE}" "--console" "$INSTDIR\${PK_ICON}" 0
a8518c
SectionEnd
a8518c
2d3d89
Section "Desktop Icon"
2d3d89
  SetRegView ${PK_ARCH}
2d3d89
2d3d89
  SetOutPath "$INSTDIR\bin"
2d3d89
2d3d89
  SetShellVarContext All
2d3d89
  CreateShortCut "$DESKTOP\${PK_NAME_FULL}.lnk" "$INSTDIR\${PK_EXECUTABLE}" "" "$INSTDIR\${PK_ICON}" 0
2d3d89
SectionEnd
2d3d89
a8518c
;--------------------------------
a8518c
; Uninstaller
a8518c
;--------------------------------
a8518c
a8518c
Section "Uninstall"
a8518c
  SetRegView ${PK_ARCH}
a8518c
a8518c
  ReadRegStr $INSTDIR HKLM "${PRODUCT_REG_KEY}" "Path"
a8518c
a8518c
  ; Remove registry keys
a8518c
  DeleteRegKey HKCR "Synfig.Composition\shell\open\command" 
a8518c
  DeleteRegKey HKCR "Synfig.Composition\DefaultIcon" 
a8518c
  DeleteRegKey HKCR "Synfig.Composition\shell"
a8518c
  DeleteRegKey HKCR "Synfig.Composition" 
a8518c
  DeleteRegKey HKCR ".sif"
a8518c
  DeleteRegKey HKCR ".sifz"
a8518c
  DeleteRegKey HKCR ".sfg"
a8518c
a8518c
  DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
a8518c
  DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
a8518c
a8518c
  ; Remove files and uninstaller
a8518c
  !include "files-uninstall.nsh"
a8518c
  Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
a8518c
a8518c
  ; Remove shortcuts, if any
a8518c
  SetShellVarContext All
2d3d89
  Delete "$DESKTOP\${PK_NAME_FULL}.lnk"
aefcfb
  Delete "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\${PK_NAME_FULL}.lnk"
aefcfb
  Delete "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\Uninstall ${PK_NAME_FULL}.lnk"
aefcfb
  Delete "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit\${PK_NAME_FULL} (Debug Console).lnk"
a8518c
a8518c
  ; Remove directories used
aefcfb
  RMDir "$SMPROGRAMS\${PK_DIR_NAME} ${PK_ARCH}bit"
a8518c
  RMDir "$INSTDIR"
a8518c
a8518c
  System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
a8518c
SectionEnd
a8518c
a8518c
Function .onInit
a8518c
  ; Check previous installation
a8518c
0f13c3
  SetRegView ${PK_ARCH}
0f13c3
  ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
0f13c3
  StrCmp $R0 "" 0 oops
0f13c3
  
a8518c
  SetRegView 32
a8518c
  ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
a8518c
  StrCmp $R0 "" 0 oops
a8518c
a8518c
  SetRegView 64
a8518c
  ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
a8518c
  StrCmp $R0 "" 0 oops
a8518c
a8518c
  BringToFront
a8518c
  Return
a8518c
a8518c
oops:
1f2234
  MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "Another version of this software appears to be installed. Would you like to uninstall it first?" IDNO ignore IDCANCEL cancel
1f2234
  ExecWait '$R0'
a8518c
  BringToFront
a8518c
  Return
a8518c
a8518c
cancel:
aefcfb
  MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall another version of Synfig"
a8518c
  Abort
a8518c
a8518c
ignore:
a8518c
  BringToFront
4d9b8b
  Return
a8518c
FunctionEnd