diff --git a/.gitattributes b/.gitattributes index 26d7549356..c9cf4a7d9c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -src/version.cpp export-subst +src/clientversion.cpp export-subst diff --git a/Makefile.am b/Makefile.am index fe7244edf8..7fe3811476 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,7 +36,7 @@ COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \ dist-hook: -$(MAKE) -C $(top_distdir)/src/leveldb clean -$(MAKE) -C $(top_distdir)/src/secp256k1 distclean - -$(GIT) archive --format=tar HEAD -- src/version.cpp | $(AMTAR) -C $(top_distdir) -xf - + -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf - distcheck-hook: $(MKDIR_P) $(top_distdir)/_build/src/leveldb diff --git a/src/Makefile.am b/src/Makefile.am index 91cc1b96e7..8253c4ab14 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -146,7 +146,7 @@ obj/build.h: FORCE @$(MKDIR_P) $(builddir)/obj @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ $(abs_top_srcdir) -libbitcoin_util_a-version.$(OBJEXT): obj/build.h +libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h # server: shared between bitcoind and bitcoin-qt libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) @@ -241,6 +241,7 @@ libbitcoin_util_a_SOURCES = \ compat/glibc_sanity.cpp \ compat/glibcxx_sanity.cpp \ chainparamsbase.cpp \ + clientversion.cpp \ random.cpp \ rpcprotocol.cpp \ sync.cpp \ @@ -249,7 +250,6 @@ libbitcoin_util_a_SOURCES = \ utilstrencodings.cpp \ utilmoneystr.cpp \ utiltime.cpp \ - version.cpp \ $(BITCOIN_CORE_H) if GLIBC_BACK_COMPAT @@ -354,7 +354,7 @@ clean-local: .rc.o: @test -f $(WINDRES) - $(AM_V_GEN) $(WINDRES) -i $< -o $@ + $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@ .mm.o: $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ diff --git a/src/alert.cpp b/src/alert.cpp index d495849206..f16898dc38 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -6,6 +6,7 @@ #include "alert.h" #include "chainparams.h" +#include "clientversion.h" #include "key.h" #include "net.h" #include "timedata.h" diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index aa5e285b10..38fbc29faf 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -4,12 +4,12 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparamsbase.h" +#include "clientversion.h" #include "init.h" #include "rpcclient.h" #include "rpcprotocol.h" #include "util.h" #include "utilstrencodings.h" -#include "version.h" #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 6f3409edf3..c0d21ed36f 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" +#include "clientversion.h" #include "core/transaction.h" #include "core_io.h" #include "keystore.h" diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 0737b5a83d..a79e581a80 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "clientversion.h" #include "rpcserver.h" #include "init.h" #include "main.h" diff --git a/src/version.cpp b/src/clientversion.cpp similarity index 99% rename from src/version.cpp rename to src/clientversion.cpp index d12b681e5c..4987c3ed38 100644 --- a/src/version.cpp +++ b/src/clientversion.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "version.h" +#include "clientversion.h" #include "tinyformat.h" diff --git a/src/clientversion.h b/src/clientversion.h index cd7ceb78f0..acaf54c6af 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -35,4 +35,31 @@ // Copyright string used in Windows .rc files #define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers" +/* + bitcoind-res.rc includes this file, but it cannot cope with real c++ code. + WINDRES_PREPROC is defined to indicate that its pre-processor is running. + Anything other than a define should be guarded below. +*/ + +#if !defined(WINDRES_PREPROC) + +#include +#include + +static const int CLIENT_VERSION = + 1000000 * CLIENT_VERSION_MAJOR + + 10000 * CLIENT_VERSION_MINOR + + 100 * CLIENT_VERSION_REVISION + + 1 * CLIENT_VERSION_BUILD; + +extern const std::string CLIENT_NAME; +extern const std::string CLIENT_BUILD; +extern const std::string CLIENT_DATE; + + +std::string FormatFullVersion(); +std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector& comments); + +#endif // WINDRES_PREPROC + #endif // CLIENTVERSION_H diff --git a/src/db.h b/src/db.h index 0cbdd8b91b..85ffbae1cb 100644 --- a/src/db.h +++ b/src/db.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_DB_H #define BITCOIN_DB_H +#include "clientversion.h" #include "serialize.h" #include "streams.h" #include "sync.h" diff --git a/src/leveldbwrapper.h b/src/leveldbwrapper.h index d997d56e00..10b7a2427c 100644 --- a/src/leveldbwrapper.h +++ b/src/leveldbwrapper.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_LEVELDBWRAPPER_H #define BITCOIN_LEVELDBWRAPPER_H +#include "clientversion.h" #include "serialize.h" #include "streams.h" #include "util.h" diff --git a/src/net.cpp b/src/net.cpp index 6cccdca952..5ceb82cf8b 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -11,6 +11,7 @@ #include "addrman.h" #include "chainparams.h" +#include "clientversion.h" #include "core/transaction.h" #include "ui_interface.h" diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 738fb48ef8..aedda49071 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -10,6 +10,7 @@ #include "alert.h" #include "chainparams.h" #include "checkpoints.h" +#include "clientversion.h" #include "main.h" #include "net.h" #include "ui_interface.h" diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index 5deac8007c..5533adab8b 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -5,6 +5,7 @@ #include "recentrequeststablemodel.h" #include "bitcoinunits.h" +#include "clientversion.h" #include "guiutil.h" #include "optionsmodel.h" #include "streams.h" diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 84f88dff5a..58bf040624 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -10,8 +10,8 @@ #include "clientmodel.h" #include "guiutil.h" +#include "clientversion.h" #include "init.h" -#include "version.h" #include diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 92ed1c3e2b..08e956c961 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -4,6 +4,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" +#include "clientversion.h" #include "init.h" #include "main.h" #include "net.h" diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 12dcd5b540..46b5f3d7ad 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -4,6 +4,7 @@ #include "rpcserver.h" +#include "clientversion.h" #include "main.h" #include "net.h" #include "netbase.h" diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index c99d113bc3..c2ce73106f 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -5,6 +5,7 @@ #include "rpcprotocol.h" +#include "clientversion.h" #include "tinyformat.h" #include "util.h" #include "utilstrencodings.h" diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index 28610f0d2e..9cf7a98f46 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -7,13 +7,13 @@ // #include "alert.h" +#include "clientversion.h" #include "data/alertTests.raw.h" #include "serialize.h" #include "streams.h" #include "util.h" #include "utilstrencodings.h" -#include "version.h" #include diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index 99b21a23a0..783e284af5 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -5,6 +5,7 @@ #include "bloom.h" #include "base58.h" +#include "clientversion.h" #include "key.h" #include "main.h" #include "serialize.h" diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp index 9151fdc0c8..fc36b43e16 100644 --- a/src/test/checkblock_tests.cpp +++ b/src/test/checkblock_tests.cpp @@ -8,6 +8,7 @@ +#include "clientversion.h" #include "main.h" #include "utiltime.h" diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index c46c31e99f..d4c9b1a0ea 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -5,6 +5,7 @@ #include "data/tx_invalid.json.h" #include "data/tx_valid.json.h" +#include "clientversion.h" #include "key.h" #include "keystore.h" #include "main.h" diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 761210feac..67d50fccf4 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -4,12 +4,12 @@ #include "util.h" +#include "clientversion.h" #include "core/transaction.h" #include "random.h" #include "sync.h" #include "utilstrencodings.h" #include "utilmoneystr.h" -#include "version.h" #include #include diff --git a/src/txmempool.cpp b/src/txmempool.cpp index c042dd8467..d3d9cb8a01 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -5,6 +5,7 @@ #include "txmempool.h" +#include "clientversion.h" #include "streams.h" #include "util.h" #include "utilmoneystr.h" diff --git a/src/version.h b/src/version.h index a1e440de24..6ee08c205b 100644 --- a/src/version.h +++ b/src/version.h @@ -5,25 +5,6 @@ #ifndef BITCOIN_VERSION_H #define BITCOIN_VERSION_H -#include "clientversion.h" - -#include -#include - -// -// client versioning -// - -static const int CLIENT_VERSION = - 1000000 * CLIENT_VERSION_MAJOR - + 10000 * CLIENT_VERSION_MINOR - + 100 * CLIENT_VERSION_REVISION - + 1 * CLIENT_VERSION_BUILD; - -extern const std::string CLIENT_NAME; -extern const std::string CLIENT_BUILD; -extern const std::string CLIENT_DATE; - // // network protocol versioning // @@ -53,7 +34,4 @@ static const int BIP0031_VERSION = 60000; // "mempool" command, enhanced "getdata" behavior starts with this version static const int MEMPOOL_GD_VERSION = 60002; -std::string FormatFullVersion(); -std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector& comments); - #endif // BITCOIN_VERSION_H