From 45f8b746dfcc7bc6f94da2994046f86168c984fe Mon Sep 17 00:00:00 2001 From: str4d Date: Fri, 11 Sep 2015 10:51:42 +0000 Subject: [PATCH] Undefine HAVE_FTIME for Android API > 19 The sys/timeb.h header was removed in Android 21, because this header and the ftime function were removed from the POSIX 2008 specification. (Info reference: https://rbcommons.com/s/OpenH264/r/683/diff/1/ ) --- pythonforandroid/recipes/python2/__init__.py | 7 +++++-- .../recipes/python2/patches/fix-ftime-removal.patch | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch diff --git a/pythonforandroid/recipes/python2/__init__.py b/pythonforandroid/recipes/python2/__init__.py index a0806f994e..9e33de90a7 100644 --- a/pythonforandroid/recipes/python2/__init__.py +++ b/pythonforandroid/recipes/python2/__init__.py @@ -11,7 +11,7 @@ class Python2Recipe(Recipe): url = 'http://python.org/ftp/python/{version}/Python-{version}.tar.bz2' name = 'python2' - depends = ['hostpython2'] + depends = ['hostpython2'] conflicts = ['python3'] def prebuild_armeabi(self): @@ -39,6 +39,9 @@ def prebuild_armeabi(self): self.apply_patch(join('patches', 'fix-configure-darwin.patch')) self.apply_patch(join('patches', 'fix-distutils-darwin.patch')) + if self.ctx.android_api > 19: + self.apply_patch(join('patches', 'fix-ftime-removal.patch')) + shprint(sh.touch, join(build_dir, '.patched')) def build_armeabi(self): @@ -125,7 +128,7 @@ def do_python_build(self): _env=env) except sh.ErrorReturnCode_2: print('First python2 make failed. This is expected, trying again.') - + print('Second install (expected to work)') shprint(sh.touch, 'python.exe', 'python') diff --git a/pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch b/pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch new file mode 100644 index 0000000000..5d79a1dc12 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch @@ -0,0 +1,11 @@ +diff -u -r Python-2.7.2.orig/Modules/timemodule.c Python-2.7.2/Modules/timemodule.c +--- Python-2.7.2.orig/Modules/timemodule.c 2011-06-11 15:46:27.000000000 +0000 ++++ Python-2.7.2/Modules/timemodule.c 2015-09-11 10:37:36.708661691 +0000 +@@ -27,6 +27,7 @@ + #include + #endif + ++#undef HAVE_FTIME + #ifdef HAVE_FTIME + #include + #if !defined(MS_WINDOWS) && !defined(PYOS_OS2)