mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Merge miniupnpc/libnatpmp build into main build by just adding flags, defs, and objs.
This commit is contained in:
parent
6768521330
commit
66a29a00ee
@ -42,9 +42,8 @@ ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_USE_MINIUPNPC),1)
|
ifeq ($(ZT_USE_MINIUPNPC),1)
|
||||||
DEFS+=-DZT_USE_MINIUPNPC
|
DEFS+=-DZT_USE_MINIUPNPC -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=\"1.9\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
|
||||||
LDLIBS+=ext/miniupnpc/libminiupnpc.a
|
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o 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 osdep/PortMapper.o
|
||||||
OBJS+=osdep/UPNPClient.o
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
|
# Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
|
||||||
@ -65,7 +64,7 @@ ifeq ($(ZT_DEBUG),1)
|
|||||||
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
CXXFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
CXXFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
STRIP=echo
|
STRIP?=echo
|
||||||
# The following line enables optimization for the crypto code, since
|
# The following line enables optimization for the crypto code, since
|
||||||
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
|
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
|
||||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||||
@ -75,6 +74,7 @@ else
|
|||||||
CXXFLAGS?=-O3 -fstack-protector
|
CXXFLAGS?=-O3 -fstack-protector
|
||||||
CXXFLAGS+=-Wall -fPIE -fvisibility=hidden -fno-rtti -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
CXXFLAGS+=-Wall -fPIE -fvisibility=hidden -fno-rtti -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||||
|
STRIP?=strip
|
||||||
STRIP+=--strip-all
|
STRIP+=--strip-all
|
||||||
endif
|
endif
|
||||||
ifeq ($(ZT_TRACE),1)
|
ifeq ($(ZT_TRACE),1)
|
||||||
@ -90,9 +90,6 @@ endif
|
|||||||
all: one
|
all: one
|
||||||
|
|
||||||
one: $(OBJS) one.o
|
one: $(OBJS) one.o
|
||||||
ifeq ($(ZT_USE_MINIUPNPC),1)
|
|
||||||
cd ext/miniupnpc ; make clean ; make 'CFLAGS=-O2 -fstack-protector -fPIE -fno-common -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600' -j 2 libminiupnpc.a
|
|
||||||
endif
|
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LDLIBS)
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LDLIBS)
|
||||||
$(STRIP) zerotier-one
|
$(STRIP) zerotier-one
|
||||||
ln -sf zerotier-one zerotier-idtool
|
ln -sf zerotier-one zerotier-idtool
|
||||||
@ -106,8 +103,7 @@ installer: one FORCE
|
|||||||
./ext/installfiles/linux/buildinstaller.sh
|
./ext/installfiles/linux/buildinstaller.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o zerotier-one zerotier-idtool zerotier-cli zerotier-selftest build-* ZeroTierOneInstaller-* *.deb *.rpm
|
rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest build-* ZeroTierOneInstaller-* *.deb *.rpm
|
||||||
cd ext/miniupnpc ; make clean
|
|
||||||
|
|
||||||
debug: FORCE
|
debug: FORCE
|
||||||
make ZT_DEBUG=1 one
|
make ZT_DEBUG=1 one
|
||||||
|
@ -42,7 +42,7 @@ ifeq ($(ZT_AUTO_UPDATE),1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_USE_MINIUPNPC),1)
|
ifeq ($(ZT_USE_MINIUPNPC),1)
|
||||||
DEFS+=-DMACOSX -DZT_USE_MINIUPNPC -D_DARWIN_C_SOURCE -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -DOS_STRING=\"Darwin/15.0.0\" -DMINIUPNPC_VERSION_STRING=\"1.9\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
|
DEFS+=-DMACOSX -DZT_USE_MINIUPNPC -DMINIUPNP_STATICLIB -D_DARWIN_C_SOURCE -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -DOS_STRING=\"Darwin/15.0.0\" -DMINIUPNPC_VERSION_STRING=\"1.9\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
|
||||||
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o 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 osdep/PortMapper.o
|
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o 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 osdep/PortMapper.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
InetAddress publicAddress;
|
InetAddress publicAddress;
|
||||||
sendpublicaddressrequest(&natpmp);
|
sendpublicaddressrequest(&natpmp);
|
||||||
uint64_t myTimeout = OSUtils::now() + 30000;
|
uint64_t myTimeout = OSUtils::now() + 5000;
|
||||||
do {
|
do {
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
Loading…
Reference in New Issue
Block a user