Modified Windows Build Environment

- Removed commandline switch "version"
- Added MinGit for determining version information during compile process
- Added sigcheck to determine version of the executable
This commit is contained in:
thunder2 2018-10-13 13:19:22 +02:00
parent c7563f1efd
commit 617ed25a19
43 changed files with 2731 additions and 2725 deletions

View file

@ -9,7 +9,7 @@ call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env if errorlevel 1 goto error_env
%cecho% info "Build %SourceName%" %cecho% info "Build %SourceName%"
call "%~dp0build\build.bat" 32 release tor version autologin plugins call "%~dp0build\build.bat" 32 release tor autologin plugins
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%" %cecho% info "Pack %SourceName%"

View file

@ -9,7 +9,7 @@ call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env if errorlevel 1 goto error_env
%cecho% info "Build %SourceName%" %cecho% info "Build %SourceName%"
call "%~dp0build\build.bat" 32 release version autologin plugins call "%~dp0build\build.bat" 32 release autologin plugins
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%" %cecho% info "Pack %SourceName%"

View file

@ -49,10 +49,8 @@ echo.
title Build - %SourceName%-%RsBuildConfig% [qmake] title Build - %SourceName%-%RsBuildConfig% [qmake]
set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%" set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%"
if "%ParamVersion%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=version_detail_bash_script"
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin" if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin"
if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins" if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins"
if "%ParamRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retrotor"
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path

View file

@ -3,7 +3,6 @@ set Param32=0
set Param64=0 set Param64=0
set ParamRelease=0 set ParamRelease=0
set ParamDebug=0 set ParamDebug=0
set ParamVersion=0
set ParamAutologin=0 set ParamAutologin=0
set ParamPlugins=0 set ParamPlugins=0
set ParamTor=0 set ParamTor=0
@ -19,8 +18,6 @@ if "%~1" NEQ "" (
set ParamRelease=1 set ParamRelease=1
) else if "%%~a"=="debug" ( ) else if "%%~a"=="debug" (
set ParamDebug=1 set ParamDebug=1
) else if "%%~a"=="version" (
set ParamVersion=1
) else if "%%~a"=="autologin" ( ) else if "%%~a"=="autologin" (
set ParamAutologin=1 set ParamAutologin=1
) else if "%%~a"=="plugins" ( ) else if "%%~a"=="plugins" (
@ -87,7 +84,6 @@ echo 32^|64 32-bit or 64-bit Version
echo release^|debug Build release or debug version echo release^|debug Build release or debug version
echo. echo.
echo Optional parameter (need clean when changed) echo Optional parameter (need clean when changed)
echo version Create version information from git
echo autologin Build with autologin echo autologin Build with autologin
echo plugins Build plugins echo plugins Build plugins
echo. echo.

View file

@ -26,27 +26,21 @@ if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error
:: Get compiled revision :: Get compiled revision
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
if not exist "%GetRsVersion%" ( if not exist "%GetRsVersion%" (
echo File not found %cecho% error "File not found"
echo %GetRsVersion% echo %GetRsVersion%
goto error goto error
) )
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& goto error
:: Get compiled version :: Get compiled version
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion call "%GetRsVersion%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
if "%RsMajorVersion%"=="" echo Major version not found.& goto error if errorlevel 1 %cecho% error "Revision not found."& goto error
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
if "%RsBuildNumber%"=="" echo Build number not found.& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
:: Check WMIC is available :: Check WMIC is available
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
@ -59,10 +53,7 @@ set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
if "%ParamTor%"=="1" ( if "%ParamTor%"=="1" (
:: Check for tor executable :: Check for tor executable
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" ( if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
echo Tor binary not found. Please download Tor Expert Bundle from %cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
echo https://www.torproject.org/download/download.html.en
echo and unpack to
echo %EnvDownloadPath%\tor
goto error goto error
) )
) )
@ -78,9 +69,9 @@ if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5 if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%RsBuildConfig%" NEQ "release" ( if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
) else ( ) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z
) )
if exist "%Archive%" del /Q "%Archive%" if exist "%Archive%" del /Q "%Archive%"

View file

@ -10,6 +10,8 @@ set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
set WgetInstall=wget.exe set WgetInstall=wget.exe
set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip
set DependsInstall=depends22_x86.zip set DependsInstall=depends22_x86.zip
set SigcheckInstall=Sigcheck.zip
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
if not exist "%EnvToolsPath%\wget.exe" ( if not exist "%EnvToolsPath%\wget.exe" (
echo Download Wget installation echo Download Wget installation
@ -70,6 +72,16 @@ if not exist "%EnvToolsPath%\depends.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
) )
if not exist "%EnvToolsPath%\sigcheck.exe" (
%cecho% info "Download Sigcheck installation"
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
%cecho% info "Unpack Sigcheck"
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
)
:exit :exit
endlocal endlocal
exit /B 0 exit /B 0

View file

@ -1,9 +1,14 @@
:: Usage: :: Usage:
:: call get-rs-version.bat Define Variable :: call get-rs-version.bat Executable Variable
::
:: Variable.Major
:: Variable.Minor
:: Variable.Mini
:: Variable.Extra
setlocal setlocal
set Define=%~1 set Executable=%~1
set Variable=%~2 set Variable=%~2
if "%Variable%"=="" ( if "%Variable%"=="" (
echo. echo.
@ -11,23 +16,23 @@ if "%Variable%"=="" (
exit /B 1 exit /B 1
) )
set Result= if not exist "%Executable%" (
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
if not exist "%VersionFile%" (
echo. echo.
echo Version file doesn't exist. echo File %Executable% doesn't exist.
echo %VersionFile%
exit /B1 exit /B1
) )
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do ( set VersionMajor=
if "%%A"=="#define" ( set VersionMinor=
if "%%B"=="%Define%" ( set VersionMini=
set Result=%%~C set VersionExtra=
)
) for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
set VersionMajor=%%A
set VersionMinor=%%B
set VersionMini=%%C
set VersionExtra=%%D
) )
endlocal & set %Variable%=%Result% endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
exit /B 0 exit /B 0

View file

@ -13,7 +13,7 @@ call "%~dp0build-libs\build-libs.bat"
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
%cecho% info "Build %SourceName%" %cecho% info "Build %SourceName%"
call "%~dp0build\build.bat" release tor version autologin plugins call "%~dp0build\build.bat" release tor autologin plugins
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%" %cecho% info "Pack %SourceName%"

View file

@ -13,7 +13,7 @@ call "%~dp0build-libs\build-libs.bat"
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
%cecho% info "Build %SourceName%" %cecho% info "Build %SourceName%"
call "%~dp0build\build.bat" release version autologin plugins call "%~dp0build\build.bat" release autologin plugins
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%" %cecho% info "Pack %SourceName%"

View file

@ -31,15 +31,13 @@ set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%" set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
set NSIS_PARAM=%NSIS_PARAM% /DEXTERNAL_LIB_DIR="%BuildLibsPath%\libs" set NSIS_PARAM=%NSIS_PARAM% /DEXTERNAL_LIB_DIR="%BuildLibsPath%\libs"
:: Scan version from source :: Get compiled version
set RsRevision= call "%ToolsPath%\get-rs-version.bat" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
set RsBuildAdd= if errorlevel 1 %cecho% error "Version not found."& exit /B 1
call "%ToolsPath%\get-rs-version.bat" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& exit /B 1
call "%ToolsPath%\get-rs-version.bat" RS_BUILD_NUMBER_ADD RsBuildAdd
if errorlevel 1 exit /B 1
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsRevision% /DBUILDADD=%RsBuildAdd% if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& exit /B 1
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra%
set QtMainVersion=%QtVersion:~0,1% set QtMainVersion=%QtVersion:~0,1%

View file

@ -22,13 +22,12 @@ 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 if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
:: Check git executable :: Check git executable
if "%ParamVersion%"=="0" goto found_git
set GitPath= set GitPath=
call "%ToolsPath%\find-in-path.bat" GitPath git.exe call "%ToolsPath%\find-in-path.bat" GitPath git.exe
if "%GitPath%" NEQ "" goto found_git if "%GitPath%"=="" (
choice /M "Git not found in PATH. Version information cannot be calculated. Do you want to proceed?" %cecho% error "Git not found in PATH. Version information cannot be determined."
if %errorlevel%==2 exit /B 1 exit /B 1
:found_git )
echo. echo.
echo === Version echo === Version
@ -75,7 +74,7 @@ popd
title %COMSPEC% title %COMSPEC%
if errorlevel 1 echo.& echo Build failed& echo. if errorlevel 1 %cecho% error "\nBuild failed\n"
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
:error_env :error_env

View file

@ -1,7 +1,6 @@
:: Process commandline parameter :: Process commandline parameter
set ParamRelease=0 set ParamRelease=0
set ParamDebug=0 set ParamDebug=0
set ParamVersion=0
set ParamAutologin=0 set ParamAutologin=0
set ParamPlugins=0 set ParamPlugins=0
set ParamTor=0 set ParamTor=0
@ -13,8 +12,6 @@ if "%~1" NEQ "" (
set ParamRelease=1 set ParamRelease=1
) else if "%%~a"=="debug" ( ) else if "%%~a"=="debug" (
set ParamDebug=1 set ParamDebug=1
) else if "%%~a"=="version" (
set ParamVersion=1
) else if "%%~a"=="autologin" ( ) else if "%%~a"=="autologin" (
set ParamAutologin=1 set ParamAutologin=1
) else if "%%~a"=="plugins" ( ) else if "%%~a"=="plugins" (
@ -95,7 +92,6 @@ echo Mandatory parameter
echo release^|debug Build release or debug version echo release^|debug Build release or debug version
echo. echo.
echo Optional parameter (need clean when changed) echo Optional parameter (need clean when changed)
echo version Create version information from git
echo autologin Build with autologin echo autologin Build with autologin
echo plugins Build plugins echo plugins Build plugins
echo. echo.

View file

@ -32,27 +32,21 @@ if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error
:: Get compiled revision :: Get compiled revision
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
if not exist "%GetRsVersion%" ( if not exist "%GetRsVersion%" (
echo File not found %cecho% error "File not found"
echo %GetRsVersion% echo %GetRsVersion%
goto error goto error
) )
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& goto error
:: Get compiled version :: Get compiled version
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion call "%GetRsVersion%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
if "%RsMajorVersion%"=="" echo Major version not found.& goto error if errorlevel 1 %cecho% error "Version not found."& goto error
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
if "%RsBuildNumber%"=="" echo Build number not found.& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
:: Check WMIC is available :: Check WMIC is available
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
@ -65,10 +59,7 @@ set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
if "%ParamTor%"=="1" ( if "%ParamTor%"=="1" (
:: Check for tor executable :: Check for tor executable
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" ( if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
echo Tor binary not found. Please download Tor Expert Bundle from %cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
echo https://www.torproject.org/download/download.html.en
echo and unpack to
echo %EnvDownloadPath%\tor
goto error goto error
) )
) )
@ -83,9 +74,9 @@ if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5 if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%RsBuildConfig%" NEQ "release" ( if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
) else ( ) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
) )
if exist "%Archive%" del /Q "%Archive%" if exist "%Archive%" del /Q "%Archive%"
@ -98,7 +89,7 @@ title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
set Extensions= set Extensions=
for /f %%e in ('type "%ExtensionsFile%" ^| "%EnvSedExe%" -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| "%EnvSedExe%" -n "1,1p"') do set Extensions=%%e for /f %%e in ('type "%ExtensionsFile%" ^| "%EnvSedExe%" -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| "%EnvSedExe%" -n "1,1p"') do set Extensions=%%e
if "%Extensions%"=="" echo Folder for extensions not found in %ExtensionsFile%& goto error if "%Extensions%"=="" %cecho% error "Folder for extensions not found in %ExtensionsFile%"& goto error
:: Copy files :: Copy files
mkdir "%RsDeployPath%\Data\%Extensions%" mkdir "%RsDeployPath%\Data\%Extensions%"

View file

@ -24,7 +24,13 @@ if not exist "%EnvToolsPath%" mkdir "%EnvToolsPath%"
if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%" if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%"
call "%~dp0tools\prepare-tools.bat" call "%~dp0tools\prepare-tools.bat"
exit /B %ERRORLEVEL% if errorlevel 1 exit /B %ERRORLEVEL%
:: Add MinGit to PATH
set PATH=%EnvToolsPath%\MinGit\cmd;%PATH%
set HOME=%EnvToolsPath%\MinGit\home
exit /B 0
:error_env :error_env
echo Failed to initialize environment. echo Failed to initialize environment.

View file

@ -19,6 +19,11 @@ set UnixToolsInstall=UnxUpdates.zip
set NSISUrl=http://prdownloads.sourceforge.net/nsis/nsis-3.0-setup.exe?download set NSISUrl=http://prdownloads.sourceforge.net/nsis/nsis-3.0-setup.exe?download
set NSISInstall=nsis-3.0-setup.exe set NSISInstall=nsis-3.0-setup.exe
set NSISInstallPath=%EnvToolsPath%\NSIS set NSISInstallPath=%EnvToolsPath%\NSIS
set MinGitInstall=MinGit-2.19.1-32-bit.zip
set MinGitUrl=https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/%MinGitInstall%
set MinGitInstallPath=%EnvToolsPath%\MinGit
set SigcheckInstall=Sigcheck.zip
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
if not exist "%EnvToolsPath%\wget.exe" ( if not exist "%EnvToolsPath%\wget.exe" (
echo Download Wget installation echo Download Wget installation
@ -143,7 +148,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
) )
if not exist "%EnvToolsPath%\NSIS\nsis.exe" ( if not exist "%NSISInstallPath%\nsis.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%" mkdir "%EnvTempPath%"
@ -160,6 +165,26 @@ if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
) )
if not exist "%MinGitInstallPath%\cmd\git.exe" (
%cecho% info "Download MinGit installation"
if not exist "%EnvDownloadPath%\%MinGitInstall%" call "%ToolsPath%\download-file.bat" "%MinGitUrl%" "%EnvDownloadPath%\%MinGitInstall%"
if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
%cecho% info "Unpack MinGit"
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%"
)
if not exist "%EnvToolsPath%\sigcheck.exe" (
%cecho% info "Download Sigcheck installation"
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
%cecho% info "Unpack Sigcheck"
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
)
:exit :exit
endlocal endlocal
exit /B 0 exit /B 0

View file

@ -4,7 +4,7 @@
!include ifexist.nsh !include ifexist.nsh
# Needed defines # Needed defines
;!define BUILDADD "" ;!define REVISION ""
;!define RELEASEDIR "" ;!define RELEASEDIR ""
;!define QTDIR "" ;!define QTDIR ""
;!define MINGWDIR "" ;!define MINGWDIR ""
@ -13,10 +13,6 @@
;!define OUTDIR "" ;!define OUTDIR ""
# Check needed defines # Check needed defines
!ifndef BUILDADD
!error "BUILDADD is not defined"
!endif
!ifndef RELEASEDIR !ifndef RELEASEDIR
!error "RELEASEDIR is not defined" !error "RELEASEDIR is not defined"
!endif !endif
@ -44,7 +40,7 @@
# Get version from executable # Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_ !GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD} !define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
;!define REVISION ${VERSION_4} ;!define REVISION ${VERSION_4}
# Get version of Qt # Get version of Qt
@ -56,10 +52,6 @@
!error "REVISION is not defined" !error "REVISION is not defined"
!endif !endif
!ifndef REVISION
!error "REVISION is not defined"
!endif
# Date # Date
!define /date Date "%Y%m%d" !define /date Date "%Y%m%d"

View file

@ -4,7 +4,7 @@
!include ifexist.nsh !include ifexist.nsh
# Needed defines # Needed defines
;!define BUILDADD "" ;!define REVISION ""
;!define RELEASEDIR "" ;!define RELEASEDIR ""
;!define QTDIR "" ;!define QTDIR ""
;!define MINGWDIR "" ;!define MINGWDIR ""
@ -13,10 +13,6 @@
;!define OUTDIR "" ;!define OUTDIR ""
# Check needed defines # Check needed defines
!ifndef BUILDADD
!error "BUILDADD is not defined"
!endif
!ifndef RELEASEDIR !ifndef RELEASEDIR
!error "RELEASEDIR is not defined" !error "RELEASEDIR is not defined"
!endif !endif
@ -44,7 +40,7 @@
# Get version from executable # Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_ !GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD} !define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
;!define REVISION ${VERSION_4} ;!define REVISION ${VERSION_4}
# Get version of Qt # Get version of Qt
@ -56,10 +52,6 @@
!error "REVISION is not defined" !error "REVISION is not defined"
!endif !endif
!ifndef REVISION
!error "REVISION is not defined"
!endif
# Date # Date
!define /date Date "%Y%m%d" !define /date Date "%Y%m%d"

View file

@ -1,9 +1,14 @@
:: Usage: :: Usage:
:: call get-rs-version.bat Define Variable :: call get-rs-version.bat Executable Variable
::
:: Variable.Major
:: Variable.Minor
:: Variable.Mini
:: Variable.Extra
setlocal setlocal
set Define=%~1 set Executable=%~1
set Variable=%~2 set Variable=%~2
if "%Variable%"=="" ( if "%Variable%"=="" (
echo. echo.
@ -11,23 +16,23 @@ if "%Variable%"=="" (
exit /B 1 exit /B 1
) )
set Result= if not exist "%Executable%" (
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
if not exist "%VersionFile%" (
echo. echo.
echo Version file doesn't exist. echo File %Executable% doesn't exist.
echo %VersionFile%
exit /B1 exit /B1
) )
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do ( set VersionMajor=
if "%%A"=="#define" ( set VersionMinor=
if "%%B"=="%Define%" ( set VersionMini=
set Result=%%~C set VersionExtra=
)
) for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
set VersionMajor=%%A
set VersionMinor=%%B
set VersionMini=%%C
set VersionExtra=%%D
) )
endlocal & set %Variable%=%Result% endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
exit /B 0 exit /B 0