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\installer_logo.bmp"
40 !insertmacro MUI_PAGE_WELCOME
41 ;!insertmacro MUI_PAGE_LICENSE "@srcdir@\alphalicense.txt"
42 !insertmacro MUI_PAGE_LICENSE "@srcdir@\COPYING"
43 !insertmacro MUI_PAGE_COMPONENTS
44 !insertmacro MUI_PAGE_DIRECTORY
45 !insertmacro MUI_PAGE_INSTFILES
47 !insertmacro MUI_UNPAGE_CONFIRM
48 !insertmacro MUI_UNPAGE_INSTFILES
50 !insertmacro MUI_LANGUAGE "English"
52 ;--------------------------------
54 ; The stuff to install
55 Section "Synfig Studio"
59 SetOutPath "$INSTDIR\share\pixmaps"
62 SetOutPath "$INSTDIR\share"
65 SetOutPath "$INSTDIR\bin"
66 File "src\synfigapp\.libs\libsynfigapp-0.dll"
67 File "src\gtkmm\.libs\synfigstudio.exe"
69 FileOpen $0 $PROFILE\.gtkrc-2.0 a
71 FileWrite $0 "gtk-toolbar-style = 0"
74 FileWrite $0 'gtk-theme-name = "Default"'
79 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
80 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "@PRODUCT_VERSION@"
82 ; Write the uninstall keys for Windows
83 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "@PACKAGE_NAME@"
84 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "@PACKAGE_VERSION@"
85 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
86 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
87 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
90 WriteRegStr HKCR ".sif" "" "Synfig.Composition"
91 WriteRegStr HKCR ".sif" "Content Type" "image/x-sif"
92 WriteRegStr HKCR ".sif" "PerceivedType" "image"
94 WriteRegStr HKCR ".sif.gz" "" "Synfig.Composition"
95 WriteRegStr HKCR ".sif.gz" "Content Type" "image/x-sifz"
96 WriteRegStr HKCR ".sif.gz" "PerceivedType" "image"
98 WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
99 WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\bin\synfigstudio.exe;1"
100 WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
101 WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\synfigstudio.exe "%1"'
103 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
104 WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
108 ; Optional section (can be disabled by the user)
109 Section "Start Menu Shortcuts"
111 CreateDirectory "$SMPROGRAMS\Voria"
112 CreateShortCut "$SMPROGRAMS\Voria\Uninstall Synfig Studio.lnk" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" "" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" 0
113 CreateShortCut "$SMPROGRAMS\Voria\Synfig Studio.lnk" "$INSTDIR\bin\synfigstudio.exe" "" "$INSTDIR\bin\synfigstudio.exe" 0
117 ;--------------------------------
123 DeleteRegKey HKCR "Synfig.Composition\shell\open\command"
124 DeleteRegKey HKCR "Synfig.Composition\DefaultIcon"
125 DeleteRegKey HKCR "Synfig.Composition\shell"
126 DeleteRegKey HKCR "Synfig.Composition"
127 DeleteRegKey HKCR ".sif"
128 DeleteRegKey HKCR ".sif.gz"
130 ; Remove registry keys
131 DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
132 DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
134 ; Remove files and uninstaller
135 Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
136 Delete $INSTDIR\bin\synfigstudio.exe
137 Delete $INSTDIR\bin\libsynfigapp-0.dll
140 ; Remove shortcuts, if any
141 Delete "$SMPROGRAMS\Voria\Uninstall Synfig Studio.lnk"
142 Delete "$SMPROGRAMS\Voria\Synfig Studio.lnk"
144 ; Remove directories used
145 RMDir "$SMPROGRAMS\Voria"
148 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
152 ; Get installer location
153 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
155 ; ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
159 ; Get current installed version
160 ReadRegStr $R1 HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
162 ; ReadRegStr $R1 HKCU "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
164 ; StrCmp $R1 ${PRODUCT_VERSION} done
166 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
168 ; Run the uninstaller
171 ; CopyFiles "$R0" $TEMP
172 ExecWait '$R0 _?=$INSTDIR'
173 IfErrors no_remove_uninstaller
177 no_remove_uninstaller:
180 ; Check that the user completed the uninstallation by examining the registry
181 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
182 StrCmp $R0 "" done abortInstall
183 ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
184 StrCmp $R0 "" done abortInstall
187 MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall previous version of @PACKAGE_NAME@"