3 ; This NSIS script creates an installer for QEMU on Windows.
5 ; Copyright (C) 2006-2012 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/>.
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}"
29 !define BINDIR nsis
.tmp
35 !define OUTFILE
"qemu-setup.exe"
38 ; Optionally install documentation.
39 !ifndef CONFIG_DOCUMENTATION
40 !define CONFIG_DOCUMENTATION
43 ; Use maximum compression.
44 SetCompressor
/SOLID lzma
48 ; The name of the installer.
54 ; The default installation directory.
56 InstallDir $PROGRAMFILES64\qemu
58 InstallDir $PROGRAMFILES\qemu
61 ; Registry key to check for directory (so if you install again, it will
62 ; overwrite the old one automatically)
64 InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
66 InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
69 ; Request administrator privileges for Windows Vista.
70 RequestExecutionLevel admin
72 ;--------------------------------
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"
84 ;--------------------------------
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_QEMU_Wiki_Link
)
93 !define MUI_FINISHPAGE_LINK_LOCATION
"${URL}"
94 !insertmacro MUI_PAGE_FINISH
96 !insertmacro MUI_UNPAGE_CONFIRM
97 !insertmacro MUI_UNPAGE_INSTFILES
99 ;--------------------------------
102 !insertmacro MUI_LANGUAGE
"English"
103 !insertmacro MUI_LANGUAGE
"French"
104 !insertmacro MUI_LANGUAGE
"German"
105 !insertmacro MUI_LANGUAGE
"Italian"
106 !insertmacro MUI_LANGUAGE
"Spanish"
108 ;--------------------------------
112 !insertmacro MUI_LANGDLL_DISPLAY
116 ;--------------------------------
118 ; The stuff to install.
120 ; Remember to keep the "Uninstall" section in sync.
122 Section "${PRODUCT}" QEMU_System_File_Section_Description
126 ; Set output path to the installation directory.
127 SetOutPath "$INSTDIR"
129 File "${SRCDIR}\Changelog"
130 File "${SRCDIR}\COPYING"
131 File "${SRCDIR}\COPYING.LIB"
132 File "${SRCDIR}\README.rst"
133 File "${SRCDIR}\VERSION"
135 File "${BINDIR}\*.bin"
136 File "${BINDIR}\*.dtb"
137 File "${BINDIR}\*.fd"
138 File "${BINDIR}\*.img"
139 File "${BINDIR}\*.lid"
140 File "${BINDIR}\*.ndrv"
141 File "${BINDIR}\*.rom"
142 File "${BINDIR}\openbios-*"
143 File "${BINDIR}\palcode-clipper"
144 File "${BINDIR}\u-boot.e500"
145 File "${BINDIR}\icons\hicolor\scalable\apps\qemu.svg"
147 File /r
"${BINDIR}\keymaps"
149 File /r
"${BINDIR}\share"
152 SetOutPath "$INSTDIR\lib\gdk-pixbuf-2.0\2.10.0"
153 FileOpen $0 "loaders.cache" w
160 ; Write the installation path into the registry
161 WriteRegStr HKLM SOFTWARE\
${PRODUCT} "Install_Dir" "$INSTDIR"
163 ; Write the uninstall keys for Windows
164 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
165 !ifdef DISPLAYVERSION
166 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
168 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
169 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
170 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
171 WriteUninstaller "qemu-uninstall.exe"
174 Section "$(Tools_Section_Name)" Tools_Section_Description
175 SetOutPath "$INSTDIR"
176 File "${BINDIR}\qemu-edid.exe"
177 File "${BINDIR}\qemu-ga.exe"
178 File "${BINDIR}\qemu-img.exe"
179 File "${BINDIR}\qemu-io.exe"
182 SectionGroup
"$(System_Emulation_Section_Name)" System_Emulation_Section_Description
184 !include "${BINDIR}\system-emulations.nsh"
188 Section "$(Desktop_Icon_Section_Name)" Desktop_Icon_Section_Description
189 SetOutPath "$INSTDIR\share"
191 File /r
/usr
/x86_64
-w64
-mingw32
/sys
-root
/mingw
/share
/icons
193 File /r
/usr
/i686
-w64
-mingw32
/sys
-root
/mingw
/share
/icons
198 Section "$(DLL_Library_Section_Name)" DLL_Library_Section_Description
199 SetOutPath "$INSTDIR"
200 File "${DLLDIR}\*.dll"
204 !ifdef CONFIG_DOCUMENTATION
205 Section "$(Documentation_Section_Name)" Documentation_Section_Description
206 SetOutPath "$INSTDIR"
207 File "${BINDIR}\index.html"
208 SetOutPath "$INSTDIR\interop"
209 FILE
/r
"${BINDIR}\interop\*.*"
210 SetOutPath "$INSTDIR\specs"
211 FILE
/r
"${BINDIR}\specs\*.*"
212 SetOutPath "$INSTDIR\system"
213 FILE
/r
"${BINDIR}\system\*.*"
214 SetOutPath "$INSTDIR\tools"
215 FILE
/r
"${BINDIR}\tools\*.*"
216 SetOutPath "$INSTDIR\user"
217 FILE
/r
"${BINDIR}\user\*.*"
218 SetOutPath "$INSTDIR"
219 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
220 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk" "$INSTDIR\index.html" "" "$INSTDIR\index.html" 0
224 ; Optional section (can be disabled by the user)
225 Section "$(Start_Menu_Section_Name)" Start_Menu_Section_Description
226 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
227 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
230 ;--------------------------------
234 Section "Uninstall" Uninstall_Section_Description
235 ; Remove registry keys
239 DeleteRegKey HKLM "${UNINST_KEY}"
240 DeleteRegKey HKLM SOFTWARE\
${PRODUCT}
242 ; Remove shortcuts, if any
243 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk"
244 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Technical_Documentation).lnk"
245 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk"
246 RMDir "$SMPROGRAMS\${PRODUCT}"
248 ; Remove files and directories used
249 Delete "$INSTDIR\Changelog"
250 Delete "$INSTDIR\COPYING"
251 Delete "$INSTDIR\COPYING.LIB"
252 Delete "$INSTDIR\README.rst"
253 Delete "$INSTDIR\VERSION"
254 Delete "$INSTDIR\*.bin"
255 Delete "$INSTDIR\*.dll"
256 Delete "$INSTDIR\*.dtb"
257 Delete "$INSTDIR\*.fd"
258 Delete "$INSTDIR\*.img"
259 Delete "$INSTDIR\*.lid"
260 Delete "$INSTDIR\*.ndrv"
261 Delete "$INSTDIR\*.rom"
262 Delete "$INSTDIR\openbios-*"
263 Delete "$INSTDIR\palcode-clipper"
264 Delete "$INSTDIR\u-boot.e500"
265 Delete "$INSTDIR\qemu.svg"
266 Delete "$INSTDIR\qemu-io.exe"
267 Delete "$INSTDIR\qemu-img.exe"
268 Delete "$INSTDIR\qemu-ga.exe"
269 Delete "$INSTDIR\qemu-edid.exe"
270 Delete "$INSTDIR\qemu.exe"
271 Delete "$INSTDIR\qemu-system-*.exe"
272 Delete "$INSTDIR\index.html"
273 RMDir /r
"$INSTDIR\interop"
274 RMDir /r
"$INSTDIR\specs"
275 RMDir /r
"$INSTDIR\system"
276 RMDir /r
"$INSTDIR\tools"
277 RMDir /r
"$INSTDIR\user"
278 RMDir /r
"$INSTDIR\keymaps"
279 RMDir /r
"$INSTDIR\lib"
280 RMDir /r
"$INSTDIR\share"
281 ; Remove generated files
282 Delete "$INSTDIR\stderr.txt"
283 Delete "$INSTDIR\stdout.txt"
285 Delete "${UNINST_EXE}"
289 ; Include files with language installer strings.
290 ; Language ID table - https://www.science.co.il/language/Locale-codes.php
291 ; Language ID 1033 - English
292 ; Language ID 1031 - German
293 ; Language ID 1034 - Spanish
294 ; Language ID 1036 - French
295 ; Language ID 1040 - Italian
296 !addincludedir ${SRCDIR}/installer
297 !include installer_strings_english
.nsh
298 !include installer_strings_french
.nsh
299 !include installer_strings_german
.nsh
300 !include installer_strings_italian
.nsh
301 !include installer_strings_spanish
.nsh
304 ; ---------------------
306 ; Descriptions (mouse-over).
307 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
308 !insertmacro MUI_DESCRIPTION_TEXT
${QEMU_System_File_Section_Description} $(QEMU_System_File_Section_Description_Text
)
309 !insertmacro MUI_DESCRIPTION_TEXT
${Tools_Section_Description} $(Tools_Section_Description_Text
)
310 !insertmacro MUI_DESCRIPTION_TEXT
${System_Emulation_Section_Description} $(System_Emulation_Section_Description_Text
)
311 !insertmacro MUI_DESCRIPTION_TEXT
${Desktop_Icon_Section_Description} $(Desktop_Icon_Section_Description_Text
)
312 !insertmacro MUI_DESCRIPTION_TEXT
${Uninstall_Section_Description} $(Uninstall_Section_Description_Text
)
314 !insertmacro MUI_DESCRIPTION_TEXT
${DLL_Library_Section_Description} $(DLL_Library_Section_Description_Text
)
316 !ifdef CONFIG_DOCUMENTATION
317 !insertmacro MUI_DESCRIPTION_TEXT
${Documentation_Section_Description} $(Documentation_Section_Description_Text
)
319 !insertmacro MUI_DESCRIPTION_TEXT
${Start_Menu_Section_Description} $(Start_Menu_Section_Description_Text
)
320 !insertmacro MUI_FUNCTION_DESCRIPTION_END