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 |
||
(5 intermediate revisions by the same user not shown) | |||
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 administrator^^! | |||
pause | |||
exit /b 1 | |||
) | ) | ||
: | :: Whether to compile TDLib or not | ||
set "BuildTDLib=1" | |||
set "Configuration=Release" | set "Configuration=Release" | ||
set "Miranda=%ProgramFiles%\Miranda NG" | set "Miranda=%ProgramFiles%\Miranda NG" | ||
set " | set "VS=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" | ||
set " | set "MSBuild=%VS%\MSBuild\15.0\Bin\MSBuild.exe" | ||
set " | set "OpenSSLSources=D:\dev\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" ( | ||
cd /d "% | rd /s /q "%MirandaSources%\%Solution%\%Configuration%64" | ||
) | |||
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:"%MirandaSources%" | ||
: | :: Set VS environment variables | ||
call "% | call "%VS%\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
: | if "%BuildTDLib%"=="1" ( | ||
title Building TDLib... | :: Build TDLib | ||
"% | title Building TDLib... | ||
if %ErrorLevel% neq 0 ( | "%MSBuild%" "%MirandaSources%\%Solution%\tdlib.sln" /m /t:Rebuild /p:Configuration=%Configuration% | ||
if %ErrorLevel% neq 0 ( | |||
echo ********** TDLib build failed ********** | |||
pause | |||
exit /b 1 | |||
) | |||
) | ) | ||
: | :: Build Miranda | ||
title Building Miranda... | title Building Miranda... | ||
"% | "%MSBuild%" "%MirandaSources%\%Solution%\my.sln" /m /t:Rebuild /p:Configuration=%Configuration% | ||
if %ErrorLevel% neq 0 ( | if %ErrorLevel% neq 0 ( | ||
echo ********** Miranda build failed ********** | |||
pause | |||
exit /b 1 | |||
) | ) | ||
: | :: Build icons | ||
title Building icons... | title Building icons... | ||
"% | "%MSBuild%" "%MirandaSources%\%Solution%\my_icons.sln" /m /t:Rebuild /p:Configuration=%Configuration% | ||
if %ErrorLevel% neq 0 ( | if %ErrorLevel% neq 0 ( | ||
echo ********** Icons build failed ********** | |||
pause | |||
exit /b 1 | |||
) | ) | ||
: | :: 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 2>nul | ||
: | :: 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 | ||
if exist "%Temp%\OpenSSL" ( | |||
rd /s /q "%Temp%\OpenSSL" | |||
) | |||
xcopy /i /s "%OpenSSLSources%" "%Temp%\OpenSSL" | |||
title Building OpenSSL... | title Building OpenSSL... | ||
cd /d "% | cd /d "%Temp%\OpenSSL" | ||
git apply "% | git apply "%MirandaSources%\tools\openssl\openssl-mir-changes.patch" | ||
perl "% | perl "%Temp%\OpenSSL\Configure" shared VC-WIN64A | ||
nmake | 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 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" | ||
Latest revision as of 18:59, 9 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 "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=%Configuration% 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=%Configuration% 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=%Configuration% 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 if exist "%Temp%\OpenSSL" ( rd /s /q "%Temp%\OpenSSL" ) xcopy /i /s "%OpenSSLSources%" "%Temp%\OpenSSL" title Building OpenSSL... cd /d "%Temp%\OpenSSL" git apply "%MirandaSources%\tools\openssl\openssl-mir-changes.patch" perl "%Temp%\OpenSSL\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.