Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
iOS builds may now be configured with ``--disable-framework`` when combined with
``--disable-shared``, producing a static ``libpython`` for embedding in an app
binary. A shared iOS build must still be a framework build.
20 changes: 15 additions & 5 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ AC_ARG_ENABLE([framework],
case $enableval in
no)
case $ac_sys_system in
iOS) AC_MSG_ERROR([iOS builds must use --enable-framework]) ;;
*)
PYTHONFRAMEWORK=
PYTHONFRAMEWORKDIR=no-framework
Expand Down Expand Up @@ -689,7 +688,7 @@ AC_ARG_ENABLE([framework],
esac
],[
case $ac_sys_system in
iOS) AC_MSG_ERROR([iOS builds must use --enable-framework]) ;;
iOS) AC_MSG_ERROR([iOS builds must use --enable-framework, or --disable-framework with --disable-shared to build a static libpython]) ;;
*)
PYTHONFRAMEWORK=
PYTHONFRAMEWORKDIR=no-framework
Expand Down Expand Up @@ -1689,6 +1688,12 @@ else # shared is disabled
fi
AC_MSG_RESULT([$LDLIBRARY])

# A shared Python on iOS has to be a framework: an app can only load a signed
# framework, never a bare dylib. A static libpython has nothing to load.
if test "$ac_sys_system" = "iOS" && test "$PY_ENABLE_SHARED" = 1 && test -z "$PYTHONFRAMEWORK"; then
AC_MSG_ERROR([iOS builds must use --enable-framework, or --disable-framework with --disable-shared to build a static libpython])
fi

# HOSTRUNNER - Program to run CPython for the host platform
AC_MSG_CHECKING([HOSTRUNNER])
if test -z "$HOSTRUNNER"
Expand Down Expand Up @@ -3830,7 +3835,11 @@ then
fi
LINKFORSHARED="$LINKFORSHARED"
elif test $ac_sys_system = "iOS"; then
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)'
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"

if test "$enable_framework"; then
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)'
fi
fi
;;
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Expand Down Expand Up @@ -6755,8 +6764,9 @@ if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MA
LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
fi

# On iOS the shared libraries must be linked with the Python framework
if test "$ac_sys_system" = "iOS"; then
# On iOS the shared libraries must be linked with the Python framework, when one
# is being built
if test "$ac_sys_system" = "iOS" && test "$enable_framework"; then
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
fi

Expand Down
Loading