Browse Source

build: use git version if available.

Borrowed from Arch Linux pacman:

https://projects.archlinux.org/pacman.git/tree/
nfactor-troky
Noel Maersk 11 years ago
parent
commit
f2f2bcedc7
  1. 5
      Makefile.am
  2. 22
      configure.ac
  3. 7
      sgminer.c

5
Makefile.am

@ -26,6 +26,11 @@ endif @@ -26,6 +26,11 @@ endif
sgminer_CPPFLAGS += $(ADL_CPPFLAGS)
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty')
sgminer_CPPFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
sgminer_SOURCES := sgminer.c
sgminer_SOURCES += api.c
sgminer_SOURCES += elist.h miner.h compat.h bench_block.h

22
configure.ac

@ -225,6 +225,11 @@ else @@ -225,6 +225,11 @@ else
DLOPEN_FLAGS=""
fi
AC_ARG_ENABLE([git-version],
AS_HELP_STRING([--disable-git-version],
[Disable use of git version in version string even if available]),
[wantgitver=$enableval], [wantgitver=yes])
curses="auto"
AC_ARG_WITH([curses],
@ -287,6 +292,20 @@ else @@ -287,6 +292,20 @@ else
fi
AC_SUBST(LIBCURL_LIBS)
# Enable or disable use of git version in version string
AC_MSG_CHECKING(whether to use git version if available)
if test "x$wantgitver" = "xyes" ; then
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
usegitver=$ac_cv_file__git_
if test $GIT -a "x$hasgitdir" = "xyes"; then
AC_DEFINE([USE_GIT_VERSION], [1], [Use GIT version in version string])
fi
else
AC_MSG_RESULT([no, disabled by configure])
usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, [test x$usegitver = xyes])
#check execv signature
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
@ -374,6 +393,8 @@ echo @@ -374,6 +393,8 @@ echo
echo "Configuration Options Summary:"
echo
echo " Use git version......: $usegitver"
if test "x$libcurl" != xno; then
echo " libcurl(GBT+getwork).: Enabled: $LIBCURL_LIBS"
else
@ -382,7 +403,6 @@ fi @@ -382,7 +403,6 @@ fi
echo " curses.TUI...........: $cursesmsg"
if test "x$opencl" != xno; then
if test $found_opencl = 1; then
echo " OpenCL...............: FOUND. GPU mining support enabled"

7
sgminer.c

@ -62,6 +62,11 @@ char *curly = ":D"; @@ -62,6 +62,11 @@ char *curly = ":D";
#include <sys/wait.h>
#endif
#ifdef GIT_VERSION
#undef VERSION
#define VERSION GIT_VERSION
#endif
struct strategies strategies[] = {
{ "Failover" },
{ "Round Robin" },
@ -2124,7 +2129,7 @@ static void curses_print_status(void) @@ -2124,7 +2129,7 @@ static void curses_print_status(void)
struct pool *pool = current_pool();
wattron(statuswin, A_BOLD);
cg_mvwprintw(statuswin, 0, 0, PACKAGE " version " VERSION " - Started: %s", datestamp);
cg_mvwprintw(statuswin, 0, 0, PACKAGE " " VERSION " - Started: %s", datestamp);
wattroff(statuswin, A_BOLD);
mvwhline(statuswin, 1, 0, '-', 80);
cg_mvwprintw(statuswin, 2, 0, "%s", statusline);

Loading…
Cancel
Save