Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@owncloud.com>2012-04-02 15:44:24 +0400
committerKlaas Freitag <freitag@owncloud.com>2012-04-02 15:44:24 +0400
commit95f6f90cb5232054d723d633564e3dbdee240d47 (patch)
tree9b50860202be63b6dcde213054be0112a0ddcced /cmake
parent43a9d1dcd04c1483e06dd4f77e6ced9b7c9e4586 (diff)
Add win32 packaging with nsi
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddAppIconMacro.cmake114
-rw-r--r--cmake/modules/NSIS.InstallOptions.ini.in24
-rw-r--r--cmake/modules/NSIS.template.in615
3 files changed, 753 insertions, 0 deletions
diff --git a/cmake/modules/AddAppIconMacro.cmake b/cmake/modules/AddAppIconMacro.cmake
new file mode 100644
index 000000000..64f8f3210
--- /dev/null
+++ b/cmake/modules/AddAppIconMacro.cmake
@@ -0,0 +1,114 @@
+SET(WINDRES_EXECUTABLE ${CMAKE_RC_COMPILER})
+
+# This macro is taken from kdelibs/cmake/modules/KDE4Macros.cmake.
+#
+# Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org>
+# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
+# Copyright (c) 2007 Matthias Kretz <kretz@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file [in KDE repositories].
+
+
+# adds application icon to target source list
+# for detailed documentation see the top of FindKDE4Internal.cmake
+macro (KDE4_ADD_APP_ICON appsources pattern)
+ set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${appsources})
+
+ if (WIN32)
+ if(NOT WINCE)
+ find_program(PNG2ICO_EXECUTABLE NAMES png2ico)
+ else(NOT WINCE)
+ find_program(PNG2ICO_EXECUTABLE NAMES png2ico PATHS ${HOST_BINDIR} NO_DEFAULT_PATH )
+ endif(NOT WINCE)
+ find_program(WINDRES_EXECUTABLE NAMES windres)
+ if(MSVC)
+ set(WINDRES_EXECUTABLE TRUE)
+ endif(MSVC)
+ if (PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE)
+ string(REPLACE "*" "(.*)" pattern_rx "${pattern}")
+ file(GLOB files "${pattern}")
+ foreach (it ${files})
+ string(REGEX REPLACE "${pattern_rx}" "\\1" fn "${it}")
+ if (fn MATCHES ".*16.*" )
+ list (APPEND _icons ${it})
+ endif (fn MATCHES ".*16.*")
+ if (fn MATCHES ".*32.*" )
+ list (APPEND _icons ${it})
+ endif (fn MATCHES ".*32.*")
+ if (fn MATCHES ".*48.*" )
+ list (APPEND _icons ${it})
+ endif (fn MATCHES ".*48.*")
+ if (fn MATCHES ".*64.*" )
+ list (APPEND _icons ${it})
+ endif (fn MATCHES ".*64.*")
+ if (fn MATCHES ".*128.*" )
+ list (APPEND _icons ${it})
+ endif (fn MATCHES ".*128.*")
+ endforeach (it)
+ if (_icons)
+ add_custom_command(OUTPUT ${_outfilename}.ico ${_outfilename}.rc
+ COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${_icons}
+ DEPENDS ${PNG2ICO_EXECUTABLE} ${_icons}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ if (MINGW)
+ add_custom_command(OUTPUT ${_outfilename}_res.o
+ COMMAND ${WINDRES_EXECUTABLE} ARGS -i ${_outfilename}.rc -o ${_outfilename}_res.o --include-dir=${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${WINDRES_EXECUTABLE} ${_outfilename}.rc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ list(APPEND ${appsources} ${_outfilename}_res.o)
+ else(MINGW)
+ list(APPEND ${appsources} ${_outfilename}.rc)
+ endif(MINGW)
+ else(_icons)
+ message(STATUS "Unable to find a related icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!")
+ endif(_icons)
+ else(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE)
+ message(STATUS "Unable to find the png2ico or windres utilities - application will not have an application icon!")
+ endif(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE)
+ endif(WIN32)
+ if (Q_WS_MAC)
+ # first convert image to a tiff using the Mac OS X "sips" utility,
+ # then use tiff2icns to convert to an icon
+ find_program(SIPS_EXECUTABLE NAMES sips)
+ find_program(TIFF2ICNS_EXECUTABLE NAMES tiff2icns)
+ if (SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE)
+ file(GLOB_RECURSE files "${pattern}")
+ # we can only test for the 128-icon like that - we don't use patterns anymore
+ foreach (it ${files})
+ if (it MATCHES ".*128.*" )
+ set (_icon ${it})
+ endif (it MATCHES ".*128.*")
+ endforeach (it)
+
+ if (_icon)
+
+ # first, get the basename of our app icon
+ add_custom_command(OUTPUT ${_outfilename}.icns ${outfilename}.tiff
+ COMMAND ${SIPS_EXECUTABLE} -s format tiff ${_icon} --out ${outfilename}.tiff
+ COMMAND ${TIFF2ICNS_EXECUTABLE} ${outfilename}.tiff ${_outfilename}.icns
+ DEPENDS ${_icon}
+ )
+
+ # This will register the icon into the bundle
+ set(MACOSX_BUNDLE_ICON_FILE ${appsources}.icns)
+
+ # Append the icns file to the sources list so it will be a dependency to the
+ # main target
+ list(APPEND ${appsources} ${_outfilename}.icns)
+
+ # Install the icon into the Resources dir in the bundle
+ set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+
+ else(_icon)
+ # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly?
+ message(STATUS "Unable to find an 128x128 icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!")
+ endif(_icon)
+
+ else(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE)
+ message(STATUS "Unable to find the sips and tiff2icns utilities - application will not have an application icon!")
+ endif(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE)
+ endif(Q_WS_MAC)
+endmacro (KDE4_ADD_APP_ICON)
diff --git a/cmake/modules/NSIS.InstallOptions.ini.in b/cmake/modules/NSIS.InstallOptions.ini.in
new file mode 100644
index 000000000..566c0b47d
--- /dev/null
+++ b/cmake/modules/NSIS.InstallOptions.ini.in
@@ -0,0 +1,24 @@
+[Settings]
+NumFields=3
+
+[Field 1]
+Type=Label
+Left=0
+Right=-1
+Top=0
+Bottom=24
+
+[Field 2]
+Type=RadioButton
+Left=30
+Right=-1
+Top=50
+Bottom=58
+State=1
+
+[Field 3]
+Type=RadioButton
+Left=30
+Right=-1
+Top=70
+Bottom=78
diff --git a/cmake/modules/NSIS.template.in b/cmake/modules/NSIS.template.in
new file mode 100644
index 000000000..f5f015803
--- /dev/null
+++ b/cmake/modules/NSIS.template.in
@@ -0,0 +1,615 @@
+;ownCloud installer script.
+
+!define APPLICATION_NAME ownCloud
+!define APPLICATION_EXECUTABLE owncloud.exe
+!define APPLICATION_DOMAIN owncloud.com
+
+!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
+
+
+;-----------------------------------------------------------------------------
+; Some installer script options (comment-out options not required)
+;-----------------------------------------------------------------------------
+;!define OPTION_LICENSE_AGREEMENT
+!define OPTION_UAC_PLUGIN_ENHANCED
+!define OPTION_SECTION_SC_START_MENU
+!define OPTION_SECTION_SC_DESKTOP
+!define OPTION_SECTION_SC_QUICK_LAUNCH
+!define OPTION_FINISHPAGE
+!define OPTION_FINISHPAGE_LAUNCHER
+; !define OPTION_FINISHPAGE_RELEASE_NOTES
+
+;-----------------------------------------------------------------------------
+; Some paths.
+;-----------------------------------------------------------------------------
+!ifndef MING_PATH
+ !define MING_PATH "/usr/i686-w64-mingw32/sys-root/mingw"
+!endif
+!define MING_BIN "${MING_PATH}/bin"
+!define MING_LIB "${MING_PATH}/lib"
+!define BUILD_PATH "@CMAKE_BINARY_DIR@"
+!define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
+!define QT_DLL_PATH "${MING_BIN}"
+!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
+!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
+
+!define NSI_PATH "${SOURCE_PATH}/admin/win/nsi"
+
+;-----------------------------------------------------------------------------
+; Installer version
+;-----------------------------------------------------------------------------
+
+!define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
+!define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
+!define VER_BUILD "@CPACK_PACKAGE_VERSION_PATCH@"
+!define VERSION "@CPACK_PACKAGE_VERSION@"
+
+;-----------------------------------------------------------------------------
+; Installer build timestamp.
+;-----------------------------------------------------------------------------
+!define /date BUILD_TIME "built on %Y/%m/%d at %I:%M %p"
+
+;-----------------------------------------------------------------------------
+; Initial installer setup and definitions.
+;-----------------------------------------------------------------------------
+Name "@CPACK_NSIS_PACKAGE_NAME@"
+Caption "${APPLICATION_NAME} Installer"
+BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
+OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+InstallDirRegKey HKCU "Software\${APPLICATION_NAME}" ""
+InstType Standard
+InstType Full
+InstType Minimal
+CRCCheck On
+SetCompressor @CPACK_NSIS_COMPRESSOR@
+RequestExecutionLevel user ;Now using the UAC plugin.
+ReserveFile NSIS.InstallOptions.ini
+ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
+
+@CPACK_NSIS_SECTION_SELECTED_VARS@
+
+;-----------------------------------------------------------------------------
+; Include some required header files.
+;-----------------------------------------------------------------------------
+!include LogicLib.nsh ;Used by APPDATA uninstaller.
+!include nsDialogs.nsh ;Used by APPDATA uninstaller.
+!include MUI2.nsh ;Used by APPDATA uninstaller.
+!include InstallOptions.nsh ;Required by MUI2 to support old MUI_INSTALLOPTIONS.
+!include Memento.nsh ;Remember user selections.
+!include WinVer.nsh ;Windows version detection.
+!include WordFunc.nsh ;Used by VersionCompare macro function.
+!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
+
+;-----------------------------------------------------------------------------
+; Memento selections stored in registry.
+;-----------------------------------------------------------------------------
+!define MEMENTO_REGISTRY_ROOT HKLM
+!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}
+
+;-----------------------------------------------------------------------------
+; Modern User Interface (MUI) defintions and setup.
+;-----------------------------------------------------------------------------
+!define MUI_ABORTWARNING
+!define MUI_ICON ${NSI_PATH}\installer.ico
+!define MUI_UNICON ${NSI_PATH}\installer.ico
+!define MUI_WELCOMEFINISHPAGE_BITMAP ${NSI_PATH}\welcome_oc.bmp
+!define MUI_WELCOMEPAGE_TITLE "@CPACK_PACKAGE_NAME@ ${VERSION} Setup$\r$\nInstaller"
+!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation.$\r$\n$\r$\n$_CLICK"
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP ${NSI_PATH}\page_header_oc.bmp
+!define MUI_COMPONENTSPAGE_SMALLDESC
+!define MUI_FINISHPAGE_TITLE "@CPACK_PACKAGE_NAME@ Install Completed"
+!define MUI_FINISHPAGE_LINK "Click here to visit the @CPACK_PACKAGE_NAME@ website."
+!define MUI_FINISHPAGE_NOREBOOTSUPPORT
+!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
+ !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
+ !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NOTES.txt"
+ !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show release notes"
+!endif
+!ifdef OPTION_FINISHPAGE_LAUNCHER
+ !define MUI_FINISHPAGE_NOAUTOCLOSE
+ !define MUI_FINISHPAGE_RUN
+ !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
+!endif
+
+;-----------------------------------------------------------------------------
+; Page macros.
+;-----------------------------------------------------------------------------
+!insertmacro MUI_PAGE_WELCOME
+!ifdef OPTION_LICENSE_AGREEMENT
+ !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
+!endif
+Page custom PageReinstall PageLeaveReinstall
+!insertmacro MUI_PAGE_COMPONENTS
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!ifdef OPTION_FINISHPAGE
+ !insertmacro MUI_PAGE_FINISH
+!endif
+!insertmacro MUI_UNPAGE_CONFIRM
+UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
+!insertmacro MUI_UNPAGE_INSTFILES
+
+;-----------------------------------------------------------------------------
+; Other MUI macros.
+;-----------------------------------------------------------------------------
+!insertmacro MUI_LANGUAGE "English"
+
+##############################################################################
+# #
+# FINISH PAGE LAUNCHER FUNCTIONS #
+# #
+##############################################################################
+
+Function LaunchApplication
+ ${UAC.CallFunctionAsUser} LaunchApplicationAsUser
+FunctionEnd
+
+Function LaunchApplicationAsUser
+ Exec "$INSTDIR\${APPLICATION_EXECUTABLE}"
+FunctionEnd
+
+##############################################################################
+# #
+# PROCESS HANDLING FUNCTIONS AND MACROS #
+# #
+##############################################################################
+
+!macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
+ Processes::FindProcess ${processName}
+ StrCmp $R0 "0" ${gotoWhenNotFound} ${gotoWhenFound}
+!macroend
+
+!macro ConfirmEndProcess processName
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION \
+ "Found ${processName} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?" \
+ IDYES process_${processName}_kill IDNO process_${processName}_ended
+ process_${processName}_kill:
+ DetailPrint "Killing ${processName} processes."
+ Processes::KillProcess ${processName}
+ Sleep 1500
+ StrCmp $R0 "1" process_${processName}_ended
+ DetailPrint "Process to kill not found!"
+ process_${processName}_ended:
+!macroend
+
+!macro CheckAndConfirmEndProcess processName
+ !insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
+ !insertmacro ConfirmEndProcess ${processName}
+ no_process_${processName}_to_end:
+!macroend
+
+Function EnsureOwncloudShutdown
+ !insertmacro CheckAndConfirmEndProcess "${APPLICATION_EXECUTABLE}"
+FunctionEnd
+
+##############################################################################
+# #
+# RE-INSTALLER FUNCTIONS #
+# #
+##############################################################################
+
+Function PageReinstall
+ ReadRegStr $R0 HKLM "Software\${APPLICATION_NAME}" ""
+ StrCmp $R0 "" 0 +2
+ Abort
+
+ ;Detect version
+ ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
+ IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
+ minor_check:
+ ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
+ IntCmp $R0 ${VER_MINOR} build_check new_version older_version
+ build_check:
+ ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
+ IntCmp $R0 ${VER_BUILD} same_version new_version older_version
+
+ new_version:
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "An older version of ${APPLICATION_NAME} is installed on your system. It is recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${APPLICATION_NAME}."
+ StrCpy $R0 "1"
+ Goto reinst_start
+
+ older_version:
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "A newer version of ${APPLICATION_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it is better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${APPLICATION_NAME}."
+ StrCpy $R0 "1"
+ Goto reinst_start
+
+ same_version:
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "${APPLICATION_NAME} ${VERSION} is already installed.\r\nSelect the operation you want to perform and click Next to continue."
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Add/Reinstall components"
+ !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Uninstall ${APPLICATION_NAME}"
+ !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
+ StrCpy $R0 "2"
+
+ reinst_start:
+ !insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+FunctionEnd
+
+Function PageLeaveReinstall
+ !insertmacro INSTALLOPTIONS_READ $R1 "NSIS.InstallOptions.ini" "Field 2" "State"
+ StrCmp $R0 "1" 0 +2
+ StrCmp $R1 "1" reinst_uninstall reinst_done
+ StrCmp $R0 "2" 0 +3
+ StrCmp $R1 "1" reinst_done reinst_uninstall
+ reinst_uninstall:
+ ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString"
+ HideWindow
+ ClearErrors
+ ExecWait '$R1 _?=$INSTDIR'
+ IfErrors no_remove_uninstaller
+ IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" no_remove_uninstaller
+ Delete $R1
+ RMDir $INSTDIR
+ no_remove_uninstaller:
+ StrCmp $R0 "2" 0 +3
+ UAC::Unload
+ Quit
+ BringToFront
+ reinst_done:
+FunctionEnd
+
+##############################################################################
+# #
+# INSTALLER SECTIONS #
+# #
+##############################################################################
+Section "${APPLICATION_NAME}" SEC_OWNCLOUD_PLAYER
+ SectionIn 1 2 3 RO
+ SetDetailsPrint listonly
+
+ SetDetailsPrint textonly
+ DetailPrint "Installing ${APPLICATION_NAME} essentials."
+ SetDetailsPrint listonly
+ SetOutPath "$INSTDIR"
+
+ !ifdef INSTALL_PATH
+ ;Main executable.
+ File "${INSTALL_PATH}\bin\${APPLICATION_EXECUTABLE}"
+ !endif
+ !ifndef INSTALL_PATH
+ ;Main executable.
+ File "${BUILD_PATH}\bin\${APPLICATION_EXECUTABLE}"
+
+ SetOutPath "$INSTDIR\modules"
+ ; FIXME: fix installation dir of module, currently needs manual copying to
+ ; /usr/i686-w64-mingw32/sys-root/mingw/bin/csync_modules/
+
+ File "/home/kf/owncloud.com/win/buildcsync/modules/csync_owncloud.dll"
+ SetOutPath "$INSTDIR"
+ !endif
+
+
+
+ ;License & release notes.
+ File "@CPACK_RESOURCE_FILE_LICENSE@"
+ File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
+
+ ;QT stuff:
+ File "${QT_DLL_PATH}\QtCore4.dll"
+ File "${QT_DLL_PATH}\QtGui4.dll"
+ File "${QT_DLL_PATH}\QtNetwork4.dll"
+ File "${QT_DLL_PATH}\QtXml4.dll"
+
+ File "/home/kf/owncloud.com/win/buildcsync/src/libcsync.dll"
+ File "${MING_BIN}\libsqlite3-0.dll"
+ File "${MING_BIN}\libiniparser.dll"
+ File "${MING_BIN}\libdl.dll"
+ File "${MING_BIN}\libpng15-15.dll"
+
+ ; ownCloud plugin
+ File "${MING_BIN}\libgcrypt-11.dll"
+ File "${MING_BIN}\libgnutls-26.dll"
+ File "${MING_BIN}\libgpg-error-0.dll"
+ File "${MING_BIN}\libintl-8.dll"
+ File "${MING_BIN}\libneon-27.dll"
+ File "${MING_BIN}\libtasn1-3.dll"
+ File "${MING_BIN}\libxml2-2.dll"
+
+ ;MinGW stuff
+ File "${MING_BIN}\libgcc_s_sjlj-1.dll"
+ File "${MING_BIN}\libstdc++-6.dll"
+
+ ; Other
+ ;File "${MING_BIN}\libpng15-15.dll"
+ ;File "${MING_BIN}\libjpeg-8.dll"
+ File "${MING_BIN}\zlib1.dll"
+
+ ; CSync configs
+ File "/home/kf/owncloud.com/win/csync/config/csync.conf"
+ File "/home/kf/owncloud.com/mirall/exclude.lst"
+
+SectionEnd
+
+SectionGroup "Shortcuts"
+
+!ifdef OPTION_SECTION_SC_START_MENU
+ ${MementoSection} "Start Menu Program Group" SEC_START_MENU
+ SectionIn 1 2
+ SetDetailsPrint textonly
+ DetailPrint "Adding shortcuts for the ${APPLICATION_NAME} program group to the Start Menu."
+ SetDetailsPrint listonly
+ SetShellVarContext all
+ RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
+ CreateDirectory "$SMPROGRAMS\${APPLICATION_NAME}"
+ CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
+ CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
+ CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
+ CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
+ SetShellVarContext current
+ ${MementoSectionEnd}
+!endif
+
+!ifdef OPTION_SECTION_SC_DESKTOP
+ ${MementoSection} "Desktop Shortcut" SEC_DESKTOP
+ SectionIn 1 2
+ SetDetailsPrint textonly
+ DetailPrint "Creating Desktop Shortcuts"
+ SetDetailsPrint listonly
+ CreateShortCut "$DESKTOP\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
+ ${MementoSectionEnd}
+!endif
+
+!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
+ ${MementoSection} "Quick Launch Shortcut" SEC_QUICK_LAUNCH
+ SectionIn 1 2
+ SetDetailsPrint textonly
+ DetailPrint "Creating Quick Launch Shortcut"
+ SetDetailsPrint listonly
+ CreateShortCut "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
+ ${MementoSectionEnd}
+!endif
+
+SectionGroupEnd
+
+${MementoSectionDone}
+
+; Installer section descriptions
+;--------------------------------
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APPLICATION} "${APPLICATION_NAME} essentials."
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} "{APPLICATION_NAME} program group."
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Desktop shortcut for {APPLICATION_NAME}."
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} "Quick Launch shortcut for {APPLICATION_NAME}."
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+Section -post
+
+ ;Uninstaller file.
+ SetDetailsPrint textonly
+ DetailPrint "Writing Uninstaller"
+ SetDetailsPrint listonly
+ WriteUninstaller $INSTDIR\uninstall.exe
+
+ ;Registry keys required for installer version handling and uninstaller.
+ SetDetailsPrint textonly
+ DetailPrint "Writing Installer Registry Keys"
+ SetDetailsPrint listonly
+
+ ;Version numbers used to detect existing installation version for comparisson.
+ WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
+ WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
+ WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
+ WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${REVISION}"
+ WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
+
+ ;Add or Remove Programs entry.
+ WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
+ WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation" "$INSTDIR"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayName" "${APPLICATION_NAME}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "Publisher" "${APPLICATION_DOMAIN}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayVersion" "${VERSION}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}.${REVISION}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "URLInfoAbout" "http://${APPLICATION_DOMAIN}/"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "HelpLink" "http://${APPLICATION_DOMAIN}/"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoModify" "1"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoRepair" "1"
+
+
+ SetDetailsPrint textonly
+ DetailPrint "Finsihed."
+SectionEnd
+
+##############################################################################
+# #
+# UNINSTALLER SECTION #
+# #
+##############################################################################
+
+Var UnPageUserAppDataDialog
+Var UnPageUserAppDataCheckbox
+Var UnPageUserAppDataCheckbox_State
+Var UnPageUserAppDataEditBox
+
+Function un.UnPageUserAppData
+ !insertmacro MUI_HEADER_TEXT "Uninstall ${APPLICATION_DOMAIN}" "Remove ${APPLICATION_DOMAIN}'s data folder from your computer."
+ nsDialogs::Create /NOUNLOAD 1018
+ Pop $UnPageUserAppDataDialog
+
+ ${If} $UnPageUserAppDataDialog == error
+ Abort
+ ${EndIf}
+
+ ${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete ${APPLICATION_DOMAIN}'s data folder?"
+ Pop $0
+
+ ${NSD_CreateText} 0 13u 100% 12u "$LOCALAPPDATA\${APPLICATION_DOMAIN}"
+ Pop $UnPageUserAppDataEditBox
+ SendMessage $UnPageUserAppDataEditBox ${EM_SETREADONLY} 1 0
+
+ ${NSD_CreateLabel} 0 46u 100% 24u "Leave unchecked to keep the data folder for later use or check to delete the data folder."
+ Pop $0
+
+ ${NSD_CreateCheckbox} 0 71u 100% 8u "Yes, delete this data folder."
+ Pop $UnPageUserAppDataCheckbox
+
+ nsDialogs::Show
+FunctionEnd
+
+Function un.UnPageUserAppDataLeave
+ ${NSD_GetState} $UnPageUserAppDataCheckbox $UnPageUserAppDataCheckbox_State
+FunctionEnd
+
+Section Uninstall
+ IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" owncloud_installed
+ MessageBox MB_YESNO "It does not appear that ${APPLICATION_NAME} is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES owncloud_installed
+ Abort "Uninstall aborted by user"
+ owncloud_installed:
+
+ ;Delete registry keys.
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
+ DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
+ DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
+ DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
+ DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
+ DeleteRegValue HKLM "Software\${APPLICATION_NAME}" ""
+ DeleteRegKey HKLM "Software\${APPLICATION_NAME}"
+
+ DeleteRegKey HKCR "${APPLICATION_NAME}"
+
+ ;Start menu shortcuts.
+ !ifdef OPTION_SECTION_SC_START_MENU
+ SetShellVarContext all
+ RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
+ SetShellVarContext current
+ !endif
+
+ ;Desktop shortcut.
+ !ifdef OPTION_SECTION_SC_DESKTOP
+ IfFileExists "$DESKTOP\${APPLICATION_NAME}.lnk" 0 +2
+ Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
+ !endif
+
+ ;Quick Launch shortcut.
+ !ifdef OPTION_SECTION_SC_QUICK_LAUNCH
+ IfFileExists "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" 0 +2
+ Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
+ !endif
+
+ ;Remove all the Program Files.
+ RMDir /r $INSTDIR
+
+ ;Uninstall User Data if option is checked, otherwise skip.
+ ${If} $UnPageUserAppDataCheckbox_State == ${BST_CHECKED}
+ RMDir /r "$LOCALAPPDATA\${APPLICATION_NAME}"
+ ${EndIf}
+
+ SetDetailsPrint textonly
+ DetailPrint "Finsihed."
+SectionEnd
+
+##############################################################################
+# #
+# NSIS Installer Event Handler Functions #
+# #
+##############################################################################
+
+Function .onInit
+ !insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+ ;Remove Quick Launch option from Windows 7, as no longer applicable - usually.
+ ${IfNot} ${AtMostWinVista}
+ SectionSetText ${SEC_QUICK_LAUNCH} "Quick Launch Shortcut (N/A)"
+ SectionSetFlags ${SEC_QUICK_LAUNCH} ${SF_RO}
+ SectionSetInstTypes ${SEC_QUICK_LAUNCH} 0
+ ${EndIf}
+
+ ${MementoSectionRestore}
+
+ UAC_Elevate:
+ UAC::RunElevated
+ StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
+ StrCmp 0 $0 0 UAC_Err ; Error?
+ StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
+ Quit
+
+ UAC_Err:
+ MessageBox MB_ICONSTOP "Unable to elevate, error $0"
+ Abort
+
+ UAC_ElevationAborted:
+ Abort
+
+ UAC_Success:
+ StrCmp 1 $3 +4 ;Admin?
+ StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
+ MessageBox MB_ICONSTOP "This installer requires admin access, try again"
+ goto UAC_Elevate
+
+ ;Prevent multiple instances.
+ System::Call 'kernel32::CreateMutexA(i 0, i 0, t "owncloudInstaller") i .r1 ?e'
+ Pop $R0
+ StrCmp $R0 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
+ Abort
+
+ ;Use available InstallLocation when possible. This is useful in the uninstaller
+ ;via re-install, which would otherwise use a default location - a bug.
+ ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation"
+ StrCmp $R0 "" SkipSetInstDir
+ StrCpy $INSTDIR $R0
+ SkipSetInstDir:
+
+ ;Shutdown ${APPLICATION_NAME} in case Add/Remove re-installer option used.
+ Call EnsureOwncloudShutdown
+FunctionEnd
+
+Function .onInstSuccess
+ ${MementoSectionSave}
+ UAC::Unload ;Must call unload!
+FunctionEnd
+
+Function .onInstFailed
+ UAC::Unload ;Must call unload!
+FunctionEnd
+
+##############################################################################
+# #
+# NSIS Uninstaller Event Handler Functions #
+# #
+##############################################################################
+
+Function un.onInit
+ UAC_Elevate:
+ UAC::RunElevated
+ StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
+ StrCmp 0 $0 0 UAC_Err ; Error?
+ StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
+ Quit
+
+ UAC_Err:
+ MessageBox MB_ICONSTOP "Unable to elevate, error $0"
+ Abort
+
+ UAC_ElevationAborted:
+ Abort
+
+ UAC_Success:
+ StrCmp 1 $3 +4 ;Admin?
+ StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
+ MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
+ goto UAC_Elevate
+
+ ;Prevent multiple instances.
+ System::Call 'kernel32::CreateMutexA(i 0, i 0, t "owncloudUninstaller") i .r1 ?e'
+ Pop $R0
+ StrCmp $R0 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "This uninstaller is already running."
+ Abort
+FunctionEnd
+
+Function un.onUnInstSuccess
+ UAC::Unload ;Must call unload!
+FunctionEnd
+
+Function un.onUnInstFailed
+ UAC::Unload ;Must call unload!
+FunctionEnd