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

Commit 658f84a

Browse files
committed
Tweaks to commit 3859bc2.
1 parent 2e7ab4e commit 658f84a

File tree

5 files changed

+120
-121
lines changed

5 files changed

+120
-121
lines changed

Diff for: Makefile

+26-29
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
#
22
# Useful targets:
3-
# - all-iOS - build everything for iOS
4-
# - all-tvOS - build everything for tvOS
5-
# - all-watchOS - build everything for watchOS
6-
# - OpenSSL.framework-iOS - build OpenSSL.framework for iOS
7-
# - OpenSSL.framework-tvOS - build OpenSSL.framework for tvOS
8-
# - OpenSSL.framework-watchOS - build OpenSSL.framework for watchOS
9-
# - Python.framework-iOS - build Python.framework for iOS
10-
# - Python.framework-tvOS - build Python.framework for tvOS
11-
# - Python.framework-watchOS - build Python.framework for watchOS
12-
# - Python-host - build host python
3+
# - all - build everything
4+
# - iOS - build everything for iOS
5+
# - tvOS - build everything for tvOS
6+
# - watchOS - build everything for watchOS
7+
# - OpenSSL.framework-iOS - build OpenSSL.framework for iOS
8+
# - OpenSSL.framework-tvOS - build OpenSSL.framework for tvOS
9+
# - OpenSSL.framework-watchOS - build OpenSSL.framework for watchOS
10+
# - Python.framework-iOS - build Python.framework for iOS
11+
# - Python.framework-tvOS - build Python.framework for tvOS
12+
# - Python.framework-watchOS - build Python.framework for watchOS
13+
# - Python-host - build host python
1314

1415
# Current director
1516
PROJECT_DIR=$(shell pwd)
1617

17-
BUILD_NUMBER=3
18+
BUILD_NUMBER=4
1819

1920
# Version of packages that will be compiled by this meta-package
20-
PYTHON_VERSION= 3.4.2
21+
PYTHON_VERSION=3.4.2
2122
PYTHON_VER= $(basename $(PYTHON_VERSION))
2223

2324
OPENSSL_VERSION_NUMBER=1.0.2
24-
OPENSSL_REVISION=d
25+
OPENSSL_REVISION=e
2526
OPENSSL_VERSION=$(OPENSSL_VERSION_NUMBER)$(OPENSSL_REVISION)
2627

2728
# Supported OS
2829
OS= iOS tvOS watchOS
2930

3031
# iOS targets
31-
TARGETS-iOS= iphonesimulator.x86_64 iphonesimulator.i386\
32-
iphoneos.armv7 iphoneos.armv7s iphoneos.arm64
33-
CFLAGS-iOS= -miphoneos-version-min=7.0
32+
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.i386 iphoneos.armv7 iphoneos.armv7s iphoneos.arm64
33+
CFLAGS-iOS=-miphoneos-version-min=7.0
3434
CFLAGS-iphoneos.armv7= -fembed-bitcode
3535
CFLAGS-iphoneos.armv7s= -fembed-bitcode
3636
CFLAGS-iphoneos.arm64= -fembed-bitcode
3737

3838
# tvOS targets
39-
TARGETS-tvOS= appletvsimulator.x86_64 appletvos.arm64
40-
CFLAGS-tvOS= -mtvos-version-min=9.0
39+
TARGETS-tvOS=appletvsimulator.x86_64 appletvos.arm64
40+
CFLAGS-tvOS=-mtvos-version-min=9.0
4141
CFLAGS-appletvos.arm64= -fembed-bitcode
4242
PYTHON_CONFIGURE-tvOS= ac_cv_func_sigaltstack=no
4343

4444
# watchOS targets
45-
TARGETS-watchOS= watchsimulator.i386 watchos.armv7k
46-
CFLAGS-watchOS= -mwatchos-version-min=2.0
45+
TARGETS-watchOS=watchsimulator.i386 watchos.armv7k
46+
CFLAGS-watchOS=-mwatchos-version-min=2.0
4747
CFLAGS-watchos.armv7k= -fembed-bitcode
4848
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
4949

5050
# override machine for arm64
51-
MACHINE-arm64= aarch64
51+
MACHINE-arm64=aarch64
5252

53-
all: $(foreach os,$(OS),all-$(os))
53+
all: $(foreach os,$(OS),$(os))
5454

5555
# Clean all builds
5656
clean:
@@ -95,8 +95,8 @@ downloads/Python-$(PYTHON_VERSION).tgz:
9595
mkdir -p downloads
9696
if [ ! -e downloads/Python-$(PYTHON_VERSION).tgz ]; then curl -L https://www.python.org/ftp/python/$(PYTHON_VERSION)/Python-$(PYTHON_VERSION).tgz > downloads/Python-$(PYTHON_VERSION).tgz; fi
9797

98-
PYTHON_DIR-host= build/Python-$(PYTHON_VERSION)-host
99-
PYTHON_HOST= $(PYTHON_DIR-host)/dist/bin/python$(PYTHON_VER)
98+
PYTHON_DIR-host=build/Python-$(PYTHON_VERSION)-host
99+
PYTHON_HOST=$(PYTHON_DIR-host)/dist/bin/python$(PYTHON_VER)
100100

101101
Python-host: $(PYTHON_HOST)
102102

@@ -174,9 +174,6 @@ $$(PYTHON_DIR-$1)/Makefile: downloads/Python-$(PYTHON_VERSION).tgz $(PYTHON_HOST
174174
tar zxf downloads/Python-$(PYTHON_VERSION).tgz --strip-components 1 -C $$(PYTHON_DIR-$1)
175175
# Apply target Python patches
176176
cd $$(PYTHON_DIR-$1) && patch -p1 <$(PROJECT_DIR)/patch/Python/Python.patch
177-
ifeq ($$(findstring iphone,$$(SDK-$1)),)
178-
cd $$(PYTHON_DIR-$1) && patch -p1 <$(PROJECT_DIR)/patch/Python/Python-tvos.patch
179-
endif
180177
cp -f $(PROJECT_DIR)/patch/Python/Setup.embedded $$(PYTHON_DIR-$1)/Modules/Setup.embedded
181178
# Configure target Python
182179
cd $$(PYTHON_DIR-$1) && PATH=$(PROJECT_DIR)/$(PYTHON_DIR-host)/dist/bin:$(PATH) ./configure \
@@ -223,7 +220,7 @@ OPENSSL_FRAMEWORK-$1= build/$1/OpenSSL.framework
223220
PYTHON_FRAMEWORK-$1= build/$1/Python.framework
224221
PYTHON_RESOURCES-$1= $$(PYTHON_FRAMEWORK-$1)/Versions/$(PYTHON_VER)/Resources
225222

226-
all-$1: dist/Python-$(PYTHON_VERSION)-$1-support.b$(BUILD_NUMBER).tar.gz
223+
$1: dist/Python-$(PYTHON_VERSION)-$1-support.b$(BUILD_NUMBER).tar.gz
227224

228225
clean-$1:
229226
rm -rf build/$1
@@ -283,7 +280,7 @@ ifneq ($(TEST),)
283280
else
284281
mkdir -p $$(PYTHON_RESOURCES-$1)/lib
285282
cd $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1)))/dist/lib/python$(PYTHON_VER) && \
286-
zip -x@$(PROJECT_DIR)/python-lib-exclude.lst -r $(PROJECT_DIR)/$$(PYTHON_RESOURCES-$1)/lib/python$(subst .,,$(PYTHON_VER)) *
283+
zip -x@$(PROJECT_DIR)/patch/Python/lib-exclude.lst -r $(PROJECT_DIR)/$$(PYTHON_RESOURCES-$1)/lib/python$(subst .,,$(PYTHON_VER)) *
287284
endif
288285

289286
# Copy fat library

Diff for: README.rst

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
1-
Makefile glue for Python for iOS, tvOS and watchOS.
2-
3-
Useful targets:
4-
5-
* all - build all
6-
* all-iOS - build everything for iOS
7-
* all-tvOS - build everything for tvOS
8-
* all-watchOS - build everything for watchOS
9-
* OpenSSL.framework-iOS - build OpenSSL.framework for iOS
10-
* OpenSSL.framework-tvOS - build OpenSSL.framework for tvOS
11-
* OpenSSL.framework-watchOS - build OpenSSL.framework for watchOS
12-
* Python.framework-iOS - build Python.framework for iOS
13-
* Python.framework-tvOS - build Python.framework for tvOS
14-
* Python.framework-watchOS - build Python.framework for watchOS
15-
* Python-host - build host python
16-
171
Python iOS Support
182
==================
193

204
This is a meta-package for building a version of Python that can be embedded
21-
into an iOS project.
5+
into an iOS, tvOS or watchOS project.
226

237
It works by downloading, patching, and building a fat binary OpenSSL and
248
Python, and packaging them both in iOS Framework format.
259

2610
The binaries support the ``$(ARCHS_STANDARD)`` set - that is, armv7 and
27-
arm64. This should enable the code to run on:
11+
arm64 for iOS devices, arm64 for appleTV devices, and armv7k for watchOS.
12+
This should enable the code to run on:
2813

2914
* iPhone
3015
- iPhone 4s
3116
- iPhone 5
17+
- iPhone 5c
3218
- iPhone 5s
3319
- iPhone 6
3420
- iPhone 6 Plus
21+
- iPhone 6s
22+
- iPhone 6s Plus
23+
* iPad Pro
3524
* iPad
3625
- iPad 2
3726
- iPad (3rd gen)
3827
- iPad (4th gen)
3928
- iPad Air
29+
- iPad Air 2
4030
- iPad retina
31+
- iPad Pro
4132
* iPad Mini
4233
- iPad Mini (1st gen)
43-
- iPad Mini (2nd gen)
34+
- iPad Mini 2
35+
- iPad Mini 3
36+
- iPad Mini 4
4437
* iPod Touch
4538
- iPod Touch (4th gen)
4639
- iPod Touch (5th gen)
40+
- iPod Touch (6th gen)
41+
* Apple TV
42+
- 4th gen
43+
* Apple Watch
4744

4845
This repository branch builds a packaged version of **Python 3.4.2**.
4946
Other Python versions are available by cloning other branches of the main
@@ -52,23 +49,29 @@ repository.
5249
Quickstart
5350
----------
5451

55-
Pre-built versions of the frameworks can be downloaded_, and added to
56-
your iOS project.
52+
Pre-built versions of the frameworks can be downloaded `for iOS`_,
53+
`for tvOS`_, and `for watchOS`_, and added to your project.
5754

5855
Alternatively, to build the frameworks on your own, download/clone this
5956
repository, and then in the root directory, and run:
6057

61-
$ make
58+
* `make` (or `make all`) to build everything.
59+
* `make iOS` to build everything for iOS.
60+
* `make tvOS` to build everything for tvOS.
61+
* `make watchOS` to build everything for watchOS.
6262

6363
This should:
6464

6565
1. Download the original source packages
66-
2. Patch them as required for iOS compatibility
67-
3. Build the packages as iOS frameworks.
66+
2. Patch them as required for compatibility with the selected OS
67+
3. Build the packages as XCode-compatible frameworks.
6868

69-
The build products will be in the `build` directory.
69+
The build products will be in the `build` directory; the compiled frameworks
70+
will be in the `dist` directory.
7071

71-
.. _downloaded: https://github.com/pybee/Python-iOS-support/releases/download/3.4.2-b2/Python-3.4.2-iOS-support.b2.tar.gz
72+
.. _for iOS: https://github.com/pybee/Python-iOS-support/releases/download/3.4.2-b4/Python-3.4.2-iOS-support.b4.tar.gz
73+
.. _for tvOS: https://github.com/pybee/Python-iOS-support/releases/download/3.4.2-b4/Python-3.4.2-iOS-support.b4.tar.gz
74+
.. _for watchS: https://github.com/pybee/Python-iOS-support/releases/download/3.4.2-b4/Python-3.4.2-iOS-support.b4.tar.gz
7275

7376
Acknowledgements
7477
----------------

Diff for: patch/Python/Python-tvos.patch

-65
This file was deleted.

Diff for: patch/Python/Python.patch

+65-1
Original file line numberDiff line numberDiff line change
@@ -30904,6 +30904,38 @@ diff -Nru orig/Modules/_ctypes/libffi_ios/x86/unix64_x86_64.S modified/Modules/_
3090430904
+
3090530905
+#endif
3090630906
\ No newline at end of file
30907+
diff -Nru orig/Modules/_posixsubprocess.c modified/Modules/_posixsubprocess.c
30908+
--- orig/Modules/_posixsubprocess.c 2015-02-03 19:49:04.000000000 +0800
30909+
+++ modified/Modules/_posixsubprocess.c 2015-12-21 13:03:32.000000000 +0800
30910+
@@ -479,11 +479,15 @@
30911+
saved_errno = 0;
30912+
for (i = 0; exec_array[i] != NULL; ++i) {
30913+
const char *executable = exec_array[i];
30914+
+#if defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
30915+
+ errno = ENOTSUP;
30916+
+#else
30917+
if (envp) {
30918+
execve(executable, argv, envp);
30919+
} else {
30920+
execv(executable, argv);
30921+
}
30922+
+#endif
30923+
if (errno != ENOENT && errno != ENOTDIR && saved_errno == 0) {
30924+
saved_errno = errno;
30925+
}
30926+
@@ -646,7 +650,12 @@
30927+
cwd_obj2 = NULL;
30928+
}
30929+
30930+
+#if defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
30931+
+ pid = -1;
30932+
+ errno = ENOTSUP;
30933+
+#else
30934+
pid = fork();
30935+
+#endif
30936+
if (pid == 0) {
30937+
/* Child process */
30938+
/*
3090730939
diff -Nru orig/Modules/makesetup modified/Modules/makesetup
3090830940
--- orig/Modules/makesetup 2015-02-03 19:49:04.000000000 +0800
3090930941
+++ modified/Modules/makesetup 2015-06-28 14:39:04.000000000 +0800
@@ -30989,7 +31021,7 @@ diff -Nru orig/Modules/mathmodule.c modified/Modules/mathmodule.c
3098931021
r = hypot(x, y);
3099031022
diff -Nru orig/Modules/posixmodule.c modified/Modules/posixmodule.c
3099131023
--- orig/Modules/posixmodule.c 2015-02-03 19:49:04.000000000 +0800
30992-
+++ modified/Modules/posixmodule.c 2015-05-04 12:44:34.000000000 +0800
31024+
+++ modified/Modules/posixmodule.c 2015-12-21 13:03:32.000000000 +0800
3099331025
@@ -20,6 +20,8 @@
3099431026
# pragma weak statvfs
3099531027
# pragma weak fstatvfs
@@ -31023,6 +31055,38 @@ diff -Nru orig/Modules/posixmodule.c modified/Modules/posixmodule.c
3102331055

3102431056
/*[clinic input]
3102531057
module os
31058+
@@ -1178,7 +1197,9 @@
31059+
#include <crt_externs.h>
31060+
static char **environ;
31061+
#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
31062+
+#if !defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && !defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
31063+
extern char **environ;
31064+
+#endif
31065+
#endif /* !_MSC_VER */
31066+
31067+
static PyObject *
31068+
@@ -1229,7 +1250,7 @@
31069+
Py_DECREF(k);
31070+
Py_DECREF(v);
31071+
}
31072+
-#else
31073+
+#elif !defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && !defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
31074+
if (environ == NULL)
31075+
return d;
31076+
/* This part ignores errors */
31077+
@@ -4444,7 +4465,12 @@
31078+
31079+
command = PyBytes_AsString(command_obj);
31080+
Py_BEGIN_ALLOW_THREADS
31081+
+#if defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
31082+
+ sts = -1;
31083+
+ errno = ENOTSUP;
31084+
+#else
31085+
sts = system(command);
31086+
+#endif
31087+
Py_END_ALLOW_THREADS
31088+
Py_DECREF(command_obj);
31089+
#endif
3102631090
diff -Nru orig/Modules/pwdmodule.c modified/Modules/pwdmodule.c
3102731091
--- orig/Modules/pwdmodule.c 2015-02-03 19:49:04.000000000 +0800
3102831092
+++ modified/Modules/pwdmodule.c 2015-05-02 23:37:06.000000000 +0800
File renamed without changes.

0 commit comments

Comments
 (0)