From e93ff8c9dcb572efad0a8b01aab04c67c476f21c Mon Sep 17 00:00:00 2001 From: Hijiri Date: Mon, 8 Sep 2014 09:57:37 +0900 Subject: [PATCH 1/3] Added Makefile for Mac OS X. --- Makefile.osx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Makefile.osx diff --git a/Makefile.osx b/Makefile.osx new file mode 100644 index 0000000..aebc128 --- /dev/null +++ b/Makefile.osx @@ -0,0 +1,33 @@ +LIBS= -lpcre -lcrypto -lm -lpthread +INCPATHS=-I$(shell brew --prefix)/include -I$(shell brew --prefix openssl)/include +LIBPATHS=-L$(shell brew --prefix)/lib -L$(shell brew --prefix openssl)/lib +CFLAGS=-ggdb -O3 -Wall -Qunused-arguments $(INCPATHS) $(LIBPATHS) +OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o +PROGS=vanitygen keyconv oclvanitygen oclvanityminer + +PLATFORM=$(shell uname -s) +ifeq ($(PLATFORM),Darwin) +OPENCL_LIBS=-framework OpenCL +else +OPENCL_LIBS=-lOpenCL +endif + + +most: vanitygen keyconv + +all: $(PROGS) + +vanitygen: vanitygen.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) + +oclvanitygen: oclvanitygen.o oclengine.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) + +oclvanityminer: oclvanityminer.o oclengine.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) -lcurl + +keyconv: keyconv.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) + +clean: + rm -f $(OBJS) $(PROGS) $(TESTS) From ef2a09f162bdd9640c8253a8d43276b441d994af Mon Sep 17 00:00:00 2001 From: Hijiri Date: Mon, 8 Sep 2014 10:14:55 +0900 Subject: [PATCH 2/3] Update INSTALL --- INSTALL | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/INSTALL b/INSTALL index 8cd86e1..769f835 100644 --- a/INSTALL +++ b/INSTALL @@ -31,3 +31,32 @@ After dependencies have been prepared, open a Visual Studio command prompt window, and run: nmake /fMakefile.Win32 vanitygen.exe oclvanitygen.exe + + +Mac OS X: + +Prerequisites: +OpenSSL (0.9.8 is okay, but consider to use 1.0.1 or higher for better performance.) +pcre/pcre++ + +It's easy to use "homebrew" tool chains for install OpenSSL and pcre/pcre++. +If not installed, take the following steps. + +1) Install homebeww +ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)" + +2) Install pcre and openssl +brew install pcre pcre++ openssl +brew link --force openssl + +3) Edit ~/.bash_profile to add PATH environment at the end of the file. +export PATH=/usr/local/bin:$PATH + +4) Fetch the source. +git clone https://github.com/7m4gmh/vanitygen.git + +5) Build. +cd vanitygen +make -f Makefile.osx all + + From 470ecd2b6a121ae0fd6819d43adfc1e3510f4b95 Mon Sep 17 00:00:00 2001 From: Hijiri Date: Mon, 8 Sep 2014 11:42:07 +0900 Subject: [PATCH 3/3] Revised Makefile for Mac OSX Darwin. --- INSTALL | 2 +- Makefile | 7 +++++-- Makefile.osx | 33 --------------------------------- vanitygen.c | 15 +++++++++++++-- 4 files changed, 19 insertions(+), 38 deletions(-) delete mode 100644 Makefile.osx diff --git a/INSTALL b/INSTALL index 769f835..5215f20 100644 --- a/INSTALL +++ b/INSTALL @@ -57,6 +57,6 @@ git clone https://github.com/7m4gmh/vanitygen.git 5) Build. cd vanitygen -make -f Makefile.osx all +make -f Makefile all diff --git a/Makefile b/Makefile index 3486201..4b4905c 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ -LIBS=-lpcre -lcrypto -lm -lpthread -CFLAGS=-ggdb -O3 -Wall +LIBS= -lpcre -lcrypto -lm -lpthread OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o PROGS=vanitygen keyconv oclvanitygen oclvanityminer PLATFORM=$(shell uname -s) ifeq ($(PLATFORM),Darwin) OPENCL_LIBS=-framework OpenCL +INCPATHS=-I$(shell brew --prefix)/include -I$(shell brew --prefix openssl)/include +LIBPATHS=-L$(shell brew --prefix)/lib -L$(shell brew --prefix openssl)/lib +CFLAGS=-ggdb -O3 -Wall -Qunused-arguments $(INCPATHS) $(LIBPATHS) else OPENCL_LIBS=-lOpenCL +CFLAGS=-ggdb -O3 -Wall endif diff --git a/Makefile.osx b/Makefile.osx deleted file mode 100644 index aebc128..0000000 --- a/Makefile.osx +++ /dev/null @@ -1,33 +0,0 @@ -LIBS= -lpcre -lcrypto -lm -lpthread -INCPATHS=-I$(shell brew --prefix)/include -I$(shell brew --prefix openssl)/include -LIBPATHS=-L$(shell brew --prefix)/lib -L$(shell brew --prefix openssl)/lib -CFLAGS=-ggdb -O3 -Wall -Qunused-arguments $(INCPATHS) $(LIBPATHS) -OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o -PROGS=vanitygen keyconv oclvanitygen oclvanityminer - -PLATFORM=$(shell uname -s) -ifeq ($(PLATFORM),Darwin) -OPENCL_LIBS=-framework OpenCL -else -OPENCL_LIBS=-lOpenCL -endif - - -most: vanitygen keyconv - -all: $(PROGS) - -vanitygen: vanitygen.o pattern.o util.o - $(CC) $^ -o $@ $(CFLAGS) $(LIBS) - -oclvanitygen: oclvanitygen.o oclengine.o pattern.o util.o - $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) - -oclvanityminer: oclvanityminer.o oclengine.o pattern.o util.o - $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) -lcurl - -keyconv: keyconv.o util.o - $(CC) $^ -o $@ $(CFLAGS) $(LIBS) - -clean: - rm -f $(OBJS) $(PROGS) $(TESTS) diff --git a/vanitygen.c b/vanitygen.c index 9d88121..92c0056 100644 --- a/vanitygen.c +++ b/vanitygen.c @@ -20,7 +20,7 @@ #include #include #include - +#include #include #include @@ -240,7 +240,18 @@ vg_thread_loop(void *arg) } -#if !defined(_WIN32) +#ifdef __APPLE__ +int count_processors(void) +{ + int mib[2], count; + size_t len; + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + len = sizeof(count); + sysctl(mib, 2, &count, &len, NULL, 0); + return count; +} +#elif !defined(_WIN32) int count_processors(void) {