Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
version.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "version.h"
6 
7 #include <string>
8 
9 // Name of client reported in the 'version' message. Report the same name
10 // for both bitcoind and bitcoin-qt, to make it harder for attackers to
11 // target servers or GUI users specifically.
12 const std::string CLIENT_NAME("Satoshi");
13 
14 // Client version number
15 #define CLIENT_VERSION_SUFFIX "-beta"
16 
17 
18 // The following part of the code determines the CLIENT_BUILD variable.
19 // Several mechanisms are used for this:
20 // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
21 // generated by the build environment, possibly containing the output
22 // of git-describe in a macro called BUILD_DESC
23 // * secondly, if this is an exported version of the code, GIT_ARCHIVE will
24 // be defined (automatically using the export-subst git attribute), and
25 // GIT_COMMIT will contain the commit id.
26 // * then, three options exist for determining CLIENT_BUILD:
27 // * if BUILD_DESC is defined, use that literally (output of git-describe)
28 // * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
29 // * otherwise, use v[maj].[min].[rev].[build]-unk
30 // finally CLIENT_VERSION_SUFFIX is added
31 
32 // First, include build.h if requested
33 #ifdef HAVE_BUILD_INFO
34 # include "build.h"
35 #endif
36 
37 // git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
38 #ifdef GIT_ARCHIVE
39 # define GIT_COMMIT_ID "$Format:%h$"
40 # define GIT_COMMIT_DATE "$Format:%cD$"
41 #endif
42 
43 #define BUILD_DESC_WITH_SUFFIX(maj,min,rev,build,suffix) \
44  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix)
45 
46 #define BUILD_DESC_FROM_COMMIT(maj,min,rev,build,commit) \
47  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
48 
49 #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev,build) \
50  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
51 
52 #define BUILD_SUFFIX_ONLY(suffix) \
53  DO_STRINGIZE(suffix)
54 
55 #ifndef BUILD_DESC
56 # ifdef BUILD_SUFFIX
57 # define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
58 # elif defined(GIT_COMMIT_ID)
59 # define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
60 # else
61 # define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
62 # endif
63 #endif
64 
65 #ifndef BUILD_DATE
66 # ifdef GIT_COMMIT_DATE
67 # define BUILD_DATE GIT_COMMIT_DATE
68 # else
69 # define BUILD_DATE __DATE__ ", " __TIME__
70 # endif
71 #endif
72 
73 #ifdef BUILD_SUFFIX
74 # define COMMIT_DEF BUILD_SUFFIX_ONLY(BUILD_SUFFIX)
75 #else
76 # define COMMIT_DEF ""
77 #endif
78 
79 const std::string COMMIT_INFO(COMMIT_DEF);
81 const std::string CLIENT_DATE(BUILD_DATE);
#define BUILD_DESC
Definition: version.cpp:61
const std::string COMMIT_INFO(COMMIT_DEF)
#define BUILD_DATE
Definition: version.cpp:69
const std::string CLIENT_NAME("Satoshi")
const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX)
#define CLIENT_VERSION_SUFFIX
Definition: version.cpp:15
#define COMMIT_DEF
Definition: version.cpp:76
const std::string CLIENT_DATE(BUILD_DATE)