blob: d419986ca062ec03c09f431cfd96bcc93713ce1a [file] [log] [blame]
Stefan Weilf53ec692013-07-15 23:49:57 +02001;!/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
Philippe Mathieu-Daudédc86dd52024-09-11 17:12:03 +020010; (at your option) any later version.
Stefan Weilf53ec692013-07-15 23:49:57 +020011;
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/>.
Philippe Mathieu-Daudédc86dd52024-09-11 17:12:03 +020019;
20; SPDX-License-Identifier: GPL-2.0-or-later
Stefan Weilf53ec692013-07-15 23:49:57 +020021
22; NSIS_WIN32_MAKENSIS
23
24!define PRODUCT "QEMU"
Stefan Hajnoczi70b7fba2017-11-21 12:04:35 +000025!define URL "https://www.qemu.org/"
Stefan Weilf53ec692013-07-15 23:49:57 +020026
27!define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
28!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
29
30!ifndef BINDIR
31!define BINDIR nsis.tmp
32!endif
33!ifndef SRCDIR
34!define SRCDIR .
35!endif
36!ifndef OUTFILE
37!define OUTFILE "qemu-setup.exe"
38!endif
39
Peter Maydell6b98e862022-03-05 10:57:42 +000040; Build a unicode installer
41Unicode true
42
Stefan Weilf53ec692013-07-15 23:49:57 +020043; Use maximum compression.
44SetCompressor /SOLID lzma
45
46!include "MUI2.nsh"
47
48; The name of the installer.
49Name "QEMU"
50
51; The file to write
52OutFile "${OUTFILE}"
53
54; The default installation directory.
55!ifdef W64
56InstallDir $PROGRAMFILES64\qemu
57!else
58InstallDir $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)
Stefan Weil40b9cc52013-09-28 10:34:30 +020063!ifdef W64
64InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
65!else
66InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
67!endif
Stefan Weilf53ec692013-07-15 23:49:57 +020068
69; Request administrator privileges for Windows Vista.
70RequestExecutionLevel 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.
Philippe Mathieu-Daudée54ecc72019-07-23 09:02:18 +0200109;
110; Remember to keep the "Uninstall" section in sync.
111
Stefan Weilf53ec692013-07-15 23:49:57 +0200112Section "${PRODUCT} (required)"
113
114 SectionIn RO
115
116 ; Set output path to the installation directory.
117 SetOutPath "$INSTDIR"
118
Stefan Weilf53ec692013-07-15 23:49:57 +0200119 File "${SRCDIR}\COPYING"
120 File "${SRCDIR}\COPYING.LIB"
Paolo Bonzinif64f5982019-09-09 15:08:32 +0200121 File "${SRCDIR}\README.rst"
Stefan Weilf53ec692013-07-15 23:49:57 +0200122 File "${SRCDIR}\VERSION"
123
Stefan Weilf53ec692013-07-15 23:49:57 +0200124 File /r "${BINDIR}\keymaps"
Stefan Weilf53ec692013-07-15 23:49:57 +0200125 File /r "${BINDIR}\share"
Stefan Weilf53ec692013-07-15 23:49:57 +0200126
127!ifdef W64
128 SetRegView 64
129!endif
130
131 ; Write the installation path into the registry
132 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
133
134 ; Write the uninstall keys for Windows
135 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
Stefan Weil805d8a62015-05-03 19:57:09 +0200136!ifdef DISPLAYVERSION
137 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
138!endif
Stefan Weilf53ec692013-07-15 23:49:57 +0200139 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
140 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
141 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
142 WriteUninstaller "qemu-uninstall.exe"
143SectionEnd
144
145Section "Tools" SectionTools
146 SetOutPath "$INSTDIR"
147 File "${BINDIR}\qemu-img.exe"
148 File "${BINDIR}\qemu-io.exe"
149SectionEnd
150
151SectionGroup "System Emulations" SectionSystem
152
153!include "${BINDIR}\system-emulations.nsh"
154
155SectionGroupEnd
156
157!ifdef DLLDIR
158Section "Libraries (DLL)" SectionDll
159 SetOutPath "$INSTDIR"
160 File "${DLLDIR}\*.dll"
161SectionEnd
162!endif
163
164!ifdef CONFIG_DOCUMENTATION
165Section "Documentation" SectionDoc
Paolo Bonzini70903cc2021-01-21 07:17:13 -0500166 SetOutPath "$INSTDIR\doc"
167 File /r "${BINDIR}\doc"
Peter Maydell373c7062020-03-06 13:47:51 +0000168 SetOutPath "$INSTDIR"
Stefan Weilf53ec692013-07-15 23:49:57 +0200169 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
Paolo Bonzini70903cc2021-01-21 07:17:13 -0500170 CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0
Stefan Weilf53ec692013-07-15 23:49:57 +0200171SectionEnd
172!endif
173
174; Optional section (can be disabled by the user)
175Section "Start Menu Shortcuts" SectionMenu
176 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
177 CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
178SectionEnd
179
180;--------------------------------
181
182; Uninstaller
183
184Section "Uninstall"
185 ; Remove registry keys
186!ifdef W64
187 SetRegView 64
188!endif
189 DeleteRegKey HKLM "${UNINST_KEY}"
190 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
191
192 ; Remove shortcuts, if any
193 Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
194 Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
195 Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
196 RMDir "$SMPROGRAMS\${PRODUCT}"
197
198 ; Remove files and directories used
199 Delete "$INSTDIR\Changelog"
200 Delete "$INSTDIR\COPYING"
201 Delete "$INSTDIR\COPYING.LIB"
Paolo Bonzinif64f5982019-09-09 15:08:32 +0200202 Delete "$INSTDIR\README.rst"
Stefan Weilf53ec692013-07-15 23:49:57 +0200203 Delete "$INSTDIR\VERSION"
204 Delete "$INSTDIR\*.bmp"
205 Delete "$INSTDIR\*.bin"
206 Delete "$INSTDIR\*.dll"
Philippe Mathieu-Daudée54ecc72019-07-23 09:02:18 +0200207 Delete "$INSTDIR\*.fd"
208 Delete "$INSTDIR\*.img"
209 Delete "$INSTDIR\*.lid"
210 Delete "$INSTDIR\*.ndrv"
Stefan Weilf53ec692013-07-15 23:49:57 +0200211 Delete "$INSTDIR\*.rom"
212 Delete "$INSTDIR\openbios-*"
213 Delete "$INSTDIR\qemu-img.exe"
214 Delete "$INSTDIR\qemu-io.exe"
215 Delete "$INSTDIR\qemu.exe"
216 Delete "$INSTDIR\qemu-system-*.exe"
BALATON Zoltan12963e72025-04-23 12:02:21 +0200217 RMDir /r "$INSTDIR\dtb"
Paolo Bonzini70903cc2021-01-21 07:17:13 -0500218 RMDir /r "$INSTDIR\doc"
Stefan Weilf53ec692013-07-15 23:49:57 +0200219 RMDir /r "$INSTDIR\share"
220 ; Remove generated files
221 Delete "$INSTDIR\stderr.txt"
222 Delete "$INSTDIR\stdout.txt"
223 ; Remove uninstaller
224 Delete "${UNINST_EXE}"
225 RMDir "$INSTDIR"
226SectionEnd
227
228;--------------------------------
229
230; Descriptions (mouse-over).
231!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
232 !insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation."
Peter Maydellc0879632022-03-05 10:57:43 +0000233!include "${BINDIR}\system-mui-text.nsh"
Stefan Weilf53ec692013-07-15 23:49:57 +0200234 !insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
235!ifdef DLLDIR
236 !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)."
237!endif
238!ifdef CONFIG_DOCUMENTATION
239 !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation."
240!endif
241 !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries."
242!insertmacro MUI_FUNCTION_DESCRIPTION_END
243
244;--------------------------------
245; Functions.
246
247Function .onInit
248 !insertmacro MUI_LANGDLL_DISPLAY
249FunctionEnd