Update GitHub action for new Meson based build
[qemu/ar7.git] / qemu.nsi
blobac9f71eef5a0eca758b56852c45f260d43c4295d
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}\COPYING"
133 File "${SRCDIR}\COPYING.LIB"
134 File "${SRCDIR}\README.rst"
135 File "${SRCDIR}\VERSION"
137 File "${BINDIR}\*.bin"
138 File "${BINDIR}\*.dtb"
139 File "${BINDIR}\*.fd"
140 File "${BINDIR}\*.img"
141 File "${BINDIR}\*.lid"
142 File "${BINDIR}\*.ndrv"
143 File "${BINDIR}\*.rom"
144 File "${BINDIR}\openbios-*"
145 File "${BINDIR}\palcode-clipper"
146 File "${BINDIR}\u-boot.e500"
147 File "${BINDIR}\icons\hicolor\scalable\apps\qemu.svg"
149 File /r "${BINDIR}\keymaps"
151 SetOutPath "$INSTDIR\lib\gdk-pixbuf-2.0\2.10.0"
152 FileOpen $0 "loaders.cache" w
153 FileClose $0
155 !ifdef W64
156 SetRegView 64
157 !endif
159 ; Write the installation path into the registry
160 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
162 ; Write the uninstall keys for Windows
163 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
164 !ifdef DISPLAYVERSION
165 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
166 !endif
167 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
168 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
169 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
170 WriteUninstaller "qemu-uninstall.exe"
171 SectionEnd
173 Section "$(Tools_Section_Name)" Tools_Section_Description
174 SetOutPath "$INSTDIR"
175 File "${BINDIR}\qemu-edid.exe"
176 File "${BINDIR}\qemu-ga.exe"
177 File "${BINDIR}\qemu-img.exe"
178 File "${BINDIR}\qemu-io.exe"
179 SectionEnd
181 SectionGroup "$(System_Emulation_Section_Name)" System_Emulation_Section_Description
183 !include "${BINDIR}\system-emulations.nsh"
185 SectionGroupEnd
187 Section "$(Desktop_Icon_Section_Name)" Desktop_Icon_Section_Description
188 SetOutPath "$INSTDIR\share"
189 !ifdef W64
190 File /r /usr/x86_64-w64-mingw32/sys-root/mingw/share/icons
191 !else
192 File /r /usr/i686-w64-mingw32/sys-root/mingw/share/icons
193 !endif
194 SectionEnd
196 !ifdef DLLDIR
197 Section "$(DLL_Library_Section_Name)" DLL_Library_Section_Description
198 SetOutPath "$INSTDIR"
199 File "${DLLDIR}\*.dll"
200 SectionEnd
201 !endif
203 !ifdef CONFIG_DOCUMENTATION
204 Section "$(Documentation_Section_Name)" Documentation_Section_Description
205 SetOutPath "$INSTDIR"
206 File "${BINDIR}\index.html"
207 SetOutPath "$INSTDIR\interop"
208 FILE /r "${BINDIR}\interop\*.*"
209 SetOutPath "$INSTDIR\specs"
210 FILE /r "${BINDIR}\specs\*.*"
211 SetOutPath "$INSTDIR\system"
212 FILE /r "${BINDIR}\system\*.*"
213 SetOutPath "$INSTDIR\tools"
214 FILE /r "${BINDIR}\tools\*.*"
215 SetOutPath "$INSTDIR\user"
216 FILE /r "${BINDIR}\user\*.*"
217 SetOutPath "$INSTDIR"
218 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
219 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk" "$INSTDIR\index.html" "" "$INSTDIR\index.html" 0
220 SectionEnd
221 !endif
223 ; Optional section (can be disabled by the user)
224 Section "$(Start_Menu_Section_Name)" Start_Menu_Section_Description
225 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
226 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
227 SectionEnd
229 ;--------------------------------
231 ; Uninstaller
233 Section "Uninstall" Uninstall_Section_Description
234 ; Remove registry keys
235 !ifdef W64
236 SetRegView 64
237 !endif
238 DeleteRegKey HKLM "${UNINST_KEY}"
239 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
241 ; Remove shortcuts, if any
242 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk"
243 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Technical_Documentation).lnk"
244 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk"
245 RMDir "$SMPROGRAMS\${PRODUCT}"
247 ; Remove files and directories used
248 Delete "$INSTDIR\COPYING"
249 Delete "$INSTDIR\COPYING.LIB"
250 Delete "$INSTDIR\README.rst"
251 Delete "$INSTDIR\VERSION"
252 Delete "$INSTDIR\*.bin"
253 Delete "$INSTDIR\*.dll"
254 Delete "$INSTDIR\*.dtb"
255 Delete "$INSTDIR\*.fd"
256 Delete "$INSTDIR\*.img"
257 Delete "$INSTDIR\*.lid"
258 Delete "$INSTDIR\*.ndrv"
259 Delete "$INSTDIR\*.rom"
260 Delete "$INSTDIR\openbios-*"
261 Delete "$INSTDIR\palcode-clipper"
262 Delete "$INSTDIR\u-boot.e500"
263 Delete "$INSTDIR\qemu.svg"
264 Delete "$INSTDIR\qemu-io.exe"
265 Delete "$INSTDIR\qemu-img.exe"
266 Delete "$INSTDIR\qemu-ga.exe"
267 Delete "$INSTDIR\qemu-edid.exe"
268 Delete "$INSTDIR\qemu.exe"
269 Delete "$INSTDIR\qemu-system-*.exe"
270 Delete "$INSTDIR\index.html"
271 RMDir /r "$INSTDIR\interop"
272 RMDir /r "$INSTDIR\specs"
273 RMDir /r "$INSTDIR\system"
274 RMDir /r "$INSTDIR\tools"
275 RMDir /r "$INSTDIR\user"
276 RMDir /r "$INSTDIR\keymaps"
277 RMDir /r "$INSTDIR\lib"
278 RMDir /r "$INSTDIR\share"
279 ; Remove generated files
280 Delete "$INSTDIR\stderr.txt"
281 Delete "$INSTDIR\stdout.txt"
282 ; Remove uninstaller
283 Delete "${UNINST_EXE}"
284 RMDir "$INSTDIR"
285 SectionEnd
287 ; Include files with language installer strings.
288 ; Language ID table - https://www.science.co.il/language/Locale-codes.php
289 ; Language ID 1033 - English
290 ; Language ID 1031 - German
291 ; Language ID 1034 - Spanish
292 ; Language ID 1036 - French
293 ; Language ID 1040 - Italian
294 !addincludedir ${SRCDIR}/installer
295 !include installer_strings_english.nsh
296 !include installer_strings_french.nsh
297 !include installer_strings_german.nsh
298 !include installer_strings_italian.nsh
299 !include installer_strings_spanish.nsh
302 ; ---------------------
304 ; Descriptions (mouse-over).
305 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
306 !insertmacro MUI_DESCRIPTION_TEXT ${QEMU_System_File_Section_Description} $(QEMU_System_File_Section_Description_Text)
307 !insertmacro MUI_DESCRIPTION_TEXT ${Tools_Section_Description} $(Tools_Section_Description_Text)
308 !insertmacro MUI_DESCRIPTION_TEXT ${System_Emulation_Section_Description} $(System_Emulation_Section_Description_Text)
309 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop_Icon_Section_Description} $(Desktop_Icon_Section_Description_Text)
310 !insertmacro MUI_DESCRIPTION_TEXT ${Uninstall_Section_Description} $(Uninstall_Section_Description_Text)
311 !ifdef DLLDIR
312 !insertmacro MUI_DESCRIPTION_TEXT ${DLL_Library_Section_Description} $(DLL_Library_Section_Description_Text)
313 !endif
314 !ifdef CONFIG_DOCUMENTATION
315 !insertmacro MUI_DESCRIPTION_TEXT ${Documentation_Section_Description} $(Documentation_Section_Description_Text)
316 !endif
317 !insertmacro MUI_DESCRIPTION_TEXT ${Start_Menu_Section_Description} $(Start_Menu_Section_Description_Text)
318 !insertmacro MUI_FUNCTION_DESCRIPTION_END