]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - win/inspircd.nsi
Update Doxyfile for the latest version of Doxygen.
[user/henk/code/inspircd.git] / win / inspircd.nsi
1 ;
2 ; InspIRCd -- Internet Relay Chat Daemon
3 ;
4 ;   Copyright (C) 2011 Adam <Adam@anope.org>
5 ;   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
6 ;   Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
7 ;
8 ; This file is part of InspIRCd.  InspIRCd is free software: you can
9 ; redistribute it and/or modify it under the terms of the GNU General Public
10 ; License as published by the Free Software Foundation, version 2.
11 ;
12 ; This program is distributed in the hope that it will be useful, but WITHOUT
13 ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 ; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
15 ; details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 ;
20
21
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23
24                        ;;;; SET THE BUILD TO BE PACKAGED HERE ;;;;
25
26 !define BUILD "release"
27
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
30 ; HM NIS Edit Wizard helper defines
31 !define PRODUCT_NAME "InspIRCd"
32 !define PRODUCT_VERSION "2.0"
33 !define PRODUCT_PUBLISHER "InspIRCd Development Team"
34 !define PRODUCT_WEB_SITE "http://www.inspircd.org/"
35 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe"
36 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
37 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
38 !define DOT_MAJOR "2"
39 !define DOT_MINOR "0"
40
41 SetCompressor bzip2
42
43 ; MUI 1.67 compatible ------
44 !include "MUI.nsh"
45
46 ; MUI Settings
47 !define MUI_ABORTWARNING
48 !define MUI_ICON "inspircd.ico"
49 !define MUI_UNICON "inspircd.ico"
50
51 ; Welcome page
52 !insertmacro MUI_PAGE_WELCOME
53 ; License page
54 !define MUI_LICENSEPAGE_CHECKBOX
55 !insertmacro MUI_PAGE_LICENSE "..\docs\COPYING"
56 ; directory page
57 Page directory
58 ; Components page
59 !insertmacro MUI_PAGE_COMPONENTS
60 ; Instfiles page
61 !insertmacro MUI_PAGE_INSTFILES
62
63 ; Uninstaller pages
64 !insertmacro MUI_UNPAGE_INSTFILES
65
66 ; Language files
67 !insertmacro MUI_LANGUAGE "English"
68
69 ; Reserve files
70 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
71
72 ; MUI end ------
73
74 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
75 OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}-Setup.exe"
76 InstallDir "$PROGRAMFILES\InspIRCd"
77 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
78 ShowInstDetails show
79 ShowUnInstDetails show
80
81 Function IsDotNetInstalled
82  
83   StrCpy $0 "0"
84   StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.
85   StrCpy $2 0
86  
87   StartEnum:
88     ;Enumerate the versions installed.
89     EnumRegKey $3 HKLM "$1\policy" $2
90     
91     ;If we don't find any versions installed, it's not here.
92     StrCmp $3 "" noDotNet notEmpty
93     
94     ;We found something.
95     notEmpty:
96       ;Find out if the RegKey starts with 'v'.  
97       ;If it doesn't, goto the next key.
98       StrCpy $4 $3 1 0
99       StrCmp $4 "v" +1 goNext
100       StrCpy $4 $3 1 1
101       
102       ;It starts with 'v'.  Now check to see how the installed major version
103       ;relates to our required major version.
104       ;If it's equal check the minor version, if it's greater, 
105       ;we found a good RegKey.
106       IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg
107       ;Check the minor version.  If it's equal or greater to our requested 
108       ;version then we're good.
109       StrCpy $4 $3 1 3
110       IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg
111  
112     goNext:
113       ;Go to the next RegKey.
114       IntOp $2 $2 + 1
115       goto StartEnum
116  
117   yesDotNetReg:
118     ;Now that we've found a good RegKey, let's make sure it's actually
119     ;installed by getting the install path and checking to see if the 
120     ;mscorlib.dll exists.
121     EnumRegValue $2 HKLM "$1\policy\$3" 0
122     ;$2 should equal whatever comes after the major and minor versions 
123     ;(ie, v1.1.4322)
124     StrCmp $2 "" noDotNet
125     ReadRegStr $4 HKLM $1 "InstallRoot"
126     ;Hopefully the install root isn't empty.
127     StrCmp $4 "" noDotNet
128     ;build the actuall directory path to mscorlib.dll.
129     StrCpy $4 "$4$3.$2\mscorlib.dll"
130     IfFileExists $4 yesDotNet noDotNet
131  
132   noDotNet:
133     MessageBox MB_OK "You do not have have v${DOT_MAJOR}.${DOT_MINOR} or greater of the .NET framework installed. This is required for the InspIRCd Monitor, however you can still launch the IRCd manually."
134  
135   yesDotNet:
136     ;Everything checks out.  Go on with the rest of the installation.
137     
138 FunctionEnd
139
140 Section "Binary Executable" SEC01
141   Call IsDotNetInstalled
142   CreateDirectory "$SMPROGRAMS\InspIRCd"
143   CreateDirectory "$INSTDIR\logs"
144   CreateDirectory "$INSTDIR\data"
145   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd.lnk" "$INSTDIR\inspircd.exe"
146   SetOutPath "$INSTDIR"
147   SetOverwrite ifnewer
148   File "..\bin\${BUILD}\inspircd.exe"
149   DetailPrint "Installing InspIRCd service..."
150   nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --installservice'
151 SectionEnd
152
153 Section "Config Files" SEC02
154   SetOutPath "$INSTDIR\conf"
155   File "..\docs\conf\*.example"
156   SetOutPath "$INSTDIR\conf\aliases"
157   File "..\docs\conf\aliases\*.example"
158   SetOutPath "$INSTDIR\conf\modules"
159   File "..\docs\conf\modules\*.example"
160 SectionEnd
161
162 Section "Command Handlers" SEC03
163   SetOutPath "$INSTDIR\modules"
164   File "..\bin\${BUILD}\modules\cmd_*.so"
165 SectionEnd
166
167 Section "Modules" SEC04
168   SetOutPath "$INSTDIR\modules"
169   File "..\bin\${BUILD}\modules\m_*.so"
170   ; Copy DLLs required for modules
171   SetOutPath "$INSTDIR"
172   File /nonfatal "*.dll"
173   File "make_gnutls_cert.bat"
174 SectionEnd
175
176 Section -AdditionalIcons
177   SetOutPath $INSTDIR
178   WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
179   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
180   CreateShortCut "$SMPROGRAMS\InspIRCd\Uninstall.lnk" "$INSTDIR\uninst.exe"
181 SectionEnd
182
183 Section -Post
184   WriteUninstaller "$INSTDIR\uninst.exe"
185   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inspircd.exe"
186   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
187   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
188   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\inspircd.exe"
189   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
190   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
191   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
192   MessageBox MB_ICONINFORMATION|MB_OK "InspIRCd was successfully installed. Remember to edit your configuration file in $INSTDIR\conf!"
193 SectionEnd
194
195 ; Section descriptions
196 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
197   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Actual executable"
198   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Command modules"
199   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Default configuration files"
200   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional non-SSL modules"
201 !insertmacro MUI_FUNCTION_DESCRIPTION_END
202
203
204 Function un.onUninstSuccess
205   HideWindow
206   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
207 FunctionEnd
208
209 Function .onInit
210   SectionSetFlags ${SEC01} 17
211   SectionSetFlags ${SEC03} 17
212   StrCpy $INSTDIR "$PROGRAMFILES\InspIRCd"
213 FunctionEnd
214
215 Function un.onInit
216   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
217   Abort
218 FunctionEnd
219
220 Section Uninstall
221   DetailPrint "Uninstalling InspIRCd service..."
222   nsExec::Exec /TIMEOUT=30000 '"$INSTDIR\inspircd.exe" --removeservice'
223   Delete "$INSTDIR\${PRODUCT_NAME}.url"
224   Delete "$INSTDIR\uninst.exe"
225   Delete "$INSTDIR\modules\*.so"
226   Delete "$INSTDIR\conf\*.example"
227   Delete "$INSTDIR\conf\aliases\*.example"
228   Delete "$INSTDIR\conf\modules\*.example"
229   Delete "$INSTDIR\conf\modules\modules.conf.charybdis"
230   Delete "$INSTDIR\conf\modules\modules.conf.unreal"
231   Delete "$INSTDIR\*.log"
232   Delete "$INSTDIR\logs\*"
233   Delete "$INSTDIR\data\*"
234   Delete "$INSTDIR\*.dll"
235   Delete "$INSTDIR\make_gnutls_cert.bat"
236   Delete "$INSTDIR\inspircd.exe"
237   Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"
238   Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"
239   Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"
240
241   RMDir "$SMPROGRAMS\InspIRCd"
242   RMDir "$INSTDIR\modules"
243   RMDir "$INSTDIR\conf\aliases"
244   RMDir "$INSTDIR\conf\modules"
245   RMDir "$INSTDIR\conf"
246   RMDir "$INSTDIR\logs"
247   RMDir "$INSTDIR\data"
248   RMDir "$INSTDIR"
249
250   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
251   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
252   SetAutoClose true
253 SectionEnd