diff options
Diffstat (limited to 'tools/installer/nsis/includes')
-rw-r--r-- | tools/installer/nsis/includes/global.nsh | 146 | ||||
-rw-r--r-- | tools/installer/nsis/includes/instdir.nsh | 257 | ||||
-rw-r--r-- | tools/installer/nsis/includes/list.nsh | 139 | ||||
-rw-r--r-- | tools/installer/nsis/includes/qtcommon.nsh | 574 | ||||
-rw-r--r-- | tools/installer/nsis/includes/qtenv.nsh | 306 | ||||
-rw-r--r-- | tools/installer/nsis/includes/system.nsh | 272 |
6 files changed, 1694 insertions, 0 deletions
diff --git a/tools/installer/nsis/includes/global.nsh b/tools/installer/nsis/includes/global.nsh new file mode 100644 index 0000000..c124018 --- /dev/null +++ b/tools/installer/nsis/includes/global.nsh @@ -0,0 +1,146 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!include "StrFunc.nsh" +!include "includes\list.nsh" + +${StrCase} +${StrTrimNewLines} +${StrStr} +${StrRep} +${UnStrRep} + +var STARTMENU_STRING +var PRODUCT_UNIQUE_KEY +var RUNNING_AS_ADMIN + +!ifndef MODULE_MINGW + !ifdef MODULE_MSVC_VC60 + !define INSTALL_COMPILER "vc60" + !else + !ifdef MODULE_MSVC_VS2002 + !define INSTALL_COMPILER "vs2002" + !else + !ifdef MODULE_MSVC_VS2005 + !define INSTALL_COMPILER "vs2005" + !else + !define INSTALL_COMPILER "vs2003" + !endif + !endif + !endif +!else + !define INSTALL_COMPILER "mingw" +!endif + +; ADDIN\INTEGRATION +var VS_VERSION +var VS_VERSION_SHORT +var ADDIN_INSTDIR +var VSIP_INSTDIR +var HELP_INSTDIR +var ECLIPSE_INSTDIR +var QTJAMBIECLIPSE_INSTDIR + +; LICENSECHECK +var LICENSE_KEY +var LICENSEE +var LICENSE_PRODUCT +var LICENSE_FILE + +; MSVC +!ifdef MODULE_MSVC + !define MSVC_ValidateDirectory + var MSVC_INSTDIR +!endif + +; MINGW +!ifdef MODULE_MINGW + !define MINGW_ValidateDirectory + var MINGW_INSTDIR +!endif + +; QSA +var QSA_INSTDIR + +; QTDIR PAGE +var QTDIR_SELECTED +var COMPILER_SELECTED + +; used by addin7x and vsip +!ifndef MODULE_VSIP_ROOT + !define MODULE_VSIP_ROOT "${INSTALL_ROOT}\vsip" +!endif + +; add to confirm path +var UninstallerConfirmProduct + +Function un.ConfirmOnDelete + exch $0 + push $1 + + push "$0" + push "$UninstallerConfirmProduct" + call un.ItemInList + pop $1 + IntCmp $1 1 ConfirmOnDeleteDone + + strcmp "$UninstallerConfirmProduct" "" 0 +3 + strcpy $UninstallerConfirmProduct "$0" + goto +2 + strcpy $UninstallerConfirmProduct "$UninstallerConfirmProduct$\r$\n$0" + + ConfirmOnDeleteDone: + pop $1 + pop $0 +FunctionEnd + +!macro ConfirmOnRemove REG_KEY PRODUCT_NAME + push $0 + ClearErrors + ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "${REG_KEY}" + intcmp $0 1 0 +3 + push "${PRODUCT_NAME}" + call un.ConfirmOnDelete + ClearErrors + pop $0 +!macroend
\ No newline at end of file diff --git a/tools/installer/nsis/includes/instdir.nsh b/tools/installer/nsis/includes/instdir.nsh new file mode 100644 index 0000000..859b004 --- /dev/null +++ b/tools/installer/nsis/includes/instdir.nsh @@ -0,0 +1,257 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!ifndef INSTDIR_1 + !macro INSTDIR_INITIALIZE + !define MUI_DIRECTORYPAGE_VARIABLE $${INSTDIR_0}_INSTDIR + !ifdef ${INSTDIR_0}_ValidateDirectory + !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "${INSTDIR_0}_ValidateDirectoryFunc" + !endif + !insertmacro MUI_PAGE_DIRECTORY + !macroend + !macro INSTDIR_FUNCTIONS + !macroend + !macro INSTDIR_STARTUP + !macroend +!else +!macro INSTDIR_INITIALIZE + !define INSTDIR_INI_FILE "instdir.ini" + !define INSTDIR_0_DIRFIELD "Field 10" + !define INSTDIR_0_TEXTFIELD "Field 13" + !define INSTDIR_1_DIRFIELD "Field 7" + !define INSTDIR_1_TEXTFIELD "Field 11" + !define INSTDIR_2_DIRFIELD "Field 5" + !define INSTDIR_2_TEXTFIELD "Field 8" + !define INSTDIR_3_DIRFIELD "Field 3" + !define INSTDIR_3_TEXTFIELD "Field 6" + !define INSTDIR_4_DIRFIELD "Field 2" + !define INSTDIR_4_TEXTFIELD "Field 4" + !define INSTDIR_5_DIRFIELD "Field 9" + !define INSTDIR_5_TEXTFIELD "Field 12" + !define INSTDIR_DIRHEIGHT 18 + + Page custom InitInstDirs UpdateInstDirs + + LangString InstDirLicenseTitle ${LANG_ENGLISH} "Installation Directories" + LangString InstDirLicenseTitleDescription ${LANG_ENGLISH} "Select the directories where you want the software installed." +!macroend + +!macro INSTDIR_FUNCTIONS + Function InitInstDirs + push $0 + push $1 + push $2 + push $3 + + !insertmacro MUI_HEADER_TEXT "$(InstDirLicenseTitle)" "$(InstDirLicenseTitleDescription)" + strcpy $0 "129" + +!ifdef INSTDIR_0 + SectionGetFlags ${${INSTDIR_0}_SEC01} $1 +!ifdef ${INSTDIR_0}_SEC02 + SectionGetFlags ${${INSTDIR_0}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Text" "${INSTDIR_0_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" $${INSTDIR_0}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif +!ifdef INSTDIR_1 + SectionGetFlags ${${INSTDIR_1}_SEC01} $1 +!ifdef ${INSTDIR_1}_SEC02 + SectionGetFlags ${${INSTDIR_1}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Text" "${INSTDIR_1_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" $${INSTDIR_1}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif +!ifdef INSTDIR_2 + SectionGetFlags ${${INSTDIR_2}_SEC01} $1 +!ifdef ${INSTDIR_2}_SEC02 + SectionGetFlags ${${INSTDIR_2}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Text" "${INSTDIR_2_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" $${INSTDIR_2}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif +!ifdef INSTDIR_3 + SectionGetFlags ${${INSTDIR_3}_SEC01} $1 +!ifdef ${INSTDIR_3}_SEC02 + SectionGetFlags ${${INSTDIR_3}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Text" "${INSTDIR_3_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" $${INSTDIR_3}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif +!ifdef INSTDIR_4 + SectionGetFlags ${${INSTDIR_4}_SEC01} $1 +!ifdef ${INSTDIR_4}_SEC02 + SectionGetFlags ${${INSTDIR_4}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Text" "${INSTDIR_4_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" $${INSTDIR_4}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif +!ifdef INSTDIR_5 + SectionGetFlags ${${INSTDIR_5}_SEC01} $1 +!ifdef ${INSTDIR_5}_SEC02 + SectionGetFlags ${${INSTDIR_5}_SEC02} $3 + IntOp $1 $1 | $3 +!endif + IntOp $2 $1 & 1 ;just care about the first flag + StrCpy $1 "READONLY" + StrCmp "$2" "1" +2 + StrCpy $1 "DISABLED" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Flags" "$1" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Text" "${INSTDIR_5_TEXT}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" $${INSTDIR_5}_INSTDIR +!else + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Type" "Unknown" + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Type" "Unknown" + intop $0 $0 - ${INSTDIR_DIRHEIGHT} +!endif + + !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "Field 1" "Bottom" "$0" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${INSTDIR_INI_FILE}" + + pop $3 + pop $2 + pop $1 + pop $0 + FunctionEnd + + Function UpdateInstDirs +!ifdef INSTDIR_0 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_0}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" + !ifdef ${INSTDIR_0}_ValidateDirectory + call ${INSTDIR_0}_ValidateDirectoryFunc + !endif +!endif +!ifdef INSTDIR_1 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_1}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" + !ifdef ${INSTDIR_1}_ValidateDirectory + call ${INSTDIR_1}_ValidateDirectoryFunc + !endif +!endif +!ifdef INSTDIR_2 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_2}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" + !ifdef ${INSTDIR_2}_ValidateDirectory + call ${INSTDIR_2}_ValidateDirectoryFunc + !endif +!endif +!ifdef INSTDIR_3 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_3}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" + !ifdef ${INSTDIR_3}_ValidateDirectory + call ${INSTDIR_3}_ValidateDirectoryFunc + !endif +!endif +!ifdef INSTDIR_4 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_4}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" + !ifdef ${INSTDIR_4}_ValidateDirectory + call ${INSTDIR_4}_ValidateDirectoryFunc + !endif +!endif +!ifdef INSTDIR_5 + !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_5}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" + !ifdef ${INSTDIR_5}_ValidateDirectory + call ${INSTDIR_5}_ValidateDirectoryFunc + !endif +!endif + FunctionEnd +!macroend + +!macro INSTDIR_STARTUP + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTDIR_INI_FILE}" +!macroend + +!endif ;ifndef INSTDIR_1
\ No newline at end of file diff --git a/tools/installer/nsis/includes/list.nsh b/tools/installer/nsis/includes/list.nsh new file mode 100644 index 0000000..c553f67 --- /dev/null +++ b/tools/installer/nsis/includes/list.nsh @@ -0,0 +1,139 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!ifndef LIST_INCLUDE +!define LIST_INCLUDE + +; usage: +; push item +; push list +; call ItemInList +; returns 1 or 0 +!macro ItemInList UN +Function ${UN}ItemInList + exch $0 ;list + exch + exch $1 ;item + push $2 ;counter + push $3 ;substr + push $4 ;char + + strcpy $3 "" + strcpy $2 "0" + + loop: + strcpy $4 $0 1 $2 + strcmp "$4" "" atend + intop $2 $2 + 1 + + strcmp "$4" "|" 0 +4 + strcmp "$3" "$1" found + strcpy $3 "" ;reset substr + goto +2 + strcpy $3 "$3$4" ;append char to substr + goto loop + + found: + strcpy $0 "1" + goto done + + atend: + strcmp "$3" "$1" found + strcpy $0 "0" + + done: + pop $4 + pop $3 + pop $2 + pop $1 + exch $0 +FunctionEnd +!macroend + +!insertmacro ItemInList "" +!insertmacro ItemInList "un." + +Function GetItemInList + exch $0 ;list + exch + exch $1 ;index + push $2 ;counter + push $3 ;substr + push $4 ;char + push $5 ;current index + + strcpy $3 "" + strcpy $2 "0" + strcpy $5 "1" + + loop: + strcpy $4 $0 1 $2 + strcmp "$4" "" atend + intop $2 $2 + 1 + + strcmp "$4" "|" 0 +5 + strcmp "$5" "$1" found + strcpy $3 "" ;reset substr + intop $5 $5 + 1 + goto +2 + strcpy $3 "$3$4" ;append char to substr + goto loop + + found: + strcpy $0 "$3" + goto done + + atend: + strcmp "$5" "$1" found + strcpy $0 "" + + done: + pop $5 + pop $4 + pop $3 + pop $2 + pop $1 + exch $0 +FunctionEnd + +!endif ;LIST_INCLUDE
\ No newline at end of file diff --git a/tools/installer/nsis/includes/qtcommon.nsh b/tools/installer/nsis/includes/qtcommon.nsh new file mode 100644 index 0000000..72a5211 --- /dev/null +++ b/tools/installer/nsis/includes/qtcommon.nsh @@ -0,0 +1,574 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!ifndef QTCOMMON_INCLUDE +!define QTCOMMON_INCLUDE + +!macro MakeQtDirectory UN +Function ${UN}MakeQtDirectory + exch $0 + + push $0 + push " " #replace + push "-" #with + call ${UN}ReplaceString + pop $0 + + push $0 + push "(" #replace + push "" #with + call ${UN}ReplaceString + pop $0 + + push $0 + push ")" #replace + push "" #with + call ${UN}ReplaceString + pop $0 + + exch $0 +FunctionEnd +!macroend +!insertmacro MakeQtDirectory "" +!insertmacro MakeQtDirectory "un." + +Function DeleteFloatingLicenseProgram + exch $1 + push $0 + + StrCmp $LICENSE_KEY "" end + + ClearErrors + !ifndef OPENSOURCE_BUILD + qtnsisext::IsFloatingLicense $LICENSE_KEY + !endif + IfErrors end + pop $0 + + StrCmp $0 "1" end + IfFileExists "$1\bin\qtusagereporter.exe" 0 end + Delete "$1\bin\qtusagereporter.exe" + + end: + pop $0 + pop $1 +FunctionEnd + +Function AddStartmenuApplication + exch $0 + IfFileExists "$0\assistant.exe" 0 +2 + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk" "$0\assistant.exe" + IfFileExists "$0\designer.exe" 0 +2 + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk" "$0\designer.exe" + IfFileExists "$0\linguist.exe" 0 +2 + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk" "$0\linguist.exe" + IfFileExists "$0\qtdemo.exe" 0 +2 + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" "$0\qtdemo.exe" + IfFileExists "$0\..\README" 0 ReadMeShortCutFinished + IfFileExists "$WINDIR\notepad.exe" +3 + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$SYSDIR\notepad.exe" "$0\..\README" + goto ReadMeShortCutFinished + CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$WINDIR\notepad.exe" "$0\..\README" + ReadMeShortCutFinished: + pop $0 +FunctionEnd + +Function un.RemoveStartmenuApplication + Delete "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk" + Delete "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk" + Delete "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk" + Delete "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" + Delete "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" +FunctionEnd + +#patch the licence information +Function PatchLicenseInformation + exch $0 + push $1 + push $2 + + DetailPrint "Patching license information..." + + IfFileExists "$0\src\corelib\global\qconfig.h" 0 +3 + strcpy $2 "$0\src\corelib\global\qconfig.h" + goto PatchLicensee + + IfFileExists "$0\include\Qt\qconfig.h" 0 PatchConfigPriFile + strcpy $2 "$0\include\Qt\qconfig.h" + + PatchLicensee: + push $2 + push '#define QT_PRODUCT_LICENSEE "' + push '#define QT_PRODUCT_LICENSEE "$LICENSEE"$\r$\n' + call PatchLine + + push $2 + push '#define QT_PRODUCT_LICENSE "' + push '#define QT_PRODUCT_LICENSE "$LICENSE_PRODUCT"$\r$\n' + call PatchLine + + push $2 + ${StrCase} $1 "$LICENSE_PRODUCT" "U" + push '# define QT_EDITION QT_EDITION_' + push '# define QT_EDITION QT_EDITION_$1$\r$\n' + call PatchLine + + PatchConfigPriFile: + IfFileExists "$0\mkspecs\qconfig.pri" 0 PatchLicenseProductDone + push "$0\mkspecs\qconfig.pri" + push "QT_EDITION = " + push "QT_EDITION = $LICENSE_PRODUCT$\r$\n" + call PatchLine + + PatchLicenseProductDone: + pop $2 + pop $1 + pop $0 +FunctionEnd + +Function PatchCommonBinaryFiles + exch $2 + push $0 + push $1 + + IfFileExists "$2\bin\qmake.exe" 0 +5 + DetailPrint "Patching paths in qmake..." + push $2 + push "$2\bin\qmake.exe" + call PatchBinaryPaths + + DetailPrint "Patching paths in core..." + FindFirst $0 $1 "$2\bin\QtCore*.dll" + StrCmp $1 "" ErrorPatching + push $2 + push "$2\bin\$1" + call PatchBinaryPaths + + FindNext $0 $1 + StrCmp $1 "" ErrorPatching + push $2 + push "$2\bin\$1" + call PatchBinaryPaths + + ErrorPatching: + + pop $1 + pop $0 + pop $2 +FunctionEnd + +Function PatchBinaryPaths + exch $0 + exch + exch $2 + push $1 + +!ifndef OPENSOURCE_BUILD + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_prfxpath=" "qt_prfxpath=$2" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_docspath=" "qt_docspath=$2\doc" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_hdrspath=" "qt_hdrspath=$2\include" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_libspath=" "qt_libspath=$2\lib" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_binspath=" "qt_binspath=$2\bin" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_plugpath=" "qt_plugpath=$2\plugins" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_datapath=" "qt_datapath=$2" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_trnspath=" "qt_trnspath=$2\translations" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_xmplpath=" "qt_xmplpath=$2\examples" +!ifdef MODULE_LICENSECHECK + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsuser=" "qt_lcnsuser=$LICENSEE" + qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsprod=" "qt_lcnsprod=$LICENSE_PRODUCT" +!endif + qtnsisext::PatchBinary $0 "qt_demopath=" "qt_demopath=$2\demos" +!endif + + pop $1 + pop $2 + pop $0 +FunctionEnd + +#patching the prl files +Function PatchPrlFiles + exch $2 + exch + exch $3 ;buildDir + push $0 + push $1 + + FindFirst $0 $1 "$2\lib\*.prl" + loop: + StrCmp $1 "" done + DetailPrint "Patching $1..." + + push "$2\lib\$1" + push $3 + push $2 + call PatchPath + + FindNext $0 $1 + Goto loop + done: + pop $1 + pop $0 + pop $3 + pop $2 +FunctionEnd + +# +# patch line in text files +# push "qtcore4.prl" #Filename +# push "#define ..." #START WITH +# push "c:\qt" #REPLACE WITH +# call PatchLine +# +Function PatchLine + exch $2 ;replacement line + exch 2 + exch $1 ;Filename + exch + exch $0 ;start with + push $3 ; tmp filename + push $4 ; handle (tmp) + push $5 ; handle (org) + push $6 ; string + + ClearErrors + GetTempFileName $3 + IfErrors done + FileOpen $4 $3 w + IfErrors done + FileOpen $5 $1 r + IfErrors done + +nextline: + FileRead $5 $6 + IfErrors renameFile + push $6 + push $0 + push $2 + call ReplaceLine + pop $6 + FileWrite $4 $6 + goto nextline + +renameFile: + FileClose $4 + FileClose $5 + SetDetailsPrint none + Delete $1 + Rename $3 $1 + SetDetailsPrint both + + done: + pop $6 + pop $5 + pop $4 + pop $3 + pop $0 + pop $1 + pop $2 +FunctionEnd + +# +# replaces a string that starts with something, with another string +# push string +# push "#define ..." #START WITH +# push "c:\qt" #REPLACE WITH +# call ReplaceLine +# pop $0 #new string +# +Function ReplaceLine + exch $2 ;new line + exch 2 + exch $1 ;string + exch + exch $0 ;start with + + push $3 ; tmp string + push $4 ; counter + push $5 ; strlen + + StrCpy $4 "-1" + StrLen $5 $1 + + loop: + IntOp $4 $4 + 1 ;increase counter + StrCpy $3 $1 $4 ;get substring + IntCmp $4 $5 copystring ; check for end + StrCmp $3 $0 done ;start with found + goto loop + + copystring: + StrCpy $2 $1 + goto done + + done: + pop $5 + pop $4 + pop $3 + pop $0 + pop $1 + exch $2 +FunctionEnd + +# +# patch paths in text files +# push "qtcore4.prl" #Filename +# push "c:\compile" #OLD_QTDIR +# push "c:\qt" #QTDIR +# call PatchPath +# +Function PatchPath + exch $2 ;NEW + exch 2 + exch $1 ;Filename + exch + exch $0 ;OLD + push $3 ;readline + push $4 ;file 1 + push $5 ;file 2 + push $6 ;tmpfilename + + push $7 ;forward slash NEW + push $8 ;forward slash OLD + + push $2 + push "\" + push "/" + call ReplaceString + pop $7 + + push $0 + push "\" + push "/" + call ReplaceString + pop $8 + + ClearErrors + GetTempFileName $6 + IfErrors done + FileOpen $5 $6 w + IfErrors done + FileOpen $4 $1 r + IfErrors done + +nextline: + FileRead $4 $3 + IfErrors renameFile + push $3 + push $0 + push $2 + call ReplaceString ;replace backward slash path + push $8 + push $7 + call ReplaceString ;replace forward slash path + pop $3 + FileWrite $5 $3 + goto nextline + +renameFile: + FileClose $5 + FileClose $4 + SetDetailsPrint none + Delete $1 + Rename $6 $1 + SetDetailsPrint both + +done: + pop $8 + pop $7 + pop $6 + pop $5 + pop $4 + pop $3 + pop $0 + pop $1 + pop $2 +FunctionEnd + +# +# replaces a string with another string +# push string +# push "c:\qt" #replace +# push "c:\compile" #with +# call ReplaceString +# pop $0 #new string +# +!macro ReplaceString UN +Function ${UN}ReplaceString + exch $2 ;NEW + exch 2 + exch $1 ;string + exch + exch $0 ;OLD + + push $3 ; tmp string + push $4 ; counter + push $5 ; result + + push $6 ; old strlen + + StrCpy $4 "-1" + StrCpy $5 "" + + StrLen $6 $0 + + loop: + IntOp $4 $4 + 1 ;increase counter + StrCpy $3 $1 $6 $4 ;get substring + StrCmp $3 "" done ; check for end + StrCmp $3 $0 replace ;replace if old + StrCpy $3 $1 "1" $4 + StrCpy $5 $5$3 ;append character to result + goto loop + + replace: + StrCpy $5 $5$2 ;insert new qtdir + IntOp $4 $4 + $6 ;increase offset + IntOp $4 $4 - 1 ;decrease offset one more + goto loop + + done: + StrCpy $2 $5 + pop $6 + pop $5 + pop $4 + pop $3 + pop $0 + pop $1 + exch $2 +FunctionEnd +!macroend +!insertmacro ReplaceString "" +!insertmacro ReplaceString "un." + +Function CommonCheckDirectory + exch $4 + exch + exch $5 + push $0 + push $1 + push $2 + push $3 + + ; check if qt is already installed + IfFileExists "$4\bin\qmake.exe" 0 +2 + IfFileExists "$4\uninst.exe" qtExistsError + + ; check if directory is empty + FindFirst $0 $1 "$4\*" + CommonCheckDirectory_FileSearchLoop: + StrCmp $1 "" CommonCheckDirectory_DirDoesNotExist + StrCmp $1 "." CommonCheckDirectory_ContinueSearchLoop + StrCmp $1 ".." CommonCheckDirectory_ContinueSearchLoop + goto CommonCheckDirectory_FoundFile + CommonCheckDirectory_ContinueSearchLoop: + FindNext $0 $1 + goto CommonCheckDirectory_FileSearchLoop + +CommonCheckDirectory_FoundFile: + FindClose $0 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "This directory already has contents. Are you sure you want to use this directory?" IDYES CommonCheckDirectory_DirDoesNotExist + Goto errorInDirectory +CommonCheckDirectory_DirDoesNotExist: + FindClose $0 + + GetInstDirError $0 + IntCmp 0 $0 0 instDirError + + StrLen $0 $4 + +!ifdef USE_NODIRLENGTHCHECK + StrCpy $1 "400" +!else + StrLen $1 $5 +!endif + + IntCmp $1 $0 0 directoryToLong + + ;check for spaces + StrCpy $2 "-1" + StrCpy $3 "" + + loop: + IntOp $2 $2 + 1 ;increase counter + StrCpy $3 $4 "1" $2 ;get char + StrCmp $3 "" directoryOk ; check for end + StrCmp $3 " " spaceInDirectory ;check for space + goto loop + +qtExistsError: + MessageBox MB_OK|MB_ICONEXCLAMATION "Qt is already installed in this directory. Please uninstall the previous version and try again." + Goto errorInDirectory + +instDirError: + MessageBox MB_OK|MB_ICONEXCLAMATION "This is not a valid installation directory." + Goto errorInDirectory + +spaceInDirectory: + MessageBox MB_OK|MB_ICONEXCLAMATION "The installation path can't contain spaces." + Goto errorInDirectory + +directoryToLong: + MessageBox MB_OK|MB_ICONEXCLAMATION "The installation directory is to long." + Goto errorInDirectory + +errorInDirectory: + pop $3 + pop $2 + pop $1 + pop $0 + pop $5 + pop $4 + Abort + goto done + +directoryOk: + pop $3 + pop $2 + pop $1 + pop $0 + pop $5 + pop $4 +done: +FunctionEnd + +!endif ;QTCOMMON_INCLUDE
\ No newline at end of file diff --git a/tools/installer/nsis/includes/qtenv.nsh b/tools/installer/nsis/includes/qtenv.nsh new file mode 100644 index 0000000..9232093 --- /dev/null +++ b/tools/installer/nsis/includes/qtenv.nsh @@ -0,0 +1,306 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!ifndef QTENV_INCLUDE +!define QTENV_INCLUDE +# +# creates a qtvars.bat file in $QTDIR\bin +# push "vs2003" #compiler +# push "c:\qt" #QTDIR +# call MakeQtVarsFile +# +Function MakeQtVarsFile + exch $1 ; QTDIR + exch + exch $3 ; vs version + push $0 ; file handle + push $2 + push $4 + + push $3 + call GetMkSpec + pop $2 + + ClearErrors + FileOpen $0 "$1\bin\qtvars.bat" w + IfErrors done + FileWrite $0 "@echo off$\r$\n" + FileWrite $0 "rem$\r$\n" + FileWrite $0 "rem This file is generated$\r$\n" + FileWrite $0 "rem$\r$\n" + FileWrite $0 "$\r$\n" + FileWrite $0 "echo Setting up a Qt environment...$\r$\n" + FileWrite $0 "echo -- QTDIR set to $1$\r$\n" + FileWrite $0 "echo -- Added $1\bin to PATH$\r$\n" + FileWrite $0 "echo -- QMAKESPEC set to $2$\r$\n" + FileWrite $0 "$\r$\n" + FileWrite $0 "set QTDIR=$1$\r$\n" + FileWrite $0 "set PATH=$1\bin;%PATH%$\r$\n" + FileWrite $0 "set QMAKESPEC=$2$\r$\n" + + call IsExpressVersion + pop $4 + strcmp $4 "" noExpressVersion + FileWrite $0 "$\r$\n" + FileWrite $0 'regedit /e S$$D$$K$$ "HKEY_LOCAL_MACHINE\Software\Microsoft\MicrosoftSDK"$\r$\n' + Filewrite $0 'if not exist S$$D$$K$$ goto ENDSDK\r$\n' + FileWrite $0 'find "Install Dir" < S$$D$$K$$ > D$$I$$R$$$\r$\n' + FileWrite $0 'del S$$D$$K$$$\r$\n' + FileWrite $0 'for /f "tokens=2 delims==" %%i in (D$$I$$R$$) do call %%i\setenv$\r$\n' + FileWrite $0 'del D$$I$$R$$$\r$\n' + Filewrite $0 ':ENDSDK\r$\n' + noExpressVersion: + + push $3 + call GetVSVarsFile + pop $2 + strcmp $2 "" novsvars + FileWrite $0 "$\r$\n" + FileWrite $0 'if not "%1"=="vsvars" goto END$\r$\n' + FileWrite $0 'call "$2"$\r$\n' + FileWrite $0 ":END$\r$\n" + + FileWrite $0 "$\r$\n" + FileWrite $0 'if not "%1"=="vsstart" goto ENDSTARTVS$\r$\n' + FileWrite $0 'call "$2"$\r$\n' + + strcmp $3 "vc60" vc60startup + FileWrite $0 "devenv /useenv$\r$\n" + Goto donevsstartup + vc60startup: + FileWrite $0 "msdev /useenv$\r$\n" + donevsstartup: + + FileWrite $0 ":ENDSTARTVS$\r$\n" + + novsvars: + FileWrite $0 "$\r$\n" + FileClose $0 + done: + pop $4 + pop $2 + pop $0 + pop $3 + pop $1 +FunctionEnd + +Function GetMkSpec + exch $0 + StrCmp $0 "mingw" MINGW + StrCmp $0 "vs2005" VS2005 + StrCmp $0 "vs2003" VS2003 + StrCmp $0 "vs2002" VS2002 + StrCmp $0 "vc60" VS60 + StrCmp $0 "icc" ICC + + MINGW: + pop $0 + push "win32-g++" + goto done + + VS2005: + pop $0 + push "win32-msvc2005" + goto done + + VS2003: + pop $0 + push "win32-msvc.net" + goto done + + VS2002: + pop $0 + push "win32-msvc.net" + goto done + + VS60: + pop $0 + push "win32-msvc" + goto done + + ICC: + pop $0 + push "win32-icc" + goto done + + done: +FunctionEnd + +!define AD_COMPILER_NAME_VS2005 "Visual Studio .NET 2005" +!define AD_COMPILER_NAME_VS2005_EXPRESS "Visual C++ 2005 Express Edition" +!define AD_COMPILER_NAME_VS2003 "Visual Studio .NET 2003" +!define AD_COMPILER_NAME_VS2002 "Visual Studio .NET 2002" +!define AD_COMPILER_NAME_VC60 "Visual Studio 6.0" +!define AD_COMPILER_NAME_ICC "Intel C++ Compiler" +!define AD_COMPILER_NAME_MINGW "MinGW (Must be in PATH!)" + +Function GetShortCompilerName + exch $0 + + strcmp "$0" "${AD_COMPILER_NAME_VS2005}" 0 +3 + strcpy $0 "vs2005" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_VS2005_EXPRESS}" 0 +3 + strcpy $0 "vs2005" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_VS2003}" 0 +3 + strcpy $0 "vs2003" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_VS2002}" 0 +3 + strcpy $0 "vs2002" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_VC60}" 0 +3 + strcpy $0 "vc60" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_ICC}" 0 +3 + strcpy $0 "icc" + goto done + + strcmp "$0" "${AD_COMPILER_NAME_MINGW}" 0 +3 + strcpy $0 "mingw" + goto done + + strcpy $0 "" ;this is bad! + + done: + exch $0 +FunctionEnd + +Function IsExpressVersion + push $0 + ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir" + ClearErrors + exch $0 +FunctionEnd + +Function AutoDetectCompilers + push $0 + push $1 + + strcpy $1 "" + + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0" "InstallDir" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_VS2005}|" + + ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_VS2005_EXPRESS}|" + + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1" "InstallDir" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_VS2003}|" + + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0" "InstallDir" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_VS2002}|" + + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_VC60}|" + + ReadRegStr $0 HKLM "Software\Intel\Compilers\C++\80" "Major Version" + strcmp $0 "" +2 + strcpy $1 "$1${AD_COMPILER_NAME_ICC}|" + + strcpy $1 "$1${AD_COMPILER_NAME_MINGW}" + + exch + pop $0 + exch $1 +FunctionEnd + +Function GetVSVarsFile + exch $1 + push $0 + + StrCmp $1 "vs2005" VS2005 + StrCmp $1 "vs2003" VS2003 + StrCmp $1 "vs2002" VS2002 + StrCmp $1 "vc60" VS60 + + push "" ;empty string if not found + goto done + + VS2005: + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0\Setup\VS" "ProductDir" + StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005 + + ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0\Setup\VS" "ProductDir" + StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005 epress + + VS2003: + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1\Setup\VS" "ProductDir" + StrCmp $0 "" +1 foundVSDir ; found msvc.net 2003 + + VS2002: + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0\Setup\VS" "ProductDir" + StrCmp $0 "" +1 foundVSDir ; found msvc.net 2002 + + VS60: + ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++" "ProductDir" + StrCmp $0 "" +1 foundVCDir ; found msvc 6.0 + + push "" ;empty string if not found + goto done + + foundVSDir: + push "$0\Common7\Tools\vsvars32.bat" + goto done + + foundVCDir: + push "$0\bin\vcvars32.bat" + + done: + exch + pop $0 + exch + pop $1 +FunctionEnd + +!endif ;QTENV_INCLUDE diff --git a/tools/installer/nsis/includes/system.nsh b/tools/installer/nsis/includes/system.nsh new file mode 100644 index 0000000..f7cbec4 --- /dev/null +++ b/tools/installer/nsis/includes/system.nsh @@ -0,0 +1,272 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +;; Contact: Qt Software Information (qt-info@nokia.com) +;; +;; This file is part of the tools applications of the Qt Toolkit. +;; +;; $QT_BEGIN_LICENSE:LGPL$ +;; No Commercial Usage +;; This file contains pre-release code and may not be distributed. +;; You may use this file in accordance with the terms and conditions +;; contained in the either Technology Preview License Agreement or the +;; Beta Release License Agreement. +;; +;; GNU Lesser General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU Lesser +;; General Public License version 2.1 as published by the Free Software +;; Foundation and appearing in the file LICENSE.LGPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU Lesser General Public License version 2.1 requirements +;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +;; +;; In addition, as a special exception, Nokia gives you certain +;; additional rights. These rights are described in the Nokia Qt LGPL +;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +;; package. +;; +;; GNU General Public License Usage +;; Alternatively, this file may be used under the terms of the GNU +;; General Public License version 3.0 as published by the Free Software +;; Foundation and appearing in the file LICENSE.GPL included in the +;; packaging of this file. Please review the following information to +;; ensure the GNU General Public License version 3.0 requirements will be +;; met: http://www.gnu.org/copyleft/gpl.html. +;; +;; If you are unsure which license is appropriate for your use, please +;; contact the sales department at qt-sales@nokia.com. +;; $QT_END_LICENSE$ +;; +;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!ifndef SYSTEM_INCLUDE +!define SYSTEM_INCLUDE + +!define QTVSIP2003_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD68}" +!define QTVSIP2005_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD69}" + +!define QMSNET2002_GUID "{C174ACCD-D856-4B60-9887-0FF9E841E0EC}" +!define QMSNET2003_GUID "{C174ACCE-D857-4B61-9888-0FF9E841E0ED}" +!define QMSNET2005_GUID "{14E98DB4-A232-49a4-8EC1-8CE4F6985C73}" + +!macro GetVSInstallationDir UN +; Usage: +; +; push "7.0" +; call GetVSInstallationDir +; pop $0 +; +; If the requested VS version can be found, its +; installation directory is returned. +Function ${UN}GetVSInstallationDir + Exch $0 + Push $1 + ReadRegStr $1 HKLM "Software\Microsoft\VisualStudio\$0" "InstallDir" + StrCpy $0 $1 + StrCmp $0 "" 0 +2 + SetErrors + Pop $1 + Exch $0 +FunctionEnd +!macroend + +!insertmacro GetVSInstallationDir "" +!insertmacro GetVSInstallationDir "un." + + +!macro IsDotNETInstalled UN +; Usage: +; +; push "8.0" +; call IsDotNETInstalled +; pop $0 +; +; $0 contains the path where the .NET framework is installed. +; If not installation can be found $0 is empty. +Function ${UN}IsDotNETInstalled + Exch $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + + StrCpy $5 $0 + + ReadRegStr $4 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework" "InstallRoot" + Push $4 + Exch $EXEDIR + Exch $EXEDIR + Pop $4 + + IfFileExists $4 0 noDotNET + StrCpy $0 0 + + EnumStart: + EnumRegKey $2 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy" $0 + IntOp $0 $0 + 1 + StrCmp $2 "" noDotNET + StrCpy $1 0 + + EnumPolicy: + EnumRegValue $3 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy\$2" $1 + IntOp $1 $1 + 1 + StrCmp $3 "" EnumStart + + StrCmp $5 "8.0" 0 +2 + StrCmp $2 "v2.0" 0 EnumPolicy + + IfFileExists "$4\$2.$3" foundDotNET EnumPolicy + + noDotNET: + StrCpy $0 0 + Goto done + + foundDotNET: + StrCpy $0 "$4\$2.$3" + + done: + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Exch $0 +FunctionEnd +!macroend + +!insertmacro IsDotNETInstalled "" +!insertmacro IsDotNETInstalled "un." + +!macro IsQMsNetInstalled UN +; Usage: +; +; push "8.0" +; call IsQMsNetInstalled +; pop $0 +Function ${UN}IsQMsNetInstalled + Exch $0 + Push $1 + Push $2 + Push $3 + + StrCmp $0 "7.0" 0 +2 + StrCpy $2 "${QMSNET2002_GUID}" + StrCmp $0 "7.1" 0 +2 + StrCpy $2 "${QMSNET2003_GUID}" + StrCmp $0 "8.0" 0 +2 + StrCpy $2 "${QMSNET2005_GUID}" + + StrCpy $3 0 + + ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" + StrCmp $1 "" +3 + StrCpy $3 1 + goto done + + ReadRegStr $1 HKCU "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" + StrCmp $1 "" +2 + StrCpy $3 1 + +done: + StrCpy $0 $3 + + Pop $3 + Pop $2 + Pop $1 + Exch $0 +FunctionEnd +!macroend + +!insertmacro IsQMsNetInstalled "" +!insertmacro IsQMsNetInstalled "un." + +!macro IsQMsDevInstalled UN +; Usage: +; +; call IsQMsDevInstalled +; pop $0 +Function ${UN}IsQMsDevInstalled + Push $0 + Push $1 + Push $2 + + StrCpy $0 0 + + ReadRegStr $1 HKLM "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename" + StrCmp $1 "" +3 + StrCpy $0 1 + goto done + + ReadRegStr $1 HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename" + StrCmp $1 "" +2 + StrCpy $0 1 + +done: + Pop $2 + Pop $1 + Exch $0 +FunctionEnd +!macroend + +!insertmacro IsQMsDevInstalled "" +!insertmacro IsQMsDevInstalled "un." + +!macro IsIntegrationInstalled UN +; Usage: +; +; push "8.0" +; call IsIntegrationInstalled +; pop $0 +Function ${UN}IsIntegrationInstalled + Exch $0 + Push $1 + Push $2 + + StrCmp $0 "7.1" 0 +2 + StrCpy $2 "${QTVSIP2003_GUID}" + StrCmp $0 "8.0" 0 +2 + StrCpy $2 "${QTVSIP2005_GUID}" + + ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\Packages\$2" "ProductName" + + StrCpy $0 0 + StrCmp $1 "" done + StrCpy $0 1 + +done: + Pop $2 + Pop $1 + Exch $0 +FunctionEnd +!macroend + +!insertmacro IsIntegrationInstalled "" +!insertmacro IsIntegrationInstalled "un." + +!macro AdministratorRights UN +Function ${UN}HasAdminRights + push $0 + ClearErrors + UserInfo::GetAccountType + IfErrors Yes ;It's probably Win95 + pop $0 + StrCmp $0 "Admin" Yes + StrCmp $0 "Power" Yes + + StrCpy $0 "false" + goto Done + + Yes: + StrCpy $0 "true" + + Done: + exch $0 +FunctionEnd +!macroend +!insertmacro AdministratorRights "" +!insertmacro AdministratorRights "un." + +!endif ;SYSTEM_INCLUDE
\ No newline at end of file |