xref: /openbmc/qemu/qemu.nsi (revision 5983021e)
1;!/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
10; (at your option) version 3 or any later version.
11;
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/>.
19
20; NSIS_WIN32_MAKENSIS
21
22!define PRODUCT "QEMU"
23!define URL     "https://www.qemu.org/"
24
25!define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
26!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
27
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
37
38; Optionally install documentation.
39!ifndef CONFIG_DOCUMENTATION
40!define CONFIG_DOCUMENTATION
41!endif
42
43; 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)
63!ifdef W64
64InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
65!else
66InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
67!endif
68
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.
109;
110; Remember to keep the "Uninstall" section in sync.
111
112Section "${PRODUCT} (required)"
113
114    SectionIn RO
115
116    ; Set output path to the installation directory.
117    SetOutPath "$INSTDIR"
118
119    File "${SRCDIR}\Changelog"
120    File "${SRCDIR}\COPYING"
121    File "${SRCDIR}\COPYING.LIB"
122    File "${SRCDIR}\README.rst"
123    File "${SRCDIR}\VERSION"
124
125    File "${BINDIR}\*.bmp"
126    File "${BINDIR}\*.bin"
127    File "${BINDIR}\*.dtb"
128    File "${BINDIR}\*.fd"
129    File "${BINDIR}\*.img"
130    File "${BINDIR}\*.lid"
131    File "${BINDIR}\*.ndrv"
132    File "${BINDIR}\*.rom"
133    File "${BINDIR}\openbios-*"
134
135    File /r "${BINDIR}\keymaps"
136!ifdef CONFIG_GTK
137    File /r "${BINDIR}\share"
138!endif
139
140!ifdef W64
141    SetRegView 64
142!endif
143
144    ; Write the installation path into the registry
145    WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
146
147    ; Write the uninstall keys for Windows
148    WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
149!ifdef DISPLAYVERSION
150    WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
151!endif
152    WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
153    WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
154    WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
155    WriteUninstaller "qemu-uninstall.exe"
156SectionEnd
157
158Section "Tools" SectionTools
159    SetOutPath "$INSTDIR"
160    File "${BINDIR}\qemu-img.exe"
161    File "${BINDIR}\qemu-io.exe"
162SectionEnd
163
164SectionGroup "System Emulations" SectionSystem
165
166!include "${BINDIR}\system-emulations.nsh"
167
168SectionGroupEnd
169
170!ifdef DLLDIR
171Section "Libraries (DLL)" SectionDll
172    SetOutPath "$INSTDIR"
173    File "${DLLDIR}\*.dll"
174SectionEnd
175!endif
176
177!ifdef CONFIG_DOCUMENTATION
178Section "Documentation" SectionDoc
179    SetOutPath "$INSTDIR"
180    File "${BINDIR}\index.html"
181    SetOutPath "$INSTDIR\interop"
182    FILE /r "${BINDIR}\interop\*.*"
183    SetOutPath "$INSTDIR\specs"
184    FILE /r "${BINDIR}\specs\*.*"
185    SetOutPath "$INSTDIR\system"
186    FILE /r "${BINDIR}\system\*.*"
187    SetOutPath "$INSTDIR\tools"
188    FILE /r "${BINDIR}\tools\*.*"
189    SetOutPath "$INSTDIR\user"
190    FILE /r "${BINDIR}\user\*.*"
191    SetOutPath "$INSTDIR"
192    CreateDirectory "$SMPROGRAMS\${PRODUCT}"
193    CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\index.html" "" "$INSTDIR\index.html" 0
194SectionEnd
195!endif
196
197; Optional section (can be disabled by the user)
198Section "Start Menu Shortcuts" SectionMenu
199    CreateDirectory "$SMPROGRAMS\${PRODUCT}"
200    CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
201SectionEnd
202
203;--------------------------------
204
205; Uninstaller
206
207Section "Uninstall"
208    ; Remove registry keys
209!ifdef W64
210    SetRegView 64
211!endif
212    DeleteRegKey HKLM "${UNINST_KEY}"
213    DeleteRegKey HKLM SOFTWARE\${PRODUCT}
214
215    ; Remove shortcuts, if any
216    Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
217    Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
218    Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
219    RMDir "$SMPROGRAMS\${PRODUCT}"
220
221    ; Remove files and directories used
222    Delete "$INSTDIR\Changelog"
223    Delete "$INSTDIR\COPYING"
224    Delete "$INSTDIR\COPYING.LIB"
225    Delete "$INSTDIR\README.rst"
226    Delete "$INSTDIR\VERSION"
227    Delete "$INSTDIR\*.bmp"
228    Delete "$INSTDIR\*.bin"
229    Delete "$INSTDIR\*.dll"
230    Delete "$INSTDIR\*.dtb"
231    Delete "$INSTDIR\*.fd"
232    Delete "$INSTDIR\*.img"
233    Delete "$INSTDIR\*.lid"
234    Delete "$INSTDIR\*.ndrv"
235    Delete "$INSTDIR\*.rom"
236    Delete "$INSTDIR\openbios-*"
237    Delete "$INSTDIR\qemu-img.exe"
238    Delete "$INSTDIR\qemu-io.exe"
239    Delete "$INSTDIR\qemu.exe"
240    Delete "$INSTDIR\qemu-system-*.exe"
241    Delete "$INSTDIR\index.html"
242    RMDir /r "$INSTDIR\interop"
243    RMDir /r "$INSTDIR\specs"
244    RMDir /r "$INSTDIR\system"
245    RMDir /r "$INSTDIR\tools"
246    RMDir /r "$INSTDIR\user"
247    RMDir /r "$INSTDIR\keymaps"
248    RMDir /r "$INSTDIR\share"
249    ; Remove generated files
250    Delete "$INSTDIR\stderr.txt"
251    Delete "$INSTDIR\stdout.txt"
252    ; Remove uninstaller
253    Delete "${UNINST_EXE}"
254    RMDir "$INSTDIR"
255SectionEnd
256
257;--------------------------------
258
259; Descriptions (mouse-over).
260!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
261    !insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem}  "System emulation."
262    !insertmacro MUI_DESCRIPTION_TEXT ${Section_alpha}  "Alpha system emulation."
263    !insertmacro MUI_DESCRIPTION_TEXT ${Section_alphaw} "Alpha system emulation (GUI)."
264    !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386}   "PC i386 system emulation."
265    !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386w}  "PC i386 system emulation (GUI)."
266    !insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
267!ifdef DLLDIR
268    !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll}   "Runtime Libraries (DLL)."
269!endif
270!ifdef CONFIG_DOCUMENTATION
271    !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc}   "Documentation."
272!endif
273    !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu}  "Menu entries."
274!insertmacro MUI_FUNCTION_DESCRIPTION_END
275
276;--------------------------------
277; Functions.
278
279Function .onInit
280    !insertmacro MUI_LANGDLL_DISPLAY
281FunctionEnd
282