Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated windows makefile and windows build info. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions doc/build-msw_namecoin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
most of this taken from: https://bitcointalk.org/index.php?topic=5851.msg86700#msg86700
thanks Matt :]

INSTALL
MinGW Automated Installer
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/mingw-get-inst-20110316.exe/download.
Install with the C++ and MSYS options checked.

Activestate Perl (for building openssl)
http://www.activestate.com/activeperl/downloads
You don't need anything except ActivePerl and Perl, none of the other fancy crap. You do want to add Perl to your PATH (its an option in the installer).


DOWNLOAD
#WxWidgets 2.9.1: http://sourceforge.net/projects/wxwindows/files/2.9.1/wxWidgets-2.9.1.zip/download. Unzip to C:\wxWidgets-2.9.1-mgw
Instead of c:\ you can also use a directory to put everything (including the namecoin dir)

OpenSSL 1.0.0j: http://www.openssl.org/source/openssl-1.0.0j.tar.gz
Untar to C:\openssl-1.0.0j-mgw
(yes bitcoin is designed to build with 1.0.0c, but might as well use the latest version since it works right?)
untar using the tar binary which is included in MinGW using cd \c\ && tar xvvf \c\Users\Matt\Downloads\openssl-1.0.0j.tar.gz && mv openssl-1.0.0j openssl-1.0.0j-mgw in the msys shell
otherwise you will have to do this: http://stackoverflow.com/questions/7256087/error-compiling-openssl-with-mingw-msys/8376364#8376364
Note the subtle differences in versions/paths 1.0.0 vs 1.0.1 and 1.0.1c vs 1.0.1d - what a pita.

Berkeley DB 4.7.25 NC: http://download.oracle.com/berkeley-db/db-4.7.25.NC.zip. Unzip to C:\db-4.7.25.NC-mgw
Boost 1.43.0: http://sourceforge.net/projects/boost/files/boost/1.43.0/boost_1_43_0.zip/download. Unzip to C:\boost-1.43.0-mgw
Boost Jam: http://sourceforge.net/projects/boost/files/boost-jam/3.1.18/boost-jam-3.1.18-1-ntx86.zip/download. Unzip wherever you like, I used C:\bjam
miniUPnPc binary http://miniupnp.tuxfamily.org/files/download.php?file=upnpc-exe-win32-20110215.zip. Unzip to C:\upnpc-exe-win32-20110215
miniUPnPc source http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.5.20110215.tar.gz. Untar to C:\upnpc-exe-win32-20110215\miniupnpc (you only need *.h, but the others won't hurt) untar with cd \c\upnpc-exe-win32-20110215 && tar xvvf \c\Users\Matt\Downloads\miniupnpc-1.5.20110215.tar.gz && mv miniupnpc-1.5.20110215 miniupnpc
Matt: Note that the reason for using the binary miniupnpc release is that I was unable to get it to build on my system.

Add C:\MinGW\bin to your PATH environment variable (Google is your friend as it depends on your Windows Version).
or use a path like this "\Program Files\MinGW\bin\mingw32-make.exe" (Tab is your friend.)

BUILD
In the DOS Shell:
#wxWidgets:
#cd \wxWidgets-2.9.1-mgw\build\msw
#mingw32-make -f makefile.gcc

Boost:
cd \boost-1.43.0-mgw
\bjam\bjam.exe toolset=gcc --build-type=complete stage

In the msys Shell (MinGW shell in your start folder or C:\MinGW\msys\1.0\msys.bat, might require a reboot after installation):
OpenSSL:
cd /c/openssl-1.0.0c-mgw
./config
make
perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
Copy the libeay32.dll file to the folder where you are building/running bitcoin.

In the msys Shell :
Berkeley DB:
cd /c/db-4.7.25.NC-mgw/build_unix
sh ../dist/configure --enable-mingw --enable-cxx
make

In the msys Shell:
namecoind.exe
get the latest linux version from here: https://dot-bit.org/Main_Page

In the msys shell, cd to the unzipped location and

make -f makefile.mingw

If you need to alter the makefile be careful - make is a whitespace bitch (beginning/end of line) and will often give you completely worthless error messages.

Run with namecoind.exe
make sure you have the libeay32.dll in the same folder
copy from c:\program files\mingw\bin\ libstdc++-6.dll and libgcc_s_dw2-1.dll
149 changes: 84 additions & 65 deletions src/makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,123 @@
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

BUILDROOT = C:/_temp/_namecoin
#khalahan-namecoin-82c140e/src

INCLUDEPATHS= \
-I"C:\boost-1.43.0-mgw" \
-I"C:\db-4.7.25.NC-mgw\build_unix" \
-I"C:\openssl-1.0.0d-mgw\include" \
-I"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib\mswud" \
-I"C:\wxWidgets-2.9.1-mgw\include"
-I"$(BUILDROOT)/boost-1.43.0-mgw" \
-I"$(BUILDROOT)/db-4.7.25.NC-mgw/build_unix" \
-I"$(BUILDROOT)/openssl-1.0.0j-mgw" \
-I"$(BUILDROOT)/openssl-1.0.0j-mgw/include" \
-I"$(BUILDROOT)/openssl-1.0.0j-mgw/include/openssl" \
-I"$(BUILDROOT)/wxWidgets-2.9.4-mgw/lib/gcc_lib/mswud" \
-I"$(BUILDROOT)/wxWidgets-2.9.4-mgw/include"


LIBPATHS= \
-L"C:\boost-1.43.0-mgw\stage\lib" \
-L"C:\db-4.7.25.NC-mgw\build_unix" \
-L"C:\openssl-1.0.0d-mgw" \
-L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
-L"$(BUILDROOT)/boost-1.43.0-mgw/stage/lib" \
-L"$(BUILDROOT)/db-4.7.25.NC-mgw/build_unix" \
-L"$(BUILDROOT)/openssl-1.0.0j-mgw" \
-L"$(BUILDROOT)/wxWidgets-2.9.4-mgw/lib/gcc_lib"

WXLIBS= \
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd

LIBS= \
-l boost_system-mgw45-mt-s-1_43 \
-l boost_filesystem-mgw45-mt-s-1_43 \
-l boost_program_options-mgw45-mt-s-1_43 \
-l boost_thread-mgw45-mt-s-1_43 \
-l db_cxx \
-l ssl \
-l crypto
-l boost_system-mgw44-mt-s-1_43 \
-l boost_filesystem-mgw44-mt-s-1_43 \
-l boost_program_options-mgw44-mt-s-1_43 \
-l boost_thread-mgw44-mt-s-1_43 \
-l db_cxx \
-l ssl \
-l crypto \
-l eay32

DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL
DEBUGFLAGS=-g -D__WXDEBUG__
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h keystore.h main.h wallet.h rpc.h uibase.h ui.h noui.h init.h
script.h db.h net.h irc.h keystore.h main.h wallet.h rpc.h uibase.h ui.h noui.h init.h \
auxpow.h


bitcoin.exe: USE_UPNP:=1
ifdef USE_UPNP
INCLUDEPATHS += -I"C:\upnpc-exe-win32-20110215"
LIBPATHS += -L"C:\upnpc-exe-win32-20110215"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif
ifdef USE_UPNP
INCLUDEPATHS += -I"$(BUILDROOT)/upnpc-exe-win32-20110215"
LIBPATHS += -L"$(BUILDROOT)/upnpc-exe-win32-20110215"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

bitcoind.exe: USE_UPNP:=0
ifdef USE_UPNP
INCLUDEPATHS += -I"C:\upnpc-exe-win32-20110215"
LIBPATHS += -L"C:\upnpc-exe-win32-20110215"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif
ifdef USE_UPNP
INCLUDEPATHS += -I"$(BUILDROOT)/upnpc-exe-win32-20110215"
LIBPATHS += -L"$(BUILDROOT)/upnpc-exe-win32-20110215"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi

OBJS= \
obj/util.o \
obj/script.o \
obj/db.o \
obj/net.o \
obj/irc.o \
obj/keystore.o \
obj/main.o \
obj/wallet.o \
obj/rpc.o \
obj/init.o \
cryptopp/obj/sha.o \
cryptopp/obj/cpu.o


all: bitcoin.exe
BASE_OBJS= \
obj/auxpow.o \
obj/util.o \
obj/script.o \
obj/db.o \
obj/net.o \
obj/irc.o \
obj/keystore.o \
obj/main.o \
obj/wallet.o \
obj/rpc.o \
obj/init.o \
cryptopp/obj/sha.o \
cryptopp/obj/cpu.o

OBJS = \
$(BASE_OBJS) \
obj/hook.o

all: namecoind.exe
#all: bitcoind.exe


obj/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -DGUI -o $@ $<
g++ -c $(CFLAGS) -DGUI -o $@ $<

cryptopp/obj/%.o: cryptopp/%.cpp
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $<
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $<

obj/ui_res.o: ../share/ui.rc ../share/pixmaps/bitcoin.ico ../share/pixmaps/check.ico ../share/pixmaps/send16.bmp ../share/pixmaps/send16mask.bmp ../share/pixmaps/send16masknoshadow.bmp ../share/pixmaps/send20.bmp ../share/pixmaps/send20mask.bmp ../share/pixmaps/addressbook16.bmp ../share/pixmaps/addressbook16mask.bmp ../share/pixmaps/addressbook20.bmp ../share/pixmaps/addressbook20mask.bmp
windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<

bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<

#bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
#g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)

obj/nogui/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
g++ -c $(CFLAGS) -o $@ $<

#bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o
#g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

#obj/test/%.o: obj/test/%.cpp $(HEADERS)
# g++ -c $(CFLAGS) -o $@ $<

bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
#test_bitcoin: obj/test/test_bitcoin.o
#g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

obj/nogui/namecoin.o: namecoin.h

obj/test/%.o: obj/test/%.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
namecoind.exe: $(BASE_OBJS:obj/%=obj/nogui/%) obj/nogui/namecoin.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

test_bitcoin: obj/test/test_bitcoin.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
#strip namecoind.exe

clean:
-del /Q bitcoin bitcoind test_bitcoin
-del /Q obj\*
-del /Q obj\nogui\*
-del /Q obj\test\*
-del /Q cryptopp\obj\*
-del /Q test\*.o
-del /Q headers.h.gch
-del /Q bitcoin bitcoind test_bitcoin
-del /Q obj/*
-del /Q obj/nogui/*
-del /Q obj/test/*
-del /Q cryptopp/obj/*
-del /Q test/*.o
-del /Q headers.h.gch