8e74499d7d6a4bc3d8485b50b568d3f325876e2c
[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 COPYING 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 #ifdef USE_LEVELDB
15 #define CLIENT_VERSION_SUFFIX   "-leveldb"
16 #else
17 #define CLIENT_VERSION_SUFFIX   "-bdb"
18 #endif
19
20 // Compiler name
21 #ifdef __GNUC__
22 /*code for GNU C compiler */
23 #define CL_NAME   "-gcc"
24 #elif _MSC_VER
25 /*usually has the version number in _MSC_VER*/
26 /*code specific to MSVC compiler*/
27 #define CL_NAME   "-msvc"
28 #elif __clang__
29 /*code specific to clang compilers*/
30 #define CL_NAME   "-clang"
31 #elif __MINGW32__
32 /*code specific to mingw compilers*/
33 #define CL_NAME   "-mingw"
34 #else
35 #define CL_NAME   "-genericcl"
36 /*others*/
37 #endif
38
39 // The following part of the code determines the CLIENT_BUILD variable.
40 // Several mechanisms are used for this:
41 // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
42 //   generated by the build environment, possibly containing the output
43 //   of git-describe in a macro called BUILD_DESC
44 // * secondly, if this is an exported version of the code, GIT_ARCHIVE will
45 //   be defined (automatically using the export-subst git attribute), and
46 //   GIT_COMMIT will contain the commit id.
47 // * then, three options exist for determining CLIENT_BUILD:
48 //   * if BUILD_DESC is defined, use that literally (output of git-describe)
49 //   * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
50 //   * otherwise, use v[maj].[min].[rev].[build]-unk
51 // finally CLIENT_VERSION_SUFFIX is added
52
53 // First, include build.h if requested
54 #ifdef HAVE_BUILD_INFO
55 #    include "build.h"
56 #endif
57
58 // git will put "#define GIT_ARCHIVE 1" on the next line inside archives. 
59 #define GIT_ARCHIVE 1
60 #ifdef GIT_ARCHIVE
61 #    define GIT_COMMIT_ID "32a928e"
62 #    define GIT_COMMIT_DATE "$Format:%cD"
63 #endif
64
65 #define BUILD_DESC_FROM_COMMIT(maj,min,rev,commit) \
66     "nvc-v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
67
68 #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev) \
69     "nvc-v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
70
71 #ifndef BUILD_DESC
72 #    ifdef GIT_COMMIT_ID
73 #        define BUILD_DESC BUILD_DESC_FROM_COMMIT(DISPLAY_VERSION_MAJOR, DISPLAY_VERSION_MINOR, DISPLAY_VERSION_REVISION, GIT_COMMIT_ID)
74 #    else
75 #        define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(DISPLAY_VERSION_MAJOR, DISPLAY_VERSION_MINOR, DISPLAY_VERSION_REVISION)
76 #    endif
77 #endif
78
79 #ifdef _MSC_VER
80 #undef GIT_COMMIT_DATE
81 #endif
82
83 #ifndef BUILD_DATE
84 #    ifdef GIT_COMMIT_DATE
85 #        define BUILD_DATE GIT_COMMIT_DATE
86 #    else
87 #        define BUILD_DATE __DATE__ ", " __TIME__
88 #    endif
89 #endif
90
91 const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX CL_NAME);
92 const std::string CLIENT_DATE(BUILD_DATE);