rewrite script to include them in the make file. Use both util/rsversion.h and gui/help/version.html for gui version information

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1473 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-08-01 13:53:47 +00:00
parent 19de883705
commit 96f2d92ee7
8 changed files with 88 additions and 51 deletions

View File

@ -1,5 +1,5 @@
TEMPLATE = lib
CONFIG += static
CONFIG += static version_detail_bash_script
TARGET = retroshare
CONFIG += release
@ -42,6 +42,13 @@ linux-g++-64 {
QMAKE_CC = g++
SSL_DIR = /usr/include/openssl
}
version_detail_bash_script {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
#################### Cross compilation for windows under Linux ####################
win32-x-g++ {

View File

@ -9,5 +9,5 @@
std::string RsUtil::retroshareVersion()
{
return std::string(VERSION);
return std::string(LIB_VERSION);
}

View File

@ -5,17 +5,12 @@
* Author: alexandrut
*/
#ifndef RSVERSION_H_
#define RSVERSION_H_
#include <string>
#define VERSION "0.5.x"
#define LIB_VERSION "0.5.x"
namespace RsUtil {
std::string retroshareVersion();
}
#endif /* RSVERSION_H_ */

View File

@ -0,0 +1,23 @@
#!/bin/bash
if ( git log -n 1 &> /dev/null); then
#retrieve git information
version="git : $(git status | grep branch | cut -c 6-) $(git log -n 1 | grep commit)"
fi
if ( git log -n 1 | grep svn &> /dev/null); then
#retrieve git svn information
version="$version svn : $(git log -n 1 | grep svn | awk '{print $2}' | head -1 | sed 's/.*@//')"
elif ( git log -n 10 | grep svn &> /dev/null); then
#retrieve git svn information
version="$version svn closest version : $(git log -n 10 | grep svn | awk '{print $2}' | head -1 | sed 's/.*@//')"
fi
if ( svn info &> /dev/null); then
version=$(svn info | head -n 5 | tail -1)
fi
if [[ $version != '' ]]; then
version="$version date : $(date +'%T %m.%d.%y')"
echo "Writing version to util/rsversion.h : $version "
sed -i "s/LIB_VERSION .*/LIB_VERSION \"$version\"/g" util/rsversion.h
fi

View File

@ -1,4 +1,4 @@
CONFIG += qt gui uic qrc resources uitools debug pluginmgr version_detail_linux #release newsettings
CONFIG += qt gui uic qrc resources uitools debug pluginmgr version_detail_bash_script #release newsettings
QT += network xml script
TEMPLATE = app
TARGET = RetroShare
@ -19,32 +19,11 @@ linux-g++-64 {
QMAKE_LFLAGS += -L"../../../../lib/linux-g++-64"
}
version_detail_linux {
version_detail_bash_script {
DEFINES += ADD_LIBRETROSHARE_VERSION_INFO
system(echo "Retroshare Gui version : " > gui/help/version.html)
system(date >> gui/help/version.html)
system(ls /usr/bin/git) {
system(/usr/bin/git log -n 1) {
#retrieve git commit
system(echo "Git version : $(git status | grep branch | cut -c 3-) $(git log -n 1 | grep commit)" >> gui/help/version.html)
system(git log -n 1 | grep svn) {
system(echo "Svn version : $(git log -n 1 | grep svn | awk 'NR==1{$NF=\"\"} 1' | head -1)" >> gui/help/version.html)
} else:system(git log -n 10 | grep svn) {
system(echo "Svn closest version : $(git log -n 10 | grep svn | awk 'NR==1{$NF=\"\"} 1' | head -1)" >> gui/help/version.html)
}
system(echo "" >> gui/help/version.html)
system(echo "" >> gui/help/version.html)
}
}
system(ls /usr/bin/svn) {
system(/usr/bin/svn info) {
#retrieve svn revision
system(echo "Svn version : $(svn info | head -n 5 | head -n 5 | tail -1)" >> gui/help/version.html)
system(echo "" >> gui/help/version.html)
system(echo "" >> gui/help/version.html)
}
}
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
#################### Cross compilation for windows under Linux ###################

View File

@ -21,18 +21,6 @@
#include "rsversion.h"
//#define USE_SVN_VERSIONS 1
#define VERSION "0.5.0"
#if USE_SVN_VERSIONS
#include "svn_revision.h"
#endif
QString retroshareVersion() {
#if USE_SVN_VERSIONS
return QString(QString(VERSION) + "+" + QString(SVN_REVISION));
#else
return QString(VERSION);
#endif
return QString(GUI_VERSION);
}

View File

@ -19,12 +19,10 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _RSVERSION_H_
#define _RSVERSION_H_
#define GUI_VERSION "0.5.x"
#include <QString>
QString retroshareVersion();
#endif

View File

@ -0,0 +1,47 @@
#!/bin/bash
#check if we're on *nix system
#write the version.html file
if (ls &> /dev/null); then
echo "Retroshare Gui version : " > gui/help/version.html
if ( /usr/bin/git log -n 1 &> /dev/null); then
#retrieve git information
echo "Git version : $(git status | grep branch | cut -c 3-) $(git log -n 1 | grep commit)" >> gui/help/version.html
fi
if ( /usr/bin/git log -n 1 | grep svn &> /dev/null); then
#retrieve git svn information
echo "Svn version : $(git log -n 1 | grep svn | awk '{print $2}' | head -1)" >> gui/help/version.html
elif ( /usr/bin/git log -n 10 | grep svn &> /dev/null); then
#retrieve git svn information
echo "Svn closest version : $(git log -n 10 | grep svn | awk '{print $2}' | head -1)" >> gui/help/version.html
fi
if ( /usr/bin/svn info &> /dev/null); then
echo "Svn version : $(svn info | head -n 5 | tail -1)" >> gui/help/version.html
fi
date >> gui/help/version.html
echo "" >> gui/help/version.html
echo "" >> gui/help/version.html
fi
#write the rsversion.h file
if ( git log -n 1 &> /dev/null); then
#retrieve git information
version="git : $(git status | grep branch | cut -c 6-) $(git log -n 1 | grep commit)"
fi
if ( git log -n 1 | grep svn &> /dev/null); then
#retrieve git svn information
version="$version svn : $(git log -n 1 | grep svn | awk '{print $2}' | head -1 | sed 's/.*@//')"
elif ( git log -n 10 | grep svn &> /dev/null); then
#retrieve git svn information
version="$version svn closest version : $(git log -n 10 | grep svn | awk '{print $2}' | head -1 | sed 's/.*@//')"
fi
if ( svn info &> /dev/null); then
version=$(svn info | head -n 5 | tail -1)
fi
if [[ $version != '' ]]; then
version="$version date : $(date +'%T %m.%d.%y')"
echo "Writing version to util/rsversion.h : $version "
sed -i "s/GUI_VERSION .*/GUI_VERSION \"$version\"/g" util/rsversion.h
fi