nsis: Remove duplicate installation of documentation
[qemu/ar7.git] / qemu.nsi
blobb64eda36dd549cb2d7a7c48f9dbc173637e90e08
1 ;!/usr/bin/makensis
3 ; This NSIS script creates an installer for QEMU on Windows.
5 ; Copyright (C) 2006-2021 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/>.
20 ; NSIS_WIN32_MAKENSIS
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}"
28 !ifndef BINDIR
29 !define BINDIR nsis.tmp
30 !endif
31 !ifndef DATADIR
32 !define DATADIR "${BINDIR}\share"
33 !endif
34 !ifndef SRCDIR
35 !define SRCDIR .
36 !endif
37 !ifndef OUTFILE
38 !define OUTFILE "qemu-setup.exe"
39 !endif
41 ; Use maximum compression.
42 SetCompressor /SOLID lzma
44 ; Generate a Unicode installer.
45 Unicode true
47 !include "MUI2.nsh"
49 ; The name of the installer.
50 Name "QEMU"
52 ; The file to write
53 OutFile "${OUTFILE}"
55 ; The default installation directory.
56 !ifdef W64
57 InstallDir $PROGRAMFILES64\qemu
58 !else
59 InstallDir $PROGRAMFILES\qemu
60 !endif
62 ; Registry key to check for directory (so if you install again, it will
63 ; overwrite the old one automatically)
64 !ifdef W64
65 InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
66 !else
67 InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
68 !endif
70 ; Request administrator privileges for Windows Vista.
71 RequestExecutionLevel admin
73 ;--------------------------------
74 ; Interface Settings.
75 ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
76 ; !define MUI_SPECIALBITMAP "qemu.bmp"
77 !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
78 !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
79 !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
80 ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
81 ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
82 ; !define MUI_COMPONENTSPAGE_SMALLDESC
83 ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
85 ;--------------------------------
86 ; Pages.
88 !insertmacro MUI_PAGE_WELCOME
89 !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
90 !insertmacro MUI_PAGE_COMPONENTS
91 !insertmacro MUI_PAGE_DIRECTORY
92 !insertmacro MUI_PAGE_INSTFILES
93 !define MUI_FINISHPAGE_LINK $(Visit_QEMU_Wiki_Link)
94 !define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
95 !insertmacro MUI_PAGE_FINISH
97 !insertmacro MUI_UNPAGE_CONFIRM
98 !insertmacro MUI_UNPAGE_INSTFILES
100 ;--------------------------------
101 ; Languages.
103 !insertmacro MUI_LANGUAGE "English"
104 !insertmacro MUI_LANGUAGE "French"
105 !insertmacro MUI_LANGUAGE "German"
106 !insertmacro MUI_LANGUAGE "Italian"
107 !insertmacro MUI_LANGUAGE "Spanish"
109 ;--------------------------------
110 ; Functions.
112 Function .onInit
113 !insertmacro MUI_LANGDLL_DISPLAY
114 FunctionEnd
117 ;--------------------------------
119 ; The stuff to install.
121 ; Remember to keep the "Uninstall" section in sync.
123 Section "${PRODUCT}" QEMU_System_File_Section_Description
125 SectionIn RO
127 ; Set output path to the installation directory.
128 SetOutPath "$INSTDIR"
130 File "${SRCDIR}\COPYING"
131 File "${SRCDIR}\COPYING.LIB"
132 File "${SRCDIR}\README.rst"
133 File "${SRCDIR}\VERSION"
135 File /r "${BINDIR}\share"
137 SetOutPath "$INSTDIR\lib\gdk-pixbuf-2.0\2.10.0"
138 FileOpen $0 "loaders.cache" w
139 FileClose $0
141 !ifdef W64
142 SetRegView 64
143 !endif
145 ; Write the installation path into the registry
146 WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
148 ; Write the uninstall keys for Windows
149 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
150 !ifdef DISPLAYVERSION
151 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
152 !endif
153 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
154 WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
155 WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
156 WriteUninstaller "qemu-uninstall.exe"
157 SectionEnd
159 Section "$(Tools_Section_Name)" Tools_Section_Description
160 SetOutPath "$INSTDIR"
161 File "${BINDIR}\qemu-edid.exe"
162 File "${BINDIR}\qemu-ga.exe"
163 File "${BINDIR}\qemu-img.exe"
164 File "${BINDIR}\qemu-io.exe"
165 SectionEnd
167 SectionGroup "$(System_Emulation_Section_Name)" System_Emulation_Section_Description
169 !include "${BINDIR}\system-emulations.nsh"
171 SectionGroupEnd
173 Section "$(Desktop_Icon_Section_Name)" Desktop_Icon_Section_Description
174 SetOutPath "$INSTDIR\share"
175 !ifdef W64
176 File /r /usr/x86_64-w64-mingw32/sys-root/mingw/share/icons
177 !else
178 File /r /usr/i686-w64-mingw32/sys-root/mingw/share/icons
179 !endif
180 SectionEnd
182 !ifdef DLLDIR
183 Section "$(DLL_Library_Section_Name)" DLL_Library_Section_Description
184 SetOutPath "$INSTDIR"
185 File "${DLLDIR}\*.dll"
186 SectionEnd
187 !endif
189 !ifdef CONFIG_DOCUMENTATION
190 Section "$(Documentation_Section_Name)" Documentation_Section_Description
191 ; SetOutPath "$INSTDIR\share\doc"
192 ; File /r "${BINDIR}\share\doc"
193 SetOutPath "$INSTDIR"
194 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
195 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk" "$INSTDIR\share\doc\index.html" "" "$INSTDIR\share\doc\index.html" 0
196 SectionEnd
197 !endif
199 ; Optional section (can be disabled by the user)
200 Section "$(Start_Menu_Section_Name)" Start_Menu_Section_Description
201 CreateDirectory "$SMPROGRAMS\${PRODUCT}"
202 CreateShortCut "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
203 SectionEnd
205 ;--------------------------------
207 ; Uninstaller
209 Section "Uninstall" Uninstall_Section_Description
210 ; Remove registry keys
211 !ifdef W64
212 SetRegView 64
213 !endif
214 DeleteRegKey HKLM "${UNINST_KEY}"
215 DeleteRegKey HKLM SOFTWARE\${PRODUCT}
217 ; Remove shortcuts, if any
218 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_User_Documentation).lnk"
219 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Technical_Documentation).lnk"
220 Delete "$SMPROGRAMS\${PRODUCT}\$(Link_Description_Uninstall).lnk"
221 RMDir "$SMPROGRAMS\${PRODUCT}"
223 ; Remove files and directories used
224 Delete "$INSTDIR\COPYING"
225 Delete "$INSTDIR\COPYING.LIB"
226 Delete "$INSTDIR\README.rst"
227 Delete "$INSTDIR\VERSION"
228 Delete "$INSTDIR\*.dll"
229 Delete "$INSTDIR\qemu.svg"
230 Delete "$INSTDIR\qemu-io.exe"
231 Delete "$INSTDIR\qemu-img.exe"
232 Delete "$INSTDIR\qemu-ga.exe"
233 Delete "$INSTDIR\qemu-edid.exe"
234 Delete "$INSTDIR\qemu.exe"
235 Delete "$INSTDIR\qemu-system-*.exe"
236 RMDir /r "$INSTDIR\share"
237 ; Remove generated files
238 Delete "$INSTDIR\stderr.txt"
239 Delete "$INSTDIR\stdout.txt"
240 ; Remove uninstaller
241 Delete "${UNINST_EXE}"
242 RMDir "$INSTDIR"
243 SectionEnd
245 ; Include files with language installer strings.
246 ; Language ID table - https://www.science.co.il/language/Locale-codes.php
247 ; Language ID 1033 - English
248 ; Language ID 1031 - German
249 ; Language ID 1034 - Spanish
250 ; Language ID 1036 - French
251 ; Language ID 1040 - Italian
252 !addincludedir ${SRCDIR}/installer
253 !include installer_strings_english.nsh
254 !include installer_strings_french.nsh
255 !include installer_strings_german.nsh
256 !include installer_strings_italian.nsh
257 !include installer_strings_spanish.nsh
260 ; ---------------------
262 ; Descriptions (mouse-over).
263 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
264 !insertmacro MUI_DESCRIPTION_TEXT ${QEMU_System_File_Section_Description} $(QEMU_System_File_Section_Description_Text)
265 !insertmacro MUI_DESCRIPTION_TEXT ${Tools_Section_Description} $(Tools_Section_Description_Text)
266 !insertmacro MUI_DESCRIPTION_TEXT ${System_Emulation_Section_Description} $(System_Emulation_Section_Description_Text)
267 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop_Icon_Section_Description} $(Desktop_Icon_Section_Description_Text)
268 !insertmacro MUI_DESCRIPTION_TEXT ${Uninstall_Section_Description} $(Uninstall_Section_Description_Text)
269 !ifdef DLLDIR
270 !insertmacro MUI_DESCRIPTION_TEXT ${DLL_Library_Section_Description} $(DLL_Library_Section_Description_Text)
271 !endif
272 !ifdef CONFIG_DOCUMENTATION
273 !insertmacro MUI_DESCRIPTION_TEXT ${Documentation_Section_Description} $(Documentation_Section_Description_Text)
274 !endif
275 !insertmacro MUI_DESCRIPTION_TEXT ${Start_Menu_Section_Description} $(Start_Menu_Section_Description_Text)
276 !insertmacro MUI_FUNCTION_DESCRIPTION_END