mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05:00
RS version is now parametrizable at compile time
Avoid the need of dirty patching to set the version at build time In case RS version is not passed as argument attempt to determine it using git describe, if unavailable use hardcoded default
This commit is contained in:
parent
5495f43c51
commit
92f90178c4
@ -515,7 +515,6 @@ HEADERS += util/folderiterator.h \
|
||||
util/rsstring.h \
|
||||
util/rsstd.h \
|
||||
util/rsthreads.h \
|
||||
util/rsversioninfo.h \
|
||||
util/rswin.h \
|
||||
util/rsrandom.h \
|
||||
util/rsmemcache.h \
|
||||
@ -666,7 +665,6 @@ SOURCES += util/folderiterator.cc \
|
||||
util/rsprint.cc \
|
||||
util/rsstring.cc \
|
||||
util/rsthreads.cc \
|
||||
util/rsversioninfo.cc \
|
||||
util/rsrandom.cc \
|
||||
util/rstickevent.cc \
|
||||
util/rsrecogn.cc \
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <rsserver/p3face.h>
|
||||
#include <util/rsdir.h>
|
||||
#include <util/rsversioninfo.h>
|
||||
#include <retroshare/rsversion.h>
|
||||
#include <util/folderiterator.h>
|
||||
#include <ft/ftserver.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
@ -351,7 +351,6 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
|
||||
|
||||
std::cerr << " -> plugin revision number: " << pinfo.svn_revision << std::endl;
|
||||
std::cerr << " plugin API number : " << std::hex << pinfo.API_version << std::dec << std::endl;
|
||||
std::cerr << " retroshare svn number: " << RsUtil::retroshareRevision() << std::endl;
|
||||
|
||||
// Check that the plugin provides a svn revision number and a API number
|
||||
//
|
||||
|
@ -205,7 +205,7 @@ class RsPlugin
|
||||
//
|
||||
// All these items appear in the config->plugins tab, as a description of the plugin.
|
||||
//
|
||||
uint32_t getSvnRevision() const { return RS_REVISION_NUMBER ; } // This is read from libretroshare/retroshare/rsversion.h
|
||||
uint32_t getSvnRevision() const { return 0; } // This is read from libretroshare/retroshare/rsversion.h
|
||||
|
||||
virtual std::string getShortPluginDescription() const = 0 ;
|
||||
virtual std::string getPluginName() const = 0 ;
|
||||
|
@ -19,14 +19,63 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#define RS_MAJOR_VERSION 0
|
||||
#define RS_MINOR_VERSION 6
|
||||
#define RS_BUILD_NUMBER 4
|
||||
#define RS_BUILD_NUMBER_ADD "" // <-- do we need this?
|
||||
// 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 "01234567"
|
||||
#define RS_REVISION_NUMBER 0x01234567
|
||||
#pragma once
|
||||
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* First number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MAJOR_VERSION
|
||||
# define RS_MAJOR_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* Second number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MINOR_VERSION
|
||||
# define RS_MINOR_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* Third number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MINI_VERSION
|
||||
# define RS_MINI_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_EXTRA_VERSION
|
||||
* An extra string to append to the version to make it more descriptive.
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_EXTRA_VERSION
|
||||
# define RS_EXTRA_VERSION "unknown"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Use this macro to check in your code if version of RetroShare is at least the
|
||||
* specified.
|
||||
*/
|
||||
#define RS_VERSION_AT_LEAST(A,B,C) (RS_MAJOR_VERSION > (A) || \
|
||||
(RS_MAJOR_VERSION == (A) && \
|
||||
(RS_MINOR_VERSION > (B) || \
|
||||
(RS_MINOR_VERSION == (B) && RS_MINI_VERSION >= (C)))))
|
||||
|
||||
|
||||
#define __RS_PRIVATE_STRINGIFY2(X) #X
|
||||
#define __RS_PRIVATE_STRINGIFY(X) __RS_PRIVATE_STRINGIFY2(X)
|
||||
|
||||
/**
|
||||
* Human readable string describing RetroShare version
|
||||
*/
|
||||
constexpr auto RS_HUMAN_READABLE_VERSION =
|
||||
__RS_PRIVATE_STRINGIFY(RS_MAJOR_VERSION) "." \
|
||||
__RS_PRIVATE_STRINGIFY(RS_MINOR_VERSION) "." \
|
||||
__RS_PRIVATE_STRINGIFY(RS_MINI_VERSION) RS_EXTRA_VERSION;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*******************************************************************************/
|
||||
#include "services/p3discovery2.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
#include "util/rsversioninfo.h"
|
||||
#include "retroshare/rsversion.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
@ -349,7 +349,7 @@ void p3discovery2::sendOwnContactInfo(const SSLID &sslid)
|
||||
* revert an hardcoded policy. */
|
||||
//populateContactInfo(detail, pkt, true);
|
||||
|
||||
pkt->version = RsUtil::retroshareVersion();
|
||||
pkt->version = RS_HUMAN_READABLE_VERSION;
|
||||
pkt->PeerId(sslid);
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
@ -408,7 +408,7 @@ void p3discovery2::recvOwnContactInfo(const SSLID &fromId, const RsDiscContactIt
|
||||
sendPGPList(fromId);
|
||||
|
||||
// Update mDiscStatus.
|
||||
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mDiscMtx);
|
||||
|
||||
PGPID pgpId = getPGPId(fromId);
|
||||
std::map<PGPID, DiscPgpInfo>::iterator it = mFriendList.find(pgpId);
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* libretroshare/src/util: rsversioninfo.cc *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2013-2013 by Alexandrut *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include "rsversioninfo.h"
|
||||
#include "retroshare/rsversion.h"
|
||||
#include "rsstring.h"
|
||||
|
||||
std::string RsUtil::retroshareVersion()
|
||||
{
|
||||
std::string version;
|
||||
rs_sprintf(version, "%d.%d.%d%s Revision %08x", RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_NUMBER);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
uint32_t RsUtil::retroshareRevision()
|
||||
{
|
||||
return RS_REVISION_NUMBER;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* libretroshare/src/util: rsversioninfo.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2013-2013 by Alexandrut *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace RsUtil {
|
||||
|
||||
uint32_t retroshareRevision();
|
||||
std::string retroshareVersion();
|
||||
|
||||
}
|
@ -56,7 +56,7 @@ extern "C" {
|
||||
#ifdef WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ;
|
||||
uint32_t RETROSHARE_PLUGIN_revision = 0;
|
||||
|
||||
// This symbol contains the svn revision number grabbed from the executable.
|
||||
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins
|
||||
@ -72,8 +72,8 @@ void FeedReaderPlugin::getPluginVersion(int& major, int& minor, int &build, int&
|
||||
{
|
||||
major = RS_MAJOR_VERSION;
|
||||
minor = RS_MINOR_VERSION;
|
||||
build = RS_BUILD_NUMBER;
|
||||
svn_rev = RS_REVISION_NUMBER;
|
||||
build = RS_MINI_VERSION;
|
||||
svn_rev = 0;
|
||||
}
|
||||
|
||||
FeedReaderPlugin::FeedReaderPlugin()
|
||||
|
@ -61,7 +61,7 @@ extern "C" {
|
||||
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins
|
||||
// with same revision numbers, assuming that the revision numbers are up-to-date.
|
||||
//
|
||||
uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ;
|
||||
uint32_t RETROSHARE_PLUGIN_revision = 0;
|
||||
|
||||
// This symbol contains the svn revision number grabbed from the executable.
|
||||
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins
|
||||
@ -74,8 +74,8 @@ void VOIPPlugin::getPluginVersion(int& major, int& minor, int& build, int& svn_r
|
||||
{
|
||||
major = RS_MAJOR_VERSION ;
|
||||
minor = RS_MINOR_VERSION ;
|
||||
build = RS_BUILD_NUMBER ;
|
||||
svn_rev = RS_REVISION_NUMBER ;
|
||||
build = RS_MINI_VERSION ;
|
||||
svn_rev = 0;
|
||||
}
|
||||
|
||||
VOIPPlugin::VOIPPlugin()
|
||||
|
@ -356,15 +356,7 @@ void Rshare::slotConnectionEstablished()
|
||||
}
|
||||
}
|
||||
|
||||
QString Rshare::retroshareVersion(bool withRevision)
|
||||
{
|
||||
QString version = QString("%1.%2.%3%4").arg(RS_MAJOR_VERSION).arg(RS_MINOR_VERSION).arg(RS_BUILD_NUMBER).arg(RS_BUILD_NUMBER_ADD);
|
||||
if (withRevision) {
|
||||
version += QString(" %1 %2").arg(tr("Revision")).arg(RS_REVISION_NUMBER,8,16,QChar('0'));
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
QString Rshare::retroshareVersion(bool) { return RS_HUMAN_READABLE_VERSION; }
|
||||
|
||||
/** Enters the main event loop and waits until exit() is called. The signal
|
||||
* running() will be emitted when the event loop has started. */
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
~Rshare();
|
||||
|
||||
/** Return the version info */
|
||||
static QString retroshareVersion(bool withRevision);
|
||||
static QString retroshareVersion(bool=true);
|
||||
|
||||
/** Return the map of command-line arguments and values. */
|
||||
static QMap<QString, QString> arguments() { return _args; }
|
||||
|
@ -144,6 +144,23 @@ CONFIG+=no_rs_deep_search
|
||||
CONFIG *= rs_deep_search
|
||||
no_rs_deep_search:CONFIG -= rs_deep_search
|
||||
|
||||
# Specify RetroShare major version appending the following assignation to qmake
|
||||
# command line 'RS_MAJOR_VERSION=0'
|
||||
#RS_MAJOR_VERSION=0
|
||||
|
||||
# Specify RetroShare major version appending the following assignation to qmake
|
||||
# command line 'RS_MINOR_VERSION=6'
|
||||
#RS_MINOR_VERSION=6
|
||||
|
||||
# Specify RetroShare major version appending the following assignation to qmake
|
||||
# command line 'RS_MINI_VERSION=4'
|
||||
#RS_MINI_VERSION=4
|
||||
|
||||
# Specify RetroShare major version appending the following assignation to qmake
|
||||
# command line 'RS_EXTRA_VERSION=""'
|
||||
#RS_EXTRA_VERSION=git
|
||||
|
||||
|
||||
###########################################################################################################################################################
|
||||
#
|
||||
# V07_NON_BACKWARD_COMPATIBLE_CHANGE_001:
|
||||
@ -259,7 +276,6 @@ defineReplace(linkDynamicLibs) {
|
||||
return($$retDlib)
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
## Statements and variables that depends on build options (CONFIG) goes here ###
|
||||
################################################################################
|
||||
@ -283,6 +299,42 @@ defineReplace(linkDynamicLibs) {
|
||||
## RS_THREAD_LIB String viariable containing the name of the multi threading
|
||||
## library to use (pthread, "") it usually depend on platform.
|
||||
|
||||
defined(RS_MAJOR_VERSION,var):\
|
||||
defined(RS_MINOR_VERSION,var):\
|
||||
defined(RS_MINI_VERSION,var):\
|
||||
defined(RS_EXTRA_VERSION,var) {
|
||||
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} defined in command line")
|
||||
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
|
||||
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
|
||||
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
|
||||
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
|
||||
} else {
|
||||
RS_GIT_DESCRIBE = $$system(git describe)
|
||||
isEmpty(RS_GIT_DESCRIBE) {
|
||||
warning("Determining RetroShare version via git failed plese specify it trough qmake command line arguments!")
|
||||
} else {
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE,v)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,.)
|
||||
|
||||
RS_MAJOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_MINOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
|
||||
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,-)
|
||||
|
||||
RS_MINI_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-)
|
||||
|
||||
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} determined via git")
|
||||
|
||||
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
|
||||
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
|
||||
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
|
||||
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
|
||||
}
|
||||
}
|
||||
|
||||
gxsdistsync:DEFINES *= RS_USE_GXS_DISTANT_SYNC
|
||||
wikipoos:DEFINES *= RS_USE_WIKI
|
||||
rs_gxs:DEFINES *= RS_ENABLE_GXS
|
||||
|
Loading…
Reference in New Issue
Block a user