diff --git a/recipes/python3crystax/__init__.py b/recipes/python3crystax/__init__.py index b8d06c6..71e20aa 100644 --- a/recipes/python3crystax/__init__.py +++ b/recipes/python3crystax/__init__.py @@ -170,7 +170,28 @@ class Python3Recipe(TargetPythonRecipe): def prebuild_arch(self, arch): super(Python3Recipe, self).prebuild_arch(arch) if self.version == '3.6' or self.version == '3.7' or self.version == '3.9': - Python3Recipe.patches = ['patch_python3.6.patch', 'remove_android_api_check.patch', 'selectors.patch'] + Python3Recipe.patches = [ + 'patch/patch_python3.6.patch', + 'patch/remove_android_api_check.patch', + 'patch/selectors.patch' + ] + + if self.version == '3.9': + Python3Recipe.patches = [ + 'patch/remove_android_api_check.patch', + 'patch/patch_python3.9.patch', + 'patch/platlibdir.patch', + 'patch/strdup.patch', + + # from https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/python3/__init__.py#L63 + 'patch/pyconfig_detection.patch', + 'patch/reproducible-buildinfo.diff', + 'patch/py3.8.1.patch' + ] + + if sh.which('lld') is not None: + Python3Recipe.patches += ['patch/py3.8.1_fix_cortex_a8.patch'] + build_dir = self.get_build_dir(arch.arch) # copy bundled libffi to _ctypes diff --git a/recipes/python3crystax/android.mk.3.7 b/recipes/python3crystax/android.mk.3.7 deleted file mode 100644 index 47d7b6b..0000000 --- a/recipes/python3crystax/android.mk.3.7 +++ /dev/null @@ -1,194 +0,0 @@ -LOCAL_SRC_FILES := config.c \ - $(MY_PYTHON_SRC_ROOT)/Python/asdl.c \ - $(MY_PYTHON_SRC_ROOT)/Python/ast.c \ - $(MY_PYTHON_SRC_ROOT)/Python/ast_opt.c \ - $(MY_PYTHON_SRC_ROOT)/Python/ast_unparse.c \ - $(MY_PYTHON_SRC_ROOT)/Python/bltinmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Python/bootstrap_hash.c \ - $(MY_PYTHON_SRC_ROOT)/Python/ceval.c \ - $(MY_PYTHON_SRC_ROOT)/Python/codecs.c \ - $(MY_PYTHON_SRC_ROOT)/Python/compile.c \ - $(MY_PYTHON_SRC_ROOT)/Python/context.c \ - $(MY_PYTHON_SRC_ROOT)/Python/dtoa.c \ - $(MY_PYTHON_SRC_ROOT)/Python/dup2.c \ - $(MY_PYTHON_SRC_ROOT)/Python/dynamic_annotations.c \ - $(MY_PYTHON_SRC_ROOT)/Python/dynload_shlib.c \ - $(MY_PYTHON_SRC_ROOT)/Python/errors.c \ - $(MY_PYTHON_SRC_ROOT)/Python/fileutils.c \ - $(MY_PYTHON_SRC_ROOT)/Python/formatter_unicode.c \ - $(MY_PYTHON_SRC_ROOT)/Python/frozen.c \ - $(MY_PYTHON_SRC_ROOT)/Python/frozenmain.c \ - $(MY_PYTHON_SRC_ROOT)/Python/future.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getargs.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getcompiler.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getcopyright.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getopt.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getplatform.c \ - $(MY_PYTHON_SRC_ROOT)/Python/getversion.c \ - $(MY_PYTHON_SRC_ROOT)/Python/graminit.c \ - $(MY_PYTHON_SRC_ROOT)/Python/hamt.c \ - $(MY_PYTHON_SRC_ROOT)/Python/import.c \ - $(MY_PYTHON_SRC_ROOT)/Python/importdl.c \ - $(MY_PYTHON_SRC_ROOT)/Python/marshal.c \ - $(MY_PYTHON_SRC_ROOT)/Python/modsupport.c \ - $(MY_PYTHON_SRC_ROOT)/Python/mysnprintf.c \ - $(MY_PYTHON_SRC_ROOT)/Python/mystrtoul.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pathconfig.c \ - $(MY_PYTHON_SRC_ROOT)/Python/peephole.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pyarena.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pyctype.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pyfpe.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pyhash.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pylifecycle.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pymath.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pystate.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pystrcmp.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pystrhex.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pystrtod.c \ - $(MY_PYTHON_SRC_ROOT)/Python/Python-ast.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pythonrun.c \ - $(MY_PYTHON_SRC_ROOT)/Python/pytime.c \ - $(MY_PYTHON_SRC_ROOT)/Python/strdup.c \ - $(MY_PYTHON_SRC_ROOT)/Python/structmember.c \ - $(MY_PYTHON_SRC_ROOT)/Python/symtable.c \ - $(MY_PYTHON_SRC_ROOT)/Python/sysmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Python/thread.c \ - $(MY_PYTHON_SRC_ROOT)/Python/traceback.c \ - $(MY_PYTHON_SRC_ROOT)/Python/_warnings.c \ - \ - $(MY_PYTHON_SRC_ROOT)/Parser/acceler.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/bitset.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/firstsets.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/grammar.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/grammar1.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/listnode.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/metagrammar.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/myreadline.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/node.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/parser.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/parsetok.c \ - $(MY_PYTHON_SRC_ROOT)/Parser/tokenizer.c \ - \ - $(MY_PYTHON_SRC_ROOT)/Objects/abstract.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/accu.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/boolobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/bytearrayobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/bytes_methods.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/bytesobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/call.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/capsule.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/cellobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/classobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/codeobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/complexobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/descrobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/dictobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/enumobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/exceptions.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/fileobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/floatobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/frameobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/funcobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/genobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/iterobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/listobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/longobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/memoryobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/methodobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/moduleobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/namespaceobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/object.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/obmalloc.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/odictobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/rangeobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/setobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/sliceobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/structseq.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/tupleobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/typeobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/unicodectype.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/unicodeobject.c \ - $(MY_PYTHON_SRC_ROOT)/Objects/weakrefobject.c \ - \ - $(MY_PYTHON_SRC_ROOT)/Modules/_abc.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/arraymodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_asynciomodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/atexitmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/audioop.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/binascii.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_bisectmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_bz2module.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cmathmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_codecsmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_collectionsmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_contextvarsmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_csv.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_datetimemodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/errnomodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/faulthandler.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/fcntlmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_functoolsmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/gcmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/getbuildinfo.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/getpath.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/hashtable.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_heapqmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/itertoolsmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_json.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_localemodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_lsprof.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/main.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_math.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/mathmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/md5module.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/mmapmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_opcode.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_operator.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/ossaudiodev.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/parsermodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/posixmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_posixsubprocess.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/pwdmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_queuemodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_randommodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/resource.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/rotatingtree.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/selectmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/sha1module.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/sha256module.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/sha512module.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/signalmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/socketmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_sre.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_stat.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_struct.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/symtablemodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/termios.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_testbuffer.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_testimportmultiple.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_testmultiphase.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_threadmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/timemodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_tracemalloc.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/unicodedata.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_weakref.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/xxlimited.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/xxmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/xxsubtype.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/zipimport.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/zlibmodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_cn.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_hk.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_iso2022.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_jp.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_kr.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_tw.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/multibytecodec.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/_iomodule.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/textio.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/iobase.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/bufferedio.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/stringio.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/bytesio.c \ - $(MY_PYTHON_SRC_ROOT)/Modules/_io/fileio.c diff --git a/recipes/python3crystax/config.c.3.7 b/recipes/python3crystax/config.c.3.7 deleted file mode 100644 index c7cbbc3..0000000 --- a/recipes/python3crystax/config.c.3.7 +++ /dev/null @@ -1,142 +0,0 @@ -#include - -extern PyObject* PyInit_posix(void); -extern PyObject* PyInit_pwd(void); -extern PyObject* PyInit_fcntl(void); -extern PyObject* PyInit__posixsubprocess(void); -extern PyObject* PyInit_termios(void); -extern PyObject* PyInit_audioop(void); -extern PyObject* PyInit__locale(void); -extern PyObject* PyInit_array(void); -extern PyObject* PyInit_binascii(void); -extern PyObject* PyInit_cmath(void); -extern PyObject* PyInit_errno(void); -extern PyObject* PyInit_faulthandler(void); -extern PyObject* PyInit__tracemalloc(void); -extern PyObject* PyInit_gc(void); -extern PyObject* PyInit_math(void); -extern PyObject* PyInit__md5(void); -extern PyObject* PyInit__operator(void); -extern PyObject* PyInit__signal(void); -extern PyObject* PyInit__sha1(void); -extern PyObject* PyInit__sha256(void); -extern PyObject* PyInit__sha512(void); -extern PyObject* PyInit_time(void); -extern PyObject* PyInit__thread(void); -extern PyObject* PyInit__codecs(void); -extern PyObject* PyInit__weakref(void); -extern PyObject* PyInit_xxsubtype(void); -extern PyObject* PyInit_zipimport(void); -extern PyObject* PyInit__random(void); -extern PyObject* PyInit_itertools(void); -extern PyObject* PyInit__collections(void); -extern PyObject* PyInit__heapq(void); -extern PyObject* PyInit__bisect(void); -extern PyObject* PyInit__symtable(void); -extern PyObject* PyInit_mmap(void); -extern PyObject* PyInit__csv(void); -extern PyObject* PyInit__sre(void); -extern PyObject* PyInit_parser(void); -extern PyObject* PyInit__struct(void); -extern PyObject* PyInit__datetime(void); -extern PyObject* PyInit__functools(void); -extern PyObject* PyInit__json(void); -extern PyObject* PyInit_zlib(void); -extern PyObject* PyInit__multibytecodec(void); -extern PyObject* PyInit__codecs_cn(void); -extern PyObject* PyInit__codecs_hk(void); -extern PyObject* PyInit__codecs_iso2022(void); -extern PyObject* PyInit__codecs_jp(void); -extern PyObject* PyInit__codecs_kr(void); -extern PyObject* PyInit__codecs_tw(void); -extern PyObject* PyInit__winapi(void); -extern PyObject* PyInit__lsprof(void); -extern PyObject* PyInit__ast(void); -extern PyObject* PyInit__io(void); -extern PyObject* PyInit__pickle(void); -extern PyObject* PyInit_atexit(void); -extern PyObject* _PyWarnings_Init(void); -extern PyObject* PyInit__string(void); -extern PyObject* PyInit__stat(void); -extern PyObject* PyInit__opcode(void); -extern PyObject* PyMarshal_Init(void); -extern PyObject* PyInit__imp(void); - -struct _inittab _PyImport_Inittab[] = { - {"posix", PyInit_posix}, - {"pwd", PyInit_pwd}, - {"fcntl", PyInit_fcntl}, - {"_posixsubprocess", PyInit__posixsubprocess}, - {"termios", PyInit_termios}, - {"audioop", PyInit_audioop}, - {"_locale", PyInit__locale}, - {"array", PyInit_array}, - {"_ast", PyInit__ast}, - {"binascii", PyInit_binascii}, - {"cmath", PyInit_cmath}, - {"errno", PyInit_errno}, - {"faulthandler", PyInit_faulthandler}, - {"gc", PyInit_gc}, - {"math", PyInit_math}, - {"_operator", PyInit__operator}, - {"_signal", PyInit__signal}, - {"_md5", PyInit__md5}, - {"_sha1", PyInit__sha1}, - {"_sha256", PyInit__sha256}, - {"_sha512", PyInit__sha512}, - {"time", PyInit_time}, - {"_thread", PyInit__thread}, - {"_tracemalloc", PyInit__tracemalloc}, - {"_codecs", PyInit__codecs}, - {"_weakref", PyInit__weakref}, - {"_random", PyInit__random}, - {"_bisect", PyInit__bisect}, - {"_heapq", PyInit__heapq}, - {"_lsprof", PyInit__lsprof}, - {"itertools", PyInit_itertools}, - {"_collections", PyInit__collections}, - {"_symtable", PyInit__symtable}, - {"mmap", PyInit_mmap}, - {"_csv", PyInit__csv}, - {"_sre", PyInit__sre}, - {"parser", PyInit_parser}, - {"_struct", PyInit__struct}, - {"_datetime", PyInit__datetime}, - {"_functools", PyInit__functools}, - {"_json", PyInit__json}, - - {"xxsubtype", PyInit_xxsubtype}, - {"zipimport", PyInit_zipimport}, - {"zlib", PyInit_zlib}, - - /* CJK codecs */ - {"_multibytecodec", PyInit__multibytecodec}, - {"_codecs_cn", PyInit__codecs_cn}, - {"_codecs_hk", PyInit__codecs_hk}, - {"_codecs_iso2022", PyInit__codecs_iso2022}, - {"_codecs_jp", PyInit__codecs_jp}, - {"_codecs_kr", PyInit__codecs_kr}, - {"_codecs_tw", PyInit__codecs_tw}, - - /* This module "lives in" with marshal.c */ - {"marshal", PyMarshal_Init}, - - /* This lives it with import.c */ - {"_imp", PyInit__imp}, - - /* These entries are here for sys.builtin_module_names */ - {"builtins", NULL}, - {"sys", NULL}, - {"_warnings", _PyWarnings_Init}, - {"_string", PyInit__string}, - - {"_io", PyInit__io}, - {"_pickle", PyInit__pickle}, - {"atexit", PyInit_atexit}, - {"_stat", PyInit__stat}, - {"_opcode", PyInit__opcode}, - - /* Sentinel */ - {0, 0} -}; - diff --git a/recipes/python3crystax/interpreter.c.3.7 b/recipes/python3crystax/interpreter.c.3.7 deleted file mode 100644 index daf2c52..0000000 --- a/recipes/python3crystax/interpreter.c.3.7 +++ /dev/null @@ -1,199 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#define PYTHON3_STDLIB_REL_PATH "stdlib.zip" -#define PYTHON3_MODULES_REL_PATH "modules" -#define PYTHON3_DLL_REL_PATH "libpython3.7m.so" - -#define SYS_PATH_BUFFER_SIZE (2*(PATH_MAX + 1)) - -static char NULL_PTR_STR[] = "NULL"; - -static void GetExecutablePath(char* path) -{ - int size = readlink("/proc/self/exe", path, PATH_MAX); - if (size < 0) - size = 0; - path[size] = 0; -} - -static void GetRelativePathFormat(char* base, char* fmt) -{ - unsigned idx; - char *p, *end; - end = strrchr(base, '/'); - for (idx = 0, p = base; *p; ++p, ++idx) - { - fmt[idx] = *p; - if (p == end) - break; - } - fmt[++idx] = '%'; - fmt[++idx] = 's'; - fmt[++idx] = 0; -} - -typedef void (*Py_SetProgramNamePtr)(wchar_t*); -typedef void (*Py_SetPathPtr)(const wchar_t*); -typedef int (*Py_MainPtr)(int, wchar_t**); -typedef void* (*PyMem_RawMallocPtr)(size_t); -typedef void (*PyMem_RawFreePtr)(void*); -typedef wchar_t* (*Py_DecodeLocalePtr)(const char*, size_t*); - - -int main(int argc, char** argv) -{ - char executable[PATH_MAX + 1] = {0}; - char pthfmt[PATH_MAX + 1] = {0}; - char corepath[PATH_MAX + 1] = {0}; - char stdlibpath[PATH_MAX + 1] = {0}; - char modpath[PATH_MAX + 1] = {0}; - char syspath[SYS_PATH_BUFFER_SIZE] = {0}; - void* core = 0; - int retcode = 126; - int i; - - Py_SetProgramNamePtr Py_SetProgramName = 0; - Py_SetPathPtr Py_SetPath = 0; - Py_MainPtr Py_Main = 0; - PyMem_RawMallocPtr PyMem_RawMalloc = 0; - PyMem_RawFreePtr PyMem_RawFree = 0; - Py_DecodeLocalePtr Py_DecodeLocale = 0; - - GetExecutablePath(executable); - GetRelativePathFormat(executable, pthfmt); - - snprintf(corepath, PATH_MAX, pthfmt, PYTHON3_DLL_REL_PATH); - snprintf(stdlibpath, PATH_MAX, pthfmt, PYTHON3_STDLIB_REL_PATH); - snprintf(modpath, PATH_MAX, pthfmt, PYTHON3_MODULES_REL_PATH); - snprintf(syspath, SYS_PATH_BUFFER_SIZE-1, "%s:%s", stdlibpath, modpath); - - core = dlopen(corepath, RTLD_LAZY); - if (core == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load library: '%s', dlerror: %s\n", corepath, lasterr); - goto exit; - } - - Py_SetProgramName = (Py_SetProgramNamePtr)dlsym(core, "Py_SetProgramName"); - if (Py_SetProgramName == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "Py_SetProgramName", corepath, lasterr); - goto exit; - } - - Py_SetPath = (Py_SetPathPtr)dlsym(core, "Py_SetPath"); - if (Py_SetPath == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "Py_SetPath", corepath, lasterr); - goto exit; - } - - Py_Main = (Py_MainPtr)dlsym(core, "Py_Main"); - if (Py_Main == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "Py_Main", corepath, lasterr); - goto exit; - } - - PyMem_RawMalloc = (PyMem_RawMallocPtr)dlsym(core, "PyMem_RawMalloc"); - if (PyMem_RawMalloc == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "PyMem_RawMalloc", corepath, lasterr); - goto exit; - } - - PyMem_RawFree = (PyMem_RawFreePtr)dlsym(core, "PyMem_RawFree"); - if (PyMem_RawFree == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "PyMem_RawFree", corepath, lasterr); - goto exit; - } - - Py_DecodeLocale = (Py_DecodeLocalePtr)dlsym(core, "Py_DecodeLocale"); - if (Py_DecodeLocale == 0) - { - const char* lasterr = dlerror(); - if (lasterr == 0) - lasterr = NULL_PTR_STR; - fprintf(stderr, "Fatal Python error: cannot load symbol: '%s' from library '%s', dlerror: %s\n", "Py_DecodeLocale", corepath, lasterr); - goto exit; - } - - wchar_t* executable_w = Py_DecodeLocale(executable, 0); - if (executable_w == 0) - { - fprintf(stderr, "Fatal Python error: unable to decode executable path: '%s'\n", executable); - goto exit; - } - - wchar_t* syspath_w = Py_DecodeLocale(syspath, 0); - if (syspath_w == 0) - { - fprintf(stderr, "Fatal Python error: unable to decode syspath: '%s'\n", syspath); - goto exit; - } - - wchar_t** argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*)*(argc+1)); - wchar_t** argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*)*(argc+1)); - - char* oldloc = strdup(setlocale(LC_ALL, 0)); - setlocale(LC_ALL, ""); - for (i = 0; i < argc; ++i) - { - argv_copy[i] = Py_DecodeLocale(argv[i], 0); - if (argv_copy[i] == 0) - { - free(oldloc); - fprintf(stderr, "Fatal Python error: unable to decode the command line argument #%i\n", i + 1); - goto exit; - } - argv_copy2[i] = argv_copy[i]; - } - argv_copy2[argc] = argv_copy[argc] = 0; - setlocale(LC_ALL, oldloc); - free(oldloc); - - Py_SetProgramName(executable_w); - Py_SetPath(syspath_w); - retcode = Py_Main(argc, argv_copy); - - PyMem_RawFree(executable_w); - PyMem_RawFree(syspath_w); - for (i = 0; i < argc; i++) - { - PyMem_RawFree(argv_copy2[i]); - } - PyMem_RawFree(argv_copy); - PyMem_RawFree(argv_copy2); - -exit: - if (core != 0) - dlclose(core); - - return retcode; -} diff --git a/recipes/python3crystax/patch_python3.6.patch b/recipes/python3crystax/patch_python3.6.patch deleted file mode 100644 index 4402d1b..0000000 --- a/recipes/python3crystax/patch_python3.6.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c ---- a/Modules/expat/xmlparse.c -+++ b/Modules/expat/xmlparse.c -@@ -84,6 +84,8 @@ - # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 - #endif - -+#define XML_POOR_ENTROPY 1 -+ - #if !defined(HAVE_GETRANDOM) && !defined(HAVE_SYSCALL_GETRANDOM) \ - && !defined(HAVE_ARC4RANDOM_BUF) && !defined(HAVE_ARC4RANDOM) \ - && !defined(XML_DEV_URANDOM) \ -diff --git a/Modules/getpath.c b/Modules/getpath.c ---- a/Modules/getpath.c -+++ b/Modules/getpath.c -@@ -101,8 +101,35 @@ - #endif - - --#if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) --#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" -+ /* These variables were set this way in old versions of Python, but -+ changed somewhere between 3.5.0 and 3.5.3. Here we just force -+ the old way again. A better solution would be to work out where -+ they should be defined, and make the CrystaX build scripts do -+ so. */ -+ -+/* #if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) */ -+/* #error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" */ -+/* #endif */ -+ -+#ifndef VERSION -+#define VERSION "2.1" -+#endif -+ -+#ifndef VPATH -+#define VPATH "." -+#endif -+ -+#ifndef PREFIX -+# define PREFIX "/usr/local" -+#endif -+ -+#ifndef EXEC_PREFIX -+#define EXEC_PREFIX PREFIX -+#endif -+ -+#ifndef PYTHONPATH -+#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ -+ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" - #endif - - #ifndef LANDMARK -diff --git a/Modules/timemodule.c b/Modules/timemodule.c ---- a/Modules/timemodule.c -+++ b/Modules/timemodule.c -@@ -358,18 +358,20 @@ time_gmtime(PyObject *self, PyObject *args) - #endif - } - --#ifndef HAVE_TIMEGM --static time_t --timegm(struct tm *p) --{ -- /* XXX: the following implementation will not work for tm_year < 1970. -- but it is likely that platforms that don't have timegm do not support -- negative timestamps anyways. */ -- return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 + -- (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 - -- ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400; --} --#endif -+/* In the Android build, HAVE_TIMEGM apparently should be defined but isn't. A better fix would be to work out why and fix that. */ -+ -+/* #ifndef HAVE_TIMEGM */ -+/* static time_t */ -+/* timegm(struct tm *p) */ -+/* { */ -+/* /\* XXX: the following implementation will not work for tm_year < 1970. */ -+/* but it is likely that platforms that don't have timegm do not support */ -+/* negative timestamps anyways. *\/ */ -+/* return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 + */ -+/* (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 - */ -+/* ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400; */ -+/* } */ -+/* #endif */ - - PyDoc_STRVAR(gmtime_doc, - "gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,\n\ diff --git a/recipes/python3crystax/remove_android_api_check.patch b/recipes/python3crystax/remove_android_api_check.patch deleted file mode 100644 index 55613b6..0000000 --- a/recipes/python3crystax/remove_android_api_check.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/configure 2018-10-20 07:04:19.000000000 +0100 -+++ b/configure 2018-12-17 08:26:38.713933919 +0100 -@@ -5650,34 +5650,6 @@ - #endif - EOF - --if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then -- ANDROID_API_LEVEL=`sed -n -e '/__ANDROID_API__/d' -e 's/^android_api = //p' conftest.out` -- _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out` -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5 --$as_echo "$ANDROID_API_LEVEL" >&6; } -- if test -z "$ANDROID_API_LEVEL"; then -- echo 'Fatal: you must define __ANDROID_API__' -- exit 1 -- fi -- --cat >>confdefs.h <<_ACEOF --#define ANDROID_API_LEVEL $ANDROID_API_LEVEL --_ACEOF -- -- -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Android arm ABI" >&5 --$as_echo_n "checking for the Android arm ABI... " >&6; } -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_arm_arch" >&5 --$as_echo "$_arm_arch" >&6; } -- if test "$_arm_arch" = 7; then -- BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16" -- LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8" -- fi --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5 --$as_echo "not Android" >&6; } --fi --rm -f conftest.c conftest.out - - # Check for unsupported systems - case $ac_sys_system/$ac_sys_release in -@@ -18383,4 +18355,3 @@ - echo "" >&6 - echo "" >&6 - fi -- diff --git a/recipes/python3crystax/selectors.patch b/recipes/python3crystax/selectors.patch deleted file mode 100644 index 89e4966..0000000 --- a/recipes/python3crystax/selectors.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/Lib/selectors.py 2018-06-27 00:39:50.000000000 +0100 -+++ b/Lib/selectors.py 2018-10-28 17:39:46.027757518 +0100 -@@ -599,9 +599,9 @@ - # Choose the best implementation, roughly: - # epoll|kqueue|devpoll > poll > select. - # select() also can't accept a FD > FD_SETSIZE (usually around 1024) --if 'KqueueSelector' in globals(): -- DefaultSelector = KqueueSelector --elif 'EpollSelector' in globals(): -+#if 'KqueueSelector' in globals(): -+# DefaultSelector = KqueueSelector -+if 'EpollSelector' in globals(): - DefaultSelector = EpollSelector - elif 'DevpollSelector' in globals(): - DefaultSelector = DevpollSelector diff --git a/scripts/build-target-python.sh b/scripts/build-target-python.sh index 0656a98..d821c96 100755 --- a/scripts/build-target-python.sh +++ b/scripts/build-target-python.sh @@ -350,7 +350,11 @@ build_python_for_abi () echo " --with-threads \\" echo " --enable-ipv6 \\" echo " --with-computed-gotos \\" - echo " --without-ensurepip" + echo " ac_cv_file__dev_ptmx=yes \\" + echo " ac_cv_file__dev_ptc=no \\" + echo " --without-ensurepip \\" + echo " ac_cv_little_endian_double=yes \\" + echo " --exec-prefix=/usr/local" fi } >$CONFIGURE_WRAPPER fail_panic "Can't create configure wrapper" @@ -382,8 +386,8 @@ build_python_for_abi () if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI" else - local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"'m' - local PYTHON_SOABI='cpython-'"$PYTHON_ABI"'m' + local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI" + local PYTHON_SOABI='cpython-'"$PYTHON_ABI" fi { echo 'LOCAL_PATH := $(call my-dir)' @@ -391,6 +395,8 @@ build_python_for_abi () echo "LOCAL_MODULE := $PYTHON_CORE_MODULE_NAME" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include' + echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/internal' + echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/cpython' if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then echo "LOCAL_CFLAGS := -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\"" else @@ -951,6 +957,64 @@ build_python_for_abi () log "Install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES" run cp -p -T $OBJDIR_UNICODEDATA/libunicodedata.so $PYBIN_INSTALLDIR_MODULES/unicodedata.so fail_panic "Can't install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES" + +# _json speedups + local BUILDDIR_JSON="$BUILDDIR/json" + local OBJDIR_JSON="$BUILDDIR_JSON/obj/local/$ABI" + + run mkdir -p "$BUILDDIR_JSON/jni" + fail_panic "Can't create directory: $BUILDDIR_JSON/jni" + + { + echo 'LOCAL_PATH := $(call my-dir)' + echo 'include $(CLEAR_VARS)' + echo 'LOCAL_MODULE := _json' + echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" + echo 'LOCAL_SRC_FILES := \' + echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_json.c' + echo 'LOCAL_STATIC_LIBRARIES := python_shared' + echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal' + echo 'LOCAL_C_FLAGS := -DPy_BUILD_CORE_MODULE' + echo 'include $(BUILD_SHARED_LIBRARY)' + echo "\$(call import-module,python/$PYTHON_ABI)" + } >$BUILDDIR_JSON/jni/Android.mk + fail_panic "Can't generate $BUILDDIR_JSON/jni/Android.mk" + + run $NDK_DIR/ndk-build -C $BUILDDIR_JSON -j$NUM_JOBS APP_ABI=$ABI V=1 + fail_panic "Can't build python$PYTHON_ABI-$ABI module '_json'" + + log "Install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES" + run cp -p -T $OBJDIR_JSON/lib_json.so $PYBIN_INSTALLDIR_MODULES/_json.so + fail_panic "Can't install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES" + +# _pickle accelerator + local BUILDDIR_PICKLE="$BUILDDIR/pickle" + local OBJDIR_PICKLE="$BUILDDIR_PICKLE/obj/local/$ABI" + + run mkdir -p "$BUILDDIR_PICKLE/jni" + fail_panic "Can't create directory: $BUILDDIR_PICKLE/jni" + + { + echo 'LOCAL_PATH := $(call my-dir)' + echo 'include $(CLEAR_VARS)' + echo 'LOCAL_MODULE := _pickle' + echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" + echo 'LOCAL_SRC_FILES := \' + echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c' + echo 'LOCAL_STATIC_LIBRARIES := python_shared' + echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal' + echo 'LOCAL_C_FLAGS := -DPy_BUILD_CORE_MODULE' + echo 'include $(BUILD_SHARED_LIBRARY)' + echo "\$(call import-module,python/$PYTHON_ABI)" + } >$BUILDDIR_PICKLE/jni/Android.mk + fail_panic "Can't generate $BUILDDIR_PICKLE/jni/Android.mk" + + run $NDK_DIR/ndk-build -C $BUILDDIR_PICKLE -j$NUM_JOBS APP_ABI=$ABI V=1 + fail_panic "Can't build python$PYTHON_ABI-$ABI module '_pickle'" + + log "Install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES" + run cp -p -T $OBJDIR_PICKLE/lib_pickle.so $PYBIN_INSTALLDIR_MODULES/_pickle.so + fail_panic "Can't install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES" } if [ -n "$PACKAGE_DIR" ]; then