tools/installer/batch/installer.bat
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
     2 ::
       
     3 :: Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 :: All rights reserved.
       
     5 :: Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 ::
       
     7 :: This file is part of the tools applications of the Qt Toolkit.
       
     8 ::
       
     9 :: $QT_BEGIN_LICENSE:LGPL$
       
    10 :: No Commercial Usage
       
    11 :: This file contains pre-release code and may not be distributed.
       
    12 :: You may use this file in accordance with the terms and conditions
       
    13 :: contained in the Technology Preview License Agreement accompanying
       
    14 :: this package.
       
    15 ::
       
    16 :: GNU Lesser General Public License Usage
       
    17 :: Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 :: General Public License version 2.1 as published by the Free Software
       
    19 :: Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 :: packaging of this file.  Please review the following information to
       
    21 :: ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 :: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 ::
       
    24 :: In addition, as a special exception, Nokia gives you certain additional
       
    25 :: rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 :: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 ::
       
    28 :: If you have questions regarding the use of this file, please contact
       
    29 :: Nokia at qt-info@nokia.com.
       
    30 ::
       
    31 ::
       
    32 ::
       
    33 ::
       
    34 ::
       
    35 ::
       
    36 ::
       
    37 ::
       
    38 :: $QT_END_LICENSE$
       
    39 ::
       
    40 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    41 call :%1 %2
       
    42 goto END
       
    43 
       
    44 :begin
       
    45   call :reset
       
    46   echo !define PRODUCT_NAME "%~1" >> %IWMAKE_NSISCONF%
       
    47   echo !define INSTALL_ROOT "%IWMAKE_ROOT%" >> %IWMAKE_NSISCONF%
       
    48 goto :eof
       
    49 
       
    50 :output
       
    51   set IWMAKE_OUTPUT_FILE=%~1
       
    52   echo !define OUTPUT_FILE "%~1" >> %IWMAKE_NSISCONF%
       
    53 goto :eof
       
    54 
       
    55 :module
       
    56   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1
       
    57   echo !define MODULE_%IWMAKE_RESULT% >> %IWMAKE_NSISCONF%
       
    58 goto :eof
       
    59 
       
    60 :enable
       
    61   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1
       
    62   echo !define USE_%IWMAKE_RESULT:"=% >> %IWMAKE_NSISCONF%
       
    63 goto :eof
       
    64 
       
    65 :disable
       
    66   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1
       
    67   echo !undef USE_%IWMAKE_RESULT:"=% >> %IWMAKE_NSISCONF%
       
    68 goto :eof
       
    69 
       
    70 :startmenu
       
    71   echo !define DEFAULT_STARTMENU_STRING "%~1" >> %IWMAKE_NSISCONF%
       
    72 goto :eof
       
    73 
       
    74 :reset
       
    75   if exist "%IWMAKE_NSISCONF%" del /Q /F "%IWMAKE_NSISCONF%"
       
    76 goto :eof
       
    77 
       
    78 :instdir
       
    79   for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3="%%~o"
       
    80   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
    81   echo !define INSTDIR_%IWMAKE_TMP2% %IWMAKE_RESULT:"=% >> "%IWMAKE_NSISCONF%"
       
    82   echo !define INSTDIR_%IWMAKE_TMP2%_TEXT %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%"
       
    83 goto :eof
       
    84 
       
    85 :version
       
    86   echo !define PRODUCT_VERSION "%~1" >> "%IWMAKE_NSISCONF%"
       
    87 goto :eof
       
    88 
       
    89 :readme
       
    90   echo !define README_FILE "%~1" >> "%IWMAKE_NSISCONF%"
       
    91 goto :eof
       
    92 
       
    93 :licenseFile
       
    94   echo !define LICENSE_FILE "%~1" >> "%IWMAKE_NSISCONF%"
       
    95 goto :eof
       
    96 
       
    97 :runfunction
       
    98   echo !define RUN_FUNCTION "%~1" >> "%IWMAKE_NSISCONF%"
       
    99 goto :eof
       
   100 
       
   101 :readmefunction
       
   102   echo !define README_FUNCTION "%~1" >> "%IWMAKE_NSISCONF%"
       
   103 goto :eof
       
   104 
       
   105 :welcomenote
       
   106   echo !define WELCOME_NOTE "%~1" >> "%IWMAKE_NSISCONF%"
       
   107 goto :eof
       
   108 
       
   109 :updateplugins
       
   110   call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync INetLoad
       
   111   xcopy /Q /Y /R "%IWMAKE_ROOT%\INetLoad\INetLoad.dll" "%IWMAKE_NSISPATH%\Plugins\" >> %IWMAKE_LOGFILE%
       
   112 ::  xcopy /Q /Y /R "%IWMAKE_SCRIPTDIR%\nsis\qtnsisext\qtnsisext.dll" "%IWMAKE_NSISPATH%\Plugins\" >> %IWMAKE_LOGFILE%
       
   113 goto :eof
       
   114 
       
   115 :defineDir
       
   116   for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3=%%~o
       
   117   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
   118   set IWMAKE_TMP=%IWMAKE_RESULT%
       
   119   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP2%
       
   120   set IWMAKE_TMP2=%IWMAKE_RESULT%
       
   121   echo !define MODULE_%IWMAKE_TMP%_%IWMAKE_TMP2% "%IWMAKE_ROOT%\%IWMAKE_TMP3%" >> "%IWMAKE_NSISCONF%"
       
   122 goto :eof
       
   123 
       
   124 :define
       
   125   for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3="%%~o"
       
   126   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
   127   set IWMAKE_TMP=%IWMAKE_RESULT%
       
   128   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP2%
       
   129   set IWMAKE_TMP2=%IWMAKE_RESULT%
       
   130   if %IWMAKE_TMP3%=="" set IWMAKE_TMP3=
       
   131   echo !define MODULE_%IWMAKE_TMP%_%IWMAKE_TMP2% %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%"
       
   132 goto :eof
       
   133 
       
   134 :src
       
   135   for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n
       
   136   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
   137   set IWMAKE_TMP=%IWMAKE_RESULT%
       
   138   set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%"
       
   139   echo !define MODULE_%IWMAKE_TMP%_ROOT %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%"
       
   140 goto :eof
       
   141 
       
   142 :buildDir
       
   143   for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n
       
   144   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
   145   set IWMAKE_TMP=%IWMAKE_RESULT%
       
   146   set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%"
       
   147   echo !define MODULE_%IWMAKE_TMP%_BUILDDIR %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%"
       
   148   for /F "eol=- tokens=1,2,3" %%m in ('%SystemRoot%\system32\find "QT_PACKAGEDATE_STR" %IWMAKE_ROOT%\%IWMAKE_TMP2%\src\corelib\global\qglobal.h') do echo !define MODULE_LICENSECHECK_PACKAGEDATE %%o >> "%IWMAKE_NSISCONF%"
       
   149 goto :eof
       
   150 
       
   151 :compile
       
   152   call :required
       
   153   pushd %IWMAKE_SCRIPTDIR%\nsis
       
   154   "%IWMAKE_NSISPATH%\makensis.exe" installer.nsi >> %IWMAKE_LOGFILE%
       
   155   popd
       
   156 goto :eof
       
   157 
       
   158 :required
       
   159   call :setrequired PRODUCT_NAME
       
   160   call :setrequired INSTALL_ROOT
       
   161   call :setrequired PRODUCT_VERSION
       
   162   call :setrequired OUTPUT_FILE
       
   163   call :setrequired INSTDIR_0
       
   164   call :setrequired DEFAULT_STARTMENU_STRING
       
   165 goto :eof
       
   166 
       
   167 :setrequired
       
   168   echo !ifndef %1 >> "%IWMAKE_NSISCONF%"
       
   169   echo   !error "%1 must be in the .conf file..." >> "%IWMAKE_NSISCONF%"
       
   170   echo !endif >> "%IWMAKE_NSISCONF%"
       
   171 goto :eof
       
   172 
       
   173 :makeFileList
       
   174   for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n
       
   175   call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP%
       
   176   set IWMAKE_TMP=%IWMAKE_RESULT%
       
   177   set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%"
       
   178 
       
   179 
       
   180   echo !macro MODULE_%IWMAKE_TMP%_INSTALLFILES >> "%IWMAKE_NSISCONF%"
       
   181 
       
   182   pushd %IWMAKE_TMP3%
       
   183 
       
   184   echo set IWMAKE_TMP2=%%IWMAKE_TMP2:%CD%\=%% > "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   185 
       
   186   dir /AD /B /S | %SystemRoot%\system32\sort /R > "%IWMAKE_ROOT%\iwmake_tmp.txt"
       
   187   for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addInstallDirectory "%%m"
       
   188 
       
   189 
       
   190   dir /A-D /B /S > "%IWMAKE_ROOT%\iwmake_tmp.txt"
       
   191   for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addInstallFile "%%m"
       
   192 
       
   193   popd
       
   194   echo !macroend >> "%IWMAKE_NSISCONF%"
       
   195 
       
   196 
       
   197   echo !macro MODULE_%IWMAKE_TMP%_REMOVE removepath >> "%IWMAKE_NSISCONF%"
       
   198   echo     strcmp ${removepath} "" MODULE_%IWMAKE_TMP%_REMOVE_SAFETYLABEL >> "%IWMAKE_NSISCONF%"
       
   199   pushd %IWMAKE_TMP3%
       
   200 
       
   201   echo set IWMAKE_TMP2=%%IWMAKE_TMP2:%CD%\=%% > "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   202 
       
   203   dir /A-D /B /S > "%IWMAKE_ROOT%\iwmake_tmp.txt"
       
   204   for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addRemoveFiles "%%m"
       
   205 
       
   206   dir /AD /B /S | %SystemRoot%\system32\sort /R > "%IWMAKE_ROOT%\iwmake_tmp.txt"
       
   207   for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addRemoveDirectory "%%m"
       
   208 
       
   209   popd
       
   210   echo     MODULE_%IWMAKE_TMP%_REMOVE_SAFETYLABEL: >> "%IWMAKE_NSISCONF%"
       
   211   echo !macroend >> "%IWMAKE_NSISCONF%"
       
   212 goto :eof
       
   213 
       
   214 :addInstallFile
       
   215   set IWMAKE_TMP2=%~1
       
   216   call "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   217   echo     File "/oname=%IWMAKE_TMP2%" "%~1" >> "%IWMAKE_NSISCONF%"
       
   218 goto :eof
       
   219 
       
   220 :addInstallDirectory
       
   221   set IWMAKE_TMP2=%~1
       
   222   call "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   223   echo     CreateDirectory "$OUTDIR\%IWMAKE_TMP2%" >> "%IWMAKE_NSISCONF%"
       
   224 goto :eof
       
   225 
       
   226 :addRemoveDirectory
       
   227   set IWMAKE_TMP2=%~1
       
   228   call "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   229   echo     RMDir ${removepath}\%IWMAKE_TMP2% >> "%IWMAKE_NSISCONF%" 
       
   230 goto :eof
       
   231 
       
   232 :addRemoveFiles
       
   233   set IWMAKE_TMP2=%~1
       
   234   call "%IWMAKE_ROOT%\iwmake_tmp.bat"
       
   235   echo     Delete ${removepath}\%IWMAKE_TMP2% >> "%IWMAKE_NSISCONF%"
       
   236 goto :eof
       
   237 
       
   238 :sign
       
   239   echo Signing Installer ...
       
   240   %IWMAKE_SIGNPATH%\signtool.exe sign /v /t http://timestamp.verisign.com/scripts/timestamp.dll /f "%IWMAKE_SIGNPATH%\keys.pfx" "%IWMAKE_OUTPUT_FILE%" >> %IWMAKE_LOGFILE%
       
   241 goto :eof
       
   242 
       
   243 :openpackage
       
   244   echo !define OPENSOURCE_BUILD >> "%IWMAKE_NSISCONF%"
       
   245 goto :eof
       
   246 
       
   247 :END