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