--- Python-3.7.1.orig/config.sub	2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/config.sub	2018-10-31 13:31:22.000000000 +0100
@@ -249,7 +249,7 @@
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arceb \
-	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][armk] \
 	| avr | avr32 \
 	| ba \
 	| be32 | be64 \
@@ -1524,7 +1524,11 @@
 		;;
 	-nacl*)
 		;;
-	-ios)
+	-ios*)
+		;;
+	-tvos*)
+		;;
+	-watchos*)
 		;;
 	-none)
 		;;
--- Python-3.7.1.orig/configure	2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/configure	2018-10-31 13:41:38.000000000 +0100
@@ -3253,6 +3253,15 @@
 	*-*-cygwin*)
 		ac_sys_system=Cygwin
 		;;
+	*-apple-ios)
+		ac_sys_system=iOS
+		;;
+	*-apple-tvos)
+		ac_sys_system=tvOS
+		;;
+	*-apple-watchos)
+		ac_sys_system=watchOS
+		;;
 	*)
 		# for now, limit cross builds to known configurations
 		MACHDEP="unknown"
@@ -3294,6 +3303,15 @@
 			_host_cpu=$host_cpu
 		esac
 		;;
+	*-apple-*)
+		case "$host_cpu" in
+		arm*)
+			_host_cpu=arm
+			;;
+		*)
+			_host_cpu=$host_cpu
+		esac
+		;;
 	*-*-cygwin*)
 		_host_cpu=
 		;;
@@ -3369,6 +3387,13 @@
     define_xopen_source=no;;
   Darwin/1[0-9].*)
     define_xopen_source=no;;
+  # On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
+  iOS/*)
+    define_xopen_source=no;;
+  tvOS/*)
+    define_xopen_source=no;;
+  watchOS/*)
+    define_xopen_source=no;;
   # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
   # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
   # or has another value. By not (re)defining it, the defaults come in place.
@@ -6176,11 +6201,17 @@
 fi

 if test "$cross_compiling" = yes; then
-    case "$READELF" in
-	readelf|:)
-	as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
-	;;
-    esac
+	case "$host" in
+	*-apple-*os)
+		# readelf not required for iOS cross builds.
+		;;
+	*)
+		case "$READELF" in
+			readelf|:)
+			as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
+			;;
+		esac
+	esac
 fi


@@ -6803,8 +6834,6 @@
 # tweak BASECFLAGS based on compiler and platform
 case $GCC in
 yes)
-    CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
 $as_echo_n "checking for -Wextra... " >&6; }
      ac_save_cc="$CC"
@@ -11281,6 +11310,10 @@
 	fi
 	;;
 	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
+	# Dynamic loading on iOS
+	iOS/*) DYNLOADFILE="dynload_shlib.o";;
+	tvOS/*) DYNLOADFILE="dynload_shlib.o";;
+	watchOS/*) DYNLOADFILE="dynload_shlib.o";;
 	*)
 	# use dynload_shlib.c and dlopen() if we have it; otherwise stub
 	# out any dynamic loading
@@ -18383,4 +18416,3 @@
     echo "" >&6
     echo "" >&6
 fi
-
--- Python-3.7.1.orig/Modules/posixmodule.c	2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/Modules/posixmodule.c	2018-10-31 15:00:14.000000000 +0100
@@ -194,6 +194,22 @@
 #endif  /* _MSC_VER */
 #endif  /* ! __WATCOMC__ || __QNX__ */
 
+// iOS
+#undef HAVE_EXECV
+#undef HAVE_FORK
+#undef HAVE_FORK1
+#undef HAVE_FORKPTY
+#undef HAVE_GETGROUPS
+#undef HAVE_SCHED_H
+#undef HAVE_SENDFILE
+#undef HAVE_SETPRIORITY
+#undef HAVE_SPAWNV
+#undef HAVE_WAIT
+#undef HAVE_WAIT3
+#undef HAVE_WAIT4
+#undef HAVE_WAITPID
+#undef HAVE_SYSTEM
+#undef HAVE_FEXECVE
 
 /*[clinic input]
 # one of the few times we lie about this name!