Skip to content

Commit

Permalink
Corrections to iOS README.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Feb 17, 2024
1 parent 8c763af commit 95275c1
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions iOS/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Python distribution.

These instructions are only needed if you're planning to compile Python for iOS
yourself. Most users should *not* need to do this. If you're looking to
experiment with writing an iOS app in Python on iOS, tools such as `BeeWare's
Briefcase <https://briefcase.readthedocs.io>`__ and `Kivy's Builddozer
<https://buildozer.readthedocs.io>`__ will provide a much more approachable user
experience.
experiment with writing an iOS app in Python, tools such as `BeeWare's Briefcase
<https://briefcase.readthedocs.io>`__ and `Kivy's Buildozer
<https://buildozer.readthedocs.io>`__ will provide a much more approachable
user experience.

Compilers for building on iOS
=============================
Expand All @@ -34,7 +34,7 @@ iOS specific arguments to configure

* ``--with-framework-name=NAME``

Specify the name for the python framework; defaults to ``Python``.
Specify the name for the Python framework; defaults to ``Python``.

Building Python on iOS
======================
Expand Down Expand Up @@ -95,13 +95,20 @@ In this invocation:

* ``iOS/Resources/bin`` has been added to the path, providing some shims for the
compilers and linkers needed by the build. Xcode requires the use of ``xcrun``
to invoke compiler tooling; however, ``xcrun`` embeds user- and
to invoke compiler tooling. However, if ``xcrun`` is pre-evaluated and the
result passed to ``configure``, these results can embed user- and
version-specific paths into the sysconfig data, which limits the portability
of the compiled Python. It also requires that compiler variables like ``CC``
include spaces, which can cause significant problems with many C configuration
systems which assume that ``CC`` will be a single executable. The
``iOS/Resources/bin`` folder contains some wrapper scripts that present as
simple compilers and linkers, but wrap underlying calls to ``xcrun``.
of the compiled Python. Alternatively, if ``xcrun`` is used *as* the compiler,
it requires that compiler variables like ``CC`` include spaces, which can
cause significant problems with many C configuration systems which assume that
``CC`` will be a single executable.

To work around this problem, the ``iOS/Resources/bin`` folder contains some
wrapper scripts that present as simple compilers and linkers, but wrap
underlying calls to ``xcrun``. This allows configure to use a ``CC``
definition without spaces, and without user- or version-specific paths, while
retaining the ability to adapt to the local Xcode install. These scripts are
included in the ``bin`` directory of an iOS install.

The path has also been cleared of any user customizations. A common source of
bugs is for tools like Homebrew to accidentally leak macOS binaries into an iOS
Expand Down Expand Up @@ -139,8 +146,8 @@ the binary libraries that CPython depends on (XZ, BZip2, LibFFI and OpenSSL).
This can be done by defining the ``LIBLZMA_CFLAGS``, ``LIBLZMA_LIBS``,
``BZIP2_CFLAGS``, ``BZIP2_LIBS``, ``LIBFFI_CFLAGS``, and ``LIBFFI_LIBS``
environment variables, and the ``--with-openssl`` configure option. Versions of
these libraries pre-compiled for iOS can be found in [this
repository](https://github.com/beeware/cpython-apple-source-deps/releases).
these libraries pre-compiled for iOS can be found in `this repository
<https://github.com/beeware/cpython-apple-source-deps/releases>`__.

By default, Python will be compiled with an iOS deployment target (i.e., the
minimum supported iOS version) of 12.0. To specify a different deployment
Expand Down

0 comments on commit 95275c1

Please sign in to comment.