Compiling python for ios platform is not difficult. Here gives some experience and steps to show how to do. Python source code version is 2.7.9
Setup Compiling Environment
build host version to create "Parser/pgen"
./configure
. make
setup environment for i386
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/:/usr/local/bin:/usr/bin:/bin:$PATH"
export CFLAGS="-DIOS -arch i386 -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk"
export CXXFLAGS="$CFLAGS"
export CC="clang $CFLAGS"
export CXX="clang++ $CXXFLAGS"
export AR="ar"
export RANLIB="ranlib"
export STRIP="strip —-strip-unneeded"
export MAKE="make -j4"
export CONFIG_SITE="config.site"
setup environment for x86_64
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/:/usr/local/bin:/usr/bin:/bin:$PATH"
export CFLAGS="-DIOS -arch x86_64 -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk"
export CXXFLAGS="$CFLAGS"
export CC="clang $CFLAGS"
export CXX="clang++ $CXXFLAGS"
export AR="ar"
export RANLIB="ranlib"
export STRIP="strip —-strip-unneeded"
export MAKE="make -j4"
export CONFIG_SITE="config.site"
setup environment for armv7
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/:/usr/local/bin:/usr/bin:/bin:$PATH"
export CFLAGS="-DIOS -arch armv7 -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk"
export CXXFLAGS="$CFLAGS"
export CC="clang $CFLAGS"
export CXX="clang++ $CXXFLAGS"
export AR="ar"
export RANLIB="ranlib"
export STRIP="strip —-strip-unneeded"
export MAKE="make -j4"
export CONFIG_SITE="config.site"
setup environment for armv7s
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/:/usr/local/bin:/usr/bin:/bin:$PATH"
export CFLAGS="-DIOS -arch armv7s -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk"
export CXXFLAGS="$CFLAGS"
export CC="clang $CFLAGS"
export CXX="clang++ $CXXFLAGS"
export AR="ar"
export RANLIB="ranlib"
export STRIP="strip —-strip-unneeded"
export MAKE="make -j4"
export CONFIG_SITE="config.site"
setup environment for arm64
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/:/usr/local/bin:/usr/bin:/bin:$PATH"
export CFLAGS="-DIOS -arch arm64 -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk"
export CXXFLAGS="$CFLAGS"
export CC="clang $CFLAGS"
export CXX="clang++ $CXXFLAGS"
export AR="ar"
export RANLIB="ranlib"
export STRIP="strip —-strip-unneeded"
export MAKE="make -j4"
export CONFIG_SITE="config.site"
Apply patch code
download : starpython-2.7.9.ios.patch
patch -p0 -i starpython-2.7.9.ios.patch
Compile
configure for i386
./configure LDFLAGS="-Wl -L$(pwd)/../../zlib/zlib" CFLAGS="-Wno-format -I$(pwd)/zlib/zlib" --host=i386-iphone-darwin --build=x86_64-apple-darwin --prefix="$(pwd)/../../install/python279.i386" --disable-ipv6 --disable-toolbox-glue
configure for x86_64
./configure LDFLAGS="-Wl -L$(pwd)/../../zlib/zlib" CFLAGS="-Wno-format -I$(pwd)/zlib/zlib" --host=x86_64-iphone-darwin --build=x86_64-apple-darwin --prefix="$(pwd)/../../install/python279.x86_64" --disable-ipv6 --disable-toolbox-glue
configure for armv7
./configure LDFLAGS="-Wl -L$(pwd)/../../zlib/zlib" CFLAGS="-Wno-format -I$(pwd)/zlib/zlib" --host=arm-iphone-darwin --build=x86_64-apple-darwin --prefix="$(pwd)/../../install/python279.armv7" --disable-ipv6 --disable-toolbox-glue
configure for armv7s
./configure LDFLAGS="-Wl -L$(pwd)/../../zlib/zlib" CFLAGS="-Wno-format -I$(pwd)/zlib/zlib" --host=arm-iphone-darwin --build=x86_64-apple-darwin --prefix="$(pwd)/../../install/python279.armv7s" --disable-ipv6 --disable-toolbox-glue
configure for arm64
./configure LDFLAGS="-Wl -L$(pwd)/../../zlib/zlib" CFLAGS="-Wno-format -I$(pwd)/zlib/zlib" --host=aarch64-iphone-darwin --build=x86_64-apple-darwin --prefix="$(pwd)/../../install/python279.arm64" --disable-ipv6 --disable-toolbox-glue
./make
./make install
If there are errors, please copy "Parser/pgen" from host version, which is built in previous step