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

Commit 87127df

Browse files
committed
Initial Commit
1 parent eb96685 commit 87127df

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

Makefile

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,23 @@ build/python/ios-simulator/Python: src/Python-$(PYTHON_VERSION)/build
133133
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
134134
# cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
135135
# 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
136137
cd build/python/ios-simulator/lib/python2.7 && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
137138
cd build/python/ios-simulator/lib/python2.7 && find . -iname '*.pyc' | xargs rm
138139
cd build/python/ios-simulator/lib/python2.7 && find . -iname '*.py' | xargs rm
139140
cd build/python/ios-simulator/lib && rm -rf pkgconfig
141+
# 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 .
148+
# Move all headers except for pyconfig.h into a Headers directory
149+
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
152+
140153

141154
build/python/ios-armv7/Python: src/Python-$(PYTHON_VERSION)/build
142155
# Apply extra patches for iPhone build
@@ -161,26 +174,39 @@ build/python/ios-armv7/Python: src/Python-$(PYTHON_VERSION)/build
161174
cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/ctypes_duplicate.patch
162175
# cd src/Python-$(PYTHON_VERSION) && patch -p1 -R < ../../patch/Python/$(PYTHON_VERSION)/pyconfig.patch
163176
# 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
164178
cd build/python/ios-armv7/lib/python2.7 && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot
165179
cd build/python/ios-armv7/lib/python2.7 && find . -iname '*.pyc' | xargs rm
166180
cd build/python/ios-armv7/lib/python2.7 && find . -iname '*.py' | xargs rm
167181
cd build/python/ios-armv7/lib && rm -rf pkgconfig
182+
# 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 .
189+
# 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
168193

169194
build/Python.framework: build/python/ios-simulator/Python build/python/ios-armv7/Python
170195
# Create the framework directory from the compiled resrouces
171196
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/
172197
cd build/Python.framework/Versions && ln -fs $(basename $(PYTHON_VERSION)) Current
173-
# Use the include and .pyo files from the simulator build.
174-
cp -r build/python/ios-simulator/include/python$(basename $(PYTHON_VERSION)) build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Headers
198+
# Copy the headers from the simulator
199+
cp -r build/python/ios-simulator/Headers build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Headers
175200
cd build/Python.framework && ln -fs Versions/Current/Headers
176-
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources
177-
cp -r build/python/ios-simulator/lib build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/lib
178-
mkdir -p build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python2.7
179-
cp -r build/python/ios-simulator/include/python2.7/pyconfig.h build/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python2.7/pyconfig.h
180-
cd build/Python.framework && ln -fs Versions/Current/Resources
181201
# Build a fat library with all targets included.
182202
xcrun lipo -create -output build/Python.framework/Versions/Current/Python build/python/ios-simulator/Python build/python/ios-armv7/Python
183203
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
184210

185211
env:
186212
# PYTHON_VERSION $(PYTHON_VERSION)

0 commit comments

Comments
 (0)