Skip to content

Commit 35f1189

Browse files
committed
build: Rename BUILD_* macros and the code self-descriptive
1 parent dc1fba9 commit 35f1189

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

share/genbuild.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$
3636
fi
3737

3838
if [ -n "$GIT_TAG" ]; then
39-
NEWINFO="#define BUILD_DESC \"$GIT_TAG\""
39+
NEWINFO="#define BUILD_GIT_TAG \"$GIT_TAG\""
4040
elif [ -n "$GIT_COMMIT" ]; then
41-
NEWINFO="#define BUILD_SUFFIX $GIT_COMMIT"
41+
NEWINFO="#define BUILD_GIT_COMMIT $GIT_COMMIT"
4242
else
4343
NEWINFO="// No build information available"
4444
fi

src/clientversion.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,13 @@
1515
const std::string CLIENT_NAME("Satoshi");
1616

1717

18-
/**
19-
* The following part of the code determines the CLIENT_BUILD variable.
20-
* Several mechanisms are used for this:
21-
* * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
22-
* generated by the build environment, possibly containing the output
23-
* of git-describe in a macro called BUILD_DESC
24-
* * secondly, if this is an exported version of the code, GIT_ARCHIVE will
25-
* be defined (automatically using the export-subst git attribute), and
26-
* GIT_COMMIT will contain the commit id.
27-
* * then, three options exist for determining CLIENT_BUILD:
28-
* * if BUILD_DESC is defined, use that literally (output of git-describe)
29-
* * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
30-
* * otherwise, use v[maj].[min].[rev].[build]-unk
31-
*/
32-
33-
//! First, include build.h if requested
3418
#ifdef HAVE_BUILD_INFO
3519
#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
3625
#endif
3726

3827
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
@@ -50,9 +39,11 @@ const std::string CLIENT_NAME("Satoshi");
5039
#define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \
5140
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
5241

53-
#ifndef BUILD_DESC
54-
#ifdef BUILD_SUFFIX
55-
#define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
42+
#ifdef BUILD_GIT_TAG
43+
#define BUILD_DESC BUILD_GIT_TAG
44+
#else
45+
#ifdef BUILD_GIT_COMMIT
46+
#define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_GIT_COMMIT)
5647
#elif defined(GIT_COMMIT_ID)
5748
#define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
5849
#else

0 commit comments

Comments
 (0)