Build on Windows using mingw32.
This commit is contained in:
parent
4575851ea3
commit
0a333110f7
6 changed files with 36 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
minerd
|
minerd
|
||||||
|
minerd.exe
|
||||||
*.o
|
*.o
|
||||||
|
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
|
@ -19,3 +20,5 @@ compile
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
|
|
||||||
|
mingw32-config.cache
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ endif
|
||||||
|
|
||||||
SUBDIRS = compat
|
SUBDIRS = compat
|
||||||
|
|
||||||
INCLUDES = -pthread -fno-strict-aliasing $(JANSSON_INCLUDES)
|
INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES)
|
||||||
|
|
||||||
bin_PROGRAMS = minerd
|
bin_PROGRAMS = minerd
|
||||||
|
|
||||||
EXTRA_DIST = sha256_generic.c
|
EXTRA_DIST = sha256_generic.c
|
||||||
|
|
||||||
minerd_SOURCES = util.c cpu-miner.c miner.h compat.h
|
minerd_SOURCES = util.c cpu-miner.c miner.h compat.h
|
||||||
minerd_LDFLAGS = -pthread
|
minerd_LDFLAGS = $(PTHREAD_FLAGS)
|
||||||
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@
|
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@
|
||||||
|
|
||||||
|
|
10
compat.h
10
compat.h
|
@ -10,6 +10,16 @@ static inline void sleep(int secs)
|
||||||
Sleep(secs * 1000);
|
Sleep(secs * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PRIO_PROCESS = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline int setpriority(int which, int who, int prio)
|
||||||
|
{
|
||||||
|
/* FIXME - actually do something */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
#endif /* __COMPAT_H__ */
|
#endif /* __COMPAT_H__ */
|
||||||
|
|
3
compat/jansson/.gitignore
vendored
Normal file
3
compat/jansson/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
libjansson.a
|
||||||
|
|
13
configure.ac
13
configure.ac
|
@ -17,6 +17,18 @@ AC_PROG_RANLIB
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
|
case $host in
|
||||||
|
*-*-mingw*)
|
||||||
|
have_win32=true
|
||||||
|
PTHREAD_FLAGS=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
have_win32=false
|
||||||
|
PTHREAD_FLAGS="-pthread"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
|
AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
|
||||||
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)
|
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)
|
||||||
|
|
||||||
|
@ -35,6 +47,7 @@ LIBCURL_CHECK_CONFIG(, 7.10.1, ,
|
||||||
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
||||||
|
|
||||||
AC_SUBST(JANSSON_LIBS)
|
AC_SUBST(JANSSON_LIBS)
|
||||||
|
AC_SUBST(PTHREAD_FLAGS)
|
||||||
AC_SUBST(PTHREAD_LIBS)
|
AC_SUBST(PTHREAD_LIBS)
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifndef WIN32
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
@ -352,7 +354,7 @@ static void parse_cmdline(int argc, char *argv[])
|
||||||
static void calc_stats(void)
|
static void calc_stats(void)
|
||||||
{
|
{
|
||||||
uint64_t hashes;
|
uint64_t hashes;
|
||||||
long double hd, sd;
|
double hd, sd;
|
||||||
|
|
||||||
pthread_mutex_lock(&stats_mutex);
|
pthread_mutex_lock(&stats_mutex);
|
||||||
|
|
||||||
|
@ -366,7 +368,8 @@ static void calc_stats(void)
|
||||||
hd = hashes;
|
hd = hashes;
|
||||||
sd = STAT_SLEEP_INTERVAL;
|
sd = STAT_SLEEP_INTERVAL;
|
||||||
|
|
||||||
fprintf(stderr, "wildly inaccurate HashMeter: %.2Lf khash/sec\n", hd / sd);
|
fprintf(stderr, "wildly inaccurate HashMeter: %.2f khash/sec\n",
|
||||||
|
hd / sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
|
|
Loading…
Reference in a new issue