version.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // ECOin - Copyright (c) - 2014/2022 - GPLv3 - epsylon@riseup.net (https://03c8.net)
  2. #include <string>
  3. #include "version.h"
  4. // Name of client reported in the 'version' message. Report the same name
  5. // for both ecoind and ecoin-qt, to make it harder for attackers to
  6. // target servers or GUI users specifically.
  7. const std::string CLIENT_NAME("Ikujam");
  8. // Client version number
  9. #define CLIENT_VERSION_SUFFIX "-beta"
  10. // The following part of the code determines the CLIENT_BUILD variable.
  11. // Several mechanisms are used for this:
  12. // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
  13. // generated by the build environment, possibly containing the output
  14. // of git-describe in a macro called BUILD_DESC
  15. // * secondly, if this is an exported version of the code, GIT_ARCHIVE will
  16. // be defined (automatically using the export-subst git attribute), and
  17. // GIT_COMMIT will contain the commit id.
  18. // * then, three options exist for determining CLIENT_BUILD:
  19. // * if BUILD_DESC is defined, use that literally (output of git-describe)
  20. // * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
  21. // * otherwise, use v[maj].[min].[rev].[build]-unk
  22. // finally CLIENT_VERSION_SUFFIX is added
  23. // First, include build.h if requested
  24. #ifdef HAVE_BUILD_INFO
  25. # include "build.h"
  26. #endif
  27. // git will put "#define GIT_ARCHIVE 1" on the next line inside archives.
  28. #define GIT_ARCHIVE 1
  29. #ifdef GIT_ARCHIVE
  30. # define GIT_COMMIT_ID "a"
  31. # define GIT_COMMIT_DATE "$Format:%cD"
  32. #endif
  33. #define BUILD_DESC_FROM_COMMIT(maj,min,rev,build,commit) \
  34. "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
  35. #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev,build) \
  36. "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
  37. #ifndef BUILD_DESC
  38. # ifdef GIT_COMMIT_ID
  39. # define BUILD_DESC BUILD_DESC_FROM_COMMIT(DISPLAY_VERSION_MAJOR, DISPLAY_VERSION_MINOR, DISPLAY_VERSION_REVISION, DISPLAY_VERSION_BUILD, GIT_COMMIT_ID)
  40. # else
  41. # define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(DISPLAY_VERSION_MAJOR, DISPLAY_VERSION_MINOR, DISPLAY_VERSION_REVISION, DISPLAY_VERSION_BUILD)
  42. # endif
  43. #endif
  44. #ifndef BUILD_DATE
  45. # ifdef GIT_COMMIT_DATE
  46. # define BUILD_DATE GIT_COMMIT_DATE
  47. # else
  48. # define BUILD_DATE __DATE__ ", " __TIME__
  49. # endif
  50. #endif
  51. const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX);
  52. const std::string CLIENT_DATE(BUILD_DATE);