3 ; This script is based on example1.nsi, but it remember the directory,
4 ; has uninstall support and (optionally) installs start menu shortcuts.
6 ; It will install makensisw.exe into a directory that the user selects,
10 ;--------------------------------
12 ; The name of the installer
13 Name "@PACKAGE_NAME@ @PACKAGE_VERSION@"
16 OutFile "@PACKAGE_TARNAME@-@PACKAGE_VERSION@.exe"
18 ; The default installation directory
19 InstallDir $PROGRAMFILES\Synfig
21 ; Registry key to check for directory (so if you install again, it will
22 ; overwrite the old one automatically)
23 InstallDirRegKey HKLM "Software\Voria_@PACKAGE_TARNAME@" "Install_Dir"
25 !define MUI_ABORTWARNING
27 !define SHCNE_ASSOCCHANGED 0x8000000
28 !define SHCNF_IDLIST 0
30 !define PRODUCT_REG_KEY "Software\@PACKAGE_TARNAME@\@API_VERSION@"
31 !define PRODUCT_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE_TARNAME@"
32 !define PRODUCT_UNINSTALL_EXE "uninstall-@PACKAGE_TARNAME@.exe"
34 ;--------------------------------
36 ;!define MUI_WELCOMEFINISHPAGE_BITMAP "images\about_dialog.bmp"
40 !insertmacro MUI_PAGE_WELCOME
41 !insertmacro MUI_PAGE_LICENSE "@srcdir@\alphalicense.txt"
42 !insertmacro MUI_PAGE_COMPONENTS
43 !insertmacro MUI_PAGE_DIRECTORY
44 !insertmacro MUI_PAGE_INSTFILES
46 !insertmacro MUI_UNPAGE_CONFIRM
47 !insertmacro MUI_UNPAGE_INSTFILES
49 !insertmacro MUI_LANGUAGE "English"
51 ;--------------------------------
53 ; The stuff to install
54 Section "Synfig Studio"
58 SetOutPath "$INSTDIR\share\pixmaps"
61 SetOutPath "$INSTDIR\share"
64 SetOutPath "$INSTDIR\bin"
65 File "src\synfigapp\.libs\libsynfigapp-0.dll"
66 File "src\gtkmm\.libs\synfigstudio.exe"
68 FileOpen $0 $PROFILE\.gtkrc-2.0 a
70 FileWrite $0 "gtk-toolbar-style = 0"
73 FileWrite $0 'gtk-theme-name = "Default"'
78 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
79 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "@PRODUCT_VERSION@"
81 ; Write the uninstall keys for Windows
82 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "@PACKAGE_NAME@"
83 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "@PACKAGE_VERSION@"
84 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
85 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
86 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
89 WriteRegStr HKCR ".sif" "" "Synfig.Composition"
90 WriteRegStr HKCR ".sif" "Content Type" "image/x-sif"
91 WriteRegStr HKCR ".sif" "PerceivedType" "image"
93 WriteRegStr HKCR ".sif.gz" "" "Synfig.Composition"
94 WriteRegStr HKCR ".sif.gz" "Content Type" "image/x-sifz"
95 WriteRegStr HKCR ".sif.gz" "PerceivedType" "image"
97 WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
98 WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\bin\synfigstudio.exe;1"
99 WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
100 WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\synfigstudio.exe "%1"'
102 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
103 WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
107 ; Optional section (can be disabled by the user)
108 Section "Start Menu Shortcuts"
110 CreateDirectory "$SMPROGRAMS\Voria"
111 CreateShortCut "$SMPROGRAMS\Voria\Uninstall Synfig Studio.lnk" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" "" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" 0
112 CreateShortCut "$SMPROGRAMS\Voria\Synfig Studio.lnk" "$INSTDIR\bin\synfigstudio.exe" "" "$INSTDIR\bin\synfigstudio.exe" 0
116 ;--------------------------------
122 DeleteRegKey HKCR "Synfig.Composition\shell\open\command"
123 DeleteRegKey HKCR "Synfig.Composition\DefaultIcon"
124 DeleteRegKey HKCR "Synfig.Composition\shell"
125 DeleteRegKey HKCR "Synfig.Composition"
126 DeleteRegKey HKCR ".sif"
127 DeleteRegKey HKCR ".sif.gz"
129 ; Remove registry keys
130 DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
131 DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
133 ; Remove files and uninstaller
134 Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
135 Delete $INSTDIR\bin\synfigstudio.exe
136 Delete $INSTDIR\bin\libsynfigapp-0.dll
139 ; Remove shortcuts, if any
140 Delete "$SMPROGRAMS\Voria\Uninstall Synfig Studio.lnk"
141 Delete "$SMPROGRAMS\Voria\Synfig Studio.lnk"
143 ; Remove directories used
144 RMDir "$SMPROGRAMS\Voria"
147 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
151 ; Get installer location
152 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
154 ; ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
158 ; Get current installed version
159 ReadRegStr $R1 HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
161 ; ReadRegStr $R1 HKCU "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
163 ; StrCmp $R1 ${PRODUCT_VERSION} done
165 MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "A previous version of @PACKAGE_NAME@ appears to be installed. Would you like to uninstall it first?" IDNO done IDCANCEL abortInstall
167 ; Run the uninstaller
170 ; CopyFiles "$R0" $TEMP
171 ExecWait '$R0 _?=$INSTDIR'
172 IfErrors no_remove_uninstaller
176 no_remove_uninstaller:
179 ; Check that the user completed the uninstallation by examining the registry
180 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
181 StrCmp $R0 "" done abortInstall
182 ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
183 StrCmp $R0 "" done abortInstall
186 MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall previous version of @PACKAGE_NAME@"