Skip to content
Snippets Groups Projects
Commit c3f07d73 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Adrien Béraud
Browse files

iOS: enable nat-pmp

This patch enables nat-pmp for iOS and macOS and
fixes build for iOS by removing USE_SYSCTL_NET_ROUTE,
which requires net/route.h that is not available
on iOS.

Change-Id: I7342f65a85ecbc0d7f291c981cc78ded2e741e58
parent 4aff5e97
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,8 @@ PKGS += dhtnet
DEPS_dhtnet += opendht pjproject asio upnp
ifndef HAVE_WIN32
ifndef HAVE_IOS
ifndef HAVE_MACOSX
DEPS_dhtnet += natpmp
endif
endif
endif
DHTNET_CONF = -DBUILD_SHARED_LIBS=Off \
......
diff --git a/getgateway.c b/getgateway.c
index d05bc5e..33b8c45 100644
--- a/getgateway.c
+++ b/getgateway.c
@@ -56,10 +56,16 @@ POSSIBILITY OF SUCH DAMAGE.
#endif
#ifdef __APPLE__
+#include <TargetConditionals.h>
#undef USE_PROC_NET_ROUTE
#undef USE_SOCKET_ROUTE
+#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
+// iOS or Simulator: Do not use SYSCTL_NET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#else
#define USE_SYSCTL_NET_ROUTE
#endif
+#endif
#if (defined(sun) && defined(__SVR4))
#undef USE_PROC_NET_ROUTE
......@@ -3,10 +3,8 @@ NATPMP_VERSION := 007c3a53165a0551c877130eea4d966885ce19ae
NATPMP_URL := https://github.com/miniupnp/libnatpmp/archive/${NATPMP_VERSION}.tar.gz
ifndef HAVE_WIN32
ifndef HAVE_IOS
PKGS += natpmp
endif
endif
ifeq ($(call need_pkg,'libnatpmp'),)
PKGS_FOUND += natpmp
......@@ -19,6 +17,9 @@ $(TARBALLS)/libnatpmp-$(NATPMP_VERSION).tar.gz:
natpmp: libnatpmp-$(NATPMP_VERSION).tar.gz .sum-natpmp
$(UNPACK)
ifdef HAVE_IOS
$(APPLY) $(SRC)/natpmp/disable_sysctl_on_ios.patch
endif
$(MOVE)
.natpmp: natpmp toolchain.cmake
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment