User:Dart Raiden/Build Miranda: Difference between revisions
Jump to navigation
Jump to search
Dart Raiden (talk | contribs) No edit summary |
Dart Raiden (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
@echo off | @echo off | ||
: | :: check admin rights | ||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1 | reg query "HKU\S-1-5-19\Environment" >nul 2>&1 | ||
if not %ErrorLevel% == 0 ( | if not %ErrorLevel% == 0 ( | ||
echo Please run as | echo Please run as administrator^^! | ||
pause | pause | ||
exit /b 1 | exit /b 1 | ||
Line 20: | Line 20: | ||
set "Vs=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" | set "Vs=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" | ||
set "Msbuild=%Vs%\MSBuild\15.0\Bin\MSBuild.exe" | set "Msbuild=%Vs%\MSBuild\15.0\Bin\MSBuild.exe" | ||
set " | set "OpensslSources=D:\dev\openssl" | ||
set "OpensslBuild=%Temp%\OpenSSL" | |||
set "Path=%ProgramFiles%\NASM;%Path%" | set "Path=%ProgramFiles%\NASM;%Path%" | ||
set "Solution=bin15" | set "Solution=bin15" | ||
set " | set "MirandaSources=D:\dev\miranda-ng" | ||
: | :: clean Miranda sources | ||
if exist "% | if exist "%MirandaSources%\%Solution%\%Configuration%64" rd /s /q "%MirandaSources%\%Solution%\%Configuration%64" | ||
cd /d "% | cd /d "%MirandaSources%" | ||
call cleaner.bat | call cleaner.bat | ||
: | :: update Miranda sources | ||
git --work-tree="% | git --work-tree="%MirandaSources%" --git-dir="%MirandaSources%/.git" pull | ||
:: or you can use something like tortoisegitproc /command:pull /path:"% | :: or you can use something like tortoisegitproc /command:pull /path:"%MirandaSources%" | ||
: | :: set VS environment variables | ||
call "%Vs%\VC\Auxiliary\Build\vcvarsall.bat" x64 | call "%Vs%\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
if "%BuildTdlib%"=="1" ( | if "%BuildTdlib%"=="1" ( | ||
:: build TDLib | |||
title Building TDLib... | |||
"%Msbuild%" "%MirandaSources%\%Solution%\tdlib.sln" /m /t:Rebuild /p:Configuration=Release | |||
if %ErrorLevel% neq 0 ( | |||
echo ********** TDLib build failed ********** | |||
pause | |||
exit /b 1 | |||
) | |||
) | ) | ||
: | :: build Miranda | ||
title Building Miranda... | title Building Miranda... | ||
"%Msbuild%" "% | "%Msbuild%" "%MirandaSources%\%Solution%\my.sln" /m /t:Rebuild /p:Configuration=Release | ||
if %ErrorLevel% neq 0 ( | if %ErrorLevel% neq 0 ( | ||
echo ********** Miranda build failed ********** | echo ********** Miranda build failed ********** | ||
Line 57: | Line 58: | ||
) | ) | ||
: | :: build icons | ||
title Building icons... | title Building icons... | ||
"%Msbuild%" "% | "%Msbuild%" "%MirandaSources%\%Solution%\my_icons.sln" /m /t:Rebuild /p:Configuration=Release | ||
if %ErrorLevel% neq 0 ( | if %ErrorLevel% neq 0 ( | ||
echo ********** Icons build failed ********** | echo ********** Icons build failed ********** | ||
Line 66: | Line 67: | ||
) | ) | ||
: | :: build langpack | ||
mkdir "% | mkdir "%MirandaSources%\%Solution%\%Configuration%64\Languages" | ||
cscript /nologo "% | cscript /nologo "%MirandaSources%\tools\lpgen\translate.js" /sourcelang:"russian" /release:"%MirandaSources%\%Solution%\%Configuration%64\Languages\langpack_russian.txt" | ||
: | :: sort compiled files | ||
cd /d "% | cd /d "%MirandaSources%\%Solution%\%Configuration%64" | ||
rd /q /s Obj | rd /q /s Obj | ||
for /r %%i in (*.ilk,*.iobj,*.ipdb) do del /q /s %%i | for /r %%i in (*.ilk,*.iobj,*.ipdb) do del /q /s %%i | ||
for /r %%j in (Icons\*.pdb) do del /q /s %%j | for /r %%j in (Icons\*.pdb) do del /q /s %%j | ||
for /r %%k in (*.pdb) do move %%k "% | for /r %%k in (*.pdb) do move %%k "%MirandaSources%\%Solution%\%Configuration%64" | ||
: | :: kill Miranda | ||
Taskkill /f /im Miranda64.exe | Taskkill /f /im Miranda64.exe | ||
: | :: backup old Miranda | ||
if exist "%Temp%\Miranda_backup" rd /q /s "%Temp%\Miranda_backup" | if exist "%Temp%\Miranda_backup" rd /q /s "%Temp%\Miranda_backup" | ||
xcopy /i /s /y "%Miranda%" "%Temp%\Miranda_backup" | xcopy /i /s /y "%Miranda%" "%Temp%\Miranda_backup" | ||
: | :: update Miranda | ||
xcopy /i /s /y "% | xcopy /i /s /y "%MirandaSources%\%Solution%\%Configuration%64" "%Miranda%" | ||
: | :: build OpenSSL | ||
rd /s /q "%OpensslBuild%" | |||
xcopy /i /s "%OpensslSources%" "%OpensslBuild%" | |||
title Building OpenSSL... | title Building OpenSSL... | ||
cd /d "% | cd /d "%OpensslBuild%" | ||
git apply "% | git apply "%MirandaSources%\tools\openssl\openssl-mir-changes.patch" | ||
perl "% | perl "%OpensslBuild%\Configure" shared VC-WIN64A | ||
nmake | nmake | ||
copy /y libcrypto-3.dll "%Miranda%\Libs\libcrypto-3.mir" | |||
copy /y libssl-3.dll "%Miranda%\Libs\libssl-3.mir" | copy /y libssl-3.dll "%Miranda%\Libs\libssl-3.mir" | ||
copy /y libcrypto-3.pdb "%Miranda%\Libs\libcrypto-3.pdb" | copy /y libcrypto-3.pdb "%Miranda%\Libs\libcrypto-3.pdb" | ||
copy /y libssl-3.pdb "%Miranda%\Libs\libssl-3.pdb" | copy /y libssl-3.pdb "%Miranda%\Libs\libssl-3.pdb" | ||
:: run Miranda (dirty hack to prevent the app from inheriting elevated permissions) | |||
:: dirty hack to prevent the app from inheriting elevated permissions | |||
explorer "%Miranda%\Miranda64.exe" | explorer "%Miranda%\Miranda64.exe" | ||
Revision as of 17:12, 6 March 2025
It is assumed that you have 7-Zip, NASM, Strawberry Perl, and Visual Studion 2017 installed.
build.bat:
@echo off :: check admin rights reg query "HKU\S-1-5-19\Environment" >nul 2>&1 if not %ErrorLevel% == 0 ( echo Please run as administrator^^! pause exit /b 1 ) :: whether to compile tdlib or not set "BuildTdlib=1" set "Configuration=Release" set "Miranda=%ProgramFiles%\Miranda NG" set "Vs=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" set "Msbuild=%Vs%\MSBuild\15.0\Bin\MSBuild.exe" set "OpensslSources=D:\dev\openssl" set "OpensslBuild=%Temp%\OpenSSL" set "Path=%ProgramFiles%\NASM;%Path%" set "Solution=bin15" set "MirandaSources=D:\dev\miranda-ng" :: clean Miranda sources if exist "%MirandaSources%\%Solution%\%Configuration%64" rd /s /q "%MirandaSources%\%Solution%\%Configuration%64" cd /d "%MirandaSources%" call cleaner.bat :: update Miranda sources git --work-tree="%MirandaSources%" --git-dir="%MirandaSources%/.git" pull :: or you can use something like tortoisegitproc /command:pull /path:"%MirandaSources%" :: set VS environment variables call "%Vs%\VC\Auxiliary\Build\vcvarsall.bat" x64 if "%BuildTdlib%"=="1" ( :: build TDLib title Building TDLib... "%Msbuild%" "%MirandaSources%\%Solution%\tdlib.sln" /m /t:Rebuild /p:Configuration=Release if %ErrorLevel% neq 0 ( echo ********** TDLib build failed ********** pause exit /b 1 ) ) :: build Miranda title Building Miranda... "%Msbuild%" "%MirandaSources%\%Solution%\my.sln" /m /t:Rebuild /p:Configuration=Release if %ErrorLevel% neq 0 ( echo ********** Miranda build failed ********** pause exit /b 1 ) :: build icons title Building icons... "%Msbuild%" "%MirandaSources%\%Solution%\my_icons.sln" /m /t:Rebuild /p:Configuration=Release if %ErrorLevel% neq 0 ( echo ********** Icons build failed ********** pause exit /b 1 ) :: build langpack mkdir "%MirandaSources%\%Solution%\%Configuration%64\Languages" cscript /nologo "%MirandaSources%\tools\lpgen\translate.js" /sourcelang:"russian" /release:"%MirandaSources%\%Solution%\%Configuration%64\Languages\langpack_russian.txt" :: sort compiled files cd /d "%MirandaSources%\%Solution%\%Configuration%64" rd /q /s Obj for /r %%i in (*.ilk,*.iobj,*.ipdb) do del /q /s %%i for /r %%j in (Icons\*.pdb) do del /q /s %%j for /r %%k in (*.pdb) do move %%k "%MirandaSources%\%Solution%\%Configuration%64" :: kill Miranda Taskkill /f /im Miranda64.exe :: backup old Miranda if exist "%Temp%\Miranda_backup" rd /q /s "%Temp%\Miranda_backup" xcopy /i /s /y "%Miranda%" "%Temp%\Miranda_backup" :: update Miranda xcopy /i /s /y "%MirandaSources%\%Solution%\%Configuration%64" "%Miranda%" :: build OpenSSL rd /s /q "%OpensslBuild%" xcopy /i /s "%OpensslSources%" "%OpensslBuild%" title Building OpenSSL... cd /d "%OpensslBuild%" git apply "%MirandaSources%\tools\openssl\openssl-mir-changes.patch" perl "%OpensslBuild%\Configure" shared VC-WIN64A nmake copy /y libcrypto-3.dll "%Miranda%\Libs\libcrypto-3.mir" copy /y libssl-3.dll "%Miranda%\Libs\libssl-3.mir" copy /y libcrypto-3.pdb "%Miranda%\Libs\libcrypto-3.pdb" copy /y libssl-3.pdb "%Miranda%\Libs\libssl-3.pdb" :: run Miranda (dirty hack to prevent the app from inheriting elevated permissions) explorer "%Miranda%\Miranda64.exe" exit /b 0
my.sln and my_icons.sln are my custom solutions.