2013-07-16 01:49:57 +04:00
;!/usr/bin/makensis
; This NSIS script creates an installer for QEMU on Windows.
; Copyright (C) 2006-2012 Stefan Weil
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) version 3 or any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
; NSIS_WIN32_MAKENSIS
!define PRODUCT "QEMU"
2017-11-21 15:04:35 +03:00
!define URL "https://www.qemu.org/"
2013-07-16 01:49:57 +04:00
!define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
!ifndef BINDIR
!define BINDIR nsis.tmp
!endif
!ifndef SRCDIR
!define SRCDIR .
!endif
!ifndef OUTFILE
!define OUTFILE "qemu-setup.exe"
!endif
2022-03-05 13:57:42 +03:00
; Build a unicode installer
Unicode true
2013-07-16 01:49:57 +04:00
; Use maximum compression.
SetCompressor /SOLID lzma
!include "MUI2.nsh"
; The name of the installer.
Name "QEMU"
; The file to write
OutFile "${OUTFILE}"
; The default installation directory.
!ifdef W64
InstallDir $PROGRAMFILES64\qemu
!else
InstallDir $PROGRAMFILES\qemu
!endif
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
2013-09-28 12:34:30 +04:00
!ifdef W64
InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
!else
InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
!endif
2013-07-16 01:49:57 +04:00
; Request administrator privileges for Windows Vista.
RequestExecutionLevel admin
;--------------------------------
; Interface Settings.
;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
; !define MUI_SPECIALBITMAP "qemu.bmp"
!define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
!define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
; !define MUI_COMPONENTSPAGE_SMALLDESC
; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
;--------------------------------
; Pages.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_LINK "Visit the QEMU Wiki online!"
!define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
; Languages.
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
;--------------------------------
; The stuff to install.
2019-07-23 10:02:18 +03:00
;
; Remember to keep the "Uninstall" section in sync.
2013-07-16 01:49:57 +04:00
Section "${PRODUCT} (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath "$INSTDIR"
File "${SRCDIR}\COPYING"
File "${SRCDIR}\COPYING.LIB"
2019-09-09 16:08:32 +03:00
File "${SRCDIR}\README.rst"
2013-07-16 01:49:57 +04:00
File "${SRCDIR}\VERSION"
File /r "${BINDIR}\keymaps"
File /r "${BINDIR}\share"
!ifdef W64
SetRegView 64
!endif
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
2015-05-03 20:57:09 +03:00
!ifdef DISPLAYVERSION
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${DISPLAYVERSION}"
!endif
2013-07-16 01:49:57 +04:00
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
WriteUninstaller "qemu-uninstall.exe"
SectionEnd
Section "Tools" SectionTools
SetOutPath "$INSTDIR"
File "${BINDIR}\qemu-img.exe"
File "${BINDIR}\qemu-io.exe"
SectionEnd
SectionGroup "System Emulations" SectionSystem
!include "${BINDIR}\system-emulations.nsh"
SectionGroupEnd
!ifdef DLLDIR
Section "Libraries (DLL)" SectionDll
SetOutPath "$INSTDIR"
File "${DLLDIR}\*.dll"
SectionEnd
!endif
!ifdef CONFIG_DOCUMENTATION
Section "Documentation" SectionDoc
2021-01-21 15:17:13 +03:00
SetOutPath "$INSTDIR\doc"
File /r "${BINDIR}\doc"
2020-03-06 16:47:51 +03:00
SetOutPath "$INSTDIR"
2013-07-16 01:49:57 +04:00
CreateDirectory "$SMPROGRAMS\${PRODUCT}"
2021-01-21 15:17:13 +03:00
CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\doc\index.html" "" "$INSTDIR\doc\index.html" 0
2013-07-16 01:49:57 +04:00
SectionEnd
!endif
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts" SectionMenu
CreateDirectory "$SMPROGRAMS\${PRODUCT}"
CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
!ifdef W64
SetRegView 64
!endif
DeleteRegKey HKLM "${UNINST_KEY}"
DeleteRegKey HKLM SOFTWARE\${PRODUCT}
; Remove shortcuts, if any
Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${PRODUCT}"
; Remove files and directories used
Delete "$INSTDIR\Changelog"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\COPYING.LIB"
2019-09-09 16:08:32 +03:00
Delete "$INSTDIR\README.rst"
2013-07-16 01:49:57 +04:00
Delete "$INSTDIR\VERSION"
Delete "$INSTDIR\*.bmp"
Delete "$INSTDIR\*.bin"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.dtb"
2019-07-23 10:02:18 +03:00
Delete "$INSTDIR\*.fd"
Delete "$INSTDIR\*.img"
Delete "$INSTDIR\*.lid"
Delete "$INSTDIR\*.ndrv"
2013-07-16 01:49:57 +04:00
Delete "$INSTDIR\*.rom"
Delete "$INSTDIR\openbios-*"
Delete "$INSTDIR\qemu-img.exe"
Delete "$INSTDIR\qemu-io.exe"
Delete "$INSTDIR\qemu.exe"
Delete "$INSTDIR\qemu-system-*.exe"
2021-01-21 15:17:13 +03:00
RMDir /r "$INSTDIR\doc"
2013-07-16 01:49:57 +04:00
RMDir /r "$INSTDIR\share"
; Remove generated files
Delete "$INSTDIR\stderr.txt"
Delete "$INSTDIR\stdout.txt"
; Remove uninstaller
Delete "${UNINST_EXE}"
RMDir "$INSTDIR"
SectionEnd
;--------------------------------
; Descriptions (mouse-over).
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation."
2022-03-05 13:57:43 +03:00
!include "${BINDIR}\system-mui-text.nsh"
2013-07-16 01:49:57 +04:00
!insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
!ifdef DLLDIR
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)."
!endif
!ifdef CONFIG_DOCUMENTATION
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation."
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Functions.
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd