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 "http://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)
63 InstallDirRegKey HKLM "Software\qemu" "Install_Dir"
65 ; Request administrator privileges for Windows Vista.
66 RequestExecutionLevel admin
68 ;--------------------------------
70 ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
71 ; !define MUI_SPECIALBITMAP "qemu.bmp"
72 !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
73 !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
74 !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
75 ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
76 ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
77 ; !define MUI_COMPONENTSPAGE_SMALLDESC
78 ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
80 ;--------------------------------
83 !insertmacro MUI_PAGE_WELCOME
84 !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
85 !insertmacro MUI_PAGE_COMPONENTS
86 !insertmacro MUI_PAGE_DIRECTORY
87 !insertmacro MUI_PAGE_INSTFILES
88 !define MUI_FINISHPAGE_LINK "Visit the QEMU Wiki online!"
89 !define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
90 !insertmacro MUI_PAGE_FINISH
92 !insertmacro MUI_UNPAGE_CONFIRM
93 !insertmacro MUI_UNPAGE_INSTFILES
95 ;--------------------------------
98 !insertmacro MUI_LANGUAGE "English"
99 !insertmacro MUI_LANGUAGE "French"
100 !insertmacro MUI_LANGUAGE "German"
102 ;--------------------------------
104 ; The stuff to install.
105 Section "${PRODUCT} (required)"
109 ; Set output path to the installation directory.
110 SetOutPath "$INSTDIR"
112 File "${SRCDIR}\Changelog"
113 File "${SRCDIR}\COPYING"
114 File "${SRCDIR}\COPYING.LIB"
115 File "${SRCDIR}\README"
116 File "${SRCDIR}\VERSION"
118 File "${BINDIR}\*.bmp"
119 File "${BINDIR}\*.bin"
120 File "${BINDIR}\*.dtb"
121 File "${BINDIR}\*.rom"
122 File "${BINDIR}\openbios-*"
124 File /r "${BINDIR}\keymaps"
126 File /r "${BINDIR}\share"
133 ; Write the installation path into the registry
134 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
136 ; Write the uninstall keys for Windows
137 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
138 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
139 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
140 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
141 WriteUninstaller "qemu-uninstall.exe"
144 Section "Tools" SectionTools
145 SetOutPath "$INSTDIR"
146 File "${BINDIR}\qemu-img.exe"
147 File "${BINDIR}\qemu-io.exe"
150 SectionGroup "System Emulations" SectionSystem
152 !include "${BINDIR}\system-emulations.nsh"
157 Section "Libraries (DLL)" SectionDll
158 SetOutPath "$INSTDIR"
159 File "${DLLDIR}\*.dll"
163 !ifdef CONFIG_DOCUMENTATION
164 Section "Documentation" SectionDoc
165 SetOutPath "$INSTDIR"
166 File "${BINDIR}\qemu-doc.html"
167 File "${BINDIR}\qemu-tech.html"
168 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
169 CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\qemu-doc.html" "" "$INSTDIR\qemu-doc.html" 0
170 CreateShortCut "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk" "$INSTDIR\qemu-tech.html" "" "$INSTDIR\qemu-tech.html" 0
174 ; Optional section (can be disabled by the user)
175 Section "Start Menu Shortcuts" SectionMenu
176 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
177 CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
180 ;--------------------------------
185 ; Remove registry keys
189 DeleteRegKey HKLM "${UNINST_KEY}"
190 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
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}"
198 ; Remove files and directories used
199 Delete "$INSTDIR\Changelog"
200 Delete "$INSTDIR\COPYING"
201 Delete "$INSTDIR\COPYING.LIB"
202 Delete "$INSTDIR\README"
203 Delete "$INSTDIR\VERSION"
204 Delete "$INSTDIR\*.bmp"
205 Delete "$INSTDIR\*.bin"
206 Delete "$INSTDIR\*.dll"
207 Delete "$INSTDIR\*.dtb"
208 Delete "$INSTDIR\*.rom"
209 Delete "$INSTDIR\openbios-*"
210 Delete "$INSTDIR\qemu-img.exe"
211 Delete "$INSTDIR\qemu-io.exe"
212 Delete "$INSTDIR\qemu.exe"
213 Delete "$INSTDIR\qemu-system-*.exe"
214 Delete "$INSTDIR\qemu-doc.html"
215 Delete "$INSTDIR\qemu-tech.html"
216 RMDir /r "$INSTDIR\keymaps"
217 RMDir /r "$INSTDIR\share"
218 ; Remove generated files
219 Delete "$INSTDIR\stderr.txt"
220 Delete "$INSTDIR\stdout.txt"
222 Delete "${UNINST_EXE}"
226 ;--------------------------------
228 ; Descriptions (mouse-over).
229 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
230 !insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation."
231 !insertmacro MUI_DESCRIPTION_TEXT ${Section_alpha} "Alpha system emulation."
232 !insertmacro MUI_DESCRIPTION_TEXT ${Section_alphaw} "Alpha system emulation (GUI)."
233 !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386} "PC i386 system emulation."
234 !insertmacro MUI_DESCRIPTION_TEXT ${Section_i386w} "PC i386 system emulation (GUI)."
235 !insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
237 !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)."
239 !ifdef CONFIG_DOCUMENTATION
240 !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation."
242 !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries."
243 !insertmacro MUI_FUNCTION_DESCRIPTION_END
245 ;--------------------------------
249 !insertmacro MUI_LANGDLL_DISPLAY