Browse Source

Add build_number to version string

windows
elbandi 10 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') @@ -31,6 +31,10 @@ GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty')
sgminer_CPPFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
if USE_BUILD_NUMBER
sgminer_CPPFLAGS += -DBUILD_NUMBER=\"$(BUILD_NUMBER)\"
endif
sgminer_SOURCES := sgminer.c
sgminer_SOURCES += api.c
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 @@ -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);
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 = print_data(root, buf, isjson, false);

7
configure.ac

@ -219,6 +219,13 @@ AC_ARG_ENABLE([git-version], @@ -219,6 +219,13 @@ AC_ARG_ENABLE([git-version],
[Disable use of git version in version string even if available]),
[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"
AC_ARG_WITH([curses],

11
miner.h

@ -3,6 +3,17 @@ @@ -3,6 +3,17 @@
#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 <stdbool.h>

9
sgminer.c

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

6
util.c

@ -1759,7 +1759,7 @@ static bool send_version(struct pool *pool, json_t *val) @@ -1759,7 +1759,7 @@ static bool send_version(struct pool *pool, json_t *val)
if (!id)
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)))
return false;
@ -2443,9 +2443,9 @@ resend: @@ -2443,9 +2443,9 @@ resend:
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++);
} else {
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
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) {

Loading…
Cancel
Save