Browse Source

Upgrade dependancies and tweak build process.

* Upgrade to use miniupnpc 1.6
* Upgrade to wxWidgets 2.9.2
* Upgrade to Bost 1.47 for Win32 Builds
metaverse
Matt Corallo 13 years ago
parent
commit
b4ada906c0
  1. 42
      contrib/gitian-win32.yml
  2. 23
      contrib/gitian.yml
  3. 4
      contrib/wx-patches/README
  4. 86
      contrib/wx-patches/toplevel.cpp.diff
  5. 9
      contrib/wx-patches/toplevel.h.diff
  6. 36
      doc/build-msw.txt
  7. 18
      doc/build-osx.txt
  8. 21
      doc/build-unix.txt
  9. 21
      src/makefile.linux-mingw
  10. 28
      src/makefile.mingw
  11. 15
      src/net.cpp

42
contrib/gitian-win32.yml

@ -14,17 +14,15 @@ remotes:
- "url": "https://github.com/bitcoin/bitcoin.git"
"dir": "bitcoin"
files:
- "wxWidgets-2.9.1.tar.bz2"
- "boost_1_43_0.tar.bz2"
- "wxWidgets-2.9.2.tar.bz2"
- "boost_1_47_0.tar.bz2"
- "openssl-1.0.0d.tar.gz"
- "db-4.7.25.NC.tar.gz"
- "upnpc-exe-win32-20110215.zip"
- "miniupnpc-1.5.20110215.tar.gz"
- "WSPiApi.h"
- "db-4.8.30.NC.tar.gz"
- "miniupnpc-1.6.tar.gz"
script: |
#
tar xjf wxWidgets-2.9.1.tar.bz2
cd wxWidgets-2.9.1
tar xjf wxWidgets-2.9.2.tar.bz2
cd wxWidgets-2.9.2
./configure --host=i586-mingw32msvc --build=i686-linux --disable-shared --enable-monolithic --without-libpng --disable-svg
perl -i -p -e "s/__TIME__/\"$REFERENCE_TIME\"/;s/__DATE__/\"$REFERENCE_DATE\"/" include/wx/chartype.h
make $MAKEOPTS
@ -36,14 +34,14 @@ script: |
make
cd ..
#
tar xzf db-4.7.25.NC.tar.gz
cd db-4.7.25.NC/build_unix
tar xzf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --enable-mingw --enable-cxx --host=i586-mingw32msvc CFLAGS="-I/usr/i586-mingw32msvc/include"
make $MAKEOPTS
cd ../..
#
tar xjf boost_1_43_0.tar.bz2
cd boost_1_43_0
tar xjf boost_1_47_0.tar.bz2
cd boost_1_47_0
echo "using gcc : 4.4 : i586-mingw32msvc-g++
:
<rc>i586-mingw32msvc-windres
@ -53,16 +51,13 @@ script: |
./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete $MAKEOPTS stage
cd ..
#
mkdir upnpc-exe-win32-20110215
cd upnpc-exe-win32-20110215
unzip ../upnpc-exe-win32-20110215.zip
mkdir miniupnpc
cd miniupnpc
tar xzf ../../miniupnpc-1.5.20110215.tar.gz
mv ./miniupnpc-1.5.20110215/* ./
cd ../..
#
cp WSPiApi.h $HOME/build
tar xzf miniupnpc-1.6.tar.gz
cd miniupnpc-1.6
sed 's/dllwrap -k --driver-name gcc/$(DLLWRAP) -k --driver-name $(CC)/' -i Makefile.mingw
sed 's|wingenminiupnpcstrings $< $@|./wingenminiupnpcstrings $< $@|' -i Makefile.mingw
make -f Makefile.mingw DLLWRAP=i586-mingw32msvc-dllwrap CC=i586-mingw32msvc-gcc AR=i586-mingw32msvc-ar
cd ..
mv miniupnpc-1.6 miniupnpc
#
cd bitcoin
mkdir -p $OUTDIR/src
@ -72,8 +67,7 @@ script: |
cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt
cp $OUTDIR/src/COPYING $OUTDIR/license.txt
cd src
sed 's/$(DEBUGFLAGS)//' < makefile.linux-mingw > makefile.linux-mingw.2 && mv makefile.linux-mingw.2 makefile.linux-mingw
sed 's|//#include <WSPiApi.h>|#include <WSPiApi.h>|' < net.cpp > net.cpp.2 && mv net.cpp.2 net.cpp
sed 's/$(DEBUGFLAGS)//' -i makefile.linux-mingw
make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoin.exe USE_UPNP=1
make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0
i586-mingw32msvc-strip bitcoin.exe

23
contrib/gitian.yml

@ -6,7 +6,7 @@ architectures:
- "i386"
- "amd64"
packages:
- "libdb4.7++-dev"
- "libdb4.8++-dev"
- "libxxf86vm-dev"
- "libgtk2.0-dev"
- "libboost-all-dev"
@ -17,26 +17,19 @@ remotes:
- "url": "https://github.com/bitcoin/bitcoin.git"
"dir": "bitcoin"
files:
- "wxWidgets-2.9.1.tar.bz2"
- "miniupnpc-1.5.tar.gz"
- "toplevel.h.diff"
- "toplevel.cpp.diff"
- "wxWidgets-2.9.2.tar.bz2"
- "miniupnpc-1.6.tar.gz"
script: |
INSTDIR="$HOME/install"
export LIBRARY_PATH="$INSTDIR/lib"
#
tar xzf miniupnpc-1.5.tar.gz
cd miniupnpc-1.5
tar xzf miniupnpc-1.6.tar.gz
cd miniupnpc-1.6
INSTALLPREFIX=$INSTDIR make $MAKEOPTS install
cd ..
#
tar xjf wxWidgets-2.9.1.tar.bz2
cd wxWidgets-2.9.1
cd include/wx/gtk
patch < ../../../../toplevel.h.diff
cd ../../../src/gtk
patch < ../../../toplevel.cpp.diff
cd ../..
tar xjf wxWidgets-2.9.2.tar.bz2
cd wxWidgets-2.9.2
./configure --prefix=$INSTDIR --enable-monolithic --disable-shared
perl -i -p -e "s/__TIME__/\"$REFERENCE_TIME\"/;s/__DATE__/\"$REFERENCE_DATE\"/" include/wx/chartype.h
make $MAKEOPTS install
@ -50,7 +43,7 @@ script: |
cp $OUTDIR/src/doc/README $OUTDIR
cp $OUTDIR/src/COPYING $OUTDIR
cd src
sed 's/$(DEBUGFLAGS)//' < makefile.unix > makefile.unix.2 && mv makefile.unix.2 makefile.unix
sed 's/$(DEBUGFLAGS)//' -i makefile.unix
PATH=$INSTDIR/bin:$PATH make -f makefile.unix CXX="g++ -I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoin USE_UPNP=1
PATH=$INSTDIR/bin:$PATH make -f makefile.unix CXX="g++ -I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0
mkdir -p $OUTDIR/bin/$GBUILD_BITS

4
contrib/wx-patches/README

@ -1,4 +0,0 @@
This folder contains two patches which are applied to wxWidgets
2.9.1 before building the wxWidgets which is used for release
versions of bitcoin. They make the GUI show up on newer OSs
with new libgtks, such as Ubuntu 11.04.

86
contrib/wx-patches/toplevel.cpp.diff

@ -1,86 +0,0 @@
--- /wxWidgets/trunk/src/gtk/toplevel.cpp (revision 67326)
+++ /wxWidgets/trunk/src/gtk/toplevel.cpp (revision 67496)
@@ -72,4 +72,8 @@
// send any activate events at all
static int g_sendActivateEvent = -1;
+
+// Whether _NET_REQUEST_FRAME_EXTENTS support is working
+// 0 == not tested yet, 1 == working, 2 == broken
+static int gs_requestFrameExtentsStatus;
//-----------------------------------------------------------------------------
@@ -432,4 +436,12 @@
if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property)
{
+ if (win->m_netFrameExtentsTimerId)
+ {
+ // WM support for _NET_REQUEST_FRAME_EXTENTS is working
+ gs_requestFrameExtentsStatus = 1;
+ g_source_remove(win->m_netFrameExtentsTimerId);
+ win->m_netFrameExtentsTimerId = 0;
+ }
+
wxSize decorSize = win->m_decorSize;
int left, right, top, bottom;
@@ -439,4 +451,22 @@
win->GTKUpdateDecorSize(decorSize);
}
+ return false;
+}
+}
+
+extern "C" {
+static gboolean request_frame_extents_timeout(void* data)
+{
+ // WM support for _NET_REQUEST_FRAME_EXTENTS is broken
+ gs_requestFrameExtentsStatus = 2;
+ gdk_threads_enter();
+ wxTopLevelWindowGTK* win = static_cast<wxTopLevelWindowGTK*>(data);
+ win->m_netFrameExtentsTimerId = 0;
+ wxSize decorSize = win->m_decorSize;
+ int left, right, top, bottom;
+ if (wxGetFrameExtents(gtk_widget_get_window(win->m_widget), &left, &right, &top, &bottom))
+ decorSize.Set(left + right, top + bottom);
+ win->GTKUpdateDecorSize(decorSize);
+ gdk_threads_leave();
return false;
}
@@ -459,4 +489,5 @@
m_deferShowAllowed = true;
m_updateDecorSize = true;
+ m_netFrameExtentsTimerId = 0;
m_urgency_hint = -2;
@@ -811,5 +842,6 @@
if (deferShow)
{
- deferShow = m_deferShowAllowed && !GTK_WIDGET_REALIZED(m_widget);
+ deferShow = gs_requestFrameExtentsStatus != 2 &&
+ m_deferShowAllowed && !gtk_widget_get_realized(m_widget);
if (deferShow)
{
@@ -829,11 +861,4 @@
// GetSize()/SetSize() because it makes window bigger between each
// restore and save.
- m_updateDecorSize = deferShow;
- }
- if (deferShow)
- {
- // Fluxbox support for _NET_REQUEST_FRAME_EXTENTS is broken
- const char* name = gdk_x11_screen_get_window_manager_name(screen);
- deferShow = strcmp(name, "Fluxbox") != 0;
m_updateDecorSize = deferShow;
}
@@ -875,4 +900,12 @@
(XEvent*)&xevent);
+ if (gs_requestFrameExtentsStatus == 0)
+ {
+ // if WM does not respond to request within 1 second,
+ // we assume support for _NET_REQUEST_FRAME_EXTENTS is not working
+ m_netFrameExtentsTimerId =
+ g_timeout_add(1000, request_frame_extents_timeout, this);
+ }
+
// defer calling gtk_widget_show()
m_isShown = true;

9
contrib/wx-patches/toplevel.h.diff

@ -1,9 +0,0 @@
--- /wxWidgets/trunk/include/wx/gtk/toplevel.h (revision 65373)
+++ /wxWidgets/trunk/include/wx/gtk/toplevel.h (revision 67496)
@@ -114,4 +114,6 @@
// wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
int m_urgency_hint;
+ // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling
+ unsigned m_netFrameExtentsTimerId;
// return the size of the window without WM decorations

36
doc/build-msw.txt

@ -27,11 +27,11 @@ Dependencies
Libraries you need to download separately and build:
default path download
wxWidgets \wxwidgets-2.9.1-mgw http://www.wxwidgets.org/downloads/
wxWidgets \wxwidgets-2.9.2-mgw http://www.wxwidgets.org/downloads/
OpenSSL \openssl-1.0.0d-mgw http://www.openssl.org/source/
Berkeley DB \db-4.7.25.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \boost-1.43.0-mgw http://www.boost.org/users/download/
miniupnpc \upnpc-exe-win32-20110215 http://miniupnp.tuxfamily.org/files/
Berkeley DB \db-4.8.30.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \boost-1.47.0-mgw http://www.boost.org/users/download/
miniupnpc \miniupnpc-1.6-mgw http://miniupnp.tuxfamily.org/files/
Their licenses:
wxWidgets LGPL 2.1 with very liberal exceptions
@ -41,11 +41,11 @@ Boost MIT-like license
miniupnpc New (3-clause) BSD license
Versions used in this release:
wxWidgets 2.9.1
wxWidgets 2.9.2
OpenSSL 1.0.0d
Berkeley DB 4.7.25.NC
Boost 1.43.0
miniupnpc 1.5-20110215
Berkeley DB 4.8.30.NC
Boost 1.47.0
miniupnpc 1.6
Notes
@ -57,7 +57,7 @@ classes that do the rote work of constructing all the UI elements.
wxWidgets
---------
DOS shell:
cd \wxWidgets-2.9.1-mgw\build\msw
cd \wxWidgets-2.9.2-mgw\build\msw
mingw32-make -f makefile.gcc
OpenSSL
@ -73,30 +73,26 @@ make
Berkeley DB
-----------
MSYS shell:
cd /c/db-4.7.25.NC-mgw/build_unix
cd /c/db-4.8.30.NC-mgw/build_unix
sh ../dist/configure --enable-mingw --enable-cxx
make
Boost
-----
DOS prompt:
downloaded boost jam 3.1.18
cd \boost-1.43.0-mgw
cd \boost-1.47.0-mgw
bjam toolset=gcc --build-type=complete stage
Note:
building with boost 1.45.0 failed because of boost ticket 4614, 4258
builds fine with boost 1.43.0
MiniUPnPc
---------
Building miniupnpc failed on Windows Server 2003, thus it is expected that a binary copy will be used.
See http://miniupnp.tuxfamily.org/forum/viewtopic.php?t=642
UPnP support is optional, make with USE_UPNP= to disable it.
Get upnpc-exe-win32-20110215.zip and unzip it to \upnpc-exe-win32-20110215
Get miniupnpc-1.5.20110215.tar.gz and copy *.h to \upnpc-exe-win32-20110215\miniupnpc
MSYS shell:
cd /c/miniupnpc-1.6-mgw
make -f Makefile.mingw
mkdir miniupnpc
cp *.h miniupnpc/
Bitcoin
-------

18
doc/build-osx.txt

@ -135,18 +135,18 @@ The process for miniupnpc (optional) is similar to that of OpenSSL.
Download from http://miniupnp.tuxfamily.org/files/.
cd ~/bitcoin/deps
tar xvf ~/Downloads/miniupnpc-1.5.tar
mv miniupnpc-1.5 miniupnpc-1.5-x86_64
tar xvf ~/Downloads/miniupnpc-1.5.tar
mv miniupnpc-1.5 miniupnpc-1.5-i386
tar xvf ~/Downloads/miniupnpc-1.6.tar
mv miniupnpc-1.6 miniupnpc-1.6-x86_64
tar xvf ~/Downloads/miniupnpc-1.6.tar
mv miniupnpc-1.6 miniupnpc-1.6-i386
# build x86_64 (64 bit intel) binary
cd miniupnpc-1.5-x86_64
cd miniupnpc-1.6-x86_64
export CFLAGS="-arch x86_64"
export LDFLAGS="-arch x86_64"
export PREFIX="/Users/macuser/bitcoin/deps"
make && make install
# build i386 (32 bit intel) binary
cd miniupnpc-1.5-i386
cd miniupnpc-1.6-i386
export CFLAGS="-arch i386"
export LDFLAGS="-arch i386"
export PREFIX="/Users/macuser/bitcoin/deps"
@ -154,7 +154,7 @@ make
# combine the libs
cd ~/bitcoin/deps
lipo -arch i386 miniupnpc-1.5-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.5-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create
lipo -arch i386 miniupnpc-1.6-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.6-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create
Verify your binaries
@ -175,8 +175,8 @@ Berkeley DB
Download from http://freshmeat.net/projects/berkeleydb/
cd ~/bitcoin/deps
tar xvf ~/Downloads/db-4.8.26.tar
cd db-4.8.26/build_unix
tar xvf ~/Downloads/db-4.8.30.tar
cd db-4.8.30/build_unix
../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install

21
doc/build-unix.txt

@ -25,8 +25,8 @@ Dependencies
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install libssl-dev
sudo apt-get install libdb4.7-dev
sudo apt-get install libdb4.7++-dev
sudo apt-get install libdb4.8-dev
sudo apt-get install libdb4.8++-dev
Boost 1.40+: sudo apt-get install libboost-all-dev
or Boost 1.37: sudo apt-get install libboost1.37-dev
@ -55,10 +55,10 @@ miniupnpc New (3-clause) BSD license
Versions used in this release:
GCC 4.3.3
OpenSSL 0.9.8g
wxWidgets 2.9.0
Berkeley DB 4.7.25.NC
wxWidgets 2.9.2
Berkeley DB 4.8.30.NC
Boost 1.37
miniupnpc 1.5
miniupnpc 1.6
Notes
@ -74,8 +74,8 @@ symbols, which reduces the executable size by about 90%.
wxWidgets
---------
cd /usr/local
tar -xzvf wxWidgets-2.9.0.tar.gz
cd wxWidgets-2.9.0
tar -xzvf wxWidgets-2.9.2.tar.gz
cd wxWidgets-2.9.2
mkdir buildgtk
cd buildgtk
../configure --with-gtk --enable-debug --disable-shared --enable-monolithic --without-libpng --disable-svg
@ -87,8 +87,8 @@ ldconfig
miniupnpc
---------
tar -xzvf miniupnpc-1.5.tar.gz
cd miniupnpc-1.5
tar -xzvf miniupnpc-1.6.tar.gz
cd miniupnpc-1.6
make
sudo su
make install
@ -96,8 +96,7 @@ make install
Berkeley DB
-----------
You need Berkeley DB 4.7. Don't use 4.8, the database/log0000* files
are incompatible. If you have to build Berkeley DB yourself:
You need Berkeley DB 4.8. If you have to build Berkeley DB yourself:
../dist/configure --enable-cxx
make

21
src/makefile.linux-mingw

@ -7,19 +7,19 @@ DEPSDIR:=/usr/i586-mingw32msvc
USE_UPNP:=0
INCLUDEPATHS= \
-I"$(DEPSDIR)/boost_1_43_0" \
-I"$(DEPSDIR)/db-4.7.25.NC/build_unix" \
-I"$(DEPSDIR)/boost_1_47_0" \
-I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-I"$(DEPSDIR)/openssl-1.0.0d/include" \
-I"$(DEPSDIR)/wxWidgets-2.9.1/lib/gcc_lib/mswud" \
-I"$(DEPSDIR)/wxWidgets-2.9.1/include" \
-I"$(DEPSDIR)/wxWidgets-2.9.1/lib/wx/include/i586-mingw32msvc-msw-unicode-static-2.9/" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/lib/gcc_lib/mswud" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/include" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/lib/wx/include/i586-mingw32msvc-msw-unicode-static-2.9/" \
-I"$(DEPSDIR)"
LIBPATHS= \
-L"$(DEPSDIR)/boost_1_43_0/stage/lib" \
-L"$(DEPSDIR)/db-4.7.25.NC/build_unix" \
-L"$(DEPSDIR)/boost_1_47_0/stage/lib" \
-L"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-L"$(DEPSDIR)/openssl-1.0.0d" \
-L"$(DEPSDIR)/wxWidgets-2.9.1/lib"
-L"$(DEPSDIR)/wxWidgets-2.9.2/lib"
WXLIBS= -l wx_mswu-2.9-i586-mingw32msvc
@ -32,7 +32,7 @@ LIBS= \
-l ssl \
-l crypto
DEFS=-D_MT -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL
DEFS=-D_MT -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g -D__WXDEBUG__
CFLAGS=-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 \
@ -40,8 +40,7 @@ HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h
crypter.h init.h
ifdef USE_UPNP
INCLUDEPATHS += -I"$(DEPSDIR)/upnpc-exe-win32-20110215"
LIBPATHS += -L"$(DEPSDIR)/upnpc-exe-win32-20110215"
LIBPATHS += -L"$(DEPSDIR)/miniupnpc"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

28
src/makefile.mingw

@ -5,31 +5,31 @@
USE_UPNP:=0
INCLUDEPATHS= \
-I"C:\boost-1.43.0-mgw" \
-I"C:\db-4.7.25.NC-mgw\build_unix" \
-I"C:\boost-1.47.0-mgw" \
-I"C:\db-4.8.30.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"C:\wxWidgets-2.9.2-mgw\lib\gcc_lib\mswud" \
-I"C:\wxWidgets-2.9.2-mgw\include"
LIBPATHS= \
-L"C:\boost-1.43.0-mgw\stage\lib" \
-L"C:\db-4.7.25.NC-mgw\build_unix" \
-L"C:\boost-1.47.0-mgw\stage\lib" \
-L"C:\db-4.8.30.NC-mgw\build_unix" \
-L"C:\openssl-1.0.0d-mgw" \
-L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
-L"C:\wxWidgets-2.9.2-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 boost_system-mgw45-mt-s-1_47 \
-l boost_filesystem-mgw45-mt-s-1_47 \
-l boost_program_options-mgw45-mt-s-1_47 \
-l boost_thread-mgw45-mt-s-1_47 \
-l db_cxx \
-l ssl \
-l crypto
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
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 \
@ -37,8 +37,8 @@ HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h
init.h crypter.h
ifdef USE_UPNP
INCLUDEPATHS += -I"C:\upnpc-exe-win32-20110215"
LIBPATHS += -L"C:\upnpc-exe-win32-20110215"
INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw"
LIBPATHS += -L"C:\miniupnpc-1.6-mgw"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

15
src/net.cpp

@ -12,11 +12,6 @@
#ifdef __WXMSW__
#include <string.h>
// This file can be downloaded as a part of the Windows Platform SDK
// and is required for Bitcoin binaries to work properly on versions
// of Windows before XP. If you are doing builds of Bitcoin for
// public release, you should uncomment this line.
//#include <WSPiApi.h>
#endif
#ifdef USE_UPNP
@ -1079,10 +1074,11 @@ void ThreadMapPort2(void* parg)
const char * rootdescurl = 0;
const char * multicastif = 0;
const char * minissdpdpath = 0;
int error = 0;
struct UPNPDev * devlist = 0;
char lanaddr[64];
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
struct UPNPUrls urls;
struct IGDdatas data;
@ -1094,14 +1090,9 @@ void ThreadMapPort2(void* parg)
char intClient[16];
char intPort[6];
string strDesc = "Bitcoin " + FormatFullVersion();
#ifndef __WXMSW__
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, strDesc.c_str(), "TCP", 0);
#else
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, strDesc.c_str(), "TCP", 0, "0");
#endif
if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
port, port, lanaddr, r, strupnperror(r));

Loading…
Cancel
Save