synfigstudio.nsi 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. ; example2.nsi
  2. ;
  3. ; This script is based on example1.nsi, but it remember the directory,
  4. ; has uninstall support and (optionally) installs start menu shortcuts.
  5. ;
  6. ; It will install makensisw.exe into a directory that the user selects,
  7. !include "MUI2.nsh"
  8. ;--------------------------------
  9. ; The name of the installer
  10. Name "Synfig Studio @VERSION@"
  11. ; The file to write
  12. OutFile "synfigstudio-@VERSION@.exe"
  13. ; The default installation directory and registry
  14. !include "arch-specific.nsh"
  15. ; Request application privileges for Windows Vista
  16. RequestExecutionLevel highest
  17. !define MUI_ABORTWARNING
  18. !define SHCNE_ASSOCCHANGED 0x8000000
  19. !define SHCNF_IDLIST 0
  20. !define PRODUCT_REG_KEY "Software\synfigstudio\0.0"
  21. !define PRODUCT_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\synfigstudio"
  22. !define PRODUCT_UNINSTALL_EXE "uninstall-synfigstudio.exe"
  23. ;--------------------------------
  24. ;!define MUI_HEADERIMAGE
  25. ;!define MUI_HEADERIMAGE_BITMAP "installer_logo.bmp"
  26. ;!define MUI_WELCOMEFINISHPAGE_BITMAP ".\share\pixmaps\installer_logo.bmp"
  27. ; Pages
  28. !insertmacro MUI_PAGE_WELCOME
  29. ;!insertmacro MUI_PAGE_LICENSE ".\alphalicense.txt"
  30. !insertmacro MUI_PAGE_LICENSE ".\licenses\synfigstudio.txt"
  31. !insertmacro MUI_PAGE_COMPONENTS
  32. !insertmacro MUI_PAGE_DIRECTORY
  33. !insertmacro MUI_PAGE_INSTFILES
  34. !insertmacro MUI_UNPAGE_CONFIRM
  35. !insertmacro MUI_UNPAGE_INSTFILES
  36. !insertmacro MUI_LANGUAGE "English"
  37. ;--------------------------------
  38. ; The stuff to install
  39. Section "Synfig Studio"
  40. SectionIn RO
  41. SetOutPath "$INSTDIR\bin"
  42. !include "bin.nsh"
  43. SetOutPath "$INSTDIR\etc"
  44. !include "etc.nsh"
  45. SetOutPath "$INSTDIR\lib"
  46. !include "lib-gdk-pixbuf.nsh"
  47. !include "lib-gtk.nsh"
  48. !include "lib-pango.nsh"
  49. !include "lib-synfig.nsh"
  50. SetOutPath "$INSTDIR\licenses"
  51. !include "licenses.nsh"
  52. SetOutPath "$INSTDIR\share"
  53. !include "share.nsh"
  54. ;SetOutPath "$INSTDIR\python"
  55. ;!include "python.nsh"
  56. SetOutPath "$INSTDIR"
  57. File /r /x .* python
  58. WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
  59. WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "@VERSION@"
  60. ; Write the uninstall keys for Windows
  61. WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "Synfig Studio"
  62. WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "@VERSION@"
  63. WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
  64. WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
  65. WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
  66. WriteRegStr HKCR ".sif" "" "Synfig.Composition"
  67. WriteRegStr HKCR ".sif" "Content Type" "image/x-sif"
  68. WriteRegStr HKCR ".sif" "PerceivedType" "image"
  69. WriteRegStr HKCR ".sifz" "" "Synfig.Composition"
  70. WriteRegStr HKCR ".sifz" "Content Type" "image/x-sifz"
  71. WriteRegStr HKCR ".sifz" "PerceivedType" "image"
  72. WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
  73. WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\share\pixmaps\sif_icon.ico"
  74. WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
  75. WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\synfigstudio.exe "%1"'
  76. System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
  77. WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
  78. SectionEnd
  79. Section "FFMpeg"
  80. SetOutPath "$INSTDIR\bin"
  81. File "bin\ffmpeg.exe"
  82. SectionEnd
  83. Section "Examples"
  84. !include "examples.nsh"
  85. SectionEnd
  86. ; Optional section (can be disabled by the user)
  87. Section "Start Menu Shortcuts"
  88. SetOutPath "$INSTDIR\bin"
  89. SetShellVarContext All
  90. CreateDirectory "$SMPROGRAMS\Synfig"
  91. CreateShortCut "$SMPROGRAMS\Synfig\Uninstall Synfig Studio.lnk" "$INSTDIR\uninstall-synfigstudio.exe" "" "$INSTDIR\uninstall-synfigstudio.exe" 0
  92. CreateShortCut "$SMPROGRAMS\Synfig\Synfig Studio.lnk" "$INSTDIR\bin\synfigstudio.exe" "" "$INSTDIR\share\pixmaps\synfig_icon.ico" 0
  93. CreateShortCut "$SMPROGRAMS\Synfig\Synfig Studio (Debug Console).lnk" "$INSTDIR\bin\synfigstudio.exe" "--console" "$INSTDIR\share\pixmaps\synfig_icon.ico" 0
  94. SectionEnd
  95. ;--------------------------------
  96. ; Uninstaller
  97. Section "Uninstall"
  98. DeleteRegKey HKCR "Synfig.Composition\shell\open\command"
  99. DeleteRegKey HKCR "Synfig.Composition\DefaultIcon"
  100. DeleteRegKey HKCR "Synfig.Composition\shell"
  101. DeleteRegKey HKCR "Synfig.Composition"
  102. DeleteRegKey HKCR ".sif"
  103. DeleteRegKey HKCR ".sifz"
  104. ; Remove registry keys
  105. DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
  106. DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
  107. ; Remove files and uninstaller
  108. Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
  109. !include "bin-uninst.nsh"
  110. !include "etc-uninst.nsh"
  111. !include "examples-uninst.nsh"
  112. !include "lib-gdk-pixbuf-uninst.nsh"
  113. !include "lib-gtk-uninst.nsh"
  114. !include "lib-pango-uninst.nsh"
  115. !include "lib-synfig-uninst.nsh"
  116. RMDir "$INSTDIR\lib"
  117. !include "licenses-uninst.nsh"
  118. ;!include "python-uninst.nsh"
  119. RMDir /r "$INSTDIR\python"
  120. !include "share-uninst.nsh"
  121. RMDir "$INSTDIR\share"
  122. ; Remove shortcuts, if any
  123. SetShellVarContext All
  124. Delete "$SMPROGRAMS\Synfig\Uninstall Synfig Studio.lnk"
  125. Delete "$SMPROGRAMS\Synfig\Synfig Studio.lnk"
  126. ; Remove directories used
  127. RMDir "$SMPROGRAMS\Synfig"
  128. RMDir "$INSTDIR"
  129. System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
  130. SectionEnd
  131. Function .onInit
  132. ; Get installer location
  133. ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
  134. ; IfErrors 0 +2
  135. ; ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
  136. StrCmp $R0 "" done
  137. ; Get current installed version
  138. ReadRegStr $R1 HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
  139. ; IfErrors 0 +2
  140. ; ReadRegStr $R1 HKCU "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
  141. ; StrCmp $R1 ${PRODUCT_VERSION} done
  142. MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "A previous version of Synfig Studio appears to be installed. Would you like to uninstall it first?" IDNO done IDCANCEL abortInstall
  143. ; Run the uninstaller
  144. ClearErrors
  145. ; CopyFiles "$R0" $TEMP
  146. ExecWait '$R0 _?=$INSTDIR'
  147. IfErrors no_remove_uninstaller
  148. Delete $R0
  149. RMDir $INSTDIR
  150. no_remove_uninstaller:
  151. ; Delete "$TEMP\$R0"
  152. ; Check that the user completed the uninstallation by examining the registry
  153. ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
  154. StrCmp $R0 "" done abortInstall
  155. ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
  156. StrCmp $R0 "" done abortInstall
  157. abortInstall:
  158. MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall previous version of Synfig Studio"
  159. Abort
  160. done:
  161. BringToFront
  162. FunctionEnd