Skip to content

Commit 8f52eb8

Browse files
committed
Versioning final version
1 parent 0bae47a commit 8f52eb8

File tree

5 files changed

+75
-21
lines changed

5 files changed

+75
-21
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xmrstak/version.hpp export-subst
1+
xmrstak/version.cpp export-subst

xmrstak/cli/cli-miner.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void help()
8585
cout<<" -u, --user USERNAME pool user name or wallet address"<<endl;
8686
cout<<" -p, --pass PASSWD pool password, in the most cases x or empty \"\""<<endl;
8787
cout<<" \n"<<endl;
88-
cout<<XMR_STAK_NAME << " " << XMR_STAK_VERSION << " " << GIT_COMMIT_HASH << " " << GIT_BRANCH << endl;
88+
cout<< "Version: " << get_version_str_short() << endl;
8989
cout<<"Brought to by fireice_uk and psychocrypt under GPLv3."<<endl;
9090
}
9191

@@ -433,17 +433,18 @@ int main(int argc, char *argv[])
433433
#endif
434434

435435
printer::inst()->print_str("-------------------------------------------------------------------\n");
436-
printer::inst()->print_str( XMR_STAK_NAME" " XMR_STAK_VERSION " mining software.\n");
436+
printer::inst()->print_str(get_version_str_short().c_str());
437+
printer::inst()->print_str("\n\n");
438+
printer::inst()->print_str("Brought to you by fireice_uk and psychocrypt under GPLv3.\n");
437439
printer::inst()->print_str("Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).\n");
438440
#ifndef CONF_NO_CUDA
439-
printer::inst()->print_str("NVIDIA mining code was written by KlausT and psychocrypt.\n");
441+
printer::inst()->print_str("Original NVIDIA mining code was written by KlausT and psychocrypt.\n");
440442
#endif
441443
#ifndef CONF_NO_OPENCL
442-
printer::inst()->print_str("AMD mining code was written by wolf9466.\n");
444+
printer::inst()->print_str("Original mining code was written by wolf9466.\n");
443445
#endif
444-
printer::inst()->print_str("Brought to you by fireice_uk and psychocrypt under GPLv3.\n\n");
445446
char buffer[64];
446-
snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n\n", fDevDonationLevel * 100.0);
447+
snprintf(buffer, sizeof(buffer), "\nConfigurable dev donation level is set to %.1f%%\n\n", fDevDonationLevel * 100.0);
447448
printer::inst()->print_str(buffer);
448449
printer::inst()->print_str("You can use following keys to display reports:\n");
449450
printer::inst()->print_str("'h' - hashrate\n");

xmrstak/net/jpsock.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ bool jpsock::cmd_login()
509509
{
510510
char cmd_buffer[1024];
511511

512-
snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"" AGENTID_STR "\"},\"id\":1}\n",
513-
usr_login.c_str(), usr_pass.c_str());
512+
snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s\"},\"id\":1}\n",
513+
usr_login.c_str(), usr_pass.c_str(), get_version_str().c_str());
514514

515515
opq_json_val oResult(nullptr);
516516

xmrstak/version.cpp

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include "version.hpp"
2+
3+
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
4+
#if defined(GIT_ARCHIVE) && !defined(GIT_COMMIT_HASH)
5+
#define GIT_COMMIT_HASH "$Format:%h$"
6+
#endif
7+
8+
#ifndef GIT_COMMIT_HASH
9+
#define GIT_COMMIT_HASH "0000000"
10+
#endif
11+
12+
#ifndef GIT_BRANCH
13+
#define GIT_BRANCH "unknown"
14+
#endif
15+
16+
#define XMR_STAK_NAME "xmr-stak"
17+
#define XMR_STAK_VERSION "2.0.0"
18+
19+
#if defined(_WIN32)
20+
#define OS_TYPE "win"
21+
#elif defined(__APPLE__)
22+
#define OS_TYPE "mac"
23+
#elif defined(__FreeBSD__)
24+
#define OS_TYPE "bsd"
25+
#elif defined(__linux__)
26+
#define OS_TYPE "lin"
27+
#else
28+
#define OS_TYPE "unk"
29+
#endif
30+
31+
#if !defined(CONF_NO_CUDA) && !defined(CONF_NO_OPENCL)
32+
#define BACKEND_TYPE "cpu-nvidia-amd"
33+
#elif !defined(CONF_NO_OPENCL)
34+
#define BACKEND_TYPE "cpu-amd"
35+
#elif !defined(CONF_NO_CUDA)
36+
#define BACKEND_TYPE "cpu-nvidia"
37+
#else
38+
#define BACKEND_TYPE "cpu"
39+
#endif
40+
41+
#if defined(CONF_NO_AEON)
42+
#define COIN_TYPE "monero"
43+
#elif defined(CONF_NO_MONERO)
44+
#define COIN_TYPE "aeon"
45+
#else
46+
#define COIN_TYPE "aeon-monero"
47+
#endif
48+
49+
#define VERSION_LONG XMR_STAK_NAME "/" XMR_STAK_VERSION "/" GIT_COMMIT_HASH "/" GIT_BRANCH "/" OS_TYPE "/" BACKEND_TYPE "/" COIN_TYPE "/"
50+
#define VERSION_SHORT XMR_STAK_NAME " " XMR_STAK_VERSION " " GIT_COMMIT_HASH
51+
52+
const char ver_long[] = VERSION_LONG;
53+
const char ver_short[] = VERSION_SHORT;

xmrstak/version.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#pragma once
22

3-
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
4-
#if defined(GIT_ARCHIVE) && !defined(GIT_COMMIT_HASH)
5-
#define GIT_COMMIT_HASH "$Format:%h$"
6-
#endif
3+
#include <string>
4+
#include "donate-level.hpp"
75

8-
#ifndef GIT_COMMIT_HASH
9-
#define GIT_COMMIT_HASH "0000000"
10-
#endif
6+
extern const char ver_long[];
7+
extern const char ver_short[];
118

12-
#ifndef GIT_BRANCH
13-
#define GIT_BRANCH "unknown"
14-
#endif
9+
inline std::string get_version_str()
10+
{
11+
return std::string(ver_long) + std::to_string(uint(fDevDonationLevel * 1000)) ;
12+
}
1513

16-
#define XMR_STAK_NAME "xmr-stak"
17-
#define XMR_STAK_VERSION "2.0.0-predev"
14+
inline std::string get_version_str_short()
15+
{
16+
return std::string(ver_short);
17+
}

0 commit comments

Comments
 (0)