Merge remote-tracking branch 'qemu/master' into master
[qemu/ar7.git] / qemu.nsi
blob678970aaae46790bd3da815236eb7c89e2c1809a
1 ;!/usr/bin/makensis
3 ; This NSIS script creates an installer for QEMU on Windows.
5 ; Copyright (C) 2006-2020 Stefan Weil
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.
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.
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/>.
20 ; NSIS_WIN32_MAKENSIS
22 !define PRODUCT "QEMU"
23 !define URL "https://www.qemu.org/"
25 !define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
26 !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
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
38 ; Optionally install documentation.
39 !ifndef CONFIG_DOCUMENTATION
40 !define CONFIG_DOCUMENTATION
41 !endif
43 ; Use maximum compression.
44 SetCompressor /SOLID lzma
46 ; Generate a Unicode installer.
47 Unicode true
49 !include "MUI2.nsh"
51 ; The name of the installer.
52 Name "QEMU"
54 ; The file to write
55 OutFile "${OUTFILE}"
57 ; The default installation directory.
58 !ifdef W64
59 InstallDir $PROGRAMFILES64\qemu
60 !else
61 InstallDir $PROGRAMFILES\qemu
62 !endif
64 ; Registry key to check for directory (so if you install again, it will
65 ; overwrite the old one automatically)
66 !ifdef W64
67 InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
68 !else
69 InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
70 !endif
72 ; Request administrator privileges for Windows Vista.
73 RequestExecutionLevel admin
75 ;--------------------------------
76 ; Interface Settings.
77 ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
78 ; !define MUI_SPECIALBITMAP "qemu.bmp"
79 !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
80 !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
81 !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
82 ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
83 ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
84 ; !define MUI_COMPONENTSPAGE_SMALLDESC
85 ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
87 ;--------------------------------
88 ; Pages.
90 !insertmacro MUI_PAGE_WELCOME
91 !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
92 !insertmacro MUI_PAGE_COMPONENTS
93 !insertmacro MUI_PAGE_DIRECTORY
94 !insertmacro MUI_PAGE_INSTFILES
95 !define MUI_FINISHPAGE_LINK $(Visit_QEMU_Wiki_Link)
96 !define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
97 !insertmacro MUI_PAGE_FINISH
99 !insertmacro MUI_UNPAGE_CONFIRM
100 !insertmacro MUI_UNPAGE_INSTFILES
102 ;--------------------------------
103 ; Languages.
105 !insertmacro MUI_LANGUAGE "English"
106 !insertmacro MUI_LANGUAGE "French"
107 !insertmacro MUI_LANGUAGE "German"
108 !insertmacro MUI_LANGUAGE "Italian"
109 !insertmacro MUI_LANGUAGE "Spanish"
111 ;--------------------------------
112 ; Functions.
114 Function .onInit
115 !insertmacro MUI_LANGDLL_DISPLAY
116 FunctionEnd
119 ;--------------------------------
121 ; The stuff to install.
123 ; Remember to keep the "Uninstall" section in sync.
125 Section "${PRODUCT}" QEMU_System_File_Section_Description
127 SectionIn RO
129 ; Set output path to the installation directory.
130 SetOutPath "$INSTDIR"
132 File "${SRCDIR}\Changelog"
133 File "${SRCDIR}\COPYING"
134 File "${SRCDIR}\COPYING.LIB"
135 File "${SRCDIR}\README.rst"
136 File "${SRCDIR}\VERSION"
138 File "${BINDIR}\*.bin"
139 File "${BINDIR}\*.dtb"
140 File "${BINDIR}\*.fd"
141 File "${BINDIR}\*.img"
142 File "${BINDIR}\*.lid"
143 File "${BINDIR}\*.ndrv"
144 File "${BINDIR}\*.rom"
145 File "${BINDIR}\openbios-*"
146 File "${BINDIR}\palcode-clipper"
147 File "${BINDIR}\u-boot.e500"
148 File "${BINDIR}\icons\hicolor\scalable\apps\qemu.svg"
150 File /r "${BINDIR}\keymaps"
151 !ifdef CONFIG_GTK
152 File /r "${BINDIR}\share"
153 !endif
155 SetOutPath "$INSTDIR\lib\gdk-pixbuf-2.0\2.10.0"
156 FileOpen $0 "loaders.cache" w
157 FileClose $0
159 !ifdef W64
160 SetRegView 64
161 !endif
163 ; Write the installation path into the registry
164 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
166 ; Write the uninstall keys for Windows
167 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
168 !ifdef DISPLAYVERSION
169 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
170 !endif
171 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
172 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
173 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
174 WriteUninstaller "qemu-uninstall.exe"
175 SectionEnd
177 Section "$(Tools_Section_Name)" Tools_Section_Description
178 SetOutPath "$INSTDIR"
179 File "${BINDIR}\qemu-edid.exe"
180 File "${BINDIR}\qemu-ga.exe"
181 File "${BINDIR}\qemu-img.exe"
182 File "${BINDIR}\qemu-io.exe"
183 SectionEnd
185 SectionGroup "$(System_Emulation_Section_Name)" System_Emulation_Section_Description
187 !include "${BINDIR}\system-emulations.nsh"
189 SectionGroupEnd
191 Section "$(Desktop_Icon_Section_Name)" Desktop_Icon_Section_Description
192 SetOutPath "$INSTDIR\share"
193 !ifdef W64
194 File /r /usr/x86_64-w64-mingw32/sys-root/mingw/share/icons
195 !else
196 File /r /usr/i686-w64-mingw32/sys-root/mingw/share/icons
197 !endif
198 SectionEnd
200 !ifdef DLLDIR
201 Section "$(DLL_Library_Section_Name)" DLL_Library_Section_Description
202 SetOutPath "$INSTDIR"
203 File "${DLLDIR}\*.dll"
204 SectionEnd
205 !endif
207 !ifdef CONFIG_DOCUMENTATION
208 Section "$(Documentation_Section_Name)" Documentation_Section_Description
209 SetOutPath "$INSTDIR"
210 File "${BINDIR}\index.html"
211 SetOutPath "$INSTDIR\interop"
212 FILE /r "${BINDIR}\interop\*.*"
213 SetOutPath "$INSTDIR\specs"
214 FILE /r "${BINDIR}\specs\*.*"
215 SetOutPath "$INSTDIR\system"
216 FILE /r "${BINDIR}\system\*.*"
217 SetOutPath "$INSTDIR\tools"
218 FILE /r "${BINDIR}\tools\*.*"
219 SetOutPath "$INSTDIR\user"
220 FILE /r "${BINDIR}\user\*.*"
221 SetOutPath "$INSTDIR"
222 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
223 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk" "$INSTDIR\index.html" "" "$INSTDIR\index.html" 0
224 SectionEnd
225 !endif
227 ; Optional section (can be disabled by the user)
228 Section "$(Start_Menu_Section_Name)" Start_Menu_Section_Description
229 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
230 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
231 SectionEnd
233 ;--------------------------------
235 ; Uninstaller
237 Section "Uninstall" Uninstall_Section_Description
238 ; Remove registry keys
239 !ifdef W64
240 SetRegView 64
241 !endif
242 DeleteRegKey HKLM "${UNINST_KEY}"
243 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
245 ; Remove shortcuts, if any
246 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk"
247 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Technical_Documentation).lnk"
248 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk"
249 RMDir "$SMPROGRAMS\${PRODUCT}"
251 ; Remove files and directories used
252 Delete "$INSTDIR\Changelog"
253 Delete "$INSTDIR\COPYING"
254 Delete "$INSTDIR\COPYING.LIB"
255 Delete "$INSTDIR\README.rst"
256 Delete "$INSTDIR\VERSION"
257 Delete "$INSTDIR\*.bin"
258 Delete "$INSTDIR\*.dll"
259 Delete "$INSTDIR\*.dtb"
260 Delete "$INSTDIR\*.fd"
261 Delete "$INSTDIR\*.img"
262 Delete "$INSTDIR\*.lid"
263 Delete "$INSTDIR\*.ndrv"
264 Delete "$INSTDIR\*.rom"
265 Delete "$INSTDIR\openbios-*"
266 Delete "$INSTDIR\palcode-clipper"
267 Delete "$INSTDIR\u-boot.e500"
268 Delete "$INSTDIR\qemu.svg"
269 Delete "$INSTDIR\qemu-io.exe"
270 Delete "$INSTDIR\qemu-img.exe"
271 Delete "$INSTDIR\qemu-ga.exe"
272 Delete "$INSTDIR\qemu-edid.exe"
273 Delete "$INSTDIR\qemu.exe"
274 Delete "$INSTDIR\qemu-system-*.exe"
275 Delete "$INSTDIR\index.html"
276 RMDir /r "$INSTDIR\interop"
277 RMDir /r "$INSTDIR\specs"
278 RMDir /r "$INSTDIR\system"
279 RMDir /r "$INSTDIR\tools"
280 RMDir /r "$INSTDIR\user"
281 RMDir /r "$INSTDIR\keymaps"
282 RMDir /r "$INSTDIR\lib"
283 RMDir /r "$INSTDIR\share"
284 ; Remove generated files
285 Delete "$INSTDIR\stderr.txt"
286 Delete "$INSTDIR\stdout.txt"
287 ; Remove uninstaller
288 Delete "${UNINST_EXE}"
289 RMDir "$INSTDIR"
290 SectionEnd
292 ; Include files with language installer strings.
293 ; Language ID table - https://www.science.co.il/language/Locale-codes.php
294 ; Language ID 1033 - English
295 ; Language ID 1031 - German
296 ; Language ID 1034 - Spanish
297 ; Language ID 1036 - French
298 ; Language ID 1040 - Italian
299 !addincludedir ${SRCDIR}/installer
300 !include installer_strings_english.nsh
301 !include installer_strings_french.nsh
302 !include installer_strings_german.nsh
303 !include installer_strings_italian.nsh
304 !include installer_strings_spanish.nsh
307 ; ---------------------
309 ; Descriptions (mouse-over).
310 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
311 !insertmacro MUI_DESCRIPTION_TEXT ${QEMU_System_File_Section_Description} $(QEMU_System_File_Section_Description_Text)
312 !insertmacro MUI_DESCRIPTION_TEXT ${Tools_Section_Description} $(Tools_Section_Description_Text)
313 !insertmacro MUI_DESCRIPTION_TEXT ${System_Emulation_Section_Description} $(System_Emulation_Section_Description_Text)
314 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop_Icon_Section_Description} $(Desktop_Icon_Section_Description_Text)
315 !insertmacro MUI_DESCRIPTION_TEXT ${Uninstall_Section_Description} $(Uninstall_Section_Description_Text)
316 !ifdef DLLDIR
317 !insertmacro MUI_DESCRIPTION_TEXT ${DLL_Library_Section_Description} $(DLL_Library_Section_Description_Text)
318 !endif
319 !ifdef CONFIG_DOCUMENTATION
320 !insertmacro MUI_DESCRIPTION_TEXT ${Documentation_Section_Description} $(Documentation_Section_Description_Text)
321 !endif
322 !insertmacro MUI_DESCRIPTION_TEXT ${Start_Menu_Section_Description} $(Start_Menu_Section_Description_Text)
323 !insertmacro MUI_FUNCTION_DESCRIPTION_END