subsurface/packaging/windows/subsurface.nsi.in
Dirk Hohndel 9383693928 Create installer with qmake
This is seriously flawed. makensis is run twice for some reason. I also
noticed that the data and xslt directories under packaging/windows aren't
created when running make install. Running
	make -f Makefile.Release install_marbledir install_deploy
works, but obviously this should be taken care of by the dependency.

The installed binary under Windows is not finding its icon, the
translations are missing... lots of work left to do here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 13:05:14 +09:00

183 lines
5.4 KiB
Text

#
# Subsurface NSIS installer script
#
# This installer creator needs to be run with:
# makensis subsurface.nsi
#
# It assumes that packaging/windows/dll is a symlink to
# the directory in which the required Windows DLLs are installed
# (in my case that's /usr/i686-w64-mingw32/sys-root/mingw/bin)
#
#--------------------------------
# Include Modern UI
!include "MUI2.nsh"
#--------------------------------
# General
# Program version
!define SUBSURFACE_VERSION "VERSIONTOKEN"
# VIProductVersion requires version in x.x.x.x format
!define SUBSURFACE_VIPRODUCTVERSION "PRODVTOKEN"
# Installer name and filename
Name "Subsurface"
Caption "Subsurface ${SUBSURFACE_VERSION} Setup"
OutFile "subsurface-${SUBSURFACE_VERSION}.exe"
# Icon to use for the installer
!define MUI_ICON "subsurface.ico"
# Default installation folder
InstallDir "$PROGRAMFILES\Subsurface"
# Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Subsurface" ""
# Request application privileges
RequestExecutionLevel admin
#--------------------------------
# Version information
VIProductVersion "${SUBSURFACE_VIPRODUCTVERSION}"
VIAddVersionKey "ProductName" "Subsurface"
VIAddVersionKey "FileDescription" "Subsurface - an open source dive log program."
VIAddVersionKey "FileVersion" "${SUBSURFACE_VERSION}"
VIAddVersionKey "LegalCopyright" "GPL v.2"
VIAddVersionKey "ProductVersion" "${SUBSURFACE_VERSION}"
#--------------------------------
# Settings
# Show a warn on aborting installation
!define MUI_ABORTWARNING
# Defines the target start menu folder
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Subsurface"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
#--------------------------------
# Variables
Var StartMenuFolder
#--------------------------------
# Pages
# Installer pages
!insertmacro MUI_PAGE_LICENSE "..\..\gpl-2.0.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
# Uninstaller pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
#--------------------------------
# Languages
!insertmacro MUI_LANGUAGE "English"
#--------------------------------
# Default installer section
Section
SetShellVarContext all
# Installation path
SetOutPath "$INSTDIR"
# Delete any already installed DLLs to avoid buildup of various
# versions of the same library when upgrading
Delete "$INSTDIR\*.dll"
# Files to include in installer
File subsurface.exe
File /r xslt
File /r data
File /r images
File dll\iconv.dll
File dll\libdivecomputer-0.dll
File dll\libintl-8.dll
File dll\libpng15-15.dll
File dll\libusb-1.0.dll
File dll\libxml2-2.dll
File dll\libxslt-1.dll
File dll\zlib1.dll
File dll\libzip-2.dll
File dll\libsqlite3-0.dll
File dll\libgcc_s_sjlj-1.dll
File dll\libstdc++-6.dll
File dll\QtCore4.dll
File dll\QtGui4.dll
File dll\QtNetwork4.dll
File dll\QtSvg4.dll
File dll\QtWebKit4.dll
File dll\QtDeclarative4.dll
File dll\QtScript4.dll
File dll\QtSql4.dll
File dll\QtXmlPatterns4.dll
File dll\QtXml4.dll
File dll\libmarblewidget.dll
File subsurface.ico
# Store installation folder in registry
WriteRegStr HKCU "Software\Subsurface" "" $INSTDIR
# Create shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Subsurface.lnk" "$INSTDIR\subsurface.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Subsurface.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$DESKTOP\Subsurface.lnk" "$INSTDIR\subsurface.exe" ""
!insertmacro MUI_STARTMENU_WRITE_END
# Create the uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subsurface" \
"DisplayName" "Subsurface"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subsurface" \
"DisplayIcon" "$INSTDIR\subsurface.ico"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subsurface" \
"UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subsurface" \
"DisplayVersion" ${SUBSURFACE_VERSION}
SectionEnd
#--------------------------------
# Uninstaller section
Section "Uninstall"
SetShellVarContext all
# Delete installed files
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\xslt\*.xslt"
Delete "$INSTDIR\freetype-config"
Delete "$INSTDIR\subsurface.exe"
Delete "$INSTDIR\subsurface.ico"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR\share"
RMDir /r "$INSTDIR\xslt"
RMDir "$INSTDIR"
# Remove shortcuts
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Subsurface.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Subsurface.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
Delete "$DESKTOP\Subsurface.lnk"
# Remove registry entries
DeleteRegKey /ifempty HKCU "Software\Subsurface"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subsurface"
SectionEnd