Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 1 | ;!/usr/bin/makensis |
| 2 | |
| 3 | ; This NSIS script creates an installer for QEMU on Windows. |
| 4 | |
| 5 | ; Copyright (C) 2006-2012 Stefan Weil |
| 6 | ; |
| 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. |
| 11 | ; |
| 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. |
| 16 | ; |
| 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/>. |
| 19 | |
| 20 | ; NSIS_WIN32_MAKENSIS |
| 21 | |
| 22 | !define PRODUCT "QEMU" |
Stefan Hajnoczi | 70b7fba | 2017-11-21 12:04:35 +0000 | [diff] [blame] | 23 | !define URL "https://www.qemu.org/" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 24 | |
| 25 | !define UNINST_EXE "$INSTDIR\qemu-uninstall.exe" |
| 26 | !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" |
| 27 | |
| 28 | !ifndef BINDIR |
| 29 | !define BINDIR nsis.tmp |
| 30 | !endif |
| 31 | !ifndef SRCDIR |
| 32 | !define SRCDIR . |
| 33 | !endif |
| 34 | !ifndef OUTFILE |
| 35 | !define OUTFILE "qemu-setup.exe" |
| 36 | !endif |
| 37 | |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 38 | ; Use maximum compression. |
| 39 | SetCompressor /SOLID lzma |
| 40 | |
| 41 | !include "MUI2.nsh" |
| 42 | |
| 43 | ; The name of the installer. |
| 44 | Name "QEMU" |
| 45 | |
| 46 | ; The file to write |
| 47 | OutFile "${OUTFILE}" |
| 48 | |
| 49 | ; The default installation directory. |
| 50 | !ifdef W64 |
| 51 | InstallDir $PROGRAMFILES64\qemu |
| 52 | !else |
| 53 | InstallDir $PROGRAMFILES\qemu |
| 54 | !endif |
| 55 | |
| 56 | ; Registry key to check for directory (so if you install again, it will |
| 57 | ; overwrite the old one automatically) |
Stefan Weil | 40b9cc5 | 2013-09-28 10:34:30 +0200 | [diff] [blame] | 58 | !ifdef W64 |
| 59 | InstallDirRegKey HKLM "Software\qemu64" "Install_Dir" |
| 60 | !else |
| 61 | InstallDirRegKey HKLM "Software\qemu32" "Install_Dir" |
| 62 | !endif |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 63 | |
| 64 | ; Request administrator privileges for Windows Vista. |
| 65 | RequestExecutionLevel admin |
| 66 | |
| 67 | ;-------------------------------- |
| 68 | ; Interface Settings. |
| 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" |
| 78 | |
| 79 | ;-------------------------------- |
| 80 | ; Pages. |
| 81 | |
| 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 |
| 90 | |
| 91 | !insertmacro MUI_UNPAGE_CONFIRM |
| 92 | !insertmacro MUI_UNPAGE_INSTFILES |
| 93 | |
| 94 | ;-------------------------------- |
| 95 | ; Languages. |
| 96 | |
| 97 | !insertmacro MUI_LANGUAGE "English" |
| 98 | !insertmacro MUI_LANGUAGE "French" |
| 99 | !insertmacro MUI_LANGUAGE "German" |
| 100 | |
| 101 | ;-------------------------------- |
| 102 | |
| 103 | ; The stuff to install. |
Philippe Mathieu-Daudé | e54ecc7 | 2019-07-23 09:02:18 +0200 | [diff] [blame] | 104 | ; |
| 105 | ; Remember to keep the "Uninstall" section in sync. |
| 106 | |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 107 | Section "${PRODUCT} (required)" |
| 108 | |
| 109 | SectionIn RO |
| 110 | |
| 111 | ; Set output path to the installation directory. |
| 112 | SetOutPath "$INSTDIR" |
| 113 | |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 114 | File "${SRCDIR}\COPYING" |
| 115 | File "${SRCDIR}\COPYING.LIB" |
Paolo Bonzini | f64f598 | 2019-09-09 15:08:32 +0200 | [diff] [blame] | 116 | File "${SRCDIR}\README.rst" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 117 | File "${SRCDIR}\VERSION" |
| 118 | |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 119 | File /r "${BINDIR}\keymaps" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 120 | File /r "${BINDIR}\share" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 121 | |
| 122 | !ifdef W64 |
| 123 | SetRegView 64 |
| 124 | !endif |
| 125 | |
| 126 | ; Write the installation path into the registry |
| 127 | WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR" |
| 128 | |
| 129 | ; Write the uninstall keys for Windows |
| 130 | WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU" |
Stefan Weil | 805d8a6 | 2015-05-03 19:57:09 +0200 | [diff] [blame] | 131 | !ifdef DISPLAYVERSION |
| 132 | WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}" |
| 133 | !endif |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 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" |
| 138 | SectionEnd |
| 139 | |
| 140 | Section "Tools" SectionTools |
| 141 | SetOutPath "$INSTDIR" |
| 142 | File "${BINDIR}\qemu-img.exe" |
| 143 | File "${BINDIR}\qemu-io.exe" |
| 144 | SectionEnd |
| 145 | |
| 146 | SectionGroup "System Emulations" SectionSystem |
| 147 | |
| 148 | !include "${BINDIR}\system-emulations.nsh" |
| 149 | |
| 150 | SectionGroupEnd |
| 151 | |
| 152 | !ifdef DLLDIR |
| 153 | Section "Libraries (DLL)" SectionDll |
| 154 | SetOutPath "$INSTDIR" |
| 155 | File "${DLLDIR}\*.dll" |
| 156 | SectionEnd |
| 157 | !endif |
| 158 | |
| 159 | !ifdef CONFIG_DOCUMENTATION |
| 160 | Section "Documentation" SectionDoc |
Paolo Bonzini | 70903cc | 2021-01-21 07:17:13 -0500 | [diff] [blame] | 161 | SetOutPath "$INSTDIR\doc" |
| 162 | File /r "${BINDIR}\doc" |
Peter Maydell | 373c706 | 2020-03-06 13:47:51 +0000 | [diff] [blame] | 163 | SetOutPath "$INSTDIR" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 164 | CreateDirectory "$SMPROGRAMS\${PRODUCT}" |
Paolo Bonzini | 70903cc | 2021-01-21 07:17:13 -0500 | [diff] [blame] | 165 | CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0 |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 166 | SectionEnd |
| 167 | !endif |
| 168 | |
| 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 |
| 173 | SectionEnd |
| 174 | |
| 175 | ;-------------------------------- |
| 176 | |
| 177 | ; Uninstaller |
| 178 | |
| 179 | Section "Uninstall" |
| 180 | ; Remove registry keys |
| 181 | !ifdef W64 |
| 182 | SetRegView 64 |
| 183 | !endif |
| 184 | DeleteRegKey HKLM "${UNINST_KEY}" |
| 185 | DeleteRegKey HKLM SOFTWARE\${PRODUCT} |
| 186 | |
| 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}" |
| 192 | |
| 193 | ; Remove files and directories used |
| 194 | Delete "$INSTDIR\Changelog" |
| 195 | Delete "$INSTDIR\COPYING" |
| 196 | Delete "$INSTDIR\COPYING.LIB" |
Paolo Bonzini | f64f598 | 2019-09-09 15:08:32 +0200 | [diff] [blame] | 197 | Delete "$INSTDIR\README.rst" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 198 | Delete "$INSTDIR\VERSION" |
| 199 | Delete "$INSTDIR\*.bmp" |
| 200 | Delete "$INSTDIR\*.bin" |
| 201 | Delete "$INSTDIR\*.dll" |
| 202 | Delete "$INSTDIR\*.dtb" |
Philippe Mathieu-Daudé | e54ecc7 | 2019-07-23 09:02:18 +0200 | [diff] [blame] | 203 | Delete "$INSTDIR\*.fd" |
| 204 | Delete "$INSTDIR\*.img" |
| 205 | Delete "$INSTDIR\*.lid" |
| 206 | Delete "$INSTDIR\*.ndrv" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 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" |
Paolo Bonzini | 70903cc | 2021-01-21 07:17:13 -0500 | [diff] [blame] | 213 | RMDir /r "$INSTDIR\doc" |
Stefan Weil | f53ec69 | 2013-07-15 23:49:57 +0200 | [diff] [blame] | 214 | RMDir /r "$INSTDIR\share" |
| 215 | ; Remove generated files |
| 216 | Delete "$INSTDIR\stderr.txt" |
| 217 | Delete "$INSTDIR\stdout.txt" |
| 218 | ; Remove uninstaller |
| 219 | Delete "${UNINST_EXE}" |
| 220 | RMDir "$INSTDIR" |
| 221 | SectionEnd |
| 222 | |
| 223 | ;-------------------------------- |
| 224 | |
| 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." |
| 233 | !ifdef DLLDIR |
| 234 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)." |
| 235 | !endif |
| 236 | !ifdef CONFIG_DOCUMENTATION |
| 237 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation." |
| 238 | !endif |
| 239 | !insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries." |
| 240 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 241 | |
| 242 | ;-------------------------------- |
| 243 | ; Functions. |
| 244 | |
| 245 | Function .onInit |
| 246 | !insertmacro MUI_LANGDLL_DISPLAY |
| 247 | FunctionEnd |