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 ; Use maximum compression.
39 SetCompressor
/SOLID lzma
43 ; The name of the installer.
49 ; The default installation directory.
51 InstallDir $PROGRAMFILES64\qemu
53 InstallDir $PROGRAMFILES\qemu
56 ; Registry key to check for directory (so if you install again, it will
57 ; overwrite the old one automatically)
59 InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
61 InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
64 ; Request administrator privileges for Windows Vista.
65 RequestExecutionLevel admin
67 ;--------------------------------
69 ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
70 ; !define MUI_SPECIALBITMAP "qemu.bmp"
71 !define MUI_ICON
"${SRCDIR}\pc-bios\qemu-nsis.ico"
72 !define MUI_UNICON
"${SRCDIR}\pc-bios\qemu-nsis.ico"
73 !define MUI_WELCOMEFINISHPAGE_BITMAP
"${SRCDIR}\pc-bios\qemu-nsis.bmp"
74 ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
75 ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
76 ; !define MUI_COMPONENTSPAGE_SMALLDESC
77 ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
79 ;--------------------------------
82 !insertmacro MUI_PAGE_WELCOME
83 !insertmacro MUI_PAGE_LICENSE
"${SRCDIR}\COPYING"
84 !insertmacro MUI_PAGE_COMPONENTS
85 !insertmacro MUI_PAGE_DIRECTORY
86 !insertmacro MUI_PAGE_INSTFILES
87 !define MUI_FINISHPAGE_LINK
"Visit the QEMU Wiki online!"
88 !define MUI_FINISHPAGE_LINK_LOCATION
"${URL}"
89 !insertmacro MUI_PAGE_FINISH
91 !insertmacro MUI_UNPAGE_CONFIRM
92 !insertmacro MUI_UNPAGE_INSTFILES
94 ;--------------------------------
97 !insertmacro MUI_LANGUAGE
"English"
98 !insertmacro MUI_LANGUAGE
"French"
99 !insertmacro MUI_LANGUAGE
"German"
101 ;--------------------------------
103 ; The stuff to install.
105 ; Remember to keep the "Uninstall" section in sync.
107 Section "${PRODUCT} (required)"
111 ; Set output path to the installation directory.
112 SetOutPath "$INSTDIR"
114 File "${SRCDIR}\COPYING"
115 File "${SRCDIR}\COPYING.LIB"
116 File "${SRCDIR}\README.rst"
117 File "${SRCDIR}\VERSION"
119 File /r
"${BINDIR}\keymaps"
120 File /r
"${BINDIR}\share"
126 ; Write the installation path into the registry
127 WriteRegStr HKLM SOFTWARE\
${PRODUCT} "Install_Dir" "$INSTDIR"
129 ; Write the uninstall keys for Windows
130 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
131 !ifdef DISPLAYVERSION
132 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
134 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
135 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
136 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
137 WriteUninstaller "qemu-uninstall.exe"
140 Section "Tools" SectionTools
141 SetOutPath "$INSTDIR"
142 File "${BINDIR}\qemu-img.exe"
143 File "${BINDIR}\qemu-io.exe"
146 SectionGroup
"System Emulations" SectionSystem
148 !include "${BINDIR}\system-emulations.nsh"
153 Section "Libraries (DLL)" SectionDll
154 SetOutPath "$INSTDIR"
155 File "${DLLDIR}\*.dll"
159 !ifdef CONFIG_DOCUMENTATION
160 Section "Documentation" SectionDoc
161 SetOutPath "$INSTDIR\doc"
162 File /r
"${BINDIR}\doc"
163 SetOutPath "$INSTDIR"
164 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
165 CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0
169 ; Optional section (can be disabled by the user)
170 Section "Start Menu Shortcuts" SectionMenu
171 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
172 CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
175 ;--------------------------------
180 ; Remove registry keys
184 DeleteRegKey HKLM "${UNINST_KEY}"
185 DeleteRegKey HKLM SOFTWARE\
${PRODUCT}
187 ; Remove shortcuts, if any
188 Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
189 Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
190 Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
191 RMDir "$SMPROGRAMS\${PRODUCT}"
193 ; Remove files and directories used
194 Delete "$INSTDIR\Changelog"
195 Delete "$INSTDIR\COPYING"
196 Delete "$INSTDIR\COPYING.LIB"
197 Delete "$INSTDIR\README.rst"
198 Delete "$INSTDIR\VERSION"
199 Delete "$INSTDIR\*.bmp"
200 Delete "$INSTDIR\*.bin"
201 Delete "$INSTDIR\*.dll"
202 Delete "$INSTDIR\*.dtb"
203 Delete "$INSTDIR\*.fd"
204 Delete "$INSTDIR\*.img"
205 Delete "$INSTDIR\*.lid"
206 Delete "$INSTDIR\*.ndrv"
207 Delete "$INSTDIR\*.rom"
208 Delete "$INSTDIR\openbios-*"
209 Delete "$INSTDIR\qemu-img.exe"
210 Delete "$INSTDIR\qemu-io.exe"
211 Delete "$INSTDIR\qemu.exe"
212 Delete "$INSTDIR\qemu-system-*.exe"
213 RMDir /r
"$INSTDIR\doc"
214 RMDir /r
"$INSTDIR\share"
215 ; Remove generated files
216 Delete "$INSTDIR\stderr.txt"
217 Delete "$INSTDIR\stdout.txt"
219 Delete "${UNINST_EXE}"
223 ;--------------------------------
225 ; Descriptions (mouse-over).
226 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
227 !insertmacro MUI_DESCRIPTION_TEXT
${SectionSystem} "System emulation."
228 !insertmacro MUI_DESCRIPTION_TEXT
${Section_alpha} "Alpha system emulation."
229 !insertmacro MUI_DESCRIPTION_TEXT
${Section_alphaw} "Alpha system emulation (GUI)."
230 !insertmacro MUI_DESCRIPTION_TEXT
${Section_i386} "PC i386 system emulation."
231 !insertmacro MUI_DESCRIPTION_TEXT
${Section_i386w} "PC i386 system emulation (GUI)."
232 !insertmacro MUI_DESCRIPTION_TEXT
${SectionTools} "Tools."
234 !insertmacro MUI_DESCRIPTION_TEXT
${SectionDll} "Runtime Libraries (DLL)."
236 !ifdef CONFIG_DOCUMENTATION
237 !insertmacro MUI_DESCRIPTION_TEXT
${SectionDoc} "Documentation."
239 !insertmacro MUI_DESCRIPTION_TEXT
${SectionMenu} "Menu entries."
240 !insertmacro MUI_FUNCTION_DESCRIPTION_END
242 ;--------------------------------
246 !insertmacro MUI_LANGDLL_DISPLAY