Build identification strings
[novacoin.git] / src / version.cpp
1 // Copyright (c) 2012 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
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
14 #define CLIENT_VERSION_MAJOR          0
15 #define CLIENT_VERSION_MINOR          6
16 #define CLIENT_VERSION_REVISION       0
17 #define CLIENT_VERSION_BUILD         99
18 #define CLIENT_VERSION_SUFFIX   "-beta"
19
20 const int CLIENT_VERSION = 1000000 * CLIENT_VERSION_MAJOR
21                          +   10000 * CLIENT_VERSION_MINOR 
22                          +     100 * CLIENT_VERSION_REVISION
23                          +       1 * CLIENT_VERSION_BUILD;
24
25
26
27 // The following part of the code determines the CLIENT_BUILD variable.
28 // Several mechanisms are used for this:
29 // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
30 //   generated by the build environment, possibly containing the output
31 //   of git-describe in a macro called BUILD_DESC
32 // * secondly, if this is an exported version of the code, GIT_ARCHIVE will
33 //   be defined (automatically using the export-subst git attribute), and
34 //   GIT_COMMIT will contain the commit id.
35 // * then, three options exist for determining CLIENT_BUILD:
36 //   * if BUILD_DESC is defined, use that literally (output of git-describe)
37 //   * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
38 //   * otherwise, use v[maj].[min].[rev].[build]-unk
39 // finally CLIENT_VERSION_SUFFIX is added
40
41 // First, include build.h if requested
42 #ifdef HAVE_BUILD_INFO
43 #    include "build.h"
44 #endif
45
46 // git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
47 #ifdef GIT_ARCHIVE
48 #    define GIT_COMMIT_ID "$Format:%h$"
49 #    define GIT_COMMIT_DATE "$Format:%cD"
50 #endif
51
52 #define STRINGIFY(s) #s
53
54 #define BUILD_DESC_FROM_COMMIT(maj,min,rev,build,commit) \
55     "v" STRINGIFY(maj) "." STRINGIFY(min) "." STRINGIFY(rev) "." STRINGIFY(build) "-g" commit
56
57 #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev,build) \
58     "v" STRINGIFY(maj) "." STRINGIFY(min) "." STRINGIFY(rev) "." STRINGIFY(build) "-unk"
59
60 #ifndef BUILD_DESC
61 #    ifdef GIT_COMMIT_ID
62 #        define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
63 #    else
64 #        define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
65 #    endif
66 #endif
67
68 #ifndef BUILD_DATE
69 #    ifdef GIT_COMMIT_DATE
70 #        define BUILD_DATE GIT_COMMIT_DATE
71 #    else
72 #        define BUILD_DATE __DATE__ ", " __TIME__
73 #    endif
74 #endif
75
76 const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX);
77 const std::string CLIENT_DATE(BUILD_DATE);