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