diff --git a/.gitignore b/.gitignore
index 6ed7197e3ab6269..2194b393aa48211 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,6 +69,7 @@ Lib/test/data/*
/_bootstrap_python
/Makefile
/Makefile.pre
+iOS/Resources/Info.plist
Mac/Makefile
Mac/PythonLauncher/Info.plist
Mac/PythonLauncher/Makefile
diff --git a/Makefile.pre.in b/Makefile.pre.in
index e0527633ccd03bb..6bee2ab9b65630c 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -911,6 +911,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
+# This rule is for iOS, which requires an annoyingly just slighly different
+# format for frameworks to macOS. It *doesn't* use a versioned framework, and
+# the Info.plist must be in the root of the framework.
+$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
+ $(LIBRARY) \
+ $(RESSRCDIR)/Info.plist
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
+ -all_load $(LIBRARY) \
+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
+ -compatibility_version $(VERSION) \
+ -current_version $(VERSION) \
+ -framework CoreFoundation $(LIBS);
+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
+
# This rule builds the Cygwin Python DLL and import library if configured
# for a shared core library; otherwise, this rule is a noop.
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2583,10 +2598,11 @@ frameworkinstall: install
# only have to cater for the structural bits of the framework.
.PHONY: frameworkinstallframework
-frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
+frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
-.PHONY: frameworkinstallstructure
-frameworkinstallstructure: $(LDLIBRARY)
+# macOS uses a versioned frameworks structure that includes a full install
+.PHONY: frameworkinstallversionedstructure
+frameworkinstallversionedstructure: $(LDLIBRARY)
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
echo Not configured with --enable-framework; \
exit 1; \
@@ -2607,6 +2623,27 @@ frameworkinstallstructure: $(LDLIBRARY)
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
+# iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
+# framework root, no .lproj data, and only stub compilation assistance binaries
+.PHONY: frameworkinstallunversionedstructure
+frameworkinstallunversionedstructure: $(LDLIBRARY)
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+ echo Not configured with --enable-framework; \
+ exit 1; \
+ else true; \
+ fi
+ if test -d $(PYTHONFRAMEWORKPREFIX)/include; then \
+ echo "Clearing stale header symlink directory"; \
+ rm -rf $(PYTHONFRAMEWORKPREFIX)/include; \
+ fi
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKINSTALLDIR)
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
+ $(INSTALL_SHARED) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
+ $(INSTALL) -d -m $(DIRMODE) $(BINDIR)
+ for file in $(RESSRCDIR)/bin/* ; do \
+ $(INSTALL) -m $(EXEMODE) $$file $(BINDIR); \
+ done
+
# This installs Mac/Lib into the framework
# Install a number of symlinks to keep software that expects a normal unix
# install (which includes python-config) happy.
@@ -2647,6 +2684,19 @@ frameworkaltinstallunixtools:
frameworkinstallextras:
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
+# On iOS, bin/lib can't live inside the framework; include needs to be called
+# "Headers", but *must* be in the framework, and *not* include the `python3.X`
+# subdirectory. The install has put these folders in the same folder as
+# Python.framework; Move the headers to their final framework-compatible home.
+.PHONY: frameworkinstallmobileheaders
+frameworkinstallmobileheaders:
+ if test -d $(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
+ echo "Removing old framework headers"; \
+ rm -rf $(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
+ fi
+ mv "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
+ $(LN) -fs "$(PYTHONFRAMEWORKDIR)" "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
+
# Build the toplevel Makefile
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
diff --git a/Misc/NEWS.d/next/Build/2024-02-13-14-52-59.gh-issue-114099.zjXsQr.rst b/Misc/NEWS.d/next/Build/2024-02-13-14-52-59.gh-issue-114099.zjXsQr.rst
new file mode 100644
index 000000000000000..e2858bd71d28cb2
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2024-02-13-14-52-59.gh-issue-114099.zjXsQr.rst
@@ -0,0 +1,2 @@
+Makefile targets were added to support compiling an iOS-compatible framework
+build.
diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c
index 3307260544e8a6d..0b912e332510a6b 100644
--- a/Misc/platform_triplet.c
+++ b/Misc/platform_triplet.c
@@ -233,7 +233,22 @@ PLATFORM_TRIPLET=i386-gnu
# error unknown platform triplet
# endif
#elif defined(__APPLE__)
+# include "TargetConditionals.h"
+# if TARGET_OS_IOS
+# if TARGET_OS_SIMULATOR
+# if __x86_64__
+PLATFORM_TRIPLET=x86_64-iphonesimulator
+# else
+PLATFORM_TRIPLET=arm64-iphonesimulator
+# endif
+# else
+PLATFORM_TRIPLET=arm64-iphoneos
+# endif
+# elif TARGET_OS_OSX
PLATFORM_TRIPLET=darwin
+# else
+# error unknown Apple platform
+# endif
#elif defined(__VXWORKS__)
PLATFORM_TRIPLET=vxworks
#elif defined(__wasm32__)
diff --git a/config.sub b/config.sub
index 2c6a07ab3c34eab..1bb6a05dc11026c 100755
--- a/config.sub
+++ b/config.sub
@@ -4,6 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale
+# Patched 2024-02-03 to include support for arm64_32 and iOS/tvOS/watchOS simulators
timestamp='2024-01-01'
# This file is free software; you can redistribute it and/or modify it
@@ -1127,7 +1128,7 @@ case $cpu-$vendor in
xscale-* | xscalee[bl]-*)
cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
- arm64-* | aarch64le-*)
+ arm64-* | aarch64le-* | arm64_32-*)
cpu=aarch64
;;
@@ -1866,6 +1867,8 @@ case $kernel-$os-$obj in
;;
*-eabi*- | *-gnueabi*-)
;;
+ ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
+ ;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
# can be paired with an machine code file format
diff --git a/configure b/configure
index ba2d49df7c65fee..b72f2bde8543303 100755
--- a/configure
+++ b/configure
@@ -969,6 +969,7 @@ LDFLAGS
CFLAGS
CC
HAS_XCRUN
+IOS_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET
CONFIGURE_MACOSX_DEPLOYMENT_TARGET
_PYTHON_HOST_PLATFORM
@@ -4028,6 +4029,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-apple-ios*)
+ ac_sys_system=iOS
+ ;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
@@ -4220,11 +4224,11 @@ then :
*)
PYTHONFRAMEWORKPREFIX="${enableval}"
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
- FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
- FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure "
case $ac_sys_system in #(
Darwin) :
+ FRAMEWORKINSTALLFIRST="frameworkinstallversionedstructure"
+ FRAMEWORKALTINSTALLFIRST="frameworkinstallversionedstructure "
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
FRAMEWORKPYTHONW="frameworkpythonw"
@@ -4286,6 +4290,21 @@ then :
ac_config_files="$ac_config_files Mac/Resources/app/Info.plist"
+ ;;
+ iOS) :
+ FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
+ FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
+ FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
+ FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
+ FRAMEWORKPYTHONW=
+ INSTALLTARGETS="libinstall inclinstall sharedinstall"
+
+ prefix=$PYTHONFRAMEWORKPREFIX
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
+ RESSRCDIR=iOS/Resources
+
+ ac_config_files="$ac_config_files iOS/Resources/Info.plist"
+
;;
*)
as_fn_error $? "Unknown platform for framework build" "$LINENO" 5
@@ -4352,6 +4371,28 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_ident=
;;
+ *-apple-ios*-simulator)
+ _host_os=`echo $host | cut -d '-' -f3`
+ IOS_DEPLOYMENT_TARGET=${_host_os:3}
+ case "$host_cpu" in
+ aarch64)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphonesimulator-arm64
+ ;;
+ *)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphonesimulator-$host_cpu
+ esac
+ ;;
+ *-apple-ios*)
+ _host_os=`echo $host | cut -d '-' -f3`
+ IOS_DEPLOYMENT_TARGET=${_host_os:3}
+ case "$host_cpu" in
+ aarch64)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphoneos-arm64
+ ;;
+ *)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphoneos-$host_cpu
+ esac
+ ;;
*-*-vxworks*)
_host_ident=$host_cpu
;;
@@ -4430,6 +4471,9 @@ printf "%s\n" "#define _BSD_SOURCE 1" >>confdefs.h
define_xopen_source=no;;
Darwin/[12][0-9].*)
define_xopen_source=no;;
+ # On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
+ iOS/*)
+ define_xopen_source=no;;
# On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
# defining NI_NUMERICHOST.
QNX/6.3.2)
@@ -4524,6 +4568,18 @@ case $host in #(
;;
esac
+case $ac_sys_system in #(
+ iOS) :
+
+ IOS_DEPLOYMENT_TARGET=${IOS_DEPLOYMENT_TARGET:=12.0}
+ as_fn_append CFLAGS " -mios-version-min=${IOS_DEPLOYMENT_TARGET}"
+ as_fn_append LDFLAGS " -mios-version-min=${IOS_DEPLOYMENT_TARGET}"
+
+ ;; #(
+ *) :
+ ;;
+esac
+
if test "$ac_sys_system" = "Darwin"
then
# Extract the first word of "xcrun", so it can be a program name with args.
@@ -6786,6 +6842,8 @@ printf %s "checking for multiarch... " >&6; }
case $ac_sys_system in #(
Darwin*) :
MULTIARCH="" ;; #(
+ iOS) :
+ MULTIARCH="" ;; #(
FreeBSD*) :
MULTIARCH="" ;; #(
*) :
@@ -6806,6 +6864,8 @@ fi
printf "%s\n" "$MULTIARCH" >&6; }
case $ac_sys_system in #(
+ iOS) :
+ SOABI_PLATFORM=`echo "$PLATFORM_TRIPLET" | cut -d '-' -f2` ;; #(
*) :
SOABI_PLATFORM=$PLATFORM_TRIPLET
;;
@@ -6851,6 +6911,10 @@ case $host/$ac_cv_cc_name in #(
PY_SUPPORT_TIER=3 ;; #(
x86_64-*-freebsd*/clang) :
PY_SUPPORT_TIER=3 ;; #(
+ aarch64-apple-ios*-simulator/clang) :
+ PY_SUPPORT_TIER=3 ;; #(
+ aarch64-apple-ios*/clang) :
+ PY_SUPPORT_TIER=3 ;; #(
*) :
PY_SUPPORT_TIER=0
;;
@@ -7306,12 +7370,15 @@ printf %s "checking LDLIBRARY... " >&6; }
# will find it with a -framework option). For this reason there is an
# extra variable BLDLIBRARY against which Python and the extension
# modules are linked, BLDLIBRARY. This is normally the same as
-# LDLIBRARY, but empty for MacOSX framework builds.
+# LDLIBRARY, but empty for MacOSX framework builds. iOS does the same,
+# but uses a non-versioned framework layout.
if test "$enable_framework"
then
case $ac_sys_system in
Darwin)
LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)';;
+ iOS)
+ LDLIBRARY='$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)';;
*)
as_fn_error $? "Unknown platform for framework build" "$LINENO" 5;;
esac
@@ -7369,6 +7436,9 @@ printf "%s\n" "#define Py_ENABLE_SHARED 1" >>confdefs.h
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
;;
+ iOS)
+ LDLIBRARY='libpython$(LDVERSION).dylib'
+ ;;
AIX*)
LDLIBRARY='libpython$(LDVERSION).so'
RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
@@ -12619,6 +12689,7 @@ if test -z "$SHLIB_SUFFIX"; then
esac
;;
CYGWIN*) SHLIB_SUFFIX=.dll;;
+ iOS) SHLIB_SUFFIX=.dylib;;
*) SHLIB_SUFFIX=.so;;
esac
fi
@@ -12701,6 +12772,11 @@ then
BLDSHARED="$LDSHARED"
fi
;;
+ iOS/*)
+ LDSHARED='$(CC) -dynamiclib -F . -framework Python'
+ LDCXXSHARED='$(CXX) -dynamiclib -F . -framework Python'
+ BLDSHARED="$LDSHARED"
+ ;;
Emscripten|WASI)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
@@ -12854,6 +12930,24 @@ printf "%s\n" "#define THREAD_STACK_SIZE 0x$stack_size" >>confdefs.h
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
fi
LINKFORSHARED="$LINKFORSHARED";;
+ iOS/*)
+ LINKFORSHARED="$extra_undefs -framework CoreFoundation"
+
+ # Issue #18075: the default maximum stack size (8MBytes) is too
+ # small for the default recursion limit. Increase the stack size
+ # to ensure that tests don't crash
+ stack_size="1000000" # 16 MB
+ if test "$with_ubsan" = "yes"
+ then
+ # Undefined behavior sanitizer requires an even deeper stack
+ stack_size="4000000" # 64 MB
+ fi
+
+
+printf "%s\n" "#define THREAD_STACK_SIZE 0x$stack_size" >>confdefs.h
+
+
+ LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)';;
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -14242,6 +14336,10 @@ then :
ctypes_malloc_closure=yes
;; #(
+ iOS) :
+
+ ctypes_malloc_closure=yes
+ ;; #(
sunos5) :
as_fn_append LIBFFI_LIBS " -mimpure-text"
;; #(
@@ -17493,12 +17591,6 @@ if test "x$ac_cv_func_getegid" = xyes
then :
printf "%s\n" "#define HAVE_GETEGID 1" >>confdefs.h
-fi
-ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
-if test "x$ac_cv_func_getentropy" = xyes
-then :
- printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
-
fi
ac_fn_c_check_func "$LINENO" "geteuid" "ac_cv_func_geteuid"
if test "x$ac_cv_func_geteuid" = xyes
@@ -17541,12 +17633,6 @@ if test "x$ac_cv_func_getgrouplist" = xyes
then :
printf "%s\n" "#define HAVE_GETGROUPLIST 1" >>confdefs.h
-fi
-ac_fn_c_check_func "$LINENO" "getgroups" "ac_cv_func_getgroups"
-if test "x$ac_cv_func_getgroups" = xyes
-then :
- printf "%s\n" "#define HAVE_GETGROUPS 1" >>confdefs.h
-
fi
ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname"
if test "x$ac_cv_func_gethostname" = xyes
@@ -18273,12 +18359,6 @@ if test "x$ac_cv_func_sysconf" = xyes
then :
printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h
-fi
-ac_fn_c_check_func "$LINENO" "system" "ac_cv_func_system"
-if test "x$ac_cv_func_system" = xyes
-then :
- printf "%s\n" "#define HAVE_SYSTEM 1" >>confdefs.h
-
fi
ac_fn_c_check_func "$LINENO" "tcgetpgrp" "ac_cv_func_tcgetpgrp"
if test "x$ac_cv_func_tcgetpgrp" = xyes
@@ -18457,6 +18537,32 @@ fi
fi
+# iOS defines some system methods that can be linked (so they are
+# found by configure), but either raise a compilation error (because the
+# header definition prevents usage - autoconf doesn't use the headers), or
+# raise an error if used at runtime. Force these symbols off.
+if test "$ac_sys_system" != "iOS" ; then
+ ac_fn_c_check_func "$LINENO" "getgroups" "ac_cv_func_getgroups"
+if test "x$ac_cv_func_getgroups" = xyes
+then :
+ printf "%s\n" "#define HAVE_GETGROUPS 1" >>confdefs.h
+
+fi
+ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+if test "x$ac_cv_func_getentropy" = xyes
+then :
+ printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h
+
+fi
+ac_fn_c_check_func "$LINENO" "system" "ac_cv_func_system"
+if test "x$ac_cv_func_system" = xyes
+then :
+ printf "%s\n" "#define HAVE_SYSTEM 1" >>confdefs.h
+
+fi
+
+fi
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
@@ -21752,6 +21858,10 @@ fi
done
+# On iOS, clock_settime can be linked (so it is found by
+# configure), but it raises a runtime error if used because apps can't change
+# the clock. Force the symbol off.
+if test "$ac_sys_system" != "iOS" ; then
for ac_func in clock_settime
do :
@@ -21762,7 +21872,7 @@ then :
else $as_nop
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_settime in -lrt" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_settime in -lrt" >&5
printf %s "checking for clock_settime in -lrt... " >&6; }
if test ${ac_cv_lib_rt_clock_settime+y}
then :
@@ -21800,7 +21910,7 @@ printf "%s\n" "$ac_cv_lib_rt_clock_settime" >&6; }
if test "x$ac_cv_lib_rt_clock_settime" = xyes
then :
- printf "%s\n" "#define HAVE_CLOCK_SETTIME 1" >>confdefs.h
+ printf "%s\n" "#define HAVE_CLOCK_SETTIME 1" >>confdefs.h
fi
@@ -21809,6 +21919,7 @@ fi
fi
done
+fi
for ac_func in clock_nanosleep
@@ -26693,24 +26804,25 @@ CPPFLAGS=$ac_save_cppflags
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for device files" >&5
printf "%s\n" "$as_me: checking for device files" >&6;}
-if test "x$cross_compiling" = xyes; then
- if test "${ac_cv_file__dev_ptmx+set}" != set; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
+if test "$ac_sys_system" != "iOS" ; then
+ if test "x$cross_compiling" = xyes; then
+ if test "${ac_cv_file__dev_ptmx+set}" != set; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
printf %s "checking for /dev/ptmx... " >&6; }
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5
printf "%s\n" "not set" >&6; }
- as_fn_error $? "set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
- fi
- if test "${ac_cv_file__dev_ptc+set}" != set; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
+ as_fn_error $? "set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
+ fi
+ if test "${ac_cv_file__dev_ptc+set}" != set; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
printf %s "checking for /dev/ptc... " >&6; }
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5
printf "%s\n" "not set" >&6; }
- as_fn_error $? "set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
+ as_fn_error $? "set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
+ fi
fi
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
printf %s "checking for /dev/ptmx... " >&6; }
if test ${ac_cv_file__dev_ptmx+y}
then :
@@ -26731,12 +26843,12 @@ then :
fi
-if test "x$ac_cv_file__dev_ptmx" = xyes; then
+ if test "x$ac_cv_file__dev_ptmx" = xyes; then
printf "%s\n" "#define HAVE_DEV_PTMX 1" >>confdefs.h
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
printf %s "checking for /dev/ptc... " >&6; }
if test ${ac_cv_file__dev_ptc+y}
then :
@@ -26757,10 +26869,11 @@ then :
fi
-if test "x$ac_cv_file__dev_ptc" = xyes; then
+ if test "x$ac_cv_file__dev_ptc" = xyes; then
printf "%s\n" "#define HAVE_DEV_PTC 1" >>confdefs.h
+ fi
fi
if test $ac_sys_system = Darwin
@@ -28143,6 +28256,28 @@ case $ac_sys_system in #(
;; #(
Darwin) :
;; #(
+ iOS) :
+
+
+
+ py_cv_module__curses=n/a
+ py_cv_module__curses_panel=n/a
+ py_cv_module__gdbm=n/a
+ py_cv_module__multiprocessing=n/a
+ py_cv_module__posixshmem=n/a
+ py_cv_module__posixsubprocess=n/a
+ py_cv_module__scproxy=n/a
+ py_cv_module__tkinter=n/a
+ py_cv_module__xxsubinterpreters=n/a
+ py_cv_module_grp=n/a
+ py_cv_module_nis=n/a
+ py_cv_module_readline=n/a
+ py_cv_module_pwd=n/a
+ py_cv_module_spwd=n/a
+ py_cv_module_syslog=n/a
+ py_cv_module_=n/a
+
+ ;; #(
CYGWIN*) :
@@ -31754,6 +31889,7 @@ do
"Mac/PythonLauncher/Makefile") CONFIG_FILES="$CONFIG_FILES Mac/PythonLauncher/Makefile" ;;
"Mac/Resources/framework/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/framework/Info.plist" ;;
"Mac/Resources/app/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/app/Info.plist" ;;
+ "iOS/Resources/Info.plist") CONFIG_FILES="$CONFIG_FILES iOS/Resources/Info.plist" ;;
"Makefile.pre") CONFIG_FILES="$CONFIG_FILES Makefile.pre" ;;
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
"Misc/python-embed.pc") CONFIG_FILES="$CONFIG_FILES Misc/python-embed.pc" ;;
diff --git a/configure.ac b/configure.ac
index b39af7422c4c7ca..84a02ffda61d01e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-apple-ios*)
+ ac_sys_system=iOS
+ ;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
@@ -511,11 +514,11 @@ AC_ARG_ENABLE([framework],
*)
PYTHONFRAMEWORKPREFIX="${enableval}"
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
- FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
- FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure "
case $ac_sys_system in #(
Darwin) :
+ FRAMEWORKINSTALLFIRST="frameworkinstallversionedstructure"
+ FRAMEWORKALTINSTALLFIRST="frameworkinstallversionedstructure "
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
FRAMEWORKPYTHONW="frameworkpythonw"
@@ -574,6 +577,20 @@ AC_ARG_ENABLE([framework],
AC_CONFIG_FILES([Mac/Resources/framework/Info.plist])
AC_CONFIG_FILES([Mac/Resources/app/Info.plist])
;;
+ iOS) :
+ FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
+ FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
+ FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
+ FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
+ FRAMEWORKPYTHONW=
+ INSTALLTARGETS="libinstall inclinstall sharedinstall"
+
+ prefix=$PYTHONFRAMEWORKPREFIX
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
+ RESSRCDIR=iOS/Resources
+
+ AC_CONFIG_FILES([iOS/Resources/Info.plist])
+ ;;
*)
AC_MSG_ERROR([Unknown platform for framework build])
;;
@@ -634,6 +651,28 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_ident=
;;
+ *-apple-ios*-simulator)
+ _host_os=`echo $host | cut -d '-' -f3`
+ IOS_DEPLOYMENT_TARGET=${_host_os:3}
+ case "$host_cpu" in
+ aarch64)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphonesimulator-arm64
+ ;;
+ *)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphonesimulator-$host_cpu
+ esac
+ ;;
+ *-apple-ios*)
+ _host_os=`echo $host | cut -d '-' -f3`
+ IOS_DEPLOYMENT_TARGET=${_host_os:3}
+ case "$host_cpu" in
+ aarch64)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphoneos-arm64
+ ;;
+ *)
+ _host_ident=${IOS_DEPLOYMENT_TARGET}-iphoneos-$host_cpu
+ esac
+ ;;
*-*-vxworks*)
_host_ident=$host_cpu
;;
@@ -711,6 +750,9 @@ case $ac_sys_system/$ac_sys_release in
define_xopen_source=no;;
Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
define_xopen_source=no;;
+ # On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
+ iOS/*)
+ define_xopen_source=no;;
# On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
# defining NI_NUMERICHOST.
QNX/6.3.2)
@@ -801,6 +843,18 @@ AS_CASE([$host],
],
)
+dnl iOS needs to enforce the deployment target; if the version hasn't
+dnl been provided as part of the --host configuration, fall back to
+dnl a default value (12.0 for iOS).
+AS_CASE([$ac_sys_system],
+ [iOS], [
+ IOS_DEPLOYMENT_TARGET=${IOS_DEPLOYMENT_TARGET:=12.0}
+ AS_VAR_APPEND([CFLAGS], [" -mios-version-min=${IOS_DEPLOYMENT_TARGET}"])
+ AS_VAR_APPEND([LDFLAGS], [" -mios-version-min=${IOS_DEPLOYMENT_TARGET}"])
+ AC_SUBST([IOS_DEPLOYMENT_TARGET])
+ ],
+)
+
if test "$ac_sys_system" = "Darwin"
then
dnl look for SDKROOT
@@ -967,6 +1021,7 @@ dnl platforms.
AC_MSG_CHECKING([for multiarch])
AS_CASE([$ac_sys_system],
[Darwin*], [MULTIARCH=""],
+ [iOS], [MULTIARCH=""],
[FreeBSD*], [MULTIARCH=""],
[MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
)
@@ -988,6 +1043,7 @@ dnl will have multiple sysconfig modules (one for each CPU architecture), but
dnl use a single "fat" binary at runtime. SOABI_PLATFORM is the component of
dnl the PLATFORM_TRIPLET that will be used in binary module extensions.
AS_CASE([$ac_sys_system],
+ [iOS], [SOABI_PLATFORM=`echo "$PLATFORM_TRIPLET" | cut -d '-' -f2`],
[SOABI_PLATFORM=$PLATFORM_TRIPLET]
)
@@ -1019,6 +1075,8 @@ AS_CASE([$host/$ac_cv_cc_name],
[powerpc64le-*-linux-gnu/clang], [PY_SUPPORT_TIER=3], dnl Linux on PPC64 little endian, glibc, clang
[s390x-*-linux-gnu/gcc], [PY_SUPPORT_TIER=3], dnl Linux on 64bit s390x (big endian), glibc, gcc
[x86_64-*-freebsd*/clang], [PY_SUPPORT_TIER=3], dnl FreeBSD on AMD64
+ [aarch64-apple-ios*-simulator/clang], [PY_SUPPORT_TIER=3], dnl iOS Simulator on arm64
+ [aarch64-apple-ios*/clang], [PY_SUPPORT_TIER=3], dnl iOS on ARM64
[PY_SUPPORT_TIER=0]
)
@@ -1337,12 +1395,15 @@ AC_MSG_CHECKING([LDLIBRARY])
# will find it with a -framework option). For this reason there is an
# extra variable BLDLIBRARY against which Python and the extension
# modules are linked, BLDLIBRARY. This is normally the same as
-# LDLIBRARY, but empty for MacOSX framework builds.
+# LDLIBRARY, but empty for MacOSX framework builds. iOS does the same,
+# but uses a non-versioned framework layout.
if test "$enable_framework"
then
case $ac_sys_system in
Darwin)
LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)';;
+ iOS)
+ LDLIBRARY='$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)';;
*)
AC_MSG_ERROR([Unknown platform for framework build]);;
esac
@@ -1399,6 +1460,9 @@ if test $enable_shared = "yes"; then
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
;;
+ iOS)
+ LDLIBRARY='libpython$(LDVERSION).dylib'
+ ;;
AIX*)
LDLIBRARY='libpython$(LDVERSION).so'
RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
@@ -3169,6 +3233,7 @@ if test -z "$SHLIB_SUFFIX"; then
esac
;;
CYGWIN*) SHLIB_SUFFIX=.dll;;
+ iOS) SHLIB_SUFFIX=.dylib;;
*) SHLIB_SUFFIX=.so;;
esac
fi
@@ -3249,6 +3314,11 @@ then
BLDSHARED="$LDSHARED"
fi
;;
+ iOS/*)
+ LDSHARED='$(CC) -dynamiclib -F . -framework Python'
+ LDCXXSHARED='$(CXX) -dynamiclib -F . -framework Python'
+ BLDSHARED="$LDSHARED"
+ ;;
Emscripten|WASI)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
@@ -3393,6 +3463,24 @@ then
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
fi
LINKFORSHARED="$LINKFORSHARED";;
+ iOS/*)
+ LINKFORSHARED="$extra_undefs -framework CoreFoundation"
+
+ # Issue #18075: the default maximum stack size (8MBytes) is too
+ # small for the default recursion limit. Increase the stack size
+ # to ensure that tests don't crash
+ stack_size="1000000" # 16 MB
+ if test "$with_ubsan" = "yes"
+ then
+ # Undefined behavior sanitizer requires an even deeper stack
+ stack_size="4000000" # 64 MB
+ fi
+
+ AC_DEFINE_UNQUOTED([THREAD_STACK_SIZE],
+ [0x$stack_size],
+ [Custom thread stack size depending on chosen sanitizer runtimes.])
+
+ LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)';;
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -3766,6 +3854,9 @@ AS_VAR_IF([have_libffi], [yes], [
dnl when do we need USING_APPLE_OS_LIBFFI?
ctypes_malloc_closure=yes
],
+ [iOS], [
+ ctypes_malloc_closure=yes
+ ],
[sunos5], [AS_VAR_APPEND([LIBFFI_LIBS], [" -mimpure-text"])]
)
AS_VAR_IF([ctypes_malloc_closure], [yes], [
@@ -4831,8 +4922,8 @@ AC_CHECK_FUNCS([ \
copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
- gai_strerror getegid getentropy geteuid getgid getgrent getgrgid getgrgid_r \
- getgrnam_r getgrouplist getgroups gethostname getitimer getloadavg getlogin \
+ gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
+ getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin \
getpeername getpgid getpid getppid getpriority _getpty \
getpwent getpwnam_r getpwuid getpwuid_r getresgid getresuid getrusage getsid getspent \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
@@ -4849,7 +4940,7 @@ AC_CHECK_FUNCS([ \
setresuid setreuid setsid setuid setvbuf shutdown sigaction sigaltstack \
sigfillset siginterrupt sigpending sigrelse sigtimedwait sigwait \
sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
- sysconf system tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \
+ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \
tmpnam tmpnam_r truncate ttyname umask uname unlinkat unlockpt utimensat utimes vfork \
wait wait3 wait4 waitid waitpid wcscoll wcsftime wcsxfrm wmemcmp writev \
])
@@ -4861,6 +4952,14 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi
+# iOS defines some system methods that can be linked (so they are
+# found by configure), but either raise a compilation error (because the
+# header definition prevents usage - autoconf doesn't use the headers), or
+# raise an error if used at runtime. Force these symbols off.
+if test "$ac_sys_system" != "iOS" ; then
+ AC_CHECK_FUNCS([getgroups getentropy system])
+fi
+
AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
@@ -5161,11 +5260,16 @@ AC_CHECK_FUNCS([clock_getres], [], [
])
])
-AC_CHECK_FUNCS([clock_settime], [], [
- AC_CHECK_LIB([rt], [clock_settime], [
- AC_DEFINE([HAVE_CLOCK_SETTIME], [1])
- ])
-])
+# On iOS, clock_settime can be linked (so it is found by
+# configure), but it raises a runtime error if used because apps can't change
+# the clock. Force the symbol off.
+if test "$ac_sys_system" != "iOS" ; then
+ AC_CHECK_FUNCS([clock_settime], [], [
+ AC_CHECK_LIB([rt], [clock_settime], [
+ AC_DEFINE([HAVE_CLOCK_SETTIME], [1])
+ ])
+ ])
+fi
AC_CHECK_FUNCS([clock_nanosleep], [], [
AC_CHECK_LIB([rt], [clock_nanosleep], [
@@ -6524,28 +6628,32 @@ CPPFLAGS=$ac_save_cppflags
AC_MSG_NOTICE([checking for device files])
dnl NOTE: Inform user how to proceed with files when cross compiling.
-if test "x$cross_compiling" = xyes; then
- if test "${ac_cv_file__dev_ptmx+set}" != set; then
- AC_MSG_CHECKING([for /dev/ptmx])
- AC_MSG_RESULT([not set])
- AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
- fi
- if test "${ac_cv_file__dev_ptc+set}" != set; then
- AC_MSG_CHECKING([for /dev/ptc])
- AC_MSG_RESULT([not set])
- AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
+dnl iOS cross-compile builds are predictable; they won't ever
+dnl have /dev/ptmx or /dev/ptc, so we can set them explicitly
+if test "$ac_sys_system" != "iOS" ; then
+ if test "x$cross_compiling" = xyes; then
+ if test "${ac_cv_file__dev_ptmx+set}" != set; then
+ AC_MSG_CHECKING([for /dev/ptmx])
+ AC_MSG_RESULT([not set])
+ AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
+ fi
+ if test "${ac_cv_file__dev_ptc+set}" != set; then
+ AC_MSG_CHECKING([for /dev/ptc])
+ AC_MSG_RESULT([not set])
+ AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
+ fi
fi
-fi
-AC_CHECK_FILE([/dev/ptmx], [], [])
-if test "x$ac_cv_file__dev_ptmx" = xyes; then
- AC_DEFINE([HAVE_DEV_PTMX], [1],
- [Define to 1 if you have the /dev/ptmx device file.])
-fi
-AC_CHECK_FILE([/dev/ptc], [], [])
-if test "x$ac_cv_file__dev_ptc" = xyes; then
- AC_DEFINE([HAVE_DEV_PTC], [1],
- [Define to 1 if you have the /dev/ptc device file.])
+ AC_CHECK_FILE([/dev/ptmx], [], [])
+ if test "x$ac_cv_file__dev_ptmx" = xyes; then
+ AC_DEFINE([HAVE_DEV_PTMX], [1],
+ [Define to 1 if you have the /dev/ptmx device file.])
+ fi
+ AC_CHECK_FILE([/dev/ptc], [], [])
+ if test "x$ac_cv_file__dev_ptc" = xyes; then
+ AC_DEFINE([HAVE_DEV_PTC], [1],
+ [Define to 1 if you have the /dev/ptc device file.])
+ fi
fi
if test $ac_sys_system = Darwin
@@ -7188,6 +7296,29 @@ AS_CASE([$ac_sys_system],
[VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [termios], [grp])],
dnl The _scproxy module is available on macOS
[Darwin], [],
+ [iOS], [
+ dnl subprocess and multiprocessing are not supported (no fork syscall).
+ dnl curses and tkinter user interface are not available.
+ dnl gdbm and nis aren't available
+ dnl Stub implementations are provided for pwd, grp etc APIs
+ PY_STDLIB_MOD_SET_NA(
+ [_curses],
+ [_curses_panel],
+ [_gdbm],
+ [_multiprocessing],
+ [_posixshmem],
+ [_posixsubprocess],
+ [_scproxy],
+ [_tkinter],
+ [_xxsubinterpreters],
+ [grp],
+ [nis],
+ [readline],
+ [pwd],
+ [spwd],
+ [syslog],
+ )
+ ],
[CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
[QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
[FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
diff --git a/iOS/Resources/Info.plist.in b/iOS/Resources/Info.plist.in
new file mode 100644
index 000000000000000..a6f223874bd1e98
--- /dev/null
+++ b/iOS/Resources/Info.plist.in
@@ -0,0 +1,34 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ Python
+ CFBundleGetInfoString
+ Python Runtime and Library
+ CFBundleIdentifier
+ @PYTHONFRAMEWORKIDENTIFIER@
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ Python
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ %VERSION%
+ CFBundleLongVersionString
+ %VERSION%, (c) 2001-2023 Python Software Foundation.
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1
+ CFBundleSupportedPlatforms
+
+ iPhoneOS
+
+ MinimumOSVersion
+ @IOS_DEPLOYMENT_TARGET@
+
+
diff --git a/iOS/Resources/bin/arm64-apple-ios-ar b/iOS/Resources/bin/arm64-apple-ios-ar
new file mode 100755
index 000000000000000..add54095b148928
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-ar
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphoneos ar $@
diff --git a/iOS/Resources/bin/arm64-apple-ios-clang b/iOS/Resources/bin/arm64-apple-ios-clang
new file mode 100755
index 000000000000000..e1a7b59f45d80a5
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-clang
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphoneos clang -target arm64-apple-ios $@
diff --git a/iOS/Resources/bin/arm64-apple-ios-cpp b/iOS/Resources/bin/arm64-apple-ios-cpp
new file mode 100755
index 000000000000000..ff3ce4f363d4d61
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-cpp
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphoneos clang -target arm64-apple-ios -E $@
diff --git a/iOS/Resources/bin/arm64-apple-ios-simulator-ar b/iOS/Resources/bin/arm64-apple-ios-simulator-ar
new file mode 100755
index 000000000000000..722ee1b996bb52f
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-simulator-ar
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator ar $@
diff --git a/iOS/Resources/bin/arm64-apple-ios-simulator-clang b/iOS/Resources/bin/arm64-apple-ios-simulator-clang
new file mode 100755
index 000000000000000..3dfc651212b604d
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-simulator-clang
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator clang -target arm64-apple-ios-simulator $@
diff --git a/iOS/Resources/bin/arm64-apple-ios-simulator-cpp b/iOS/Resources/bin/arm64-apple-ios-simulator-cpp
new file mode 100755
index 000000000000000..aa44f39a80166dc
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-simulator-cpp
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator clang -target arm64-apple-ios-simulator -E $@
diff --git a/iOS/Resources/bin/x86_64-apple-ios-simulator-ar b/iOS/Resources/bin/x86_64-apple-ios-simulator-ar
new file mode 100755
index 000000000000000..722ee1b996bb52f
--- /dev/null
+++ b/iOS/Resources/bin/x86_64-apple-ios-simulator-ar
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator ar $@
diff --git a/iOS/Resources/bin/x86_64-apple-ios-simulator-clang b/iOS/Resources/bin/x86_64-apple-ios-simulator-clang
new file mode 100755
index 000000000000000..567bf6b6f21d2cc
--- /dev/null
+++ b/iOS/Resources/bin/x86_64-apple-ios-simulator-clang
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator clang -target x86_64-apple-ios-simulator $@
diff --git a/iOS/Resources/bin/x86_64-apple-ios-simulator-cpp b/iOS/Resources/bin/x86_64-apple-ios-simulator-cpp
new file mode 100755
index 000000000000000..046cccfd0190afd
--- /dev/null
+++ b/iOS/Resources/bin/x86_64-apple-ios-simulator-cpp
@@ -0,0 +1,2 @@
+#!/bin/bash
+xcrun --sdk iphonesimulator clang -target x86_64-apple-ios-simulator -E $@
diff --git a/iOS/Resources/dylib-Info-template.plist b/iOS/Resources/dylib-Info-template.plist
new file mode 100644
index 000000000000000..f652e272f71c88a
--- /dev/null
+++ b/iOS/Resources/dylib-Info-template.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+
+ CFBundleIdentifier
+
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSupportedPlatforms
+
+ iPhoneOS
+
+ MinimumOSVersion
+ 12.0
+ CFBundleVersion
+ 1
+
+
diff --git a/iOS/Resources/pyconfig.h b/iOS/Resources/pyconfig.h
new file mode 100644
index 000000000000000..4acff2c60516377
--- /dev/null
+++ b/iOS/Resources/pyconfig.h
@@ -0,0 +1,7 @@
+#ifdef __arm64__
+#include "pyconfig-arm64.h"
+#endif
+
+#ifdef __x86_64__
+#include "pyconfig-x86_64.h"
+#endif