qemu.nsi (7167B)
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" 23!define URL "https://www.qemu.org/" 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 38; Use maximum compression. 39SetCompressor /SOLID lzma 40 41!include "MUI2.nsh" 42 43; The name of the installer. 44Name "QEMU" 45 46; The file to write 47OutFile "${OUTFILE}" 48 49; The default installation directory. 50!ifdef W64 51InstallDir $PROGRAMFILES64\qemu 52!else 53InstallDir $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) 58!ifdef W64 59InstallDirRegKey HKLM "Software\qemu64" "Install_Dir" 60!else 61InstallDirRegKey HKLM "Software\qemu32" "Install_Dir" 62!endif 63 64; Request administrator privileges for Windows Vista. 65RequestExecutionLevel 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. 104; 105; Remember to keep the "Uninstall" section in sync. 106 107Section "${PRODUCT} (required)" 108 109 SectionIn RO 110 111 ; Set output path to the installation directory. 112 SetOutPath "$INSTDIR" 113 114 File "${SRCDIR}\COPYING" 115 File "${SRCDIR}\COPYING.LIB" 116 File "${SRCDIR}\README.rst" 117 File "${SRCDIR}\VERSION" 118 119 File /r "${BINDIR}\keymaps" 120 File /r "${BINDIR}\share" 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" 131!ifdef DISPLAYVERSION 132 WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}" 133!endif 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" 138SectionEnd 139 140Section "Tools" SectionTools 141 SetOutPath "$INSTDIR" 142 File "${BINDIR}\qemu-img.exe" 143 File "${BINDIR}\qemu-io.exe" 144SectionEnd 145 146SectionGroup "System Emulations" SectionSystem 147 148!include "${BINDIR}\system-emulations.nsh" 149 150SectionGroupEnd 151 152!ifdef DLLDIR 153Section "Libraries (DLL)" SectionDll 154 SetOutPath "$INSTDIR" 155 File "${DLLDIR}\*.dll" 156SectionEnd 157!endif 158 159!ifdef CONFIG_DOCUMENTATION 160Section "Documentation" SectionDoc 161 SetOutPath "$INSTDIR\doc" 162 File /r "${BINDIR}\doc" 163 SetOutPath "$INSTDIR" 164 CreateDirectory "$SMPROGRAMS\${PRODUCT}" 165 CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0 166SectionEnd 167!endif 168 169; Optional section (can be disabled by the user) 170Section "Start Menu Shortcuts" SectionMenu 171 CreateDirectory "$SMPROGRAMS\${PRODUCT}" 172 CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0 173SectionEnd 174 175;-------------------------------- 176 177; Uninstaller 178 179Section "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" 197 Delete "$INSTDIR\README.rst" 198 Delete "$INSTDIR\VERSION" 199 Delete "$INSTDIR\*.bmp" 200 Delete "$INSTDIR\*.bin" 201 Delete "$INSTDIR\*.dll" 202 Delete "$INSTDIR\*.dtb" 203 Delete "$INSTDIR\*.fd" 204 Delete "$INSTDIR\*.img" 205 Delete "$INSTDIR\*.lid" 206 Delete "$INSTDIR\*.ndrv" 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" 213 RMDir /r "$INSTDIR\doc" 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" 221SectionEnd 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 245Function .onInit 246 !insertmacro MUI_LANGDLL_DISPLAY 247FunctionEnd