Author

Topic: [PATCH] build without UPNP (Read 2961 times)

hero member
Activity: 755
Merit: 515
May 01, 2011, 04:25:13 AM
#4
Building without UPNP didn't work (on Linux), so I made the below changes.
Two new #ifdef's, and you definitely can't define something :=0 and expect it to
act as if undefined (GNU make).
Actually you can.  The intended way to build bitcoin without UPnP support is make -f makefile.unix USE_UPNP=
That will successfully build bitcoin without UPnP support and without miniupnpc installed.
sr. member
Activity: 406
Merit: 251
May 01, 2011, 02:08:54 AM
#3
Yea that bit me too. I had also thought that USE_UPNP in the Makefile was compile time not run time option. To build without just comment it in the Makefile. I would have thought that a compile time def would not be used for a run time option. But I am not a programmer so...
hero member
Activity: 566
Merit: 500
Unselfish actions pay back better
May 01, 2011, 01:49:29 AM
#2
Building without UPNP didn't work (on Linux)

All I did was commenting out the USE_UPNP stanzas in the makefile and then adding a -UUSE_UPNP to the DEFS variable:

Code:

--- makefile.unix 2011-05-01 08:46:17.405173473 +0200
+++ makefile.linux 2011-05-01 08:47:22.833923365 +0200
@@ -8,9 +8,9 @@
 
 WXLIBS=$(shell wx-config --libs)
 
-USE_UPNP:=0
+#USE_UPNP:=0
 
-DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
+DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL -UUSE_UPNP
 
 # for boost 1.37, add -mt to the boost libraries
 LIBS= \
@@ -23,10 +23,10 @@
    -l ssl \
    -l crypto
 
-ifdef USE_UPNP
- LIBS += -l miniupnpc
- DEFS += -DUSE_UPNP=$(USE_UPNP)
-endif
+#ifdef USE_UPNP
+# LIBS += -l miniupnpc
+# DEFS += -DUSE_UPNP=$(USE_UPNP)
+#endif
 
 LIBS+= \
  -Wl,-Bdynamic \

Cheers,
full member
Activity: 213
Merit: 100
May 01, 2011, 12:55:54 AM
#1
Building without UPNP didn't work (on Linux), so I made the below changes.
Two new #ifdef's, and you definitely can't define something :=0 and expect it to
act as if undefined (GNU make).

I can make this into a github pull request later if need be.

Index: net.cpp
===================================================================
--- net.cpp     (revision 251)
+++ net.cpp     (working copy)
@@ -887,6 +887,7 @@
     printf("ThreadMapPort exiting\n");
 }
 
+#ifdef USE_UPNP
 void ThreadMapPort2(void* parg)
 {
     printf("ThreadMapPort started\n");
@@ -947,6 +948,7 @@
         }
     }
 }
+#endif
 
 void MapPort(bool fMapPort)
 {
Index: makefile.unix
===================================================================
--- makefile.unix       (revision 251)
+++ makefile.unix       (working copy)
@@ -8,7 +8,7 @@
 
 WXLIBS=$(shell wx-config --libs)
 
-USE_UPNP:=0
+#USE_UPNP:=1
 
 DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
 
Index: db.cpp
===================================================================
--- db.cpp      (revision 251)
+++ db.cpp      (working copy)
@@ -807,8 +807,10 @@
     printf("fMinimizeOnClose = %d\n", fMinimizeOnClose);
     printf("fUseProxy = %d\n", fUseProxy);
     printf("addrProxy = %s\n", addrProxy.ToString().c_str());
+#ifdef USE_UPNP
     if (fHaveUPnP)
         printf("fUseUPnP = %d\n", fUseUPnP);
+#endif
 
 
     // Upgrade
Jump to: