merged changes from master

This commit is contained in:
csoler 2015-08-05 16:09:30 +02:00
commit 311358bcda
13 changed files with 204 additions and 34 deletions

View File

@ -0,0 +1,43 @@
@:: Usage:
@:: call GetRsVersion.bat Define Variable
@setlocal
@echo off
set Define=%~1
if "%Define%"=="" (
echo.
echo Parameter error
endlocal
exit /B1
)
set Variable=%~2
if "%Variable%"=="" (
echo.
echo Parameter error
endlocal
exit /B1
)
set Result=
set VersionFile="%~dp0..\..\libretroshare\src\retroshare\rsversion.h"
if not exist "%VersionFile%" (
echo.
echo Version file doesn't exist.
echo %VersionFile%
endlocal
exit /B1
)
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
if "%%A"=="#define" (
if "%%B"=="%Define%" (
set Result=%%~C
)
)
)
endlocal & set %Variable%=%Result%
exit /B 0

View File

@ -24,32 +24,27 @@ if "%MinGWDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DMINGWDIR="%MinGWDir%"
if "%OutDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%OutDir%" if "%OutDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%OutDir%"
:: Scan version from source :: Scan version from source
set Revision=
set BuildAdd= set BuildAdd=
set VersionFile="%SourceDir%\libretroshare\src\retroshare\rsversion.h" call "%~dp0GetRsVersion.bat" RS_REVISION_STRING Revision
if errorlevel 1 goto exit
call "%~dp0GetRsVersion.bat" RS_BUILD_NUMBER_ADD BuildAdd
if errorlevel 1 goto exit
if not exist "%VersionFile%" ( if "%Revision%"=="" (
echo. echo.
echo Version file doesn't exist. echo Version not found in
echo %VersionFile% echo %VersionFile%
goto :exit goto exit
) )
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
if "%%A"=="#define" (
if "%%B"=="RS_BUILD_NUMBER_ADD" (
set BuildAdd=%%~C
)
)
)
if "%BuildAdd%"=="" ( if "%BuildAdd%"=="" (
echo. echo.
echo Version not found in echo Version not found in
echo %VersionFile% echo %VersionFile%
goto :exit goto exit
) )
set NSIS_PARAM=%NSIS_PARAM% /DBUILDADD=%BuildAdd% set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%Revision% /DBUILDADD=%BuildAdd%
:: Create installer :: Create installer
"%NSIS_EXE%" %NSIS_PARAM% "%~dp0retroshare.nsi" "%NSIS_EXE%" %NSIS_PARAM% "%~dp0retroshare.nsi"

View File

@ -42,7 +42,7 @@
!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}${BUILDADD}
!define REVISION ${VERSION_4} ;!define REVISION ${VERSION_4}
# Check version # Check version
!ifndef REVISION !ifndef REVISION
@ -53,6 +53,9 @@
!error "REVISION is not defined" !error "REVISION is not defined"
!endif !endif
# Date
!define /date Date "%Y%m%d"
# Application name and version # Application name and version
!define APPNAME "RetroShare" !define APPNAME "RetroShare"
!define APPNAMEANDVERSION "${APPNAME} ${VERSION}" !define APPNAMEANDVERSION "${APPNAME} ${VERSION}"
@ -68,7 +71,7 @@
# Main Install settings # Main Install settings
Name "${APPNAMEANDVERSION}" Name "${APPNAMEANDVERSION}"
InstallDirRegKey HKLM "Software\${APPNAME}" "" InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${OUTDIR_}RetroShare_${VERSION}_${REVISION}_setup.exe" OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-setup.exe"
BrandingText "${APPNAMEANDVERSION}" BrandingText "${APPNAMEANDVERSION}"
RequestExecutionlevel highest RequestExecutionlevel highest
# Use compression # Use compression

View File

@ -189,10 +189,17 @@ linux-g++-64 {
} }
version_detail_bash_script { version_detail_bash_script {
linux-* {
QMAKE_EXTRA_TARGETS += write_version_detail QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh write_version_detail.commands = ./version_detail.sh
} }
win32 {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = $$PWD/version_detail.bat
}
}
#################### Cross compilation for windows under Linux #################### #################### Cross compilation for windows under Linux ####################

View File

@ -8,4 +8,5 @@
// //
// Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer. // Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer.
// //
#define RS_REVISION_STRING "01234567"
#define RS_REVISION_NUMBER 0x01234567 #define RS_REVISION_NUMBER 0x01234567

View File

@ -2,4 +2,11 @@
#define RS_MINOR_VERSION 6 #define RS_MINOR_VERSION 6
#define RS_BUILD_NUMBER 0 #define RS_BUILD_NUMBER 0
#define RS_BUILD_NUMBER_ADD "x" // <-- do we need this? #define RS_BUILD_NUMBER_ADD "x" // <-- do we need this?
#define RS_REVISION_NUMBER $WCREV$
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
// git log --pretty="%H" | head -1 | cut -c1-8
//
// Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer.
//
#define RS_REVISION_STRING "$REV$"
#define RS_REVISION_NUMBER 0x$REV$

View File

@ -1,2 +0,0 @@
@echo off
"D:\Programme\TortoiseSVN\bin\SubWCRev" . util\rsversion.in util\rsversion.h

View File

@ -0,0 +1,48 @@
@echo off
setlocal enabledelayedexpansion
:: Search git in PATH
set GitPath=
for %%P in ("%PATH:;=" "%") do (
if exist "%%~P.\git.exe" (
set GitPath=%%~P
goto found_git
)
)
:found_git
if "%GitPath%"=="" (
echo git not found in PATH. Version update cancelled.
endlocal
exit /B 0
)
echo Update version
:: Retrieve git information
set RsHash=
pushd "%~dp0"
for /f "tokens=1*" %%A in ('"git log --pretty=format:"%%H" --max-count=1"') do set RsHash=%%A
popd
if "%RsHash%"=="" (
echo Git hash not found.
endlocal
exit /B 1
)
:: Create file
set InFile=%~dp0retroshare\rsversion.in
set OutFile=%~dp0retroshare\rsversion.h
if exist "%OutFile%" del /Q "%OutFile%"
for /f "tokens=* delims= " %%a in (%InFile%) do (
set line=%%a
set line=!line:$REV$=%RsHash:~0,8%!
echo !line!>>"%OutFile%"
)
endlocal
exit /B 0

View File

@ -0,0 +1,4 @@
Retroshare Gui version :
Git version : $Branch$
$Hash$
$Date$

View File

@ -5,11 +5,11 @@
IDI_ICON1 ICON "logo/logo_64.ico" IDI_ICON1 ICON "logo/logo_64.ico"
#define STRINGIZER(version) #version #define STRINGIZER(version) #version
#define VERSION_STRING(major,minor,build,buildadd,revision) STRINGIZER(major) "." STRINGIZER(minor) "." STRINGIZER(build) buildadd "." STRINGIZER(revision) #define VERSION_STRING(major,minor,build,buildadd,revision) STRINGIZER(major) "." STRINGIZER(minor) "." STRINGIZER(build) buildadd "." revision
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,RS_REVISION_NUMBER FILEVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,0
PRODUCTVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,RS_REVISION_NUMBER PRODUCTVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -22,11 +22,11 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "" VALUE "CompanyName", ""
VALUE "FileDescription", "RetroShare" VALUE "FileDescription", "RetroShare"
VALUE "FileVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_NUMBER) VALUE "FileVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_STRING)
VALUE "InternalName", "RetroShare" VALUE "InternalName", "RetroShare"
VALUE "OriginalFilename", "RetroShare.exe" VALUE "OriginalFilename", "RetroShare.exe"
VALUE "ProductName", "RetroShare" VALUE "ProductName", "RetroShare"
VALUE "ProductVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_NUMBER) VALUE "ProductVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_STRING)
VALUE "LegalCopyright", "" VALUE "LegalCopyright", ""
END END
END END

View File

@ -118,11 +118,18 @@ linux-g++-64 {
} }
version_detail_bash_script { version_detail_bash_script {
linux-* {
DEFINES += ADD_LIBRETROSHARE_VERSION_INFO DEFINES += ADD_LIBRETROSHARE_VERSION_INFO
QMAKE_EXTRA_TARGETS += write_version_detail QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh write_version_detail.commands = ./version_detail.sh
} }
win32 {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = $$PWD/version_detail.bat
}
}
install_rs { install_rs {
INSTALLS += binary_rs INSTALLS += binary_rs

View File

@ -1,2 +0,0 @@
@echo off
"D:\Programme\TortoiseSVN\bin\SubWCRev" . util\rsguiversion.in util\rsguiversion.cpp

View File

@ -0,0 +1,59 @@
@echo off
setlocal enabledelayedexpansion
:: Search git in PATH
set GitPath=
for %%P in ("%PATH:;=" "%") do (
if exist "%%~P.\git.exe" (
set GitPath=%%~P
goto found_git
)
)
:found_git
if "%GitPath%"=="" (
echo git not found in PATH. Version update cancelled.
endlocal
exit /B 0
)
echo Update version
:: Retrieve git information
set RsBranch=
set RsHash=
pushd "%~dp0"
for /f "tokens=1*" %%A in ('"git log --pretty=format:"%%H" --max-count=1"') do set RsHash=%%A
for /f "tokens=*" %%A in ('git rev-parse --abbrev-ref HEAD') do set RsBranch=%%A
popd
if "%RsBranch%"=="" (
echo Git branch not found.
endlocal
exit /B 1
)
if "%RsHash%"=="" (
echo Git hash not found.
endlocal
exit /B 1
)
set RsDate=%date% %TIME%
:: Create file
set InFile=%~dp0gui\help\version.html.in
set OutFile=%~dp0gui\help\version.html
if exist "%OutFile%" del /Q "%OutFile%"
for /f "tokens=* delims= " %%a in (%InFile%) do (
set line=%%a
set line=!line:$Hash$=%RsHash%!
set line=!line:$Branch$=%RsBranch%!
set line=!line:$Date$=%RsDate%!
echo !line!>>"%OutFile%"
)
endlocal
exit /B 0