zerotier: fix linking to libnatpmp and build with uclibc

Makefile always checks the existence of host's NAT-PMP header,
which results in internal NAT-PMP code being used if it's missing.

Add a patch to make it check targets' header instead.

Use aligned_alloc() instead of valloc() in case of uclibc.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
This commit is contained in:
DENG Qingfang
2019-08-08 17:05:25 +08:00
parent 3ee32eb9bc
commit 178096c9e4
2 changed files with 16 additions and 1 deletions
@@ -0,0 +1,11 @@
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -38,7 +38,7 @@ else
override 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
ONE_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
-ifeq ($(wildcard /usr/include/natpmp.h),)
+ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),)
ONE_OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
else
LDLIBS+=-lnatpmp