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 !define MUI_ABORTWARNING
23 !define SHCNE_ASSOCCHANGED 0x8000000
24 !define SHCNF_IDLIST 0
26 !define PRODUCT_REG_KEY "Software\@PACKAGE_TARNAME@\@API_VERSION@"
27 !define PRODUCT_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE_TARNAME@"
28 !define PRODUCT_UNINSTALL_EXE "uninstall-@PACKAGE_TARNAME@.exe"
30 ;--------------------------------
32 !define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\installer_logo.bmp"
36 !insertmacro MUI_PAGE_WELCOME
37 ;!insertmacro MUI_PAGE_LICENSE "@srcdir@\alphalicense.txt"
38 !insertmacro MUI_PAGE_LICENSE "@srcdir@\COPYING"
39 !insertmacro MUI_PAGE_COMPONENTS
40 !insertmacro MUI_PAGE_DIRECTORY
41 !insertmacro MUI_PAGE_INSTFILES
43 !insertmacro MUI_UNPAGE_CONFIRM
44 !insertmacro MUI_UNPAGE_INSTFILES
46 !insertmacro MUI_LANGUAGE "English"
48 ;--------------------------------
50 ; The stuff to install
51 Section "Synfig Studio"
55 SetOutPath "$INSTDIR\share\pixmaps"
56 !include "images\images.nsh"
58 SetOutPath "$INSTDIR\share\pixmaps"
59 !include "images\icons.nsh"
61 SetOutPath "$INSTDIR\bin"
62 File "src\synfigapp\.libs\libsynfigapp-0.dll"
63 File "src\gtkmm\.libs\synfigstudio.exe"
65 FileOpen $0 $PROFILE\.gtkrc-2.0 a
67 FileWrite $0 "gtk-toolbar-style = 0"
70 FileWrite $0 'gtk-theme-name = "Default"'
75 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
76 WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "@PACKAGE_VERSION@"
78 ; Write the uninstall keys for Windows
79 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "@PACKAGE_NAME@"
80 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "@PACKAGE_VERSION@"
81 WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
82 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
83 WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
86 WriteRegStr HKCR ".sif" "" "Synfig.Composition"
87 WriteRegStr HKCR ".sif" "Content Type" "image/x-sif"
88 WriteRegStr HKCR ".sif" "PerceivedType" "image"
90 WriteRegStr HKCR ".sifz" "" "Synfig.Composition"
91 WriteRegStr HKCR ".sifz" "Content Type" "image/x-sifz"
92 WriteRegStr HKCR ".sifz" "PerceivedType" "image"
94 WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
95 WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\share\pixmaps\sif_icon.ico"
96 WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
97 WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\synfigstudio.exe "%1"'
99 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
100 WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
104 ; Optional section (can be disabled by the user)
105 Section "Start Menu Shortcuts"
107 SetShellVarContext All
108 CreateDirectory "$SMPROGRAMS\Synfig"
109 CreateShortCut "$SMPROGRAMS\Synfig\Uninstall Synfig Studio.lnk" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" "" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" 0
110 CreateShortCut "$SMPROGRAMS\Synfig\Synfig Studio.lnk" "$INSTDIR\bin\synfigstudio.exe" "" "$INSTDIR\share\pixmaps\synfig_icon.ico" 0
114 ;--------------------------------
120 DeleteRegKey HKCR "Synfig.Composition\shell\open\command"
121 DeleteRegKey HKCR "Synfig.Composition\DefaultIcon"
122 DeleteRegKey HKCR "Synfig.Composition\shell"
123 DeleteRegKey HKCR "Synfig.Composition"
124 DeleteRegKey HKCR ".sif"
125 DeleteRegKey HKCR ".sifz"
127 ; Remove registry keys
128 DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
129 DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
131 ; Remove images and icons
132 !include "images\unimages.nsh"
133 !include "images\unicons.nsh"
134 RMDir "$INSTDIR\share\pixmaps"
135 RMDir "$INSTDIR\share"
137 ; Remove files and uninstaller
138 Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
139 Delete $INSTDIR\bin\synfigstudio.exe
140 Delete $INSTDIR\bin\libsynfigapp-0.dll
143 ; Remove shortcuts, if any
144 SetShellVarContext All
145 Delete "$SMPROGRAMS\Synfig\Uninstall Synfig Studio.lnk"
146 Delete "$SMPROGRAMS\Synfig\Synfig Studio.lnk"
148 ; Remove directories used
149 RMDir "$SMPROGRAMS\Synfig"
152 System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
156 ; Get installer location
157 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
159 ; ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
163 ; Get current installed version
164 ReadRegStr $R1 HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
166 ; ReadRegStr $R1 HKCU "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion"
168 ; StrCmp $R1 ${PRODUCT_VERSION} done
170 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
172 ; Run the uninstaller
175 ; CopyFiles "$R0" $TEMP
176 ExecWait '$R0 _?=$INSTDIR'
177 IfErrors no_remove_uninstaller
181 no_remove_uninstaller:
184 ; Check that the user completed the uninstallation by examining the registry
185 ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
186 StrCmp $R0 "" done abortInstall
187 ReadRegStr $R0 HKCU "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
188 StrCmp $R0 "" done abortInstall
191 MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to uninstall previous version of @PACKAGE_NAME@"