Browse Source

Add build_number to version string

windows
elbandi 11 years ago
parent
commit
08b7ab1dd4
  1. 4
      Makefile.am
  2. 2
      api.c
  3. 7
      configure.ac
  4. 11
      miner.h
  5. 9
      sgminer.c
  6. 6
      util.c

4
Makefile.am

@ -31,6 +31,10 @@ GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty')
sgminer_CPPFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" sgminer_CPPFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif endif
if USE_BUILD_NUMBER
sgminer_CPPFLAGS += -DBUILD_NUMBER=\"$(BUILD_NUMBER)\"
endif
sgminer_SOURCES := sgminer.c sgminer_SOURCES := sgminer.c
sgminer_SOURCES += api.c sgminer_SOURCES += api.c
sgminer_SOURCES += elist.h miner.h compat.h bench_block.h sgminer_SOURCES += elist.h miner.h compat.h bench_block.h

2
api.c

@ -1555,7 +1555,7 @@ static void apiversion(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
message(io_data, MSG_VERSION, 0, NULL, isjson); message(io_data, MSG_VERSION, 0, NULL, isjson);
io_open = io_add(io_data, isjson ? COMSTR JSON_VERSION : _VERSION COMSTR); io_open = io_add(io_data, isjson ? COMSTR JSON_VERSION : _VERSION COMSTR);
root = api_add_string(root, "SGMiner", VERSION, false); root = api_add_string(root, "SGMiner", CGMINER_VERSION, false);
root = api_add_const(root, "API", APIVERSION, false); root = api_add_const(root, "API", APIVERSION, false);
root = print_data(root, buf, isjson, false); root = print_data(root, buf, isjson, false);

7
configure.ac

@ -219,6 +219,13 @@ AC_ARG_ENABLE([git-version],
[Disable use of git version in version string even if available]), [Disable use of git version in version string even if available]),
[wantgitver=$enableval], [wantgitver=yes]) [wantgitver=$enableval], [wantgitver=yes])
AC_ARG_WITH([build_number],
[AC_HELP_STRING([--with-build-number], [Specify a build number.])],
[BUILD_NUMBER="$withval"]
)
AC_SUBST([BUILD_NUMBER])
AM_CONDITIONAL([USE_BUILD_NUMBER], [test x$BUILD_NUMBER != x])
curses="auto" curses="auto"
AC_ARG_WITH([curses], AC_ARG_WITH([curses],

11
miner.h

@ -3,6 +3,17 @@
#include "config.h" #include "config.h"
#ifdef GIT_VERSION
#undef VERSION
#define VERSION GIT_VERSION
#endif
#ifdef BUILD_NUMBER
#define CGMINER_VERSION VERSION "-" BUILD_NUMBER
#else
#define CGMINER_VERSION VERSION
#endif
#include "algorithm.h" #include "algorithm.h"
#include <stdbool.h> #include <stdbool.h>

9
sgminer.c

@ -65,11 +65,6 @@ char *curly = ":D";
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#ifdef GIT_VERSION
#undef VERSION
#define VERSION GIT_VERSION
#endif
struct strategies strategies[] = { struct strategies strategies[] = {
{ "Failover" }, { "Failover" },
{ "Round Robin" }, { "Round Robin" },
@ -2271,7 +2266,7 @@ static void curses_print_status(void)
unsigned short int line = 0; unsigned short int line = 0;
wattron(statuswin, A_BOLD); wattron(statuswin, A_BOLD);
cg_mvwprintw(statuswin, line, 0, PACKAGE " " VERSION " - Started: %s", datestamp); cg_mvwprintw(statuswin, line, 0, PACKAGE " " CGMINER_VERSION " - Started: %s", datestamp);
wattroff(statuswin, A_BOLD); wattroff(statuswin, A_BOLD);
mvwhline(statuswin, ++line, 0, '-', 80); mvwhline(statuswin, ++line, 0, '-', 80);
@ -8007,7 +8002,7 @@ int main(int argc, char *argv[])
/* We use the getq mutex as the staged lock */ /* We use the getq mutex as the staged lock */
stgd_lock = &getq->mutex; stgd_lock = &getq->mutex;
snprintf(packagename, sizeof(packagename), "%s %s", PACKAGE, VERSION); snprintf(packagename, sizeof(packagename), "%s %s", PACKAGE, CGMINER_VERSION);
#ifndef WIN32 #ifndef WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);

6
util.c

@ -1759,7 +1759,7 @@ static bool send_version(struct pool *pool, json_t *val)
if (!id) if (!id)
return false; return false;
sprintf(s, "{\"id\": %d, \"result\": \""PACKAGE"/"VERSION"\", \"error\": null}", id); sprintf(s, "{\"id\": %d, \"result\": \""PACKAGE"/"CGMINER_VERSION"\", \"error\": null}", id);
if (!stratum_send(pool, s, strlen(s))) if (!stratum_send(pool, s, strlen(s)))
return false; return false;
@ -2443,9 +2443,9 @@ resend:
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++); sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++);
} else { } else {
if (pool->sessionid) if (pool->sessionid)
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"VERSION"\", \"%s\"]}", swork_id++, pool->sessionid); sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"CGMINER_VERSION"\", \"%s\"]}", swork_id++, pool->sessionid);
else else
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"VERSION"\"]}", swork_id++); sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"CGMINER_VERSION"\"]}", swork_id++);
} }
if (__stratum_send(pool, s, strlen(s)) != SEND_OK) { if (__stratum_send(pool, s, strlen(s)) != SEND_OK) {

Loading…
Cancel
Save