[gaim-migrate @ 4076]
[pidgin-git.git] / gaim-installer.nsi
blob9252e7daa9d24e94d939a646ca7afd67cbece1a1
1 ; Installer script for win32 Gaim
2 ; Herman Bloggs <hermanator12002@yahoo.com>
4 ; NOTE: this .NSI script is designed for NSIS v2.0b0+
6 Name "Gaim 0.60 alpha 3 (Win32)"
7 OutFile "gaim-0.60-alpha3.exe"
8 Icon .\pixmaps\gaim-install.ico
9 UninstallIcon .\pixmaps\gaim-install.ico
11 ; Some default compiler settings (uncomment and change at will):
12 ; SetCompress auto ; (can be off or force)
13 ; SetDatablockOptimize on ; (can be off)
14 ; CRCCheck on ; (can be off)
15 ; AutoCloseWindow false ; (can be true for the window go away automatically at end)
16 ; ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
17 ; SetDateSave off ; (can be on to have files restored to their orginal date)
19 InstallDir "$PROGRAMFILES\Gaim"
20 InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" ""
21 DirShow show ; (make this hide to not let the user change it)
22 DirText "Select the directory to install Gaim in:"
24 Section "" ; (default section)
25 ; Check if previous intallation exists
26 ReadRegStr $R0 HKEY_LOCAL_MACHINE "SOFTWARE\gaim" ""
27 StrCmp $R0 "" cont_install
28 ReadRegStr $R1 HKEY_LOCAL_MACHINE "SOFTWARE\gaim" "Version"
29 StrCmp $R1 "" no_version
30 ; Gaim found, so exit Intallation
31 MessageBox MB_OK "Gaim (v$R1) already exists on this machine. Uninstall first then try again." IDOK
32 Quit
33 no_version:
34 MessageBox MB_OK "Gaim already exists on this machine. Uninstall first then try again." IDOK
35 Quit
36 cont_install:
37 ; Install Aspell
38 SetOutPath "$INSTDIR"
39 File ..\win32-dev\aspell-15\bin\aspell-0.50.2.exe
40 ExecWait '"$INSTDIR\aspell-0.50.2.exe" /S' $R0
41 ; cleanup aspell installer file
42 Delete "$INSTDIR\aspell-0.50.2.exe"
43 ; Check if aspell installer completed ok
44 StrCmp $R0 "0" have_aspell
45 ; Aspell exited uncleanly so we will exit uncleanly too.
46 RMDir /r "$INSTDIR"
47 Quit
48 have_aspell:
49 SetOutPath "$INSTDIR"
50 ; Gaim files
51 File /r .\win32-install-dir\*.*
53 ; Gaim Registry Settings
54 ; Read in Aspell install path
55 ReadRegStr $R0 HKEY_LOCAL_MACHINE "Software\Aspell" ""
56 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "" "$INSTDIR"
57 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "Version" "0.60a3"
58 ; Keep track of aspell install path, for when we uninstall
59 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Gaim" "AspellPath" $R0
60 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" "DisplayName" "Gaim (remove only)"
61 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" "UninstallString" '"$INSTDIR\gaim-uninst.exe"'
62 ; Set App path to include aspell dir (so Gaim can find aspell dlls)
63 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" "" "$INSTDIR\gaim.exe"
64 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" "Path" $R0
65 ; Increase refrence count for aspell dlls
66 Push "$R0\aspell-15.dll"
67 Call AddSharedDLL
68 Push "$R0\aspell-common-0-50-2.dll"
69 Call AddSharedDLL
70 Push "$R0\pspell-15.dll"
71 Call AddSharedDLL
73 ; Set Start Menu icons
74 SetOutPath "$SMPROGRAMS\Gaim"
75 CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" \
76 "$INSTDIR\gaim.exe"
77 CreateShortCut "$SMPROGRAMS\Gaim\Unistall.lnk" \
78 "$INSTDIR\gaim-uninst.exe"
80 ; write out uninstaller
81 WriteUninstaller "$INSTDIR\gaim-uninst.exe"
82 SectionEnd ; end of default section
84 ; begin uninstall settings/section
85 UninstallText "This will uninstall Gaim from your system"
87 Section Uninstall
88 ; Delete Gaim Dir
89 RMDir /r "$INSTDIR"
90 RMDir /r "$SMPROGRAMS\Gaim"
92 ; Read in Aspell install path
93 ReadRegStr $R0 HKEY_LOCAL_MACHINE "Software\Gaim" "AspellPath"
95 ; Delete Gaim Registry Settings
96 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Gaim"
97 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
98 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe"
100 ; Decrease refrence count for Aspell dlls
101 Push "$R0\aspell-15.dll"
102 Call un.RemoveSharedDLL
103 Push "$R0\aspell-common-0-50-2.dll"
104 Call un.RemoveSharedDLL
105 Push "$R0\pspell-15.dll"
106 Call un.RemoveSharedDLL
108 ; Delete aspell dir if its empty
109 RMDir "$R0"
110 SectionEnd ; end of uninstall section
113 ;;; FUNCTIONS
116 ; AddSharedDLL
118 ; Increments a shared DLLs reference count.
119 ; Use by passing one item on the stack (the full path of the DLL).
121 ; Usage:
122 ; Push $SYSDIR\myDll.dll
123 ; Call AddSharedDLL
126 Function AddSharedDLL
127 Exch $R1
128 Push $R0
129 ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
130 IntOp $R0 $R0 + 1
131 WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
132 Pop $R0
133 Pop $R1
134 FunctionEnd
136 ; un.RemoveSharedDLL
138 ; Decrements a shared DLLs reference count, and removes if necessary.
139 ; Use by passing one item on the stack (the full path of the DLL).
140 ; Note: for use in the main installer (not the uninstaller), rename the
141 ; function to RemoveSharedDLL.
143 ; Usage:
144 ; Push $SYSDIR\myDll.dll
145 ; Call un.RemoveShareDLL
148 Function un.RemoveSharedDLL
149 Exch $R1
150 Push $R0
151 ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
152 StrCmp $R0 "" remove
153 IntOp $R0 $R0 - 1
154 IntCmp $R0 0 rk rk uk
156 DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
157 goto Remove
159 WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
160 Goto noremove
161 remove:
162 Delete /REBOOTOK $R1
163 noremove:
164 Pop $R0
165 Pop $R1
166 FunctionEnd
168 ; eof