2016-09-06 15:31:41 -04:00
@ echo off
setlocal
: : Initialize environment
call " %~dp0 ..\env.bat "
if errorlevel 1 goto error_env
call " %EnvPath% \env.bat "
if errorlevel 1 goto error_env
2018-05-07 00:42:52 -04:00
: : Initialize environment
call " %~dp0 env.bat " %*
if errorlevel 2 exit /B 2
if errorlevel 1 goto error_env
2016-09-06 15:31:41 -04:00
: : Check external libraries
2018-05-07 00:42:52 -04:00
if not exist " %BuildLibsPath% \libs " %cecho% error " Please build external libraries first. " & exit /B 1
2016-09-06 15:31:41 -04:00
: : Check gcc version of external libraries
2018-05-07 00:42:52 -04:00
if not exist " %BuildLibsPath% \libs\gcc-version " %cecho% error " Cannot get gcc version of external libraries. " & exit /B 1
set /P LibsGCCVersion = < " %BuildLibsPath% \libs\gcc-version "
if " %LibsGCCVersion% " NEQ " %GCCVersion% " %cecho% error " Please use correct version of external libraries. (gcc %GCCVersion% ^ < ^ > libs %LibsGCCVersion% ). " & exit /B 1
2016-09-06 15:31:41 -04:00
: : Check git executable
set GitPath =
call " %ToolsPath% \find-in-path.bat " GitPath git.exe
2018-10-13 07:19:22 -04:00
if " %GitPath% " == " " (
%cecho% error " Git not found in PATH. Version information cannot be determined. "
exit /B 1
)
2016-09-06 15:31:41 -04:00
echo .
echo === Version
echo .
2018-06-17 11:51:58 -04:00
title Build - %SourceName% -%RsBuildConfig% [Version]
2016-09-06 15:31:41 -04:00
pushd " %SourcePath% \retroshare-gui\src\gui\images "
: : Touch resource file
copy /b retroshare_win.rc +,,
popd
if not exist " %RsBuildPath% " mkdir " %RsBuildPath% "
pushd " %RsBuildPath% "
echo .
echo === qmake
echo .
2018-06-17 11:51:58 -04:00
title Build - %SourceName% -%RsBuildConfig% [qmake]
2016-09-06 15:31:41 -04:00
2018-06-17 11:51:58 -04:00
set RS_QMAKE_CONFIG = %RsBuildConfig%
if " %ParamAutologin% " == " 1 " set RS_QMAKE_CONFIG = %RS_QMAKE_CONFIG% rs_autologin
2020-08-10 18:23:25 -04:00
if " %ParamJsonApi% " == " 1 " set RS_QMAKE_CONFIG = %RS_QMAKE_CONFIG% rs_jsonapi
2018-06-17 11:51:58 -04:00
if " %ParamPlugins% " == " 1 " set RS_QMAKE_CONFIG = %RS_QMAKE_CONFIG% retroshare_plugins
2018-03-08 11:45:24 -05:00
2018-05-31 13:19:41 -04:00
qmake " %SourcePath% \RetroShare.pro " -r -spec win32-g++ " CONFIG+= %RS_QMAKE_CONFIG% " " EXTERNAL_LIB_DIR= %BuildLibsPath% \libs "
2016-09-06 15:31:41 -04:00
if errorlevel 1 goto error
echo .
echo === make
echo .
2018-06-17 11:51:58 -04:00
title Build - %SourceName% -%RsBuildConfig% [make]
2016-09-06 15:31:41 -04:00
2020-08-11 05:41:10 -04:00
mingw32-make -j %CoreCount%
2020-08-04 13:04:45 -04:00
if errorlevel 1 goto error
echo .
echo === Changelog
echo .
title Build - %SourceName% -%RsBuildConfig% [changelog]
call " %ToolsPath% \generate-changelog.bat " " %SourcePath% " " %RsBuildPath% \changelog.txt "
2016-09-06 15:31:41 -04:00
: error
popd
title %COMSPEC%
2018-10-13 07:19:22 -04:00
if errorlevel 1 %cecho% error " \nBuild failed\n "
2016-09-06 15:31:41 -04:00
exit /B %ERRORLEVEL%
: error_env
echo Failed to initialize environment.
endlocal
exit /B 1