Merge tag 'v6.1.0'
[qemu/ar7.git] / qemu.nsi
blob2e26c1d1e7c00c761326fe2315de40e8031bd698
1 ;!/usr/bin/makensis
3 ; This NSIS script creates an installer for QEMU on Windows.
5 ; Copyright (C) 2006-2021 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 DATADIR
32 !define DATADIR "${BINDIR}\share"
33 !endif
34 !ifndef SRCDIR
35 !define SRCDIR .
36 !endif
37 !ifndef OUTFILE
38 !define OUTFILE "qemu-setup.exe"
39 !endif
41 ; Use maximum compression.
42 SetCompressor /SOLID lzma
44 ; Generate a Unicode installer.
45 Unicode true
47 !include "MUI2.nsh"
49 ; The name of the installer.
50 Name "QEMU"
52 ; The file to write
53 OutFile "${OUTFILE}"
55 ; The default installation directory.
56 !ifdef W64
57 InstallDir $PROGRAMFILES64\qemu
58 !else
59 InstallDir $PROGRAMFILES\qemu
60 !endif
62 ; Registry key to check for directory (so if you install again, it will
63 ; overwrite the old one automatically)
64 !ifdef W64
65 InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
66 !else
67 InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
68 !endif
70 ; Request administrator privileges for Windows Vista.
71 RequestExecutionLevel admin
73 ;--------------------------------
74 ; Interface Settings.
75 ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
76 ; !define MUI_SPECIALBITMAP "qemu.bmp"
77 !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
78 !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
79 !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
80 ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
81 ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
82 ; !define MUI_COMPONENTSPAGE_SMALLDESC
83 ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
85 ;--------------------------------
86 ; Pages.
88 !insertmacro MUI_PAGE_WELCOME
89 !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
90 !insertmacro MUI_PAGE_COMPONENTS
91 !insertmacro MUI_PAGE_DIRECTORY
92 !insertmacro MUI_PAGE_INSTFILES
93 !define MUI_FINISHPAGE_LINK $(Visit_QEMU_Wiki_Link)
94 !define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
95 !insertmacro MUI_PAGE_FINISH
97 !insertmacro MUI_UNPAGE_CONFIRM
98 !insertmacro MUI_UNPAGE_INSTFILES
100 ;--------------------------------
101 ; Languages.
103 !insertmacro MUI_LANGUAGE "English"
104 !insertmacro MUI_LANGUAGE "French"
105 !insertmacro MUI_LANGUAGE "German"
106 !insertmacro MUI_LANGUAGE "Italian"
107 !insertmacro MUI_LANGUAGE "Spanish"
109 ;--------------------------------
110 ; Functions.
112 Function .onInit
113 !insertmacro MUI_LANGDLL_DISPLAY
114 FunctionEnd
117 ;--------------------------------
119 ; The stuff to install.
121 ; Remember to keep the "Uninstall" section in sync.
123 Section "${PRODUCT}" QEMU_System_File_Section_Description
125 SectionIn RO
127 ; Set output path to the installation directory.
128 SetOutPath "$INSTDIR"
130 File "${SRCDIR}\COPYING"
131 File "${SRCDIR}\COPYING.LIB"
132 File "${SRCDIR}\README.rst"
133 File "${SRCDIR}\VERSION"
135 File /r "${BINDIR}\share"
137 SetOutPath "$INSTDIR\lib\gdk-pixbuf-2.0\2.10.0"
138 FileOpen $0 "loaders.cache" w
139 FileClose $0
141 !ifdef W64
142 SetRegView 64
143 !endif
145 ; Write the installation path into the registry
146 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
148 ; Write the uninstall keys for Windows
149 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
150 !ifdef DISPLAYVERSION
151 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
152 !endif
153 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
154 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
155 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
156 WriteUninstaller "qemu-uninstall.exe"
157 SectionEnd
159 Section "$(Tools_Section_Name)" Tools_Section_Description
160 SetOutPath "$INSTDIR"
161 File "${BINDIR}\qemu-edid.exe"
162 File "${BINDIR}\qemu-ga.exe"
163 File "${BINDIR}\qemu-img.exe"
164 File "${BINDIR}\qemu-io.exe"
165 File "${BINDIR}\qemu-nbd.exe"
166 SectionEnd
168 SectionGroup "$(System_Emulation_Section_Name)" System_Emulation_Section_Description
170 !include "${BINDIR}\system-emulations.nsh"
172 SectionGroupEnd
174 Section "$(Desktop_Icon_Section_Name)" Desktop_Icon_Section_Description
175 SetOutPath "$INSTDIR\share"
176 !ifdef W64
177 File /r /usr/x86_64-w64-mingw32/sys-root/mingw/share/icons
178 !else
179 File /r /usr/i686-w64-mingw32/sys-root/mingw/share/icons
180 !endif
181 SectionEnd
183 !ifdef DLLDIR
184 Section "$(DLL_Library_Section_Name)" DLL_Library_Section_Description
185 SetOutPath "$INSTDIR"
186 File "${DLLDIR}\*.dll"
187 SectionEnd
188 !endif
190 !ifdef CONFIG_DOCUMENTATION
191 Section "$(Documentation_Section_Name)" Documentation_Section_Description
192 ; SetOutPath "$INSTDIR\share\doc"
193 ; File /r "${BINDIR}\share\doc"
194 SetOutPath "$INSTDIR"
195 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
196 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk" "$INSTDIR\share\doc\index.html" "" "$INSTDIR\share\doc\index.html" 0
197 SectionEnd
198 !endif
200 ; Optional section (can be disabled by the user)
201 Section "$(Start_Menu_Section_Name)" Start_Menu_Section_Description
202 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
203 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
204 SectionEnd
206 ;--------------------------------
208 ; Uninstaller
210 Section "Uninstall" Uninstall_Section_Description
211 ; Remove registry keys
212 !ifdef W64
213 SetRegView 64
214 !endif
215 DeleteRegKey HKLM "${UNINST_KEY}"
216 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
218 ; Remove shortcuts, if any
219 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk"
220 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Technical_Documentation).lnk"
221 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk"
222 RMDir "$SMPROGRAMS\${PRODUCT}"
224 ; Remove files and directories used
225 Delete "$INSTDIR\COPYING"
226 Delete "$INSTDIR\COPYING.LIB"
227 Delete "$INSTDIR\README.rst"
228 Delete "$INSTDIR\VERSION"
229 Delete "$INSTDIR\*.dll"
230 Delete "$INSTDIR\qemu-nbd.exe"
231 Delete "$INSTDIR\qemu-io.exe"
232 Delete "$INSTDIR\qemu-img.exe"
233 Delete "$INSTDIR\qemu-ga.exe"
234 Delete "$INSTDIR\qemu-edid.exe"
235 Delete "$INSTDIR\qemu-system-*.exe"
236 RMDir /r "$INSTDIR\share"
237 ; Remove generated files
238 Delete "$INSTDIR\stderr.txt"
239 Delete "$INSTDIR\stdout.txt"
240 ; Remove uninstaller
241 Delete "${UNINST_EXE}"
242 RMDir "$INSTDIR"
243 SectionEnd
245 ; Include files with language installer strings.
246 ; Language ID table - https://www.science.co.il/language/Locale-codes.php
247 ; Language ID 1033 - English
248 ; Language ID 1031 - German
249 ; Language ID 1034 - Spanish
250 ; Language ID 1036 - French
251 ; Language ID 1040 - Italian
252 !addincludedir ${SRCDIR}/installer
253 !include installer_strings_english.nsh
254 !include installer_strings_french.nsh
255 !include installer_strings_german.nsh
256 !include installer_strings_italian.nsh
257 !include installer_strings_spanish.nsh
260 ; ---------------------
262 ; Descriptions (mouse-over).
263 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
264 !insertmacro MUI_DESCRIPTION_TEXT ${QEMU_System_File_Section_Description} $(QEMU_System_File_Section_Description_Text)
265 !insertmacro MUI_DESCRIPTION_TEXT ${Tools_Section_Description} $(Tools_Section_Description_Text)
266 !insertmacro MUI_DESCRIPTION_TEXT ${System_Emulation_Section_Description} $(System_Emulation_Section_Description_Text)
267 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop_Icon_Section_Description} $(Desktop_Icon_Section_Description_Text)
268 !insertmacro MUI_DESCRIPTION_TEXT ${Uninstall_Section_Description} $(Uninstall_Section_Description_Text)
269 !ifdef DLLDIR
270 !insertmacro MUI_DESCRIPTION_TEXT ${DLL_Library_Section_Description} $(DLL_Library_Section_Description_Text)
271 !endif
272 !ifdef CONFIG_DOCUMENTATION
273 !insertmacro MUI_DESCRIPTION_TEXT ${Documentation_Section_Description} $(Documentation_Section_Description_Text)
274 !endif
275 !insertmacro MUI_DESCRIPTION_TEXT ${Start_Menu_Section_Description} $(Start_Menu_Section_Description_Text)
276 !insertmacro MUI_FUNCTION_DESCRIPTION_END