Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit 799e228

Browse files
committed
Added ARMv7s build, and consolidated resource directories.
MILESTONE: Code runs on iOS hardware.
1 parent 8eefb5e commit 799e228

File tree

4 files changed

+146
-69
lines changed

4 files changed

+146
-69
lines changed

Makefile

Lines changed: 109 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@ PYTHON_VERSION=2.7.1
88
FFI_VERSION=3.0.13
99

1010
# IPHONE build commands and flags
11-
IPHONE_SDK_ROOT=$(shell xcrun --sdk iphoneos --show-sdk-path)
12-
IPHONE_CC=$(shell xcrun -find -sdk iphoneos clang)
13-
IPHONE_LD=$(shell xcrun -find -sdk iphoneos ld)
14-
IPHONE_CFLAGS=-arch armv7 -pipe -no-cpp-precomp -isysroot $(IPHONE_SDK_ROOT) -miphoneos-version-min=4.0
15-
IPHONE_LDFLAGS=-arch armv7 -isysroot $(IPHONE_SDK_ROOT) -miphoneos-version-min=4.0
11+
IPHONE_ARMV7_SDK_ROOT=$(shell xcrun --sdk iphoneos --show-sdk-path)
12+
IPHONE_ARMV7_CC=$(shell xcrun -find -sdk iphoneos clang)
13+
IPHONE_ARMV7_LD=$(shell xcrun -find -sdk iphoneos ld)
14+
IPHONE_ARMV7_CFLAGS=-arch armv7 -pipe -no-cpp-precomp -isysroot $(IPHONE_ARMV7_SDK_ROOT) -miphoneos-version-min=5.1.1
15+
IPHONE_ARMV7_LDFLAGS=-arch armv7 -isysroot $(IPHONE_ARMV7_SDK_ROOT) -miphoneos-version-min=5.1.1
1616

17-
# IPHONESIMULATOR build commands and flags
18-
IPHONESIMULATOR_SDK_ROOT=$(shell xcrun --sdk iphonesimulator --show-sdk-path)
19-
IPHONESIMULATOR_CC=$(shell xcrun -find -sdk iphonesimulator clang)
20-
IPHONESIMULATOR_LD=$(shell xcrun -find -sdk iphonesimulator ld)
21-
IPHONESIMULATOR_CFLAGS=-arch i386 -pipe -no-cpp-precomp -isysroot $(IPHONESIMULATOR_SDK_ROOT) -miphoneos-version-min=4.0
22-
IPHONESIMULATOR_LDFLAGS=-arch i386 -isysroot $(IPHONESIMULATOR_SDK_ROOT) -miphoneos-version-min=4.0
17+
# IPHONE build commands and flags
18+
IPHONE_ARMV7S_SDK_ROOT=$(shell xcrun --sdk iphoneos --show-sdk-path)
19+
IPHONE_ARMV7S_CC=$(shell xcrun -find -sdk iphoneos clang)
20+
IPHONE_ARMV7S_LD=$(shell xcrun -find -sdk iphoneos ld)
21+
IPHONE_ARMV7S_CFLAGS=-arch armv7s -pipe -no-cpp-precomp -isysroot $(IPHONE_ARMV7S_SDK_ROOT) -miphoneos-version-min=5.1.1
22+
IPHONE_ARMV7S_LDFLAGS=-arch armv7s -isysroot $(IPHONE_ARMV7S_SDK_ROOT) -miphoneos-version-min=5.1.1
23+
24+
# IPHONE_SIMULATOR build commands and flags
25+
IPHONE_SIMULATOR_SDK_ROOT=$(shell xcrun --sdk iphonesimulator --show-sdk-path)
26+
IPHONE_SIMULATOR_CC=$(shell xcrun -find -sdk iphonesimulator clang)
27+
IPHONE_SIMULATOR_LD=$(shell xcrun -find -sdk iphonesimulator ld)
28+
IPHONE_SIMULATOR_CFLAGS=-arch i386 -pipe -no-cpp-precomp -isysroot $(IPHONE_SIMULATOR_SDK_ROOT) -miphoneos-version-min=5.1.1
29+
IPHONE_SIMULATOR_LDFLAGS=-arch i386 -isysroot $(IPHONE_SIMULATOR_SDK_ROOT) -miphoneos-version-min=5.1.1
2330

2431

2532
all: working-dirs build/ffi.framework build/Python.framework
@@ -118,7 +125,7 @@ build/python/ios-simulator/Python: src/Python-$(PYTHON_VERSION)/build
118125
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/xcompile.patch
119126
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/setuppath.patch
120127
# Configure and build Simulator library
121-
cd src/Python-$(PYTHON_VERSION) && ./configure CC="$(IPHONESIMULATOR_CC)" LD="$(IPHONESIMULATOR_LD)" CFLAGS="$(IPHONESIMULATOR_CFLAGS) -I../../build/ffi.framework/Headers" LDFLAGS="$(IPHONESIMULATOR_LDFLAGS) -L../../build/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --prefix=/python --without-doc-strings
128+
cd src/Python-$(PYTHON_VERSION) && ./configure CC="$(IPHONE_SIMULATOR_CC)" LD="$(IPHONE_SIMULATOR_LD)" CFLAGS="$(IPHONE_SIMULATOR_CFLAGS) -I../../build/ffi.framework/Headers" LDFLAGS="$(IPHONE_SIMULATOR_LDFLAGS) -L../../build/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --prefix=/python --without-doc-strings
122129
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
123130
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
124131
mkdir -p build/python/ios-simulator
@@ -133,22 +140,22 @@ build/python/ios-simulator/Python: src/Python-$(PYTHON_VERSION)/build
133140
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
134141
# cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
135142
# Clean up build directory
136-
cd build/python/ios-simulator/lib/python2.7 && rm config/libpython2.7.a config/python.o config/config.c.in config/makesetup
137-
cd build/python/ios-simulator/lib/python2.7 && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
138-
cd build/python/ios-simulator/lib/python2.7 && find . -iname '*.pyc' | xargs rm
139-
cd build/python/ios-simulator/lib/python2.7 && find . -iname '*.py' | xargs rm
143+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup
144+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
145+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm
146+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm
140147
cd build/python/ios-simulator/lib && rm -rf pkgconfig
141148
# Pack libraries into .zip file
142-
cd build/python/ios-simulator/lib/python2.7 && mv config ..
143-
cd build/python/ios-simulator/lib/python2.7 && mv site-packages ..
144-
cd build/python/ios-simulator/lib/python2.7 && zip -r ../python27.zip *
145-
cd build/python/ios-simulator/lib/python2.7 && rm -rf *
146-
cd build/python/ios-simulator/lib/python2.7 && mv ../config .
147-
cd build/python/ios-simulator/lib/python2.7 && mv ../site-packages .
149+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv config ..
150+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages ..
151+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip *
152+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *
153+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv ../config .
154+
cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages .
148155
# Move all headers except for pyconfig.h into a Headers directory
149156
mkdir -p build/python/ios-simulator/Headers
150-
cd build/python/ios-simulator/Headers && mv ../include/python2.7/* .
151-
cd build/python/ios-simulator/Headers && mv pyconfig.h ../include/python2.7
157+
cd build/python/ios-simulator/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* .
158+
cd build/python/ios-simulator/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION))
152159

153160

154161
build/python/ios-armv7/Python: src/Python-$(PYTHON_VERSION)/build
@@ -159,7 +166,7 @@ build/python/ios-armv7/Python: src/Python-$(PYTHON_VERSION)/build
159166
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/xcompile.patch
160167
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/setuppath.patch
161168
# Configure and build iPhone library
162-
cd src/Python-$(PYTHON_VERSION) && ./configure CC="$(IPHONE_CC)" LD="$(IPHONE_LD)" CFLAGS="$(IPHONE_CFLAGS) -I../../build/ffi.framework/Headers" LDFLAGS="$(IPHONE_LDFLAGS) -L../../build/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --host=armv7-apple-darwin --prefix=/python --without-doc-strings
169+
cd src/Python-$(PYTHON_VERSION) && ./configure CC="$(IPHONE_ARMV7_CC)" LD="$(IPHONE_ARMV7_LD)" CFLAGS="$(IPHONE_ARMV7_CFLAGS) -I../../build/ffi.framework/Headers" LDFLAGS="$(IPHONE_ARMV7_LDFLAGS) -L../../build/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --host=armv7-apple-darwin --prefix=/python --without-doc-strings
163170
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
164171
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
165172
mkdir -p build/python/ios-armv7
@@ -174,51 +181,96 @@ build/python/ios-armv7/Python: src/Python-$(PYTHON_VERSION)/build
174181
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
175182
# cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
176183
# Clean up build directory
177-
cd build/python/ios-armv7/lib/python2.7 && rm config/libpython2.7.a config/python.o config/config.c.in config/makesetup
178-
cd build/python/ios-armv7/lib/python2.7 && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
179-
cd build/python/ios-armv7/lib/python2.7 && find . -iname '*.pyc' | xargs rm
180-
cd build/python/ios-armv7/lib/python2.7 && find . -iname '*.py' | xargs rm
184+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup
185+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
186+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm
187+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm
181188
cd build/python/ios-armv7/lib && rm -rf pkgconfig
182189
# Pack libraries into .zip file
183-
cd build/python/ios-armv7/lib/python2.7 && mv config ..
184-
cd build/python/ios-armv7/lib/python2.7 && mv site-packages ..
185-
cd build/python/ios-armv7/lib/python2.7 && zip -r ../python27.zip *
186-
cd build/python/ios-armv7/lib/python2.7 && rm -rf *
187-
cd build/python/ios-armv7/lib/python2.7 && mv ../config .
188-
cd build/python/ios-armv7/lib/python2.7 && mv ../site-packages .
190+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv config ..
191+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages ..
192+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip *
193+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *
194+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv ../config .
195+
cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages .
189196
# Move all headers except for pyconfig.h into a Headers directory
190-
mkdir -p build/python/ios-simulator/Headers
191-
cd build/python/ios-simulator/Headers && mv ../include/python2.7/* .
192-
cd build/python/ios-simulator/Headers && mv pyconfig.h ../include/python2.7
197+
mkdir -p build/python/ios-armv7/Headers
198+
cd build/python/ios-armv7/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* .
199+
cd build/python/ios-armv7/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION))
193200

194-
build/Python.framework: build/python/ios-simulator/Python build/python/ios-armv7/Python
201+
build/python/ios-armv7s/Python: src/Python-$(PYTHON_VERSION)/build
202+
# Apply extra patches for iPhone build
203+
cp patch/Python/$(PYTHON_VERSION)/ModulesSetup src/Python-$(PYTHON_VERSION)/Modules/Setup.local
204+
cat patch/Python/$(PYTHON_VERSION)/ModulesSetup.mobile >> src/Python-$(PYTHON_VERSION)/Modules/Setup.local
205+
cp patch/Python/$(PYTHON_VERSION)/_scproxy.py src/Python-$(PYTHON_VERSION)/Lib/_scproxy.py
206+
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/xcompile.patch
207+
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/setuppath.patch
208+
# Configure and build iPhone library
209+
cd src/Python-$(PYTHON_VERSION) && ./configure CC="$(IPHONE_ARMV7_CC)" LD="$(IPHONE_ARMV7S_LD)" CFLAGS="$(IPHONE_ARMV7S_CFLAGS) -I../../build/ffi.framework/Headers" LDFLAGS="$(IPHONE_ARMV7S_LDFLAGS) -L../../build/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --host=armv7s-apple-darwin --prefix=/python --without-doc-strings
210+
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
211+
cd src/Python-$(PYTHON_VERSION) && patch -p1 < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
212+
mkdir -p build/python/ios-armv7s
213+
cd src/Python-$(PYTHON_VERSION) && make altbininstall libinstall inclinstall libainstall HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="../../build/python/ios-armv7s"
214+
# Relocate and rename the libpython binary
215+
cd build/python/ios-armv7s/lib && mv libpython$(basename $(PYTHON_VERSION)).a ../Python
216+
# Clean out all the build data
217+
cd src/Python-$(PYTHON_VERSION) && make distclean
218+
# Reverse the source patches.
219+
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/xcompile.patch
220+
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/setuppath.patch
221+
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
222+
# cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
223+
# Clean up build directory
224+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup
225+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
226+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm
227+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm
228+
cd build/python/ios-armv7s/lib && rm -rf pkgconfig
229+
# Pack libraries into .zip file
230+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv config ..
231+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages ..
232+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip *
233+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *
234+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv ../config .
235+
cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages .
236+
# Move all headers except for pyconfig.h into a Headers directory
237+
mkdir -p build/python/ios-armv7s/Headers
238+
cd build/python/ios-armv7s/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* .
239+
cd build/python/ios-armv7s/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION))
240+
241+
build/Python.framework: build/python/ios-simulator/Python build/python/ios-armv7/Python build/python/ios-armv7s/Python
195242
# Create the framework directory from the compiled resrouces
196243
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/
197244
cd build/Python.framework/Versions && ln -fs $(basename $(PYTHON_VERSION)) Current
198-
# Copy the headers from the simulator
245+
# Copy the headers from the simulator build
199246
cp -r build/python/ios-simulator/Headers build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Headers
200247
cd build/Python.framework && ln -fs Versions/Current/Headers
248+
# Copy the standard library from the simulator build
249+
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources
250+
cp -r build/python/ios-simulator/lib build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources
251+
cd build/Python.framework && ln -fs Versions/Current/Resources
252+
# Copy the pyconfig headers from the builds, and install the fat header.
253+
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python$(basename $(PYTHON_VERSION))
254+
cp build/python/ios-simulator/include/python$(basename $(PYTHON_VERSION))/pyconfig.h build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/pyconfig-simulator.h
255+
cp build/python/ios-armv7/include/python$(basename $(PYTHON_VERSION))/pyconfig.h build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/pyconfig-armv7.h
256+
cp patch/Python/$(PYTHON_VERSION)/pyconfig.h build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include
201257
# Build a fat library with all targets included.
202-
xcrun lipo -create -output build/Python.framework/Versions/Current/Python build/python/ios-simulator/Python build/python/ios-armv7/Python
258+
xcrun lipo -create -output build/Python.framework/Versions/Current/Python build/python/ios-simulator/Python build/python/ios-armv7/Python build/python/ios-armv7s/Python
203259
cd build/Python.framework && ln -fs Versions/Current/Python
204-
# Clean up simulator dir
205-
rm -rf build/python/ios-simulator/bin
206-
rm -rf build/python/ios-simulator/Python
207-
# Clean up armv7 dir
208-
rm -rf build/python/ios-armv7/bin
209-
rm -rf build/python/ios-armv7/Python
260+
# Clean up temporary build dirs
261+
rm -rf build/python
210262

211263
env:
212264
# PYTHON_VERSION $(PYTHON_VERSION)
213265
# FFI_VERSION $(FFI_VERSION)
214266
# OSX_SDK_ROOT $(OSX_SDK_ROOT)
215-
# IPHONE_SDK_ROOT $(IPHONE_SDK_ROOT)
216-
# IPHONE_CC $(IPHONE_CC)
217-
# IPHONE_LD $(IPHONE_LD)
218-
# IPHONE_CFLAGS $(IPHONE_CFLAGS)
219-
# IPHONE_LDFLAGS $(IPHONE_LDFLAGS)
220-
# IPHONESIMULATOR_SDK_ROOT $(IPHONESIMULATOR_SDK_ROOT)
221-
# IPHONESIMULATOR_CC $(IPHONESIMULATOR_CC)
222-
# IPHONESIMULATOR_LD $(IPHONESIMULATOR_LD)
223-
# IPHONESIMULATOR_CFLAGS $(IPHONESIMULATOR_CFLAGS)
224-
# IPHONESIMULATOR_LDFLAGS $(IPHONESIMULATOR_LDFLAGS)
267+
# IPHONE_ARMV7_SDK_ROOT $(IPHONE_ARMV7_SDK_ROOT)
268+
# IPHONE_ARMV7_CC $(IPHONE_ARMV7_CC)
269+
# IPHONE_ARMV7_LD $(IPHONE_ARMV7_LD)
270+
# IPHONE_ARMV7_CFLAGS $(IPHONE_ARMV7_CFLAGS)
271+
# IPHONE_ARMV7_LDFLAGS $(IPHONE_ARMV7_LDFLAGS)
272+
# IPHONE_SIMULATOR_SDK_ROOT $(IPHONE_SIMULATOR_SDK_ROOT)
273+
# IPHONE_SIMULATOR_CC $(IPHONE_SIMULATOR_CC)
274+
# IPHONE_SIMULATOR_LD $(IPHONE_SIMULATOR_LD)
275+
# IPHONE_SIMULATOR_CFLAGS $(IPHONE_SIMULATOR_CFLAGS)
276+
# IPHONE_SIMULATOR_LDFLAGS $(IPHONE_SIMULATOR_LDFLAGS)

README.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ Python.framework
22
================
33

44
This is a meta-package for building a version of Python that can be embedded
5-
into an iOS project. It works by downloading, patching, and *then* building
6-
a static libPython.a, and packaging it in iOS Framework format.
5+
into an iOS project, and a cookiecutter template for such a project.
6+
7+
It works by downloading, patching, and building a static
8+
libffi.a and libPython.a, and packaging them both in fat-binary iOS Framework
9+
format.
10+
11+
The binaries support the `$(ARCHS_STANDARD_32_BIT)` set - that is, armv7 and
12+
armv7s. This should enable the code to run on iPhone 3GS, 4, 4s, 5 and 5s.
713

814
Quickstart
915
----------

patch/Python/2.7.1/pyconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#if TARGET_IPHONE_SIMULATOR
2+
#include "pyconfig-simulator.h"
3+
#else
4+
#include "pyconfig-armv7.h"
5+
#endif

patch/libffi/3.0.13/project.pbxproj.patch

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--- old/libffi.xcodeproj/project.pbxproj 2013-03-16 19:19:39.000000000 +0800
2-
+++ new/libffi.xcodeproj/project.pbxproj 2014-05-07 08:45:46.000000000 +0800
2+
+++ new/libffi.xcodeproj/project.pbxproj 2014-05-07 20:39:11.000000000 +0800
33
@@ -6,36 +6,32 @@
44
objectVersion = 46;
55
objects = {
@@ -414,35 +414,49 @@
414414
VALIDATE_PRODUCT = YES;
415415
};
416416
name = Release;
417-
@@ -517,11 +396,13 @@
418-
armv7,
419-
);
417+
@@ -512,16 +391,15 @@
418+
F6F980C2147386130008F121 /* Debug */ = {
419+
isa = XCBuildConfiguration;
420+
buildSettings = {
421+
- ARCHS = (
422+
- armv6,
423+
- armv7,
424+
- );
425+
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
420426
DSTROOT = /tmp/ffi.dst;
421427
+ FRAMEWORK_VERSION = 3.0.13;
422428
GCC_PRECOMPILE_PREFIX_HEADER = YES;
423429
GCC_THUMB_SUPPORT = NO;
424-
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
430+
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
431+
+ IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
425432
OTHER_LDFLAGS = "-ObjC";
426433
PRODUCT_NAME = ffi;
427434
+ PUBLIC_HEADERS_FOLDER_PATH = Headers;
428435
SKIP_INSTALL = YES;
429436
};
430437
name = Debug;
431-
@@ -534,11 +415,13 @@
432-
armv7,
433-
);
438+
@@ -529,16 +407,15 @@
439+
F6F980C3147386130008F121 /* Release */ = {
440+
isa = XCBuildConfiguration;
441+
buildSettings = {
442+
- ARCHS = (
443+
- armv6,
444+
- armv7,
445+
- );
446+
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
434447
DSTROOT = /tmp/ffi.dst;
435448
+ FRAMEWORK_VERSION = 3.0.13;
436449
GCC_PRECOMPILE_PREFIX_HEADER = YES;
437450
GCC_THUMB_SUPPORT = NO;
438-
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
451+
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
452+
+ IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
439453
OTHER_LDFLAGS = "-ObjC";
440454
PRODUCT_NAME = ffi;
441455
+ PUBLIC_HEADERS_FOLDER_PATH = Headers;
442456
SKIP_INSTALL = YES;
443457
};
444458
name = Release;
445-
@@ -546,11 +429,11 @@
459+
@@ -546,11 +423,11 @@
446460
/* End XCBuildConfiguration section */
447461

448462
/* Begin XCConfigurationList section */

0 commit comments

Comments
 (0)