2
0

qemu.nsi 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. ;!/usr/bin/makensis
  2. ; This NSIS script creates an installer for QEMU on Windows.
  3. ; Copyright (C) 2006-2012 Stefan Weil
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 2 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ; SPDX-License-Identifier: GPL-2.0-or-later
  19. ; NSIS_WIN32_MAKENSIS
  20. !define PRODUCT "QEMU"
  21. !define URL "https://www.qemu.org/"
  22. !define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
  23. !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
  24. !ifndef BINDIR
  25. !define BINDIR nsis.tmp
  26. !endif
  27. !ifndef SRCDIR
  28. !define SRCDIR .
  29. !endif
  30. !ifndef OUTFILE
  31. !define OUTFILE "qemu-setup.exe"
  32. !endif
  33. ; Build a unicode installer
  34. Unicode true
  35. ; Use maximum compression.
  36. SetCompressor /SOLID lzma
  37. !include "MUI2.nsh"
  38. ; The name of the installer.
  39. Name "QEMU"
  40. ; The file to write
  41. OutFile "${OUTFILE}"
  42. ; The default installation directory.
  43. !ifdef W64
  44. InstallDir $PROGRAMFILES64\qemu
  45. !else
  46. InstallDir $PROGRAMFILES\qemu
  47. !endif
  48. ; Registry key to check for directory (so if you install again, it will
  49. ; overwrite the old one automatically)
  50. !ifdef W64
  51. InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
  52. !else
  53. InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
  54. !endif
  55. ; Request administrator privileges for Windows Vista.
  56. RequestExecutionLevel admin
  57. ;--------------------------------
  58. ; Interface Settings.
  59. ;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
  60. ; !define MUI_SPECIALBITMAP "qemu.bmp"
  61. !define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
  62. !define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
  63. !define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
  64. ; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
  65. ; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
  66. ; !define MUI_COMPONENTSPAGE_SMALLDESC
  67. ; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
  68. ;--------------------------------
  69. ; Pages.
  70. !insertmacro MUI_PAGE_WELCOME
  71. !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
  72. !insertmacro MUI_PAGE_COMPONENTS
  73. !insertmacro MUI_PAGE_DIRECTORY
  74. !insertmacro MUI_PAGE_INSTFILES
  75. !define MUI_FINISHPAGE_LINK "Visit the QEMU Wiki online!"
  76. !define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
  77. !insertmacro MUI_PAGE_FINISH
  78. !insertmacro MUI_UNPAGE_CONFIRM
  79. !insertmacro MUI_UNPAGE_INSTFILES
  80. ;--------------------------------
  81. ; Languages.
  82. !insertmacro MUI_LANGUAGE "English"
  83. !insertmacro MUI_LANGUAGE "French"
  84. !insertmacro MUI_LANGUAGE "German"
  85. ;--------------------------------
  86. ; The stuff to install.
  87. ;
  88. ; Remember to keep the "Uninstall" section in sync.
  89. Section "${PRODUCT} (required)"
  90. SectionIn RO
  91. ; Set output path to the installation directory.
  92. SetOutPath "$INSTDIR"
  93. File "${SRCDIR}\COPYING"
  94. File "${SRCDIR}\COPYING.LIB"
  95. File "${SRCDIR}\README.rst"
  96. File "${SRCDIR}\VERSION"
  97. File /r "${BINDIR}\keymaps"
  98. File /r "${BINDIR}\share"
  99. !ifdef W64
  100. SetRegView 64
  101. !endif
  102. ; Write the installation path into the registry
  103. WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
  104. ; Write the uninstall keys for Windows
  105. WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
  106. !ifdef DISPLAYVERSION
  107. WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
  108. !endif
  109. WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
  110. WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
  111. WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
  112. WriteUninstaller "qemu-uninstall.exe"
  113. SectionEnd
  114. Section "Tools" SectionTools
  115. SetOutPath "$INSTDIR"
  116. File "${BINDIR}\qemu-img.exe"
  117. File "${BINDIR}\qemu-io.exe"
  118. SectionEnd
  119. SectionGroup "System Emulations" SectionSystem
  120. !include "${BINDIR}\system-emulations.nsh"
  121. SectionGroupEnd
  122. !ifdef DLLDIR
  123. Section "Libraries (DLL)" SectionDll
  124. SetOutPath "$INSTDIR"
  125. File "${DLLDIR}\*.dll"
  126. SectionEnd
  127. !endif
  128. !ifdef CONFIG_DOCUMENTATION
  129. Section "Documentation" SectionDoc
  130. SetOutPath "$INSTDIR\doc"
  131. File /r "${BINDIR}\doc"
  132. SetOutPath "$INSTDIR"
  133. CreateDirectory "$SMPROGRAMS\${PRODUCT}"
  134. CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0
  135. SectionEnd
  136. !endif
  137. ; Optional section (can be disabled by the user)
  138. Section "Start Menu Shortcuts" SectionMenu
  139. CreateDirectory "$SMPROGRAMS\${PRODUCT}"
  140. CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
  141. SectionEnd
  142. ;--------------------------------
  143. ; Uninstaller
  144. Section "Uninstall"
  145. ; Remove registry keys
  146. !ifdef W64
  147. SetRegView 64
  148. !endif
  149. DeleteRegKey HKLM "${UNINST_KEY}"
  150. DeleteRegKey HKLM SOFTWARE\${PRODUCT}
  151. ; Remove shortcuts, if any
  152. Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
  153. Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
  154. Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
  155. RMDir "$SMPROGRAMS\${PRODUCT}"
  156. ; Remove files and directories used
  157. Delete "$INSTDIR\Changelog"
  158. Delete "$INSTDIR\COPYING"
  159. Delete "$INSTDIR\COPYING.LIB"
  160. Delete "$INSTDIR\README.rst"
  161. Delete "$INSTDIR\VERSION"
  162. Delete "$INSTDIR\*.bmp"
  163. Delete "$INSTDIR\*.bin"
  164. Delete "$INSTDIR\*.dll"
  165. Delete "$INSTDIR\*.dtb"
  166. Delete "$INSTDIR\*.fd"
  167. Delete "$INSTDIR\*.img"
  168. Delete "$INSTDIR\*.lid"
  169. Delete "$INSTDIR\*.ndrv"
  170. Delete "$INSTDIR\*.rom"
  171. Delete "$INSTDIR\openbios-*"
  172. Delete "$INSTDIR\qemu-img.exe"
  173. Delete "$INSTDIR\qemu-io.exe"
  174. Delete "$INSTDIR\qemu.exe"
  175. Delete "$INSTDIR\qemu-system-*.exe"
  176. RMDir /r "$INSTDIR\doc"
  177. RMDir /r "$INSTDIR\share"
  178. ; Remove generated files
  179. Delete "$INSTDIR\stderr.txt"
  180. Delete "$INSTDIR\stdout.txt"
  181. ; Remove uninstaller
  182. Delete "${UNINST_EXE}"
  183. RMDir "$INSTDIR"
  184. SectionEnd
  185. ;--------------------------------
  186. ; Descriptions (mouse-over).
  187. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  188. !insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation."
  189. !include "${BINDIR}\system-mui-text.nsh"
  190. !insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
  191. !ifdef DLLDIR
  192. !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)."
  193. !endif
  194. !ifdef CONFIG_DOCUMENTATION
  195. !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation."
  196. !endif
  197. !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries."
  198. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  199. ;--------------------------------
  200. ; Functions.
  201. Function .onInit
  202. !insertmacro MUI_LANGDLL_DISPLAY
  203. FunctionEnd