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

a8518c
;--------------------------------
a8518c
; Requires files:
a8518c
;   config.nsh
a8518c
;   files-install.nsh
a8518c
;   files-uninstall.nsh
a8518c
;   files-stuff-install.nsh
a8518c
;   files-stuff-uninstall.nsh
a8518c
a8518c
; Defines which will set by 'config.nsh':
21fb9b
;   PK_NAME          - XxxxxXxxxx               - name without 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
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
a8518c
InstallDir "$PROGRAMFILES${PK_ARCH}\${PK_NAME}"
a8518c
Var STUFFDIR
a8518c
a8518c
; Request application privileges for Windows Vista
a8518c
RequestExecutionLevel highest
a8518c
a8518c
!insertmacro MUI_LANGUAGE "English"
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_STUFF_KEY "${PRODUCT_REG_KEY}\${PK_NAME}\${PK_VERSION}"
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
a8518c
!insertmacro MUI_PAGE_LICENSE ".\license\license-synfigstudio-master"
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
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
a8518c
  CreateDirectory "$SMPROGRAMS\${PK_NAME_FULL}"
a8518c
  CreateShortCut "$SMPROGRAMS\${PK_NAME_FULL}\Uninstall ${PK_NAME_FULL}.lnk" "$INSTDIR\uninstall-${PK_NAME}.exe" "" "$INSTDIR\uninstall-${PK_NAME}.exe" 0
21fb9b
  CreateShortCut "$SMPROGRAMS\${PK_NAME_FULL}\${PK_NAME_FULL}.lnk" "$INSTDIR\${PK_EXECUTABLE}" "" "$INSTDIR\${PK_ICON}" 0
a8518c
SectionEnd
a8518c
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
a8518c
  Delete "$SMPROGRAMS\${PK_NAME_FULL}\${PK_NAME_FULL}.lnk"
a8518c
  Delete "$SMPROGRAMS\${PK_NAME_FULL}\Uninstall ${PK_NAME_FULL}.lnk"
a8518c
a8518c
  ; Remove directories used
a8518c
  RMDir "$SMPROGRAMS\${PK_NAME_FULL}"
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
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:
a8518c
  MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "Another version of ${PK_NAME_FULL} appears to be installed. Would you like to uninstall it first?" IDNO ignore IDCANCEL cancel
a8518c
  ExecWait '$R0 _?=$INSTDIR'
a8518c
  BringToFront
a8518c
  Return
a8518c
a8518c
cancel:
a8518c
  MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall another version of ${PK_NAME_FULL}"
a8518c
  Abort
a8518c
a8518c
ignore:
a8518c
  BringToFront
a8518c
  Abort
a8518c
FunctionEnd