]>
Commit | Line | Data |
---|---|---|
f53ec699 SW |
1 | ;!/usr/bin/makensis |
2 | ||
3 | ; This NSIS script creates an installer for QEMU on Windows. | |
4 | ||
5 | ; Copyright (C) 2006-2012 Stefan Weil | |
6 | ; | |
7 | ; This program is free software: you can redistribute it and/or modify | |
8 | ; it under the terms of the GNU General Public License as published by | |
9 | ; the Free Software Foundation, either version 2 of the License, or | |
10 | ; (at your option) version 3 or any later version. | |
11 | ; | |
12 | ; This program is distributed in the hope that it will be useful, | |
13 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ; GNU General Public License for more 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 | ; NSIS_WIN32_MAKENSIS | |
21 | ||
22 | !define PRODUCT "QEMU" | |
85938981 | 23 | !define URL "http://www.qemu-project.org/" |
f53ec699 SW |
24 | |
25 | !define UNINST_EXE "$INSTDIR\qemu-uninstall.exe" | |
26 | !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" | |
27 | ||
28 | !ifndef BINDIR | |
29 | !define BINDIR nsis.tmp | |
30 | !endif | |
31 | !ifndef SRCDIR | |
32 | !define SRCDIR . | |
33 | !endif | |
34 | !ifndef OUTFILE | |
35 | !define OUTFILE "qemu-setup.exe" | |
36 | !endif | |
37 | ||
38 | ; Optionally install documentation. | |
39 | !ifndef CONFIG_DOCUMENTATION | |
40 | !define CONFIG_DOCUMENTATION | |
41 | !endif | |
42 | ||
43 | ; Use maximum compression. | |
44 | SetCompressor /SOLID lzma | |
45 | ||
46 | !include "MUI2.nsh" | |
47 | ||
48 | ; The name of the installer. | |
49 | Name "QEMU" | |
50 | ||
51 | ; The file to write | |
52 | OutFile "${OUTFILE}" | |
53 | ||
54 | ; The default installation directory. | |
55 | !ifdef W64 | |
56 | InstallDir $PROGRAMFILES64\qemu | |
57 | !else | |
58 | InstallDir $PROGRAMFILES\qemu | |
59 | !endif | |
60 | ||
61 | ; Registry key to check for directory (so if you install again, it will | |
62 | ; overwrite the old one automatically) | |
40b9cc5e SW |
63 | !ifdef W64 |
64 | InstallDirRegKey HKLM "Software\qemu64" "Install_Dir" | |
65 | !else | |
66 | InstallDirRegKey HKLM "Software\qemu32" "Install_Dir" | |
67 | !endif | |
f53ec699 SW |
68 | |
69 | ; Request administrator privileges for Windows Vista. | |
70 | RequestExecutionLevel admin | |
71 | ||
72 | ;-------------------------------- | |
73 | ; Interface Settings. | |
74 | ;!define MUI_HEADERIMAGE "qemu-nsis.bmp" | |
75 | ; !define MUI_SPECIALBITMAP "qemu.bmp" | |
76 | !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico" | |
77 | !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico" | |
78 | !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp" | |
79 | ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp" | |
80 | ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp" | |
81 | ; !define MUI_COMPONENTSPAGE_SMALLDESC | |
82 | ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK" | |
83 | ||
84 | ;-------------------------------- | |
85 | ; Pages. | |
86 | ||
87 | !insertmacro MUI_PAGE_WELCOME | |
88 | !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING" | |
89 | !insertmacro MUI_PAGE_COMPONENTS | |
90 | !insertmacro MUI_PAGE_DIRECTORY | |
91 | !insertmacro MUI_PAGE_INSTFILES | |
92 | !define MUI_FINISHPAGE_LINK "Visit the QEMU Wiki online!" | |
93 | !define MUI_FINISHPAGE_LINK_LOCATION "${URL}" | |
94 | !insertmacro MUI_PAGE_FINISH | |
95 | ||
96 | !insertmacro MUI_UNPAGE_CONFIRM | |
97 | !insertmacro MUI_UNPAGE_INSTFILES | |
98 | ||
99 | ;-------------------------------- | |
100 | ; Languages. | |
101 | ||
102 | !insertmacro MUI_LANGUAGE "English" | |
103 | !insertmacro MUI_LANGUAGE "French" | |
104 | !insertmacro MUI_LANGUAGE "German" | |
105 | ||
106 | ;-------------------------------- | |
107 | ||
108 | ; The stuff to install. | |
109 | Section "${PRODUCT} (required)" | |
110 | ||
111 | SectionIn RO | |
112 | ||
113 | ; Set output path to the installation directory. | |
114 | SetOutPath "$INSTDIR" | |
115 | ||
116 | File "${SRCDIR}\Changelog" | |
117 | File "${SRCDIR}\COPYING" | |
118 | File "${SRCDIR}\COPYING.LIB" | |
119 | File "${SRCDIR}\README" | |
120 | File "${SRCDIR}\VERSION" | |
121 | ||
122 | File "${BINDIR}\*.bmp" | |
123 | File "${BINDIR}\*.bin" | |
124 | File "${BINDIR}\*.dtb" | |
125 | File "${BINDIR}\*.rom" | |
126 | File "${BINDIR}\openbios-*" | |
127 | ||
128 | File /r "${BINDIR}\keymaps" | |
129 | !ifdef CONFIG_GTK | |
130 | File /r "${BINDIR}\share" | |
131 | !endif | |
132 | ||
133 | !ifdef W64 | |
134 | SetRegView 64 | |
135 | !endif | |
136 | ||
137 | ; Write the installation path into the registry | |
138 | WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR" | |
139 | ||
140 | ; Write the uninstall keys for Windows | |
141 | WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU" | |
142 | WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"' | |
143 | WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1 | |
144 | WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1 | |
145 | WriteUninstaller "qemu-uninstall.exe" | |
146 | SectionEnd | |
147 | ||
148 | Section "Tools" SectionTools | |
149 | SetOutPath "$INSTDIR" | |
150 | File "${BINDIR}\qemu-img.exe" | |
151 | File "${BINDIR}\qemu-io.exe" | |
152 | SectionEnd | |
153 | ||
154 | SectionGroup "System Emulations" SectionSystem | |
155 | ||
156 | !include "${BINDIR}\system-emulations.nsh" | |
157 | ||
158 | SectionGroupEnd | |
159 | ||
160 | !ifdef DLLDIR | |
161 | Section "Libraries (DLL)" SectionDll | |
162 | SetOutPath "$INSTDIR" | |
163 | File "${DLLDIR}\*.dll" | |
164 | SectionEnd | |
165 | !endif | |
166 | ||
167 | !ifdef CONFIG_DOCUMENTATION | |
168 | Section "Documentation" SectionDoc | |
169 | SetOutPath "$INSTDIR" | |
170 | File "${BINDIR}\qemu-doc.html" | |
171 | File "${BINDIR}\qemu-tech.html" | |
172 | CreateDirectory "$SMPROGRAMS\${PRODUCT}" | |
173 | CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\qemu-doc.html" "" "$INSTDIR\qemu-doc.html" 0 | |
174 | CreateShortCut "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk" "$INSTDIR\qemu-tech.html" "" "$INSTDIR\qemu-tech.html" 0 | |
175 | SectionEnd | |
176 | !endif | |
177 | ||
178 | ; Optional section (can be disabled by the user) | |
179 | Section "Start Menu Shortcuts" SectionMenu | |
180 | CreateDirectory "$SMPROGRAMS\${PRODUCT}" | |
181 | CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0 | |
182 | SectionEnd | |
183 | ||
184 | ;-------------------------------- | |
185 | ||
186 | ; Uninstaller | |
187 | ||
188 | Section "Uninstall" | |
189 | ; Remove registry keys | |
190 | !ifdef W64 | |
191 | SetRegView 64 | |
192 | !endif | |
193 | DeleteRegKey HKLM "${UNINST_KEY}" | |
194 | DeleteRegKey HKLM SOFTWARE\${PRODUCT} | |
195 | ||
196 | ; Remove shortcuts, if any | |
197 | Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" | |
198 | Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk" | |
199 | Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" | |
200 | RMDir "$SMPROGRAMS\${PRODUCT}" | |
201 | ||
202 | ; Remove files and directories used | |
203 | Delete "$INSTDIR\Changelog" | |
204 | Delete "$INSTDIR\COPYING" | |
205 | Delete "$INSTDIR\COPYING.LIB" | |
206 | Delete "$INSTDIR\README" | |
207 | Delete "$INSTDIR\VERSION" | |
208 | Delete "$INSTDIR\*.bmp" | |
209 | Delete "$INSTDIR\*.bin" | |
210 | Delete "$INSTDIR\*.dll" | |
211 | Delete "$INSTDIR\*.dtb" | |
212 | Delete "$INSTDIR\*.rom" | |
213 | Delete "$INSTDIR\openbios-*" | |
214 | Delete "$INSTDIR\qemu-img.exe" | |
215 | Delete "$INSTDIR\qemu-io.exe" | |
216 | Delete "$INSTDIR\qemu.exe" | |
217 | Delete "$INSTDIR\qemu-system-*.exe" | |
218 | Delete "$INSTDIR\qemu-doc.html" | |
219 | Delete "$INSTDIR\qemu-tech.html" | |
220 | RMDir /r "$INSTDIR\keymaps" | |
221 | RMDir /r "$INSTDIR\share" | |
222 | ; Remove generated files | |
223 | Delete "$INSTDIR\stderr.txt" | |
224 | Delete "$INSTDIR\stdout.txt" | |
225 | ; Remove uninstaller | |
226 | Delete "${UNINST_EXE}" | |
227 | RMDir "$INSTDIR" | |
228 | SectionEnd | |
229 | ||
230 | ;-------------------------------- | |
231 | ||
232 | ; Descriptions (mouse-over). | |
233 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | |
234 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation." | |
235 | !insertmacro MUI_DESCRIPTION_TEXT ${Section_alpha} "Alpha system emulation." | |
236 | !insertmacro MUI_DESCRIPTION_TEXT ${Section_alphaw} "Alpha system emulation (GUI)." | |
237 | !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386} "PC i386 system emulation." | |
238 | !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386w} "PC i386 system emulation (GUI)." | |
239 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools." | |
240 | !ifdef DLLDIR | |
241 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)." | |
242 | !endif | |
243 | !ifdef CONFIG_DOCUMENTATION | |
244 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation." | |
245 | !endif | |
246 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries." | |
247 | !insertmacro MUI_FUNCTION_DESCRIPTION_END | |
248 | ||
249 | ;-------------------------------- | |
250 | ; Functions. | |
251 | ||
252 | Function .onInit | |
253 | !insertmacro MUI_LANGDLL_DISPLAY | |
254 | FunctionEnd |