|
14 | 14 | */
|
15 | 15 | const std::string CLIENT_NAME("Satoshi");
|
16 | 16 |
|
17 |
| -/** |
18 |
| - * Client version number |
19 |
| - */ |
20 |
| -#define CLIENT_VERSION_SUFFIX "" |
21 |
| - |
22 |
| - |
23 |
| -/** |
24 |
| - * The following part of the code determines the CLIENT_BUILD variable. |
25 |
| - * Several mechanisms are used for this: |
26 |
| - * * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is |
27 |
| - * generated by the build environment, possibly containing the output |
28 |
| - * of git-describe in a macro called BUILD_DESC |
29 |
| - * * secondly, if this is an exported version of the code, GIT_ARCHIVE will |
30 |
| - * be defined (automatically using the export-subst git attribute), and |
31 |
| - * GIT_COMMIT will contain the commit id. |
32 |
| - * * then, three options exist for determining CLIENT_BUILD: |
33 |
| - * * if BUILD_DESC is defined, use that literally (output of git-describe) |
34 |
| - * * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit] |
35 |
| - * * otherwise, use v[maj].[min].[rev].[build]-unk |
36 |
| - * finally CLIENT_VERSION_SUFFIX is added |
37 |
| - */ |
38 | 17 |
|
39 |
| -//! First, include build.h if requested |
40 | 18 | #ifdef HAVE_BUILD_INFO
|
41 | 19 | #include <obj/build.h>
|
| 20 | +// The <obj/build.h>, which is generated by the build environment (share/genbuild.sh), |
| 21 | +// could contain only one line of the following: |
| 22 | +// - "#define BUILD_GIT_TAG ...", if the top commit is tagged |
| 23 | +// - "#define BUILD_GIT_COMMIT ...", if the top commit is not tagged |
| 24 | +// - "// No build information available", if proper git information is not available |
42 | 25 | #endif
|
43 | 26 |
|
44 |
| -//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$ |
45 |
| -#ifdef GIT_ARCHIVE |
46 |
| -#define GIT_COMMIT_ID "$Format:%H$" |
47 |
| -#define GIT_COMMIT_DATE "$Format:%cD$" |
48 |
| -#endif |
49 |
| - |
50 |
| -#define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ |
51 |
| - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) |
52 |
| - |
53 |
| -#define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ |
54 |
| - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit |
| 27 | +//! git will put "#define GIT_COMMIT_ID ..." on the next line inside archives. $Format:%n#define GIT_COMMIT_ID "%H"$ |
55 | 28 |
|
56 |
| -#define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ |
57 |
| - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" |
58 |
| - |
59 |
| -#ifndef BUILD_DESC |
60 |
| -#ifdef BUILD_SUFFIX |
61 |
| -#define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) |
62 |
| -#elif defined(GIT_COMMIT_ID) |
63 |
| -#define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) |
| 29 | +#ifdef BUILD_GIT_TAG |
| 30 | + #define BUILD_DESC BUILD_GIT_TAG |
| 31 | + #define BUILD_SUFFIX "" |
64 | 32 | #else
|
65 |
| -#define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) |
66 |
| -#endif |
| 33 | + #define BUILD_DESC "v" STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) \ |
| 34 | + "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) |
| 35 | + #ifdef BUILD_GIT_COMMIT |
| 36 | + #define BUILD_SUFFIX "-" BUILD_GIT_COMMIT |
| 37 | + #elif defined(GIT_COMMIT_ID) |
| 38 | + #define BUILD_SUFFIX "-g" GIT_COMMIT_ID |
| 39 | + #else |
| 40 | + #define BUILD_SUFFIX "-unk" |
| 41 | + #endif |
67 | 42 | #endif
|
68 | 43 |
|
69 |
| -const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); |
| 44 | +const std::string CLIENT_BUILD(BUILD_DESC BUILD_SUFFIX); |
70 | 45 |
|
71 | 46 | static std::string FormatVersion(int nVersion)
|
72 | 47 | {
|
|
0 commit comments