| 1 |
@echo off |
| 2 |
|
| 3 |
rem This script converts portable *.zip package to *.msi package |
| 4 |
|
| 5 |
rem Check command arguments |
| 6 |
if "%1" == "" ( |
| 7 |
echo. |
| 8 |
echo Syntax: |
| 9 |
echo. |
| 10 |
echo %~nx0 ^<Full path to portable .zip package^> |
| 11 |
goto :eof |
| 12 |
) |
| 13 |
|
| 14 |
rem Path to Windows Installer XML (WiX) toolset |
| 15 |
set PATH=%PATH%;"C:\Program Files (x86)\WiX Toolset v3.11\bin" |
| 16 |
|
| 17 |
rem The new package will be created from here |
| 18 |
set BUILD_PACK_DIR=%TEMP%\doublecmd-%DATE: =% |
| 19 |
|
| 20 |
rem The new package will be saved here |
| 21 |
set PACK_DIR=%~dp0/release |
| 22 |
|
| 23 |
rem Determine package file name |
| 24 |
for /f %%i in ("%1") do set PACKAGE=%%~ni |
| 25 |
|
| 26 |
rem Get package version and architecture |
| 27 |
for /f "tokens=1,2,3,4,5 delims=-." %%a in ("%PACKAGE%") do ( |
| 28 |
set DC_VER=%%b.%%c.%%d |
| 29 |
set CPU_TARGET=%%e |
| 30 |
) |
| 31 |
|
| 32 |
rem Prepare needed variables |
| 33 |
if "%CPU_TARGET%" == "i386" ( |
| 34 |
set CPU_TARGET=x86 |
| 35 |
set PF=ProgramFilesFolder |
| 36 |
) else if "%CPU_TARGET%" == "x86_64" ( |
| 37 |
set CPU_TARGET=x64 |
| 38 |
set PF=ProgramFiles64Folder |
| 39 |
) |
| 40 |
|
| 41 |
rem Prepare package build dir |
| 42 |
mkdir %BUILD_PACK_DIR% |
| 43 |
|
| 44 |
rem Extract archive |
| 45 |
unzip %1 -d %BUILD_PACK_DIR% |
| 46 |
|
| 47 |
rem Copy needed files |
| 48 |
copy license.rtf %BUILD_PACK_DIR%\ |
| 49 |
copy doublecmd.wxs %BUILD_PACK_DIR%\ |
| 50 |
copy ..\..\src\doublecmd.ico %BUILD_PACK_DIR%\ |
| 51 |
|
| 52 |
pushd %BUILD_PACK_DIR% |
| 53 |
|
| 54 |
del /Q doublecmd\settings\doublecmd.inf |
| 55 |
heat dir doublecmd -ag -cg HeatGroup -srd -dr APPLICATIONFOLDER -var var.SourcePath -o include.wxs |
| 56 |
candle -arch %CPU_TARGET% -dProductVersion=%DC_VER% -dSourcePath=doublecmd -dProgramFiles=%PF% doublecmd.wxs include.wxs |
| 57 |
light -ext WixUIExtension -cultures:en-us include.wixobj doublecmd.wixobj -o %PACKAGE%.msi |
| 58 |
|
| 59 |
rem Move created package |
| 60 |
move %PACKAGE%.msi %PACK_DIR%/ |
| 61 |
|
| 62 |
rem Clean temp directories |
| 63 |
popd |
| 64 |
rmdir /S /Q %BUILD_PACK_DIR% |