qemu.nsi 6.7 KB

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