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