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 4: | Line 4: | ||
<pre style="overflow:auto;"> | <pre style="overflow:auto;"> | ||
@echo off | @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 | :: Whether to compile TDLib or not | ||
Line 9: | Line 17: | ||
set "Configuration=Release" | set "Configuration=Release" | ||
set "Miranda=% | set "Miranda=%ProgramFiles%\Miranda NG" | ||
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 "OpenSSLSources= | set "OpenSSLSources=D:\dev\openssl" | ||
set "OpenSSLBuild=%Temp%\OpenSSL" | set "OpenSSLBuild=%Temp%\OpenSSL" | ||
set "Path=%ProgramFiles%\NASM;%Path%" | set "Path=%ProgramFiles%\NASM;%Path%" | ||
set "Solution=bin15" | set "Solution=bin15" | ||
set "MirandaSources= | set "MirandaSources=D:\dev\miranda-ng" | ||
:: Clean Miranda sources | :: Clean Miranda sources | ||
Line 24: | Line 32: | ||
:: Update Miranda sources | :: Update Miranda sources | ||
tortoisegitproc /command:pull /path:"%MirandaSources%" | git --work-tree="%MirandaSources%" --git-dir="%MirandaSources%/.git" pull | ||
:: Or you can use something like tortoisegitproc /command:pull /path:"%MirandaSources%" | |||
:: Set VS environment variables | :: Set VS environment variables |
Revision as of 17:39, 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 2>nul :: 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 if %ErrorLevel% neq 0 ( echo ********** OpenSSL build failed ********** pause exit /b 1 ) 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.