From 8beaec1a9df2adb91f0afc968c019ea748746cc4 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Sat, 7 Jan 2017 22:16:53 +0100 Subject: [PATCH] net/zerotier: improve libupnpc detection The patch name was wrong and the change could be made in a more elegant way. Signed-off-by: Moritz Warning --- ...05-use-external-miniupnpc-and-natpmp.patch | 32 ++++++++++++ .../0005-use-internal-miniupnpc-and-natpmp | 50 ------------------- 2 files changed, 32 insertions(+), 50 deletions(-) create mode 100644 net/zerotier/patches/0005-use-external-miniupnpc-and-natpmp.patch delete mode 100644 net/zerotier/patches/0005-use-internal-miniupnpc-and-natpmp diff --git a/net/zerotier/patches/0005-use-external-miniupnpc-and-natpmp.patch b/net/zerotier/patches/0005-use-external-miniupnpc-and-natpmp.patch new file mode 100644 index 000000000..377abefad --- /dev/null +++ b/net/zerotier/patches/0005-use-external-miniupnpc-and-natpmp.patch @@ -0,0 +1,32 @@ +--- a/make-linux.mk ++++ b/make-linux.mk +@@ -64,7 +64,8 @@ ifeq ($(ZT_USE_MINIUPNPC),1) + DEFS+=-DZT_USE_MINIUPNPC + + # Auto-detect libminiupnpc at least v2.0 +- MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1) ++ #MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1) ++ MINIUPNPC_IS_NEW_ENOUGH=1 + ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1) + DEFS+=-DZT_USE_SYSTEM_MINIUPNPC + LDLIBS+=-lminiupnpc +@@ -74,7 +75,7 @@ ifeq ($(ZT_USE_MINIUPNPC),1) + endif + + # Auto-detect libnatpmp +- ifeq ($(wildcard /usr/include/natpmp.h),) ++ ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),) + OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o + else + LDLIBS+=-lnatpmp +--- a/osdep/PortMapper.cpp ++++ b/osdep/PortMapper.cpp +@@ -180,7 +180,7 @@ public: + struct IGDdatas data; + + int upnpError = 0; +- UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,2,&upnpError); ++ UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,&upnpError); + if (devlist) { + + #ifdef ZT_PORTMAPPER_TRACE diff --git a/net/zerotier/patches/0005-use-internal-miniupnpc-and-natpmp b/net/zerotier/patches/0005-use-internal-miniupnpc-and-natpmp deleted file mode 100644 index 5197a62ba..000000000 --- a/net/zerotier/patches/0005-use-internal-miniupnpc-and-natpmp +++ /dev/null @@ -1,50 +0,0 @@ -Index: ZeroTierOne-1.1.14/make-linux.mk -=================================================================== ---- ZeroTierOne-1.1.14.orig/make-linux.mk -+++ ZeroTierOne-1.1.14/make-linux.mk -@@ -64,22 +64,22 @@ ifeq ($(ZT_USE_MINIUPNPC),1) - DEFS+=-DZT_USE_MINIUPNPC - - # Auto-detect libminiupnpc at least v2.0 -- MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1) -- ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1) -+# MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1) -+# ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1) - DEFS+=-DZT_USE_SYSTEM_MINIUPNPC - LDLIBS+=-lminiupnpc -- else -- DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR -- OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o -- endif -+# else -+# DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR -+# OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o -+# endif - - # Auto-detect libnatpmp -- ifeq ($(wildcard /usr/include/natpmp.h),) -- OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o -- else -+# ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),) -+# OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o -+# else - LDLIBS+=-lnatpmp - DEFS+=-DZT_USE_SYSTEM_NATPMP -- endif -+# endif - endif - - ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1) -Index: ZeroTierOne-1.1.14/osdep/PortMapper.cpp -=================================================================== ---- ZeroTierOne-1.1.14.orig/osdep/PortMapper.cpp -+++ ZeroTierOne-1.1.14/osdep/PortMapper.cpp -@@ -180,7 +180,7 @@ public: - struct IGDdatas data; - - int upnpError = 0; -- UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,2,&upnpError); -+ UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,&upnpError); - if (devlist) { - - #ifdef ZT_PORTMAPPER_TRACE