From ecae875497aeb9c8c950cd41c3b9e371d9a4183e Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 12:30:28 +0100 Subject: [PATCH 01/66] Refactor hostpython3's recipe into a new base class HostPythonRecipe To make it use as a base class for hostpython2 and hostpython3 recipes in a near future. --- pythonforandroid/python.py | 82 +++++++++++++++++++ .../recipes/hostpython3/__init__.py | 52 ++---------- 2 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 pythonforandroid/python.py diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py new file mode 100644 index 0000000000..932ac3fd99 --- /dev/null +++ b/pythonforandroid/python.py @@ -0,0 +1,82 @@ +from os.path import exists, join +import sh + +from pythonforandroid.recipe import Recipe +from pythonforandroid.logger import info, shprint +from pythonforandroid.util import current_directory, ensure_dir + + +class HostPythonRecipe(Recipe): + ''' + This is the base class for hostpython3 and hostpython2 recipes. This class + will take care to do all the work to build a hostpython recipe but, be + careful, it is intended to be subclassed because some of the vars needs to + be set: + + - :attr:`name` + - :attr:`version` + + .. versionadded:: 0.6.0 + Refactored from the hostpython3's recipe by inclement + ''' + + name = '' + '''The hostpython's recipe name. This should be ``hostpython2`` or + ``hostpython3`` + + .. warning:: This must be set in inherited class.''' + + version = '' + '''The hostpython's recipe version. + + .. warning:: This must be set in inherited class.''' + + build_subdir = 'native-build' + '''Specify the sub build directory for the hostpython recipe. Defaults + to ``native-build``.''' + + url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' + '''The default url to download our host python recipe. This url will + change depending on the python version set in attribute :attr:`version`.''' + + def get_build_container_dir(self, arch=None): + choices = self.check_recipe_choices() + dir_name = '-'.join([self.name] + choices) + return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop') + + def get_build_dir(self, arch=None): + ''' + .. note:: Unlike other recipes, the hostpython build dir doesn't + depend on the target arch + ''' + return join(self.get_build_container_dir(), self.name) + + def get_path_to_python(self): + return join(self.get_build_dir(), self.build_subdir) + + def build_arch(self, arch): + recipe_build_dir = self.get_build_dir(arch.arch) + + # Create a subdirectory to actually perform the build + build_dir = join(recipe_build_dir, self.build_subdir) + ensure_dir(build_dir) + + if not exists(join(build_dir, 'python')): + with current_directory(recipe_build_dir): + # Configure the build + with current_directory(build_dir): + if not exists('config.status'): + shprint( + sh.Command(join(recipe_build_dir, 'configure'))) + + # Create the Setup file. This copying from Setup.dist + # seems to be the normal and expected procedure. + shprint(sh.cp, join('Modules', 'Setup.dist'), + join(build_dir, 'Modules', 'Setup')) + + result = shprint(sh.make, '-C', build_dir) + else: + info('Skipping {name} ({version}) build, as it has already ' + 'been completed'.format(name=self.name, version=self.version)) + + self.ctx.hostpython = join(build_dir, 'python') diff --git a/pythonforandroid/recipes/hostpython3/__init__.py b/pythonforandroid/recipes/hostpython3/__init__.py index c34de54efd..8b268bdd4f 100644 --- a/pythonforandroid/recipes/hostpython3/__init__.py +++ b/pythonforandroid/recipes/hostpython3/__init__.py @@ -1,53 +1,17 @@ -from pythonforandroid.toolchain import Recipe, shprint, info -from pythonforandroid.util import ensure_dir, current_directory -from os.path import join, exists -import sh +from pythonforandroid.python import HostPythonRecipe -BUILD_SUBDIR = 'native-build' +class Hostpython3Recipe(HostPythonRecipe): + ''' + The hostpython3's recipe. -class Hostpython3Recipe(Recipe): + .. versionchanged:: 0.6.0 + Refactored into the new class + :class:`~pythonforandroid.python.HostPythonRecipe` + ''' version = '3.7.1' - url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' name = 'hostpython3' - conflicts = ['hostpython2', 'hostpython3crystax'] - def get_build_container_dir(self, arch=None): - choices = self.check_recipe_choices() - dir_name = '-'.join([self.name] + choices) - return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop') - - def get_build_dir(self, arch=None): - # Unlike other recipes, the hostpython build dir doesn't depend on the target arch - return join(self.get_build_container_dir(), self.name) - - def get_path_to_python(self): - return join(self.get_build_dir(), BUILD_SUBDIR) - - def build_arch(self, arch): - recipe_build_dir = self.get_build_dir(arch.arch) - - # Create a subdirectory to actually perform the build - build_dir = join(recipe_build_dir, BUILD_SUBDIR) - ensure_dir(build_dir) - - if not exists(join(build_dir, 'python')): - with current_directory(recipe_build_dir): - # Configure the build - with current_directory(build_dir): - if not exists('config.status'): - shprint(sh.Command(join(recipe_build_dir, 'configure'))) - - # Create the Setup file. This copying from Setup.dist - # seems to be the normal and expected procedure. - shprint(sh.cp, join('Modules', 'Setup.dist'), join(build_dir, 'Modules', 'Setup')) - - result = shprint(sh.make, '-C', build_dir) - else: - info('Skipping hostpython3 build as it has already been completed') - - self.ctx.hostpython = join(build_dir, 'python') - recipe = Hostpython3Recipe() From dd2b40246ff28af4c39f2d1f0ee6af7792824667 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 12:57:12 +0100 Subject: [PATCH 02/66] Refactor python3's recipe into a new base class GuestPythonRecipe To make it use as a base class for python2 and python3 recipes in a near future. --- pythonforandroid/python.py | 297 ++++++++++++++++++- pythonforandroid/recipes/python3/__init__.py | 243 ++------------- 2 files changed, 315 insertions(+), 225 deletions(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index 932ac3fd99..b3970d9d95 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -1,9 +1,298 @@ -from os.path import exists, join +''' +This module is kind of special because it contains the base classes used to +build our python3 and python2 recipes and his corresponding hostpython recipes. +''' + +from os.path import dirname, exists, join +from os import environ +import glob import sh -from pythonforandroid.recipe import Recipe -from pythonforandroid.logger import info, shprint -from pythonforandroid.util import current_directory, ensure_dir +from pythonforandroid.recipe import Recipe, TargetPythonRecipe +from pythonforandroid.logger import logger, info, error, shprint +from pythonforandroid.util import ( + current_directory, ensure_dir, walk_valid_filens, + BuildInterruptingException) + + +class GuestPythonRecipe(TargetPythonRecipe): + ''' + Class for target python recipes. Sets ctx.python_recipe to point to itself, + so as to know later what kind of Python was built or used. + + This base class is used for our main python recipes (python2 and python3) + which shares most of the build process. + + .. versionadded:: 0.6.0 + Refactored from the inclement's python3 recipe with a few changes: + + - Splits the python's build process several methods: :meth:`build_arch` + and :meth:`get_recipe_env`. + - Adds the attribute :attr:`configure_args`, which has been moved from + the method :meth:`build_arch` into a static class variable. + - Adds some static class variables used to create the python bundle and + modifies the method :meth:`create_python_bundle`, to adapt to the new + situation. The added static class variables are: + :attr:`stdlib_dir_blacklist`, :attr:`stdlib_filen_blacklist`, + :attr:`site_packages_dir_blacklist`and + :attr:`site_packages_filen_blacklist`. + ''' + + MIN_NDK_API = 21 + '''Sets the minimal ndk api number needed to use the recipe. + + .. warning:: This recipe can be built only against API 21+, so it means + that any class which inherits from class:`GuestPythonRecipe` will have + this limitation. + ''' + + from_crystax = False + '''True if the python is used from CrystaX, False otherwise (i.e. if + it is built by p4a).''' + + configure_args = () + '''The configure arguments needed to build the python recipe. Those are + used in method :meth:`build_arch` (if not overwritten like python3crystax's + recipe does). + + .. note:: This variable should be properly set in subclass. + ''' + + stdlib_dir_blacklist = { + '__pycache__', + 'test', + 'tests', + 'lib2to3', + 'ensurepip', + 'idlelib', + 'tkinter', + } + '''The directories that we want to omit for our python bundle''' + + stdlib_filen_blacklist = [ + '*.pyc', + '*.exe', + '*.whl', + ] + '''The file extensions that we want to blacklist for our python bundle''' + + site_packages_dir_blacklist = { + '__pycache__', + 'tests' + } + '''The directories from site packages dir that we don't want to be included + in our python bundle.''' + + site_packages_filen_blacklist = [] + '''The file extensions from site packages dir that we don't want to be + included in our python bundle.''' + + opt_depends = ['libffi'] + '''The optional libraries which we would like to get our python linked''' + + def __init__(self, *args, **kwargs): + self._ctx = None + super(GuestPythonRecipe, self).__init__(*args, **kwargs) + + def get_recipe_env(self, arch=None, with_flags_in_cc=True): + if self.from_crystax: + return \ + super(GuestPythonRecipe, self).get_recipe_env( + arch=arch, with_flags_in_cc=with_flags_in_cc) + + env = environ.copy() + platform_name = 'android-{}'.format(self.ctx.ndk_api) + + # TODO: Get this information from p4a's arch system + android_host = env['HOSTARCH'] = 'arm-linux-androideabi' + + toolchain = '{android_host}-4.9'.format(android_host=android_host) + toolchain = join(self.ctx.ndk_dir, 'toolchains', + toolchain, 'prebuilt', 'linux-x86_64') + + target_data = arch.command_prefix.split('-') + if target_data[0] == 'arm': + target_data[0] = 'armv7a' + target = '-'.join( + [target_data[0], 'none', target_data[1], target_data[2]]) + + env['CC'] = \ + '{clang} -target {target} -gcc-toolchain {toolchain}'.format( + clang=join(self.ctx.ndk_dir, 'toolchains', 'llvm', 'prebuilt', + 'linux-x86_64', 'bin', 'clang'), + target=target, + toolchain=toolchain) + env['AR'] = join(toolchain, 'bin', android_host) + '-ar' + env['LD'] = join(toolchain, 'bin', android_host) + '-ld' + env['RANLIB'] = join(toolchain, 'bin', android_host) + '-ranlib' + env['READELF'] = join(toolchain, 'bin', android_host) + '-readelf' + env['STRIP'] = \ + join(toolchain, 'bin', android_host) + \ + '-strip --strip-debug --strip-unneeded' + + env['PATH'] = \ + '{hostpython_dir}:{old_path}'.format( + hostpython_dir=self.get_recipe( + 'host' + self.name, self.ctx).get_path_to_python(), + old_path=env['PATH']) + + ndk_flags = ( + '-fPIC --sysroot={ndk_sysroot} -D__ANDROID_API__={android_api} ' + '-isystem {ndk_android_host}').format( + ndk_sysroot=join(self.ctx.ndk_dir, 'sysroot'), + android_api=self.ctx.ndk_api, + ndk_android_host=join( + self.ctx.ndk_dir, 'sysroot', 'usr', 'include', + android_host)) + sysroot = join(self.ctx.ndk_dir, 'platforms', + platform_name, 'arch-arm') + env['CFLAGS'] = env.get('CFLAGS', '') + ' ' + ndk_flags + env['CPPFLAGS'] = env.get('CPPFLAGS', '') + ' ' + ndk_flags + env['LDFLAGS'] = env.get('LDFLAGS', '') + ' --sysroot={} -L{}'.format( + sysroot, join(sysroot, 'usr', 'lib')) + + # Manually add the libs directory, and copy some object + # files to the current directory otherwise they aren't + # picked up. This seems necessary because the --sysroot + # setting in LDFLAGS is overridden by the other flags. + # TODO: Work out why this doesn't happen in the original + # bpo-30386 Makefile system. + logger.warning('Doing some hacky stuff to link properly') + lib_dir = join(sysroot, 'usr', 'lib') + if arch.arch == 'x86_64': + lib_dir = join(sysroot, 'usr', 'lib64') + env['LDFLAGS'] += ' -L{}'.format(lib_dir) + shprint(sh.cp, join(lib_dir, 'crtbegin_so.o'), './') + shprint(sh.cp, join(lib_dir, 'crtend_so.o'), './') + + env['SYSROOT'] = sysroot + + return env + + def set_libs_flags(self, env, arch): + '''Takes care to properly link libraries with python depending on our + requirements and the attribute :attr:`opt_depends`. + ''' + if 'libffi' in self.ctx.recipe_build_order: + info('Activating flags for libffi') + recipe = Recipe.get_recipe('libffi', self.ctx) + include = ' -I' + ' -I'.join(recipe.get_include_dirs(arch)) + ldflag = ' -L' + join(recipe.get_build_dir(arch.arch), + recipe.get_host(arch), '.libs') + ' -lffi' + env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include + env['LDFLAGS'] = env.get('LDFLAGS', '') + ldflag + return env + + def prebuild_arch(self, arch): + super(TargetPythonRecipe, self).prebuild_arch(arch) + if self.from_crystax and self.ctx.ndk != 'crystax': + error('The {} recipe can only be built when ' + 'using the CrystaX NDK. Exiting.'.format(self.name)) + exit(1) + self.ctx.python_recipe = self + + def build_arch(self, arch): + if self.ctx.ndk_api < self.MIN_NDK_API: + raise BuildInterruptingException( + 'Target ndk-api is {}, but the python3 recipe supports only' + ' {}+'.format(self.ctx.ndk_api, self.MIN_NDK_API)) + + recipe_build_dir = self.get_build_dir(arch.arch) + + # Create a subdirectory to actually perform the build + build_dir = join(recipe_build_dir, 'android-build') + ensure_dir(build_dir) + + # TODO: Get these dynamically, like bpo-30386 does + sys_prefix = '/usr/local' + sys_exec_prefix = '/usr/local' + + with current_directory(build_dir): + env = self.get_recipe_env(arch) + env = self.set_libs_flags(env, arch) + + android_build = sh.Command( + join(recipe_build_dir, + 'config.guess'))().stdout.strip().decode('utf-8') + + if not exists('config.status'): + shprint( + sh.Command(join(recipe_build_dir, 'configure')), + *(' '.join(self.configure_args).format( + android_host=env['HOSTARCH'], + android_build=android_build, + prefix=sys_prefix, + exec_prefix=sys_exec_prefix)).split(' '), + _env=env) + + if not exists('python'): + shprint(sh.make, 'all', _env=env) + + # TODO: Look into passing the path to pyconfig.h in a + # better way, although this is probably acceptable + sh.cp('pyconfig.h', join(recipe_build_dir, 'Include')) + + def include_root(self, arch_name): + return join(self.get_build_dir(arch_name), 'Include') + + def link_root(self, arch_name): + return join(self.get_build_dir(arch_name), 'android-build') + + def create_python_bundle(self, dirn, arch): + """ + Create a packaged python bundle in the target directory, by + copying all the modules and standard library to the right + place. + """ + # Bundle compiled python modules to a folder + modules_dir = join(dirn, 'modules') + ensure_dir(modules_dir) + # Todo: find a better way to find the build libs folder + modules_build_dir = join( + self.get_build_dir(arch.arch), + 'android-build', + 'build', + 'lib.linux{}-arm-{}'.format( + '2' if self.version[0] == '2' else '', + self.major_minor_version_string + )) + module_filens = (glob.glob(join(modules_build_dir, '*.so')) + + glob.glob(join(modules_build_dir, '*.py'))) + for filen in module_filens: + shprint(sh.cp, filen, modules_dir) + + # zip up the standard library + stdlib_zip = join(dirn, 'stdlib.zip') + with current_directory(join(self.get_build_dir(arch.arch), 'Lib')): + stdlib_filens = walk_valid_filens( + '.', self.stdlib_dir_blacklist, self.stdlib_filen_blacklist) + shprint(sh.zip, stdlib_zip, *stdlib_filens) + + # copy the site-packages into place + ensure_dir(join(dirn, 'site-packages')) + # TODO: Improve the API around walking and copying the files + with current_directory(self.ctx.get_python_install_dir()): + filens = list(walk_valid_filens( + '.', self.site_packages_dir_blacklist, + self.site_packages_filen_blacklist)) + for filen in filens: + ensure_dir(join(dirn, 'site-packages', dirname(filen))) + sh.cp(filen, join(dirn, 'site-packages', filen)) + + # copy the python .so files into place + python_build_dir = join(self.get_build_dir(arch.arch), + 'android-build') + python_lib_name = 'libpython' + self.major_minor_version_string + if self.major_minor_version_string[0] == '3': + python_lib_name += 'm' + for lib in [python_lib_name + '.so', python_lib_name + '.so.1.0']: + shprint(sh.cp, join(python_build_dir, lib), + 'libs/{}'.format(arch.arch)) + + info('Renaming .so files to reflect cross-compile') + self.reduce_object_file_names(join(dirn, 'site-packages')) + + return join(dirn, 'site-packages') class HostPythonRecipe(Recipe): diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 490e955052..83fe39e8d5 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -1,238 +1,39 @@ -from pythonforandroid.recipe import TargetPythonRecipe, Recipe -from pythonforandroid.toolchain import shprint, current_directory -from pythonforandroid.logger import logger, info -from pythonforandroid.util import ensure_dir, walk_valid_filens, BuildInterruptingException -from os.path import exists, join, dirname -from os import environ -import glob -import sh +from pythonforandroid.python import GuestPythonRecipe -STDLIB_DIR_BLACKLIST = { - '__pycache__', - 'test', - 'tests', - 'lib2to3', - 'ensurepip', - 'idlelib', - 'tkinter', -} -STDLIB_FILEN_BLACKLIST = [ - '*.pyc', - '*.exe', - '*.whl', -] - -# TODO: Move to a generic location so all recipes use the same blacklist -SITE_PACKAGES_DIR_BLACKLIST = { - '__pycache__', - 'tests' -} +class Python3Recipe(GuestPythonRecipe): + ''' + The python3's recipe. -SITE_PACKAGES_FILEN_BLACKLIST = [] + .. note:: This recipe can be built only against API 21+. Also, in order to + build certain python modules, we need to add some extra recipes to our + build requirements: + - ctypes: you must add the recipe for ``libffi``. -class Python3Recipe(TargetPythonRecipe): + .. versionchanged:: 0.6.0 + Refactored into class + :class:`~pythonforandroid.python.GuestPythonRecipe` ''' - .. note:: - In order to build certain python modules, we need to add some extra - recipes to our build requirements: - - ctypes: you must add the recipe for ``libffi``. - ''' version = '3.7.1' url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' name = 'python3' depends = ['hostpython3'] conflicts = ['python3crystax', 'python2'] - opt_depends = ['libffi'] - - # This recipe can be built only against API 21+ - MIN_NDK_API = 21 - - def set_libs_flags(self, env, arch): - '''Takes care to properly link libraries with python depending on our - requirements and the attribute :attr:`opt_depends`. - ''' - if 'libffi' in self.ctx.recipe_build_order: - info('Activating flags for libffi') - recipe = Recipe.get_recipe('libffi', self.ctx) - include = ' -I' + ' -I'.join(recipe.get_include_dirs(arch)) - ldflag = ' -L' + join(recipe.get_build_dir(arch.arch), - recipe.get_host(arch), '.libs') + ' -lffi' - env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include - env['LDFLAGS'] = env.get('LDFLAGS', '') + ldflag - return env - - def build_arch(self, arch): - if self.ctx.ndk_api < self.MIN_NDK_API: - raise BuildInterruptingException( - 'Target ndk-api is {}, but the python3 recipe supports only {}+'.format( - self.ctx.ndk_api, self.MIN_NDK_API)) - - recipe_build_dir = self.get_build_dir(arch.arch) - - # Create a subdirectory to actually perform the build - build_dir = join(recipe_build_dir, 'android-build') - ensure_dir(build_dir) - - # TODO: Get these dynamically, like bpo-30386 does - sys_prefix = '/usr/local' - sys_exec_prefix = '/usr/local' - - # Skipping "Ensure that nl_langinfo is broken" from the original bpo-30386 - - platform_name = 'android-{}'.format(self.ctx.ndk_api) - - with current_directory(build_dir): - env = environ.copy() - - # TODO: Get this information from p4a's arch system - android_host = arch.command_prefix - android_build = sh.Command(join(recipe_build_dir, 'config.guess'))().stdout.strip().decode('utf-8') - platform_dir = join(self.ctx.ndk_dir, 'platforms', platform_name, arch.platform_dir) - toolchain = '{android_host}-4.9'.format(android_host=arch.toolchain_prefix) - toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') - - target_data = arch.command_prefix.split('-') - if target_data[0] == 'arm': - target_data[0] = 'armv7a' - target = '-'.join([target_data[0], 'none', target_data[1], target_data[2]]) - - CC = '{clang} -target {target} -gcc-toolchain {toolchain}'.format( - clang=join(self.ctx.ndk_dir, 'toolchains', 'llvm', 'prebuilt', 'linux-x86_64', 'bin', 'clang'), - target=target, - toolchain=toolchain) - - AR = join(toolchain, 'bin', android_host) + '-ar' - LD = join(toolchain, 'bin', android_host) + '-ld' - RANLIB = join(toolchain, 'bin', android_host) + '-ranlib' - READELF = join(toolchain, 'bin', android_host) + '-readelf' - STRIP = join(toolchain, 'bin', android_host) + '-strip --strip-debug --strip-unneeded' - - env['CC'] = CC - env['AR'] = AR - env['LD'] = LD - env['RANLIB'] = RANLIB - env['READELF'] = READELF - env['STRIP'] = STRIP - - env['PATH'] = '{hostpython_dir}:{old_path}'.format( - hostpython_dir=self.get_recipe('hostpython3', self.ctx).get_path_to_python(), - old_path=env['PATH']) - - ndk_flags = ('-fPIC --sysroot={ndk_sysroot} -D__ANDROID_API__={android_api} ' - '-isystem {ndk_android_host}').format( - ndk_sysroot=join(self.ctx.ndk_dir, 'sysroot'), - android_api=self.ctx.ndk_api, - ndk_android_host=join( - self.ctx.ndk_dir, 'sysroot', 'usr', 'include', android_host)) - sysroot = join(self.ctx.ndk_dir, 'platforms', platform_name, arch.platform_dir) - env['CFLAGS'] = env.get('CFLAGS', '') + ' ' + ndk_flags - env['CPPFLAGS'] = env.get('CPPFLAGS', '') + ' ' + ndk_flags - env['LDFLAGS'] = env.get('LDFLAGS', '') + ' --sysroot={} -L{}'.format(sysroot, join(sysroot, 'usr', 'lib')) - - # Manually add the libs directory, and copy some object - # files to the current directory otherwise they aren't - # picked up. This seems necessary because the --sysroot - # setting in LDFLAGS is overridden by the other flags. - # TODO: Work out why this doesn't happen in the original - # bpo-30386 Makefile system. - logger.warning('Doing some hacky stuff to link properly') - lib_dir = join(sysroot, 'usr', 'lib') - if arch.arch == 'x86_64': - lib_dir = join(sysroot, 'usr', 'lib64') - env['LDFLAGS'] += ' -L{}'.format(lib_dir) - shprint(sh.cp, join(lib_dir, 'crtbegin_so.o'), './') - shprint(sh.cp, join(lib_dir, 'crtend_so.o'), './') - - env['SYSROOT'] = sysroot - - env = self.set_libs_flags(env, arch) - - if not exists('config.status'): - shprint(sh.Command(join(recipe_build_dir, 'configure')), - *(' '.join(('--host={android_host}', - '--build={android_build}', - '--enable-shared', - '--disable-ipv6', - 'ac_cv_file__dev_ptmx=yes', - 'ac_cv_file__dev_ptc=no', - '--without-ensurepip', - 'ac_cv_little_endian_double=yes', - '--prefix={prefix}', - '--exec-prefix={exec_prefix}')).format( - android_host=android_host, - android_build=android_build, - prefix=sys_prefix, - exec_prefix=sys_exec_prefix)).split(' '), _env=env) - - if not exists('python'): - shprint(sh.make, 'all', _env=env) - - # TODO: Look into passing the path to pyconfig.h in a - # better way, although this is probably acceptable - sh.cp('pyconfig.h', join(recipe_build_dir, 'Include')) - - def include_root(self, arch_name): - return join(self.get_build_dir(arch_name), - 'Include') - - def link_root(self, arch_name): - return join(self.get_build_dir(arch_name), - 'android-build') - - def create_python_bundle(self, dirn, arch): - ndk_dir = self.ctx.ndk_dir - - # Bundle compiled python modules to a folder - modules_dir = join(dirn, 'modules') - ensure_dir(modules_dir) - - modules_build_dir = join( - self.get_build_dir(arch.arch), - 'android-build', - 'build', - 'lib.linux-arm-3.7') - module_filens = (glob.glob(join(modules_build_dir, '*.so')) + - glob.glob(join(modules_build_dir, '*.py'))) - for filen in module_filens: - shprint(sh.cp, filen, modules_dir) - - # zip up the standard library - stdlib_zip = join(dirn, 'stdlib.zip') - with current_directory(join(self.get_build_dir(arch.arch), 'Lib')): - stdlib_filens = walk_valid_filens( - '.', STDLIB_DIR_BLACKLIST, STDLIB_FILEN_BLACKLIST) - shprint(sh.zip, stdlib_zip, *stdlib_filens) - - # copy the site-packages into place - ensure_dir(join(dirn, 'site-packages')) - # TODO: Improve the API around walking and copying the files - with current_directory(self.ctx.get_python_install_dir()): - filens = list(walk_valid_filens( - '.', SITE_PACKAGES_DIR_BLACKLIST, SITE_PACKAGES_FILEN_BLACKLIST)) - for filen in filens: - ensure_dir(join(dirn, 'site-packages', dirname(filen))) - sh.cp(filen, join(dirn, 'site-packages', filen)) - - # copy the python .so files into place - python_build_dir = join(self.get_build_dir(arch.arch), - 'android-build') - shprint(sh.cp, - join(python_build_dir, - 'libpython{}m.so'.format(self.major_minor_version_string)), - 'libs/{}'.format(arch.arch)) - shprint(sh.cp, - join(python_build_dir, - 'libpython{}m.so.1.0'.format(self.major_minor_version_string)), - 'libs/{}'.format(arch.arch)) - - info('Renaming .so files to reflect cross-compile') - self.reduce_object_file_names(join(dirn, 'site-packages')) - return join(dirn, 'site-packages') + configure_args = ( + '--host={android_host}', + '--build={android_build}', + '--enable-shared', + '--disable-ipv6', + 'ac_cv_file__dev_ptmx=yes', + 'ac_cv_file__dev_ptc=no', + '--without-ensurepip', + 'ac_cv_little_endian_double=yes', + '--prefix={prefix}', + '--exec-prefix={exec_prefix}') recipe = Python3Recipe() From 883849e781c0e6ef9723964f8c243f2a2ee26b32 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 13:10:24 +0100 Subject: [PATCH 03/66] Move hostpython2 and python2 recipes to a new name hostpython2legacy and python2legacy. This recipes will be useless until properly fixed or maybe it will be removed... --- .../{hostpython2 => hostpython2legacy}/Setup | 0 .../__init__.py | 15 +- .../fix-segfault-pygchead.patch | 0 .../Setup.local-ssl | 0 .../{python2 => python2legacy}/__init__.py | 31 +- .../Python-2.7.2-ctypes-disable-wchar.patch | 0 .../patches/Python-2.7.2-xcompile.patch | 0 .../Python-2.7.2-xcompile.patch-backup | 0 .../patches/Python-2.7.2-xcompile.patch-new | 0 .../patches/_scproxy.py | 0 .../patches/ctypes-find-library-updated.patch | 0 .../patches/ctypes-find-library.patch | 0 .../patches/custom-loader.patch | 0 .../patches/disable-modules.patch | 0 .../patches/disable-openpty.patch | 0 .../patches/enable-ssl.patch | 0 .../patches/fix-configure-darwin.patch | 0 .../patches/fix-distutils-darwin.patch | 0 .../patches/fix-dlfcn.patch | 0 .../patches/fix-dynamic-lookup.patch | 0 .../fix-filesystemdefaultencoding.patch | 0 .../patches/fix-ftime-removal.patch | 0 .../patches/fix-gethostbyaddr.patch | 0 .../patches/fix-locale.patch | 0 .../patches/fix-remove-corefoundation.patch | 0 .../patches/fix-setup-flags.patch | 0 .../patches/fix-termios.patch | 0 .../patches/parsetuple.patch | 0 .../{python2 => python2legacy}/patches/t.htm | 0 .../patches/t_files/a899e84.jpg | Bin .../patches/t_files/analytics.js | 0 .../patches/t_files/b0dcca.css | 382 +++++++++--------- .../patches/t_files/jquery.js | 0 .../patches/t_files/json2.js | 0 .../patches/t_files/legal_hacks.png | Bin .../patches/t_files/te-news.png | Bin .../patches/t_files/terrible_small_logo.png | Bin .../patches/verbose-compilation.patch | 0 38 files changed, 221 insertions(+), 207 deletions(-) rename pythonforandroid/recipes/{hostpython2 => hostpython2legacy}/Setup (100%) rename pythonforandroid/recipes/{hostpython2 => hostpython2legacy}/__init__.py (82%) rename pythonforandroid/recipes/{hostpython2 => hostpython2legacy}/fix-segfault-pygchead.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/Setup.local-ssl (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/__init__.py (92%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/Python-2.7.2-ctypes-disable-wchar.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/Python-2.7.2-xcompile.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/Python-2.7.2-xcompile.patch-backup (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/Python-2.7.2-xcompile.patch-new (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/_scproxy.py (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/ctypes-find-library-updated.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/ctypes-find-library.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/custom-loader.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/disable-modules.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/disable-openpty.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/enable-ssl.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-configure-darwin.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-distutils-darwin.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-dlfcn.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-dynamic-lookup.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-filesystemdefaultencoding.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-ftime-removal.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-gethostbyaddr.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-locale.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-remove-corefoundation.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-setup-flags.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/fix-termios.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/parsetuple.patch (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t.htm (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/a899e84.jpg (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/analytics.js (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/b0dcca.css (94%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/jquery.js (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/json2.js (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/legal_hacks.png (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/te-news.png (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/t_files/terrible_small_logo.png (100%) rename pythonforandroid/recipes/{python2 => python2legacy}/patches/verbose-compilation.patch (100%) diff --git a/pythonforandroid/recipes/hostpython2/Setup b/pythonforandroid/recipes/hostpython2legacy/Setup similarity index 100% rename from pythonforandroid/recipes/hostpython2/Setup rename to pythonforandroid/recipes/hostpython2legacy/Setup diff --git a/pythonforandroid/recipes/hostpython2/__init__.py b/pythonforandroid/recipes/hostpython2legacy/__init__.py similarity index 82% rename from pythonforandroid/recipes/hostpython2/__init__.py rename to pythonforandroid/recipes/hostpython2legacy/__init__.py index e47d16f7cd..5df00ed523 100644 --- a/pythonforandroid/recipes/hostpython2/__init__.py +++ b/pythonforandroid/recipes/hostpython2legacy/__init__.py @@ -5,13 +5,20 @@ import sh -class Hostpython2Recipe(Recipe): +class Hostpython2LegacyRecipe(Recipe): + ''' + .. warning:: This recipe is the original one created by @tito + and, for now, it is unusable. + + .. versionchanged:: 0.6.0 + This was the original hostpython2's recipe moved to hostpython2legacy. + ''' version = '2.7.2' url = 'https://python.org/ftp/python/{version}/Python-{version}.tar.bz2' - name = 'hostpython2' + name = 'hostpython2legacy' patches = ['fix-segfault-pygchead.patch'] - conflicts = ['hostpython3'] + conflicts = ['hostpython3', 'hostpython3crystax', 'hostpython2'] def get_build_container_dir(self, arch=None): choices = self.check_recipe_choices() @@ -57,4 +64,4 @@ def build_arch(self, arch): self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen') -recipe = Hostpython2Recipe() +recipe = Hostpython2LegacyRecipe() diff --git a/pythonforandroid/recipes/hostpython2/fix-segfault-pygchead.patch b/pythonforandroid/recipes/hostpython2legacy/fix-segfault-pygchead.patch similarity index 100% rename from pythonforandroid/recipes/hostpython2/fix-segfault-pygchead.patch rename to pythonforandroid/recipes/hostpython2legacy/fix-segfault-pygchead.patch diff --git a/pythonforandroid/recipes/python2/Setup.local-ssl b/pythonforandroid/recipes/python2legacy/Setup.local-ssl similarity index 100% rename from pythonforandroid/recipes/python2/Setup.local-ssl rename to pythonforandroid/recipes/python2legacy/Setup.local-ssl diff --git a/pythonforandroid/recipes/python2/__init__.py b/pythonforandroid/recipes/python2legacy/__init__.py similarity index 92% rename from pythonforandroid/recipes/python2/__init__.py rename to pythonforandroid/recipes/python2legacy/__init__.py index 7afd42f94d..9299326da2 100644 --- a/pythonforandroid/recipes/python2/__init__.py +++ b/pythonforandroid/recipes/python2legacy/__init__.py @@ -10,13 +10,20 @@ EXCLUDE_EXTS = (".py", ".pyc", ".so.o", ".so.a", ".so.libs", ".pyx") -class Python2Recipe(TargetPythonRecipe): +class Python2LegacyRecipe(TargetPythonRecipe): + ''' + .. warning:: This python2 recipe is the original one created by @tito and, + for now, it is unusable. + + .. versionchanged:: 0.6.0 + This was the original python2's recipe moved to python2legacy. + ''' version = "2.7.2" url = 'https://python.org/ftp/python/{version}/Python-{version}.tar.bz2' - name = 'python2' + name = 'python2legacy' - depends = ['hostpython2'] - conflicts = ['python3crystax', 'python3'] + depends = ['hostpython2legacy'] + conflicts = ['python3', 'python3crystax', 'python2'] opt_depends = ['openssl', 'sqlite3'] patches = ['patches/Python-{version}-xcompile.patch', @@ -71,7 +78,6 @@ def build_arch(self, arch): def do_python_build(self, arch): - hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx) shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch)) shprint(sh.cp, self.ctx.hostpgen, self.get_build_dir(arch.arch)) hostpython = join(self.get_build_dir(arch.arch), 'hostpython') @@ -79,7 +85,7 @@ def do_python_build(self, arch): with current_directory(self.get_build_dir(arch.arch)): - hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx) + hostpython_recipe = Recipe.get_recipe('hostpython2legacy', self.ctx) shprint(sh.cp, join(hostpython_recipe.get_recipe_dir(), 'Setup'), 'Modules') env = arch.get_env() @@ -99,7 +105,7 @@ def do_python_build(self, arch): env['OPENSSL_VERSION'] = recipe.version if 'sqlite3' in self.ctx.recipe_build_order: - # Include sqlite3 in python2 build + # Include sqlite3 in python2legacy build recipe = Recipe.get_recipe('sqlite3', self.ctx) include = ' -I' + recipe.get_build_dir(arch.arch) lib = ' -L' + recipe.get_lib_dir(arch) + ' -lsqlite3' @@ -124,9 +130,10 @@ def do_python_build(self, arch): # tito left this comment in the original source. It's still true! # FIXME, the first time, we got a error at: - # python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h - # /home/tito/code/python-for-android/build/python/Python-2.7.2/python: 1: Syntax error: word unexpected (expecting ")") - # because at this time, python is arm, not x86. even that, why /usr/include/netinet/in.h is used ? + # python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h # noqa + # /home/tito/code/python-for-android/build/python/Python-2.7.2/python: 1: Syntax error: word unexpected (expecting ")") # noqa + # because at this time, python is arm, not x86. even that, + # why /usr/include/netinet/in.h is used ? # check if we can avoid this part. make = sh.Command(env['MAKE'].split(' ')[0]) @@ -171,7 +178,7 @@ def do_python_build(self, arch): # join(self.ctx.get_python_install_dir(), 'bin', 'python.host')) # self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host') - # print('python2 build done, exiting for debug') + # print('python2legacy build done, exiting for debug') # exit(1) def create_python_bundle(self, dirn, arch): @@ -222,4 +229,4 @@ def link_root(self, arch_name): return join(self.get_build_dir(arch_name), 'python-install', 'lib') -recipe = Python2Recipe() +recipe = Python2LegacyRecipe() diff --git a/pythonforandroid/recipes/python2/patches/Python-2.7.2-ctypes-disable-wchar.patch b/pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-ctypes-disable-wchar.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/Python-2.7.2-ctypes-disable-wchar.patch rename to pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-ctypes-disable-wchar.patch diff --git a/pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch b/pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch rename to pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch diff --git a/pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch-backup b/pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch-backup similarity index 100% rename from pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch-backup rename to pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch-backup diff --git a/pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch-new b/pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch-new similarity index 100% rename from pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch-new rename to pythonforandroid/recipes/python2legacy/patches/Python-2.7.2-xcompile.patch-new diff --git a/pythonforandroid/recipes/python2/patches/_scproxy.py b/pythonforandroid/recipes/python2legacy/patches/_scproxy.py similarity index 100% rename from pythonforandroid/recipes/python2/patches/_scproxy.py rename to pythonforandroid/recipes/python2legacy/patches/_scproxy.py diff --git a/pythonforandroid/recipes/python2/patches/ctypes-find-library-updated.patch b/pythonforandroid/recipes/python2legacy/patches/ctypes-find-library-updated.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/ctypes-find-library-updated.patch rename to pythonforandroid/recipes/python2legacy/patches/ctypes-find-library-updated.patch diff --git a/pythonforandroid/recipes/python2/patches/ctypes-find-library.patch b/pythonforandroid/recipes/python2legacy/patches/ctypes-find-library.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/ctypes-find-library.patch rename to pythonforandroid/recipes/python2legacy/patches/ctypes-find-library.patch diff --git a/pythonforandroid/recipes/python2/patches/custom-loader.patch b/pythonforandroid/recipes/python2legacy/patches/custom-loader.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/custom-loader.patch rename to pythonforandroid/recipes/python2legacy/patches/custom-loader.patch diff --git a/pythonforandroid/recipes/python2/patches/disable-modules.patch b/pythonforandroid/recipes/python2legacy/patches/disable-modules.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/disable-modules.patch rename to pythonforandroid/recipes/python2legacy/patches/disable-modules.patch diff --git a/pythonforandroid/recipes/python2/patches/disable-openpty.patch b/pythonforandroid/recipes/python2legacy/patches/disable-openpty.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/disable-openpty.patch rename to pythonforandroid/recipes/python2legacy/patches/disable-openpty.patch diff --git a/pythonforandroid/recipes/python2/patches/enable-ssl.patch b/pythonforandroid/recipes/python2legacy/patches/enable-ssl.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/enable-ssl.patch rename to pythonforandroid/recipes/python2legacy/patches/enable-ssl.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-configure-darwin.patch b/pythonforandroid/recipes/python2legacy/patches/fix-configure-darwin.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-configure-darwin.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-configure-darwin.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-distutils-darwin.patch b/pythonforandroid/recipes/python2legacy/patches/fix-distutils-darwin.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-distutils-darwin.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-distutils-darwin.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-dlfcn.patch b/pythonforandroid/recipes/python2legacy/patches/fix-dlfcn.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-dlfcn.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-dlfcn.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-dynamic-lookup.patch b/pythonforandroid/recipes/python2legacy/patches/fix-dynamic-lookup.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-dynamic-lookup.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-dynamic-lookup.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-filesystemdefaultencoding.patch b/pythonforandroid/recipes/python2legacy/patches/fix-filesystemdefaultencoding.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-filesystemdefaultencoding.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-filesystemdefaultencoding.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch b/pythonforandroid/recipes/python2legacy/patches/fix-ftime-removal.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-ftime-removal.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-gethostbyaddr.patch b/pythonforandroid/recipes/python2legacy/patches/fix-gethostbyaddr.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-gethostbyaddr.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-gethostbyaddr.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-locale.patch b/pythonforandroid/recipes/python2legacy/patches/fix-locale.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-locale.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-locale.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-remove-corefoundation.patch b/pythonforandroid/recipes/python2legacy/patches/fix-remove-corefoundation.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-remove-corefoundation.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-remove-corefoundation.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-setup-flags.patch b/pythonforandroid/recipes/python2legacy/patches/fix-setup-flags.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-setup-flags.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-setup-flags.patch diff --git a/pythonforandroid/recipes/python2/patches/fix-termios.patch b/pythonforandroid/recipes/python2legacy/patches/fix-termios.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/fix-termios.patch rename to pythonforandroid/recipes/python2legacy/patches/fix-termios.patch diff --git a/pythonforandroid/recipes/python2/patches/parsetuple.patch b/pythonforandroid/recipes/python2legacy/patches/parsetuple.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/parsetuple.patch rename to pythonforandroid/recipes/python2legacy/patches/parsetuple.patch diff --git a/pythonforandroid/recipes/python2/patches/t.htm b/pythonforandroid/recipes/python2legacy/patches/t.htm similarity index 100% rename from pythonforandroid/recipes/python2/patches/t.htm rename to pythonforandroid/recipes/python2legacy/patches/t.htm diff --git a/pythonforandroid/recipes/python2/patches/t_files/a899e84.jpg b/pythonforandroid/recipes/python2legacy/patches/t_files/a899e84.jpg similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/a899e84.jpg rename to pythonforandroid/recipes/python2legacy/patches/t_files/a899e84.jpg diff --git a/pythonforandroid/recipes/python2/patches/t_files/analytics.js b/pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/analytics.js rename to pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js diff --git a/pythonforandroid/recipes/python2/patches/t_files/b0dcca.css b/pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css similarity index 94% rename from pythonforandroid/recipes/python2/patches/t_files/b0dcca.css rename to pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css index 381a428375..427083d941 100644 --- a/pythonforandroid/recipes/python2/patches/t_files/b0dcca.css +++ b/pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css @@ -1,191 +1,191 @@ -/* START GENERAL FORMAT */ -body{ - background-color:#96A8C8; - text-align:center; - font-size:16px; - font-variant:small-caps; - font-family:Lucida,Helvetica,sans-serif; - font-weight:500; - text-decoration: none; - position: absolute; - left: 50%; - width: 780px; - margin-left: -390px; -} -a{ - color:#96A8C8; - text-decoration:none; - font-weight:800 -} -a:hover{ - text-decoration:underline -} -img{ - border:0 -} -.box { /*any of the box layouts & white backgrounds*/ - background:white; - border-style:solid; - border-width:1.5px; - border-color:#071419; - border-radius: 12px; - -moz-border-radius: 12px; -} -/* END GENERAL FORMAT */ -/* START UPPER LAYOUT */ -#topContainer{ - width:780px; - position:relative; - overflow:hidden; -} -#topLeft{ - width:166px; - float:left; - position:relative; - text-align:left; - padding: 17px; -} -#topLeft ul { - margin: 0; - list-style-type: none; -} -#topLeft a { - color: #282B30; - font-size: 21px; - font-weight: 800; -} -#topLeft a:hover { - text-decoration: underline; -} -#bgLeft { - float: left; - left:0; - width: 200px; - bottom:0; - top: 0px; -} -#topRight { - width:560px; - padding-top:15px; - padding-bottom:15px; - padding-left:15px; - float:right; - position:relative; - text-align:left; - line-height: 150%; -} -#masthead { - display: block; -} -#slogan { - padding: 20px; - display: inline-block; - font-size: 20px; - font-style: italic; - font-weight: 800; - line-height: 120%; - vertical-align: top; -} -#bgRight { - right: 0; - float: right; - width: 572px; - bottom:0; - top: 0px; -} -.bg { /* necessary for positioning box layouts for bg */ - position:absolute; - z-index:-1; -} -/* END UPPER LAYOUT */ - -/*START MIDDLE */ -#middleContainer { - width:780px; - margin: 5px auto; - padding: 10px 0; -} - -#ctitle { - margin: 10px; - font-size: 21px; - font-weight: 800; -} - -ul.comicNav { - padding:0; - list-style-type:none; -} -ul.comicNav li { - display: inline; -} - -ul.comicNav li a { - /*background-color: #6E6E6E;*/ - background-color:#6E7B91; - color: #FFF; - border: 1.5px solid #333; - font-size: 16px; - font-weight: 600; - padding: 1.5px 12px; - margin: 0 4px; - text-decoration: none; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - box-shadow: 0 0 5px 0 gray; - -moz-box-shadow: 0 0 5px 0 gray; - -webkit-box-shadow: 0 0 5px 0 gray; -} - - -ul.comicNav a:hover, ul.comicNav a:focus { - background-color: #FFF; - color: #6E7B91; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; -} - -.comicInfo { - font-size:12px; - font-style:italic; - font-weight:800; -} -#bottom { - margin-top:5px; - padding:25px 15px; - width:750px; -} -#comicLinks { - display: block; - margin: auto; - width: 300px; -} -#footnote { - clear: both; - font-size: 6px; - font-style: italic; - font-variant: small-caps; - font-weight: 800; - margin: 0; - padding: 0; -} -#licenseText { - display: block; - margin: auto; - width: 410px; -} - -#transcript {display: none;} - -#middleContainer { position:relative; left:50%; margin-left:-390px; } -#comic .comic { position:absolute; } -#comic .panel, #comic .cover, #comic .panel img { position:absolute; } -#comic .cover { z-index:10; } -#comic table { margin: auto; } - -@font-face { - font-family: 'xkcd-Regular'; - src: url('//xkcd.com/fonts/xkcd-Regular.eot?') format('eot'), url('//xkcd.com/fonts/xkcd-Regular.otf') format('opentype'); -} +/* START GENERAL FORMAT */ +body{ + background-color:#96A8C8; + text-align:center; + font-size:16px; + font-variant:small-caps; + font-family:Lucida,Helvetica,sans-serif; + font-weight:500; + text-decoration: none; + position: absolute; + left: 50%; + width: 780px; + margin-left: -390px; +} +a{ + color:#96A8C8; + text-decoration:none; + font-weight:800 +} +a:hover{ + text-decoration:underline +} +img{ + border:0 +} +.box { /*any of the box layouts & white backgrounds*/ + background:white; + border-style:solid; + border-width:1.5px; + border-color:#071419; + border-radius: 12px; + -moz-border-radius: 12px; +} +/* END GENERAL FORMAT */ +/* START UPPER LAYOUT */ +#topContainer{ + width:780px; + position:relative; + overflow:hidden; +} +#topLeft{ + width:166px; + float:left; + position:relative; + text-align:left; + padding: 17px; +} +#topLeft ul { + margin: 0; + list-style-type: none; +} +#topLeft a { + color: #282B30; + font-size: 21px; + font-weight: 800; +} +#topLeft a:hover { + text-decoration: underline; +} +#bgLeft { + float: left; + left:0; + width: 200px; + bottom:0; + top: 0px; +} +#topRight { + width:560px; + padding-top:15px; + padding-bottom:15px; + padding-left:15px; + float:right; + position:relative; + text-align:left; + line-height: 150%; +} +#masthead { + display: block; +} +#slogan { + padding: 20px; + display: inline-block; + font-size: 20px; + font-style: italic; + font-weight: 800; + line-height: 120%; + vertical-align: top; +} +#bgRight { + right: 0; + float: right; + width: 572px; + bottom:0; + top: 0px; +} +.bg { /* necessary for positioning box layouts for bg */ + position:absolute; + z-index:-1; +} +/* END UPPER LAYOUT */ + +/*START MIDDLE */ +#middleContainer { + width:780px; + margin: 5px auto; + padding: 10px 0; +} + +#ctitle { + margin: 10px; + font-size: 21px; + font-weight: 800; +} + +ul.comicNav { + padding:0; + list-style-type:none; +} +ul.comicNav li { + display: inline; +} + +ul.comicNav li a { + /*background-color: #6E6E6E;*/ + background-color:#6E7B91; + color: #FFF; + border: 1.5px solid #333; + font-size: 16px; + font-weight: 600; + padding: 1.5px 12px; + margin: 0 4px; + text-decoration: none; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 5px 0 gray; + -moz-box-shadow: 0 0 5px 0 gray; + -webkit-box-shadow: 0 0 5px 0 gray; +} + + +ul.comicNav a:hover, ul.comicNav a:focus { + background-color: #FFF; + color: #6E7B91; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; +} + +.comicInfo { + font-size:12px; + font-style:italic; + font-weight:800; +} +#bottom { + margin-top:5px; + padding:25px 15px; + width:750px; +} +#comicLinks { + display: block; + margin: auto; + width: 300px; +} +#footnote { + clear: both; + font-size: 6px; + font-style: italic; + font-variant: small-caps; + font-weight: 800; + margin: 0; + padding: 0; +} +#licenseText { + display: block; + margin: auto; + width: 410px; +} + +#transcript {display: none;} + +#middleContainer { position:relative; left:50%; margin-left:-390px; } +#comic .comic { position:absolute; } +#comic .panel, #comic .cover, #comic .panel img { position:absolute; } +#comic .cover { z-index:10; } +#comic table { margin: auto; } + +@font-face { + font-family: 'xkcd-Regular'; + src: url('//xkcd.com/fonts/xkcd-Regular.eot?') format('eot'), url('//xkcd.com/fonts/xkcd-Regular.otf') format('opentype'); +} diff --git a/pythonforandroid/recipes/python2/patches/t_files/jquery.js b/pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/jquery.js rename to pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js diff --git a/pythonforandroid/recipes/python2/patches/t_files/json2.js b/pythonforandroid/recipes/python2legacy/patches/t_files/json2.js similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/json2.js rename to pythonforandroid/recipes/python2legacy/patches/t_files/json2.js diff --git a/pythonforandroid/recipes/python2/patches/t_files/legal_hacks.png b/pythonforandroid/recipes/python2legacy/patches/t_files/legal_hacks.png similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/legal_hacks.png rename to pythonforandroid/recipes/python2legacy/patches/t_files/legal_hacks.png diff --git a/pythonforandroid/recipes/python2/patches/t_files/te-news.png b/pythonforandroid/recipes/python2legacy/patches/t_files/te-news.png similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/te-news.png rename to pythonforandroid/recipes/python2legacy/patches/t_files/te-news.png diff --git a/pythonforandroid/recipes/python2/patches/t_files/terrible_small_logo.png b/pythonforandroid/recipes/python2legacy/patches/t_files/terrible_small_logo.png similarity index 100% rename from pythonforandroid/recipes/python2/patches/t_files/terrible_small_logo.png rename to pythonforandroid/recipes/python2legacy/patches/t_files/terrible_small_logo.png diff --git a/pythonforandroid/recipes/python2/patches/verbose-compilation.patch b/pythonforandroid/recipes/python2legacy/patches/verbose-compilation.patch similarity index 100% rename from pythonforandroid/recipes/python2/patches/verbose-compilation.patch rename to pythonforandroid/recipes/python2legacy/patches/verbose-compilation.patch From 4c487fd3aa066b9d9a98d7803bfc9dd57760b0e8 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 13:35:34 +0100 Subject: [PATCH 04/66] Add the new hostpython2/python2 recipes (v2.7.15) Those new recipes will use the same build method than python3. Also added a set of patches, some of them are enabled by default because they are necessary to perform a successful build. The others are added because maybe we will need them. --- .../recipes/hostpython2/__init__.py | 18 + pythonforandroid/recipes/python2/__init__.py | 48 + .../patches/fix-api-minor-than-21.patch | 145 ++ .../fix-filesystem-default-encoding.patch | 11 + .../python2/patches/fix-init-site.patch | 17 + .../recipes/python2/patches/fix-locale.patch | 91 + .../patches/fix-missing-extensions.patch | 120 ++ .../Python-2.7.15-ctypes-disable-wchar.patch | 76 + .../unused/Python-2.7.15-xcompile.patch | 321 +++ ...n_2.7.15-ctypes-libffi-fix-configure.patch | 33 + .../patches/unused/ctypes-find-library.patch | 28 + .../patches/unused/custom-loader.patch | 67 + .../patches/unused/disable-modules.patch | 11 + .../patches/unused/disable-openpty.patch | 59 + .../unused/ffi-config.sub-2.7.15.patch | 1792 +++++++++++++++++ .../python2/patches/unused/fix-dlfcn.patch | 26 + .../patches/unused/fix-dynamic-lookup.patch | 11 + .../patches/unused/fix-ftime-removal.patch | 10 + .../patches/unused/fix-gethostbyaddr.patch | 12 + .../patches/unused/fix-platform-2.7.15.patch | 32 + .../unused/fix-remove-corefoundation.patch | 13 + .../python2/patches/unused/fix-termios.patch | 29 + .../unused/modules-locales-2.7.15.patch | 27 + .../patches/unused/verbose-compilation.patch | 17 + 24 files changed, 3014 insertions(+) create mode 100644 pythonforandroid/recipes/hostpython2/__init__.py create mode 100644 pythonforandroid/recipes/python2/__init__.py create mode 100644 pythonforandroid/recipes/python2/patches/fix-api-minor-than-21.patch create mode 100644 pythonforandroid/recipes/python2/patches/fix-filesystem-default-encoding.patch create mode 100644 pythonforandroid/recipes/python2/patches/fix-init-site.patch create mode 100644 pythonforandroid/recipes/python2/patches/fix-locale.patch create mode 100644 pythonforandroid/recipes/python2/patches/fix-missing-extensions.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-ctypes-disable-wchar.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-xcompile.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/Python_2.7.15-ctypes-libffi-fix-configure.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/ctypes-find-library.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/custom-loader.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/disable-modules.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/disable-openpty.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/ffi-config.sub-2.7.15.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-dlfcn.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-dynamic-lookup.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-ftime-removal.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-gethostbyaddr.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-platform-2.7.15.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-remove-corefoundation.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/fix-termios.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/modules-locales-2.7.15.patch create mode 100644 pythonforandroid/recipes/python2/patches/unused/verbose-compilation.patch diff --git a/pythonforandroid/recipes/hostpython2/__init__.py b/pythonforandroid/recipes/hostpython2/__init__.py new file mode 100644 index 0000000000..08d45ba564 --- /dev/null +++ b/pythonforandroid/recipes/hostpython2/__init__.py @@ -0,0 +1,18 @@ +from pythonforandroid.python import HostPythonRecipe + + +class Hostpython2Recipe(HostPythonRecipe): + ''' + The hostpython2's recipe. + + .. versionchanged:: 0.6.0 + Updated to version 2.7.15 and the build process has been changed in + favour of the recently added class + :class:`~pythonforandroid.python.HostPythonRecipe` + ''' + version = '2.7.15' + name = 'hostpython2' + conflicts = ['hostpython3', 'hostpython3crystax'] + + +recipe = Hostpython2Recipe() diff --git a/pythonforandroid/recipes/python2/__init__.py b/pythonforandroid/recipes/python2/__init__.py new file mode 100644 index 0000000000..d9982a1eb9 --- /dev/null +++ b/pythonforandroid/recipes/python2/__init__.py @@ -0,0 +1,48 @@ +from pythonforandroid.python import GuestPythonRecipe +# from pythonforandroid.patching import is_api_lt + + +class Python2Recipe(GuestPythonRecipe): + ''' + The python2's recipe. + + .. note:: This recipe can be built only against API 21+ + + .. versionchanged:: 0.6.0 + Updated to version 2.7.15 and the build process has been changed in + favour of the recently added class + :class:`~pythonforandroid.python.GuestPythonRecipe` + ''' + version = "2.7.15" + url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' + name = 'python2' + + depends = ['hostpython2'] + conflicts = ['python3crystax', 'python3'] + + patches = [ + # new 2.7.15 patches + # ('patches/fix-api-minor-than-21.patch', + # is_api_lt(21)), # Todo: this should be tested + 'patches/fix-missing-extensions.patch', + 'patches/fix-filesystem-default-encoding.patch', + 'patches/fix-locale.patch', + 'patches/fix-init-site.patch', + ] + + configure_args = ('--host={android_host}', + '--build={android_build}', + '--enable-shared', + '--disable-ipv6', + '--disable-toolbox-glue', + '--disable-framework', + 'ac_cv_file__dev_ptmx=yes', + 'ac_cv_file__dev_ptc=no', + '--without-ensurepip', + 'ac_cv_little_endian_double=yes', + 'ac_cv_header_langinfo_h=no', + '--prefix={prefix}', + '--exec-prefix={exec_prefix}') + + +recipe = Python2Recipe() diff --git a/pythonforandroid/recipes/python2/patches/fix-api-minor-than-21.patch b/pythonforandroid/recipes/python2/patches/fix-api-minor-than-21.patch new file mode 100644 index 0000000000..ac1cec5f25 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-api-minor-than-21.patch @@ -0,0 +1,145 @@ +diff -Naurp Python-2.7.15.orig/configure.ac Python-2.7.15/configure.ac +--- Python-2.7.15.orig/configure.ac 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/configure.ac 2018-07-05 17:44:50.500985727 +0200 +@@ -1790,7 +1790,7 @@ fi + # structures (such as rlimit64) without declaring them. As a + # work-around, disable LFS on such configurations + +-use_lfs=yes ++use_lfs=no + AC_MSG_CHECKING(Solaris LFS bug) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define _LARGEFILE_SOURCE 1 +diff -Naurp Python-2.7.15.orig/Modules/_localemodule.c Python-2.7.15/Modules/_localemodule.c +--- Python-2.7.15.orig/Modules/_localemodule.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/_localemodule.c 2018-07-05 16:39:08.241023323 +0200 +@@ -170,6 +170,12 @@ PyLocale_setlocale(PyObject* self, PyObj + PyErr_SetString(Error, "invalid locale category"); + return NULL; + } ++#else ++ #ifdef __ANDROID__ ++ #if defined(__ANDROID_API__) && __ANDROID_API__ < 20 ++ return PyUnicode_FromFormat("%s", "C"); ++ #endif ++ #endif + #endif + + if (locale) { +@@ -215,7 +221,15 @@ PyLocale_localeconv(PyObject* self) + return NULL; + + /* if LC_NUMERIC is different in the C library, use saved value */ +- l = localeconv(); ++ //PMPP API<21 ++ #if __ANDROID_API__ < 21 ++ /* Don't even try on Android's broken locale.h. */ ++ goto failed; ++ #else ++ /* if LC_NUMERIC is different in the C library, use saved value */ ++ l = localeconv(); //PATCHED ++ #endif ++ //PMPP API<21 + + /* hopefully, the localeconv result survives the C library calls + involved herein */ +diff -Naurp Python-2.7.15.orig/Modules/mmapmodule.c Python-2.7.15/Modules/mmapmodule.c +--- Python-2.7.15.orig/Modules/mmapmodule.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/mmapmodule.c 2018-07-05 16:18:40.953035027 +0200 +@@ -78,6 +78,12 @@ my_getpagesize(void) + # define MAP_ANONYMOUS MAP_ANON + #endif + ++//PMPP API<21 ++#if __ANDROID_API__ < 21 ++ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); ++#endif ++//PMPP API<21 ++ + static PyObject *mmap_module_error; + + typedef enum +diff -Naurp Python-2.7.15.orig/Modules/posixmodule.c Python-2.7.15/Modules/posixmodule.c +--- Python-2.7.15.orig/Modules/posixmodule.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/posixmodule.c 2018-07-05 16:20:48.933033807 +0200 +@@ -9477,6 +9477,12 @@ all_ins(PyObject *d) + #define MODNAME "posix" + #endif + ++//PMPP API<21 ++#if __ANDROID_API__ < 21 ++ extern ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count); ++#endif ++//PMPP API<21 ++ + PyMODINIT_FUNC + INITFUNC(void) + { +diff -Naurp Python-2.7.15.orig/Modules/signalmodule.c Python-2.7.15/Modules/signalmodule.c +--- Python-2.7.15.orig/Modules/signalmodule.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/signalmodule.c 2018-07-05 16:40:46.601022385 +0200 +@@ -32,6 +32,13 @@ + #include + #endif + ++//PMPP API<21 ++#if __ANDROID_API__ < 21 ++ #define SIGRTMIN 32 ++ #define SIGRTMAX _NSIG ++#endif ++//PMPP API<21 ++ + #ifndef NSIG + # if defined(_NSIG) + # define NSIG _NSIG /* For BSD/SysV */ +diff -Naurp Python-2.7.15.orig/Modules/termios.c Python-2.7.15/Modules/termios.c +--- Python-2.7.15.orig/Modules/termios.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/termios.c 2018-07-05 16:43:16.457020956 +0200 +@@ -357,7 +357,11 @@ static struct constant { + #endif + + /* tcsetattr() constants */ ++#if defined(__ANDROID_API__) && __ANDROID_API__ > 0 ++ {"TCSANOW", TCSETS}, // https://github.com/android-ndk/ndk/issues/441 ++#else + {"TCSANOW", TCSANOW}, ++#endif + {"TCSADRAIN", TCSADRAIN}, + {"TCSAFLUSH", TCSAFLUSH}, + #ifdef TCSASOFT +diff -Naurp Python-2.7.15.orig/Objects/obmalloc.c Python-2.7.15/Objects/obmalloc.c +--- Python-2.7.15.orig/Objects/obmalloc.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Objects/obmalloc.c 2018-07-05 16:52:27.577015700 +0200 +@@ -1,5 +1,11 @@ + #include "Python.h" + ++//PMPP API<21 ++#if __ANDROID_API__ < 21 ++ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); ++#endif ++//PMPP API<21 ++ + #if defined(__has_feature) /* Clang */ + #if __has_feature(address_sanitizer) /* is ASAN enabled? */ + #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \ +diff -Naurp Python-2.7.15.orig/Python/pystrtod.c Python-2.7.15/Python/pystrtod.c +--- Python-2.7.15.orig/Python/pystrtod.c 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Python/pystrtod.c 2018-07-05 17:02:52.089009744 +0200 +@@ -137,9 +137,14 @@ _PyOS_ascii_strtod(const char *nptr, cha + assert(nptr != NULL); + + fail_pos = NULL; +- +- locale_data = localeconv(); +- decimal_point = locale_data->decimal_point; ++ //PMPP API<21 ++ #if __ANDROID_API__ < 21 ++ decimal_point = "."; ++ #else ++ locale_data = localeconv(); //PATCHED ++ decimal_point = locale_data->decimal_point; ++ #endif ++ //PMPP API<21 + decimal_point_len = strlen(decimal_point); + + assert(decimal_point_len != 0); diff --git a/pythonforandroid/recipes/python2/patches/fix-filesystem-default-encoding.patch b/pythonforandroid/recipes/python2/patches/fix-filesystem-default-encoding.patch new file mode 100644 index 0000000000..7cf1a8f860 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-filesystem-default-encoding.patch @@ -0,0 +1,11 @@ +--- Python-2.7.15.orig/Python/bltinmodule.c 2017-12-29 01:44:57.018079845 +0200 ++++ Python-2.7.15/Python/bltinmodule.c 2017-12-29 01:45:02.650079649 +0200 +@@ -22,7 +22,7 @@ + #elif defined(__APPLE__) + const char *Py_FileSystemDefaultEncoding = "utf-8"; + #else +-const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ ++const char *Py_FileSystemDefaultEncoding = "utf-8"; /* use default */ + #endif + + /* Forward */ diff --git a/pythonforandroid/recipes/python2/patches/fix-init-site.patch b/pythonforandroid/recipes/python2/patches/fix-init-site.patch new file mode 100644 index 0000000000..2deb4cc29b --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-init-site.patch @@ -0,0 +1,17 @@ +--- Python-2.7.2.orig/Python/pythonrun.c 2010-10-29 05:45:34.000000000 +0200 ++++ Python-2.7.2/Python/pythonrun.c 2011-04-20 17:52:12.000000000 +0200 +@@ -254,9 +254,13 @@ + _PyGILState_Init(interp, tstate); + #endif /* WITH_THREAD */ + ++ /* For PGS4A, we don't want to call initsite, as we won't have the ++ library path set up until start.pyx finishes running. */ ++#if 0 + if (!Py_NoSiteFlag) + initsite(); /* Module site */ +- ++#endif ++ + if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { + p = icodeset = codeset = strdup(p); + free_codeset = 1; diff --git a/pythonforandroid/recipes/python2/patches/fix-locale.patch b/pythonforandroid/recipes/python2/patches/fix-locale.patch new file mode 100644 index 0000000000..c5aab15553 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-locale.patch @@ -0,0 +1,91 @@ +--- Python-2.7.15.orig/Modules/pwdmodule.c 2017-12-29 12:30:26.000000000 +0200 ++++ Python-2.7.15/Modules/pwdmodule.c 2017-12-29 17:52:12.000000000 +0200 +@@ -75,11 +75,7 @@ + #endif + PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromUid(p->pw_uid)); + PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromGid(p->pw_gid)); +-#ifdef __VMS + SETS(setIndex++, ""); +-#else +- SETS(setIndex++, p->pw_gecos); +-#endif + SETS(setIndex++, p->pw_dir); + SETS(setIndex++, p->pw_shell); + + --- Python-2.7.15.orig/Modules/posixmodule.c 2017-12-29 12:35:50.000000000 +0100 ++++ Python-2.7.15/Modules/posixmodule.c 2017-12-29 17:52:12.000000000 +0200 +@@ -3991,13 +3991,6 @@ + slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ + if (slave_fd < 0) + return posix_error(); +-#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) +- ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ +- ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ +-#ifndef __hpux +- ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */ +-#endif /* __hpux */ +-#endif /* HAVE_CYGWIN */ + #endif /* HAVE_OPENPTY */ + + return Py_BuildValue("(ii)", master_fd, slave_fd); +--- Python-2.7.15.orig/Objects/stringlib/formatter.h 2017-12-29 12:45:15.000000000 +0200 ++++ Python-2.7.15/Objects/stringlib/formatter.h 2017-12-29 17:52:12.000000000 +0200 +@@ -639,13 +639,7 @@ + get_locale_info(int type, LocaleInfo *locale_info) + { + switch (type) { +- case LT_CURRENT_LOCALE: { +- struct lconv *locale_data = localeconv(); +- locale_info->decimal_point = locale_data->decimal_point; +- locale_info->thousands_sep = locale_data->thousands_sep; +- locale_info->grouping = locale_data->grouping; +- break; +- } ++ case LT_CURRENT_LOCALE: + case LT_DEFAULT_LOCALE: + locale_info->decimal_point = "."; + locale_info->thousands_sep = ","; +--- Python-2.7.15.orig/Objects/stringlib/localeutil.h 2017-12-29 15:29:05.000000000 +0200 ++++ Python-2.7.15/Objects/stringlib/localeutil.h 2017-12-29 17:52:12.000000000 +0200 +@@ -202,9 +202,8 @@ + Py_ssize_t n_digits, + Py_ssize_t min_width) + { +- struct lconv *locale_data = localeconv(); +- const char *grouping = locale_data->grouping; +- const char *thousands_sep = locale_data->thousands_sep; ++ const char *grouping = "\3\0"; ++ const char *thousands_sep = ","; + + return _Py_InsertThousandsGrouping(buffer, n_buffer, digits, n_digits, + min_width, grouping, thousands_sep); +--- Python-2.7.15.orig/Python/pystrtod.c 2017-12-29 16:46:46.000000000 +0200 ++++ Python-2.7.15/Python/pystrtod.c 2017-12-29 17:52:12.000000000 +0200 +@@ -126,7 +126,6 @@ + { + char *fail_pos; + double val = -1.0; +- struct lconv *locale_data; + const char *decimal_point; + size_t decimal_point_len; + const char *p, *decimal_point_pos; +@@ -138,8 +137,7 @@ + + fail_pos = NULL; + +- locale_data = localeconv(); +- decimal_point = locale_data->decimal_point; ++ decimal_point = "."; + decimal_point_len = strlen(decimal_point); + + assert(decimal_point_len != 0); +@@ -375,8 +373,7 @@ + Py_LOCAL_INLINE(void) + change_decimal_from_locale_to_dot(char* buffer) + { +- struct lconv *locale_data = localeconv(); +- const char *decimal_point = locale_data->decimal_point; ++ const char *decimal_point = "."; + + if (decimal_point[0] != '.' || decimal_point[1] != 0) { + size_t decimal_point_len = strlen(decimal_point); diff --git a/pythonforandroid/recipes/python2/patches/fix-missing-extensions.patch b/pythonforandroid/recipes/python2/patches/fix-missing-extensions.patch new file mode 100644 index 0000000000..a098b25634 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/fix-missing-extensions.patch @@ -0,0 +1,120 @@ +diff -Naurp Python-2.7.15/Modules/Setup.dist.orig Python-2.7.15/Modules/Setup.dist +--- Python-2.7.15/Modules/Setup.dist.orig 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/Setup.dist 2018-11-17 20:40:20.153518694 +0100 +@@ -464,7 +464,7 @@ + # Andrew Kuchling's zlib module. + # This require zlib 1.1.3 (or later). + # See http://www.gzip.org/zlib/ +-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz ++zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz + + # Interface to the Expat XML parser + # +diff -Naurp Python-2.7.15.orig/Makefile.pre.in Python-2.7.15/Makefile.pre.in +--- Python-2.7.15.orig/Makefile.pre.in 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Makefile.pre.in 2018-11-18 00:43:58.777379280 +0100 +@@ -20,6 +20,7 @@ + + # === Variables set by makesetup === + ++MODNAMES= _MODNAMES_ + MODOBJS= _MODOBJS_ + MODLIBS= _MODLIBS_ + +diff -Naurp Python-2.7.15.orig/Modules/_ctypes/libffi/src/arm/sysv.S Python-2.7.15/Modules/_ctypes/libffi/src/arm/sysv.S +--- Python-2.7.15.orig/Modules/_ctypes/libffi/src/arm/sysv.S 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/_ctypes/libffi/src/arm/sysv.S 2018-11-17 22:28:50.925456603 +0100 +@@ -396,7 +396,7 @@ LSYM(Lbase_args): + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_SINT64 +- stmeqia r2, {r0, r1} ++ stmiaeq r2, {r0, r1} + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_FLOAT +diff -Naurp Python-2.7.15.orig/Modules/makesetup Python-2.7.15/Modules/makesetup +--- Python-2.7.15.orig/Modules/makesetup 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/makesetup 2018-11-18 00:43:10.289379743 +0100 +@@ -110,6 +110,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | + # Rules appended by makedepend + " >$rulesf + DEFS= ++ NAMES= + MODS= + SHAREDMODS= + OBJS= +@@ -181,7 +182,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | + *.*) echo 1>&2 "bad word $arg in $line" + exit 1;; + -u) skip=libs; libs="$libs -u";; +- [a-zA-Z_]*) mods="$mods $arg";; ++ [a-zA-Z_]*) NAMES="$NAMES $arg"; mods="$mods $arg";; + *) echo 1>&2 "bad word $arg in $line" + exit 1;; + esac +@@ -284,6 +285,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | + echo "1i\\" >$sedf + str="# Generated automatically from $makepre by makesetup." + echo "$str" >>$sedf ++ echo "s%_MODNAMES_%$NAMES%" >>$sedf + echo "s%_MODOBJS_%$OBJS%" >>$sedf + echo "s%_MODLIBS_%$LIBS%" >>$sedf + echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf +diff -Naurp Python-2.7.15.orig/setup.py Python-2.7.15/setup.py +--- Python-2.7.15.orig/setup.py 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/setup.py 2018-11-18 00:40:50.021381080 +0100 +@@ -217,7 +217,11 @@ class PyBuildExt(build_ext): + # Python header files + headers = [sysconfig.get_config_h_filename()] + headers += glob(os.path.join(sysconfig.get_path('include'), "*.h")) +- for ext in self.extensions[:]: ++ # The sysconfig variable built by makesetup, listing the already ++ # built modules as configured by the Setup files. ++ modnames = sysconfig.get_config_var('MODNAMES').split() ++ removed_modules = [] ++ for ext in self.extensions: + ext.sources = [ find_module_file(filename, moddirlist) + for filename in ext.sources ] + if ext.depends is not None: +@@ -231,10 +235,10 @@ class PyBuildExt(build_ext): + # platform specific include directories + ext.include_dirs.extend(incdirlist) + +- # If a module has already been built statically, +- # don't build it here +- if ext.name in sys.builtin_module_names: +- self.extensions.remove(ext) ++ # If a module has already been built by the Makefile, ++ # don't build it here. ++ if ext.name in modnames: ++ removed_modules.append(ext) + + # Parse Modules/Setup and Modules/Setup.local to figure out which + # modules are turned on in the file. +@@ -249,8 +253,9 @@ class PyBuildExt(build_ext): + input.close() + + for ext in self.extensions[:]: +- if ext.name in remove_modules: +- self.extensions.remove(ext) ++ if removed_modules: ++ self.extensions = [x for x in self.extensions if x not in ++ removed_modules] + + # When you run "make CC=altcc" or something similar, you really want + # those environment variables passed into the setup.py phase. Here's +@@ -290,6 +295,13 @@ class PyBuildExt(build_ext): + " detect_modules() for the module's name.") + print + ++ if removed_modules: ++ print("The following modules found by detect_modules() in" ++ " setup.py, have been") ++ print("built by the Makefile instead, as configured by the" ++ " Setup files:") ++ print_three_column([ext.name for ext in removed_modules]) ++ + if self.failed: + failed = self.failed[:] + print diff --git a/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-ctypes-disable-wchar.patch b/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-ctypes-disable-wchar.patch new file mode 100644 index 0000000000..cd91be3a17 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-ctypes-disable-wchar.patch @@ -0,0 +1,76 @@ +--- Python-2.7.15/Lib/ctypes/__init__.py.orig 2017-12-29 16:59:33.000000000 +0100 ++++ Python-2.7.15/Lib/ctypes/__init__.py 2017-12-29 17:00:15.636079979 +0100 +@@ -265,7 +265,7 @@ + if _os.name in ("nt", "ce"): + _win_functype_cache.clear() + # _SimpleCData.c_wchar_p_from_param +- POINTER(c_wchar).from_param = c_wchar_p.from_param ++ # POINTER(c_wchar).from_param = c_wchar_p.from_param + # _SimpleCData.c_char_p_from_param + POINTER(c_char).from_param = c_char_p.from_param + _pointer_type_cache[None] = c_void_p +@@ -285,29 +285,34 @@ + else: + set_conversion_mode("ascii", "strict") + +- class c_wchar_p(_SimpleCData): +- _type_ = "Z" +- +- class c_wchar(_SimpleCData): +- _type_ = "u" +- +- def create_unicode_buffer(init, size=None): +- """create_unicode_buffer(aString) -> character array +- create_unicode_buffer(anInteger) -> character array +- create_unicode_buffer(aString, anInteger) -> character array +- """ +- if isinstance(init, (str, unicode)): +- if size is None: +- size = len(init)+1 +- buftype = c_wchar * size +- buf = buftype() +- buf.value = init +- return buf +- elif isinstance(init, (int, long)): +- buftype = c_wchar * init +- buf = buftype() +- return buf +- raise TypeError(init) ++# The wchar stuff causes a crash on Android (the bionic C library doesn't ++# implement wchar_t anyway) ++# ++# class c_wchar_p(_SimpleCData): ++# _type_ = "Z" ++# ++# class c_wchar(_SimpleCData): ++# _type_ = "u" ++# ++# POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param ++# ++# def create_unicode_buffer(init, size=None): ++# """create_unicode_buffer(aString) -> character array ++# create_unicode_buffer(anInteger) -> character array ++# create_unicode_buffer(aString, anInteger) -> character array ++# """ ++# if isinstance(init, (str, unicode)): ++# if size is None: ++# size = len(init)+1 ++# buftype = c_wchar * size ++# buf = buftype() ++# buf.value = init ++# return buf ++# elif isinstance(init, (int, long)): ++# buftype = c_wchar * init ++# buf = buftype() ++# return buf ++# raise TypeError(init) + + # XXX Deprecated + def SetPointerType(pointer, cls): +@@ -553,4 +558,4 @@ + elif sizeof(kind) == 8: c_uint64 = kind + del(kind) + +-_reset_cache() ++_reset_cache() +\ No hay ningún carácter de nueva línea al final del fichero diff --git a/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-xcompile.patch b/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-xcompile.patch new file mode 100644 index 0000000000..5a107c3784 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/Python-2.7.15-xcompile.patch @@ -0,0 +1,321 @@ +diff -Naurp Python-2.7.15.orig/configure Python-2.7.15/configure +--- Python-2.7.15.orig/configure 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/configure 2018-07-05 10:28:23.457148643 +0200 +@@ -2951,21 +2951,7 @@ test -n "$PYTHON_FOR_REGEN" || PYTHON_FO + if test "$cross_compiling" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5 + $as_echo_n "checking for python interpreter for cross build... " >&6; } +- if test -z "$PYTHON_FOR_BUILD"; then +- for interp in python$PACKAGE_VERSION python2 python; do +- which $interp >/dev/null 2>&1 || continue +- if $interp -c 'import sys;sys.exit(not (sys.version_info[:2] >= (2,7) and sys.version_info[0] < 3))'; then +- break +- fi +- interp= +- done +- if test x$interp = x; then +- as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5 +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 +-$as_echo "$interp" >&6; } +- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp +- fi ++ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(PLATDIR) $(srcdir)/host$(BUILDPYTHON)' + elif test "$cross_compiling" = maybe; then + as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 + else +diff -Naurp Python-2.7.15.orig/Makefile.pre.in Python-2.7.15/Makefile.pre.in +--- Python-2.7.15.orig/Makefile.pre.in 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Makefile.pre.in 2018-07-05 10:35:33.213144545 +0200 +@@ -240,6 +240,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ + ########################################################################## + # Parser + PGEN= Parser/pgen$(EXE) ++PGEN_FOR_BUILD=$(PGEN)$(EXE) + + PSRCS= \ + Parser/acceler.c \ +@@ -672,7 +673,7 @@ regen-grammar: $(PGEN) + # Regenerate Include/graminit.h and Python/graminit.c + # from Grammar/Grammar using pgen + @$(MKDIR_P) Include +- $(PGEN) $(srcdir)/Grammar/Grammar \ ++ $(PGEN_FOR_BUILD) $(srcdir)/Grammar/Grammar \ + $(srcdir)/Include/graminit.h \ + $(srcdir)/Python/graminit.c + +@@ -1131,12 +1132,12 @@ libinstall: build_all $(srcdir)/Lib/$(PL + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + $(DESTDIR)$(LIBDEST) +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +@@ -1266,9 +1267,9 @@ libainstall: @DEF_MAKE_RULE@ python-conf + sharedinstall: sharedmods + $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --prefix=$(prefix) \ +- --install-scripts=$(BINDIR) \ +- --install-platlib=$(DESTSHARED) \ +- --root=$(DESTDIR)/ ++ --install-scripts=$(DESTDIR)$(BINDIR) \ ++ --install-platlib=$(DESTDIR)$(DESTSHARED) \ ++ --root=/ + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* + + # Here are a couple of targets for MacOSX again, to install a full +diff -Naurp Python-2.7.15.orig/Modules/Setup.dist Python-2.7.15/Modules/Setup.dist +--- Python-2.7.15.orig/Modules/Setup.dist 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/Modules/Setup.dist 2018-07-05 10:42:05.405140805 +0200 +@@ -163,7 +163,7 @@ GLHACK=-Dclear=__GLclear + # it, depending on your system -- see the GNU readline instructions. + # It's okay for this to be a shared library, too. + +-#readline readline.c -lreadline -ltermcap ++readline readline.c -lreadline -ltermcap + + + # Modules that should always be present (non UNIX dependent): +@@ -211,14 +211,14 @@ GLHACK=-Dclear=__GLclear + #_csv _csv.c + + # Socket module helper for socket(2) +-#_socket socketmodule.c timemodule.c ++_socket socketmodule.c timemodule.c + + # Socket module helper for SSL support; you must comment out the other + # socket line above, and possibly edit the SSL variable: +-#SSL=/usr/local/ssl +-#_ssl _ssl.c \ +-# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ +-# -L$(SSL)/lib -lssl -lcrypto ++SSL=$(OPENSSL_BUILD) ++_ssl _ssl.c \ ++ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ ++ -L$(SSL) -lssl$(OPENSSL_VERSION) -lcrypto$(OPENSSL_VERSION) + + # The crypt module is now disabled by default because it breaks builds + # on many systems (where -lcrypt is needed), e.g. Linux (I believe). +@@ -464,7 +464,7 @@ GLHACK=-Dclear=__GLclear + # Andrew Kuchling's zlib module. + # This require zlib 1.1.3 (or later). + # See http://www.gzip.org/zlib/ +-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz ++zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz + + # Interface to the Expat XML parser + # +diff -Naurp Python-2.7.15.orig/setup.py Python-2.7.15/setup.py +--- Python-2.7.15.orig/setup.py 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/setup.py 2018-07-05 11:08:57.305125432 +0200 +@@ -17,7 +17,7 @@ from distutils.command.install import in + from distutils.command.install_lib import install_lib + from distutils.spawn import find_executable + +-cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ ++cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ) + + def get_platform(): + # cross build +@@ -310,6 +310,12 @@ class PyBuildExt(build_ext): + (ext.name, sys.exc_info()[1])) + self.failed.append(ext.name) + return ++ # Import check will not work when cross-compiling. ++ if 'PYTHONXCPREFIX' in os.environ: ++ self.announce( ++ 'WARNING: skipping import check for cross-compiled: "%s"' % ++ ext.name) ++ return + # Workaround for Mac OS X: The Carbon-based modules cannot be + # reliably imported into a command-line Python + if 'Carbon' in ext.extra_link_args: +@@ -342,6 +348,9 @@ class PyBuildExt(build_ext): + + # Don't try to load extensions for cross builds + if cross_compiling: ++ self.announce( ++ 'WARNING: skipping import check for cross-compiled: "%s"' % ++ ext.name) + return + + try: +@@ -496,7 +505,7 @@ class PyBuildExt(build_ext): + for directory in reversed(options.dirs): + add_dir_to_list(dir_list, directory) + +- if os.path.normpath(sys.prefix) != '/usr' \ ++ if os.path.normpath(sys.prefix) != '/usr' and not cross_compiling \ + and not sysconfig.get_config_var('PYTHONFRAMEWORK'): + # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework + # (PYTHONFRAMEWORK is set) to avoid # linking problems when +@@ -527,6 +536,15 @@ class PyBuildExt(build_ext): + '/lib', '/usr/lib', + ): + add_dir_to_list(lib_dirs, d) ++ else: ++ # The common install prefix of 3rd party ++ # libraries used during cross compilation ++ cflags = os.environ.get('CFLAGS') ++ if cflags: ++ inc_dirs += [x[2:] for x in cflags.split() if x.startswith('-I')] ++ ldflags = os.environ.get('LDFLAGS') ++ if ldflags: ++ lib_dirs += [x[2:] for x in ldflags.split() if x.startswith('-L')] + exts = [] + missing = [] + +@@ -572,6 +590,11 @@ class PyBuildExt(build_ext): + if host_platform in ['darwin', 'beos']: + math_libs = [] + ++ # Insert libraries and headers from embedded root file system (RFS) ++ if 'RFS' in os.environ: ++ lib_dirs += [os.environ['RFS'] + '/usr/lib'] ++ inc_dirs += [os.environ['RFS'] + '/usr/include'] ++ + # XXX Omitted modules: gl, pure, dl, SGI-specific modules + + # +@@ -728,7 +751,8 @@ class PyBuildExt(build_ext): + curses_library = "" + # Determine if readline is already linked against curses or tinfo. + if do_readline and find_executable('ldd'): +- fp = os.popen("ldd %s" % do_readline) ++ fp = os.popen("arm-linux-androideabi-objdump -x %s | grep NEEDED" % ++ do_readline) + ldd_output = fp.readlines() + ret = fp.close() + if ret is None or ret >> 8 == 0: +@@ -751,7 +775,11 @@ class PyBuildExt(build_ext): + curses_library = 'ncurses' + elif self.compiler.find_library_file(lib_dirs, 'curses'): + curses_library = 'curses' +- ++ print('XXXXXXXXXXXXXXX TESTING CURSES LIBRARY XXXXXXXXXXXXXXXXXXX') ++ print(curses_library) ++ print(readline_termcap_library) ++ print(do_readline) ++ print('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + if host_platform == 'darwin': + os_release = int(os.uname()[2].split('.')[0]) + dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') +@@ -774,7 +802,7 @@ class PyBuildExt(build_ext): + # before the (possibly broken) dynamic library in /usr/lib. + readline_extra_link_args = ('-Wl,-search_paths_first',) + else: +- readline_extra_link_args = () ++ readline_extra_link_args = ('-lncurses',) + + readline_libs = ['readline'] + if readline_termcap_library: +@@ -812,18 +840,15 @@ class PyBuildExt(build_ext): + '/usr/local/ssl/include', + '/usr/contrib/ssl/include/' + ] +- ssl_incs = find_file('openssl/ssl.h', inc_dirs, +- search_for_ssl_incs_in +- ) ++ ssl_incs = [ ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include'), ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')] + if ssl_incs is not None: + krb5_h = find_file('krb5.h', inc_dirs, + ['/usr/kerberos/include']) + if krb5_h: + ssl_incs += krb5_h +- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' +- ] ) ++ ssl_libs = [os.environ["OPENSSL_BUILD"]] + + if (ssl_incs is not None and + ssl_libs is not None): +@@ -841,8 +866,8 @@ class PyBuildExt(build_ext): + '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' ) + + # look for the openssl version header on the compiler search path. +- opensslv_h = find_file('openssl/opensslv.h', [], +- inc_dirs + search_for_ssl_incs_in) ++ opensslv_h = [os.path.join(os.environ["OPENSSL_BUILD"], 'include'), ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')] + if opensslv_h: + name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') + if host_platform == 'darwin' and is_macosx_sdk_path(name): +@@ -859,8 +884,7 @@ class PyBuildExt(build_ext): + + min_openssl_ver = 0x00907000 + have_any_openssl = ssl_incs is not None and ssl_libs is not None +- have_usable_openssl = (have_any_openssl and +- openssl_ver >= min_openssl_ver) ++ have_usable_openssl = (have_any_openssl and True) + + if have_any_openssl: + if have_usable_openssl: +@@ -1117,13 +1141,22 @@ class PyBuildExt(build_ext): + # We hunt for #define SQLITE_VERSION "n.n.n" + # We need to find >= sqlite version 3.0.8 + sqlite_incdir = sqlite_libdir = None +- sqlite_inc_paths = [ '/usr/include', +- '/usr/include/sqlite', +- '/usr/include/sqlite3', +- '/usr/local/include', +- '/usr/local/include/sqlite', +- '/usr/local/include/sqlite3', +- ] ++ if not cross_compiling: ++ sqlite_inc_paths = [ '/usr/include', ++ '/usr/include/sqlite', ++ '/usr/include/sqlite3', ++ '/usr/local/include', ++ '/usr/local/include/sqlite', ++ '/usr/local/include/sqlite3', ++ ] ++ else: ++ # The common install prefix of 3rd party headers used during ++ # cross compilation ++ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX') ++ if mydir: ++ sqlite_inc_paths = [mydir + '/include'] ++ else: ++ sqlite_inc_paths = [] + if cross_compiling: + sqlite_inc_paths = [] + MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) +@@ -1175,8 +1208,9 @@ class PyBuildExt(build_ext): + sqlite_dirs_to_check + lib_dirs, 'sqlite3') + if sqlite_libfile: + sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))] +- +- if sqlite_incdir and sqlite_libdir: ++ sqlite_incdir = os.environ["SQLITE3_INC_DIR"] ++ sqlite_libdir = [os.environ["SQLITE3_LIB_DIR"]] ++ if os.path.isdir(sqlite_incdir) and os.path.isdir(sqlite_libdir[0]): + sqlite_srcs = ['_sqlite/cache.c', + '_sqlite/connection.c', + '_sqlite/cursor.c', +@@ -2043,8 +2077,13 @@ class PyBuildExt(build_ext): + + # Pass empty CFLAGS because we'll just append the resulting + # CFLAGS to Python's; -g or -O2 is to be avoided. +- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ +- % (ffi_builddir, ffi_srcdir, " ".join(config_args)) ++ if cross_compiling: ++ cmd = "cd %s && env CFLAGS='' '%s/configure' --host=%s --build=%s %s" % ( ++ ffi_builddir, ffi_srcdir, os.environ.get('HOSTARCH'), ++ os.environ.get('BUILDARCH'), " ".join(config_args)) ++ else: ++ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" % ( ++ ffi_builddir, ffi_srcdir, " ".join(config_args)) + + res = os.system(cmd) + if res or not os.path.exists(ffi_configfile): diff --git a/pythonforandroid/recipes/python2/patches/unused/Python_2.7.15-ctypes-libffi-fix-configure.patch b/pythonforandroid/recipes/python2/patches/unused/Python_2.7.15-ctypes-libffi-fix-configure.patch new file mode 100644 index 0000000000..f6b8963496 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/Python_2.7.15-ctypes-libffi-fix-configure.patch @@ -0,0 +1,33 @@ +diff -pruN Python-2.7.15.orig//Modules/_ctypes/libffi/configure.ac Python-2.7.15/Modules/_ctypes/libffi/configure.ac +--- Python-2.7.15.orig//Modules/_ctypes/libffi/configure.ac 2017-12-29 22:01:18.000000000 +0200 ++++ Python-2.7.15/Modules/_ctypes/libffi/configure.ac 2017-12-29 22:46:02.000000000 +0200 +@@ -621,7 +621,7 @@ + + AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) + +-AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) ++AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile ) + + AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h) + +diff -pruN Python-2.7.15.orig//Modules/_ctypes/libffi/Makefile.am Python-2.7.15/Modules/_ctypes/libffi/Makefile.am +--- Python-2.7.15.orig//Modules/_ctypes/libffi/Makefile.am 2017-12-29 21:09:11.000000000 +0100 ++++ Python-2.7.15/Modules/_ctypes/libffi/Makefile.am 2017-12-29 22:54:03.000000000 +0200 +@@ -4,7 +4,7 @@ + + ACLOCAL_AMFLAGS = -I m4 + +-SUBDIRS = include testsuite man ++SUBDIRS = include + + EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ +@@ -52,8 +52,6 @@ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags ChangeLog.libffi-3.1 + +-info_TEXINFOS = doc/libffi.texi +- + ## ################################################################ + + ## diff --git a/pythonforandroid/recipes/python2/patches/unused/ctypes-find-library.patch b/pythonforandroid/recipes/python2/patches/unused/ctypes-find-library.patch new file mode 100644 index 0000000000..68fa93f526 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/ctypes-find-library.patch @@ -0,0 +1,28 @@ +diff -ur Python-2.7.2.orig/Lib/ctypes/util.py Python-2.7.2/Lib/ctypes/util.py +--- Python-2.7.2.orig/Lib/ctypes/util.py 2011-06-11 16:46:24.000000000 +0100 ++++ Python-2.7.2/Lib/ctypes/util.py 2015-05-10 15:50:18.906203529 +0100 +@@ -71,7 +71,21 @@ + def find_library(name): + return name + +-if os.name == "posix" and sys.platform == "darwin": ++# this test is for android specifically shoudl match here and ignore any ++# of the other platform tests below ++if os.name == "posix": ++ def find_library(name): ++ """ hack to find librarys for kivy and android ++ split the path and get the first parts which will give us ++ the app path something like /data/data/org.app.foo/""" ++ app_root = os.path.abspath('./').split(os.path.sep)[0:4] ++ lib_search = os.path.sep.join(app_root) + os.path.sep + 'lib' ++ for filename in os.listdir(lib_search): ++ if filename.endswith('.so') and name in filename: ++ return lib_search + os.path.sep + filename ++ return None ++ ++elif os.name == "posix" and sys.platform == "darwin": + from ctypes.macholib.dyld import dyld_find as _dyld_find + def find_library(name): + possible = ['lib%s.dylib' % name, +Only in Python-2.7.2/Lib/ctypes: util.py.save +Only in Python-2.7.2/Lib/ctypes: util.py.save.1 diff --git a/pythonforandroid/recipes/python2/patches/unused/custom-loader.patch b/pythonforandroid/recipes/python2/patches/unused/custom-loader.patch new file mode 100644 index 0000000000..f4408a0a05 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/custom-loader.patch @@ -0,0 +1,67 @@ +--- Python-2.7.2.orig/Python/dynload_shlib.c 2010-05-09 16:46:46.000000000 +0200 ++++ Python-2.7.2/Python/dynload_shlib.c 2011-04-20 17:52:12.000000000 +0200 +@@ -6,6 +6,7 @@ + + #include + #include ++#include + + #if defined(__NetBSD__) + #include +@@ -75,6 +76,21 @@ + char pathbuf[260]; + int dlopenflags=0; + ++ static void *libpymodules = -1; ++ void *rv = NULL; ++ ++ /* Ensure we have access to libpymodules. */ ++ if (libpymodules == -1) { ++ printf("ANDROID_UNPACK = %s\n", getenv("ANDROID_UNPACK")); ++ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_UNPACK")); ++ libpymodules = dlopen(pathbuf, RTLD_NOW); ++ ++ if (libpymodules == NULL) { ++ //abort(); ++ } ++ } ++ ++ + if (strchr(pathname, '/') == NULL) { + /* Prefix bare filename with "./" */ + PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname); +@@ -84,6 +100,17 @@ + PyOS_snprintf(funcname, sizeof(funcname), + LEAD_UNDERSCORE "init%.200s", shortname); + ++ ++ /* Read symbols that have been linked into the main binary. */ ++ ++ if (libpymodules) { ++ rv = dlsym(libpymodules, funcname); ++ if (rv != NULL) { ++ return rv; ++ } ++ } ++ ++ + if (fp != NULL) { + int i; + struct stat statb; +--- Python-2.7.2.orig/Python/pythonrun.c 2010-10-29 05:45:34.000000000 +0200 ++++ Python-2.7.2/Python/pythonrun.c 2011-04-20 17:52:12.000000000 +0200 +@@ -254,9 +254,13 @@ + _PyGILState_Init(interp, tstate); + #endif /* WITH_THREAD */ + ++ /* For PGS4A, we don't want to call initsite, as we won't have the ++ library path set up until start.pyx finishes running. */ ++#if 0 + if (!Py_NoSiteFlag) + initsite(); /* Module site */ +- ++#endif ++ + if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { + p = icodeset = codeset = strdup(p); + free_codeset = 1; diff --git a/pythonforandroid/recipes/python2/patches/unused/disable-modules.patch b/pythonforandroid/recipes/python2/patches/unused/disable-modules.patch new file mode 100644 index 0000000000..cdf4822ee5 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/disable-modules.patch @@ -0,0 +1,11 @@ +--- Python-2.7.15/setup.py.orig 2017-12-29 11:14:51.826097000 +0100 ++++ Python-2.7.15/setup.py 2017-12-29 12:31:18.192036284 +0100 +@@ -33,7 +33,7 @@ + COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) + + # This global variable is used to hold the list of modules to be disabled. +-disabled_module_list = [] ++disabled_module_list = ['spwd','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing'] + + def add_dir_to_list(dirlist, dir): + """Add the directory 'dir' to the list 'dirlist' (at the front) if diff --git a/pythonforandroid/recipes/python2/patches/unused/disable-openpty.patch b/pythonforandroid/recipes/python2/patches/unused/disable-openpty.patch new file mode 100644 index 0000000000..76beefd722 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/disable-openpty.patch @@ -0,0 +1,59 @@ +--- Python-2.7.15/Modules/posixmodule.c.orig 2017-12-29 11:14:51.668097000 +0100 ++++ Python-2.7.15/Modules/posixmodule.c 2017-12-29 12:04:09.598668939 +0100 +@@ -3941,54 +3941,8 @@ + static PyObject * + posix_openpty(PyObject *self, PyObject *noargs) + { +- int master_fd, slave_fd; +-#ifndef HAVE_OPENPTY +- char * slave_name; +-#endif +-#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) +- PyOS_sighandler_t sig_saved; +-#ifdef sun +- extern char *ptsname(int fildes); +-#endif +-#endif +- +-#ifdef HAVE_OPENPTY +- if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) +- return posix_error(); +-#elif defined(HAVE__GETPTY) +- slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); +- if (slave_name == NULL) +- return posix_error(); +- +- slave_fd = open(slave_name, O_RDWR); +- if (slave_fd < 0) +- return posix_error(); +-#else +- master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ +- if (master_fd < 0) +- return posix_error(); +- sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL); +- /* change permission of slave */ +- if (grantpt(master_fd) < 0) { +- PyOS_setsig(SIGCHLD, sig_saved); +- return posix_error(); +- } +- /* unlock slave */ +- if (unlockpt(master_fd) < 0) { +- PyOS_setsig(SIGCHLD, sig_saved); +- return posix_error(); +- } +- PyOS_setsig(SIGCHLD, sig_saved); +- slave_name = ptsname(master_fd); /* get name of slave */ +- if (slave_name == NULL) +- return posix_error(); +- slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ +- if (slave_fd < 0) +- return posix_error(); +-#endif /* HAVE_OPENPTY */ +- +- return Py_BuildValue("(ii)", master_fd, slave_fd); +- ++ PyErr_SetString(PyExc_NotImplementedError, "openpty not implemented for this build"); ++ return NULL; + } + #endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) */ + diff --git a/pythonforandroid/recipes/python2/patches/unused/ffi-config.sub-2.7.15.patch b/pythonforandroid/recipes/python2/patches/unused/ffi-config.sub-2.7.15.patch new file mode 100644 index 0000000000..12e06b6c06 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/ffi-config.sub-2.7.15.patch @@ -0,0 +1,1792 @@ +--- Python-2.7.15/Modules/_ctypes/libffi/config.sub.orig 2017-12-29 16:59:51.000000000 +0100 ++++ Python-2.7.15/Modules/_ctypes/libffi/config.sub 2017-12-29 18:58:32.633287511 +0200 +@@ -1,1788 +1,2 @@ + #! /bin/sh +-# Configuration validation subroutine script. +-# Copyright 1992-2013 Free Software Foundation, Inc. +- +-timestamp='2013-04-24' +- +-# This file is free software; you can redistribute it and/or modify it +-# under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 3 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, but +-# WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-# General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, see . +-# +-# As a special exception to the GNU General Public License, if you +-# distribute this file as part of a program that contains a +-# configuration script generated by Autoconf, you may include it under +-# the same distribution terms that you use for the rest of that +-# program. This Exception is an additional permission under section 7 +-# of the GNU General Public License, version 3 ("GPLv3"). +- +- +-# Please send patches with a ChangeLog entry to config-patches@gnu.org. +-# +-# Configuration subroutine to validate and canonicalize a configuration type. +-# Supply the specified configuration type as an argument. +-# If it is invalid, we print an error message on stderr and exit with code 1. +-# Otherwise, we print the canonical config type on stdout and succeed. +- +-# You can get the latest version of this script from: +-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +- +-# This file is supposed to be the same for all GNU packages +-# and recognize all the CPU types, system types and aliases +-# that are meaningful with *any* GNU software. +-# Each package is responsible for reporting which valid configurations +-# it does not support. The user should be able to distinguish +-# a failure to support a valid configuration from a meaningless +-# configuration. +- +-# The goal of this file is to map all the various variations of a given +-# machine specification into a single specification in the form: +-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +-# or in some cases, the newer four-part form: +-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +-# It is wrong to echo any other type of specification. +- +-me=`echo "$0" | sed -e 's,.*/,,'` +- +-usage="\ +-Usage: $0 [OPTION] CPU-MFR-OPSYS +- $0 [OPTION] ALIAS +- +-Canonicalize a configuration name. +- +-Operation modes: +- -h, --help print this help, then exit +- -t, --time-stamp print date of last modification, then exit +- -v, --version print version number, then exit +- +-Report bugs and patches to ." +- +-version="\ +-GNU config.sub ($timestamp) +- +-Copyright 1992-2013 Free Software Foundation, Inc. +- +-This is free software; see the source for copying conditions. There is NO +-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +- +-help=" +-Try \`$me --help' for more information." +- +-# Parse command line +-while test $# -gt 0 ; do +- case $1 in +- --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit ;; +- --version | -v ) +- echo "$version" ; exit ;; +- --help | --h* | -h ) +- echo "$usage"; exit ;; +- -- ) # Stop option processing +- shift; break ;; +- - ) # Use stdin as input. +- break ;; +- -* ) +- echo "$me: invalid option $1$help" +- exit 1 ;; +- +- *local*) +- # First pass through any local machine types. +- echo $1 +- exit ;; +- +- * ) +- break ;; +- esac +-done +- +-case $# in +- 0) echo "$me: missing argument$help" >&2 +- exit 1;; +- 1) ;; +- *) echo "$me: too many arguments$help" >&2 +- exit 1;; +-esac +- +-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +-# Here we must recognize all the valid KERNEL-OS combinations. +-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +-case $maybe_os in +- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ +- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ +- knetbsd*-gnu* | netbsd*-gnu* | \ +- kopensolaris*-gnu* | \ +- storm-chaos* | os2-emx* | rtmk-nova*) +- os=-$maybe_os +- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` +- ;; +- android-linux) +- os=-linux-android +- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown +- ;; +- *) +- basic_machine=`echo $1 | sed 's/-[^-]*$//'` +- if [ $basic_machine != $1 ] +- then os=`echo $1 | sed 's/.*-/-/'` +- else os=; fi +- ;; +-esac +- +-### Let's recognize common machines as not being operating systems so +-### that things like config.sub decstation-3100 work. We also +-### recognize some manufacturers as not being operating systems, so we +-### can provide default operating systems below. +-case $os in +- -sun*os*) +- # Prevent following clause from handling this invalid input. +- ;; +- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ +- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ +- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ +- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ +- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ +- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray | -microblaze*) +- os= +- basic_machine=$1 +- ;; +- -bluegene*) +- os=-cnk +- ;; +- -sim | -cisco | -oki | -wec | -winbond) +- os= +- basic_machine=$1 +- ;; +- -scout) +- ;; +- -wrs) +- os=-vxworks +- basic_machine=$1 +- ;; +- -chorusos*) +- os=-chorusos +- basic_machine=$1 +- ;; +- -chorusrdb) +- os=-chorusrdb +- basic_machine=$1 +- ;; +- -hiux*) +- os=-hiuxwe2 +- ;; +- -sco6) +- os=-sco5v6 +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco5) +- os=-sco3.2v5 +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco4) +- os=-sco3.2v4 +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco3.2.[4-9]*) +- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco3.2v[4-9]*) +- # Don't forget version if it is 3.2v4 or newer. +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco5v6*) +- # Don't forget version if it is 3.2v4 or newer. +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -sco*) +- os=-sco3.2v2 +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -udk*) +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -isc) +- os=-isc2.2 +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -clix*) +- basic_machine=clipper-intergraph +- ;; +- -isc*) +- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +- ;; +- -lynx*178) +- os=-lynxos178 +- ;; +- -lynx*5) +- os=-lynxos5 +- ;; +- -lynx*) +- os=-lynxos +- ;; +- -ptx*) +- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` +- ;; +- -windowsnt*) +- os=`echo $os | sed -e 's/windowsnt/winnt/'` +- ;; +- -psos*) +- os=-psos +- ;; +- -mint | -mint[0-9]*) +- basic_machine=m68k-atari +- os=-mint +- ;; +-esac +- +-# Decode aliases for certain CPU-COMPANY combinations. +-case $basic_machine in +- # Recognize the basic CPU types without company name. +- # Some are omitted here because they have special meanings below. +- 1750a | 580 \ +- | a29k \ +- | aarch64 | aarch64_be \ +- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ +- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ +- | am33_2.0 \ +- | arc | arceb \ +- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ +- | avr | avr32 \ +- | be32 | be64 \ +- | bfin \ +- | c4x | clipper \ +- | d10v | d30v | dlx | dsp16xx \ +- | epiphany \ +- | fido | fr30 | frv \ +- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ +- | hexagon \ +- | i370 | i860 | i960 | ia64 \ +- | ip2k | iq2000 \ +- | le32 | le64 \ +- | lm32 \ +- | m32c | m32r | m32rle | m68000 | m68k | m88k \ +- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ +- | mips | mipsbe | mipseb | mipsel | mipsle \ +- | mips16 \ +- | mips64 | mips64el \ +- | mips64octeon | mips64octeonel \ +- | mips64orion | mips64orionel \ +- | mips64r5900 | mips64r5900el \ +- | mips64vr | mips64vrel \ +- | mips64vr4100 | mips64vr4100el \ +- | mips64vr4300 | mips64vr4300el \ +- | mips64vr5000 | mips64vr5000el \ +- | mips64vr5900 | mips64vr5900el \ +- | mipsisa32 | mipsisa32el \ +- | mipsisa32r2 | mipsisa32r2el \ +- | mipsisa64 | mipsisa64el \ +- | mipsisa64r2 | mipsisa64r2el \ +- | mipsisa64sb1 | mipsisa64sb1el \ +- | mipsisa64sr71k | mipsisa64sr71kel \ +- | mipsr5900 | mipsr5900el \ +- | mipstx39 | mipstx39el \ +- | mn10200 | mn10300 \ +- | moxie \ +- | mt \ +- | msp430 \ +- | nds32 | nds32le | nds32be \ +- | nios | nios2 | nios2eb | nios2el \ +- | ns16k | ns32k \ +- | open8 \ +- | or1k | or32 \ +- | pdp10 | pdp11 | pj | pjl \ +- | powerpc | powerpc64 | powerpc64le | powerpcle \ +- | pyramid \ +- | rl78 | rx \ +- | score \ +- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ +- | sh64 | sh64le \ +- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ +- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ +- | spu \ +- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ +- | ubicom32 \ +- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ +- | we32k \ +- | x86 | xc16x | xstormy16 | xtensa \ +- | z8k | z80) +- basic_machine=$basic_machine-unknown +- ;; +- c54x) +- basic_machine=tic54x-unknown +- ;; +- c55x) +- basic_machine=tic55x-unknown +- ;; +- c6x) +- basic_machine=tic6x-unknown +- ;; +- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) +- basic_machine=$basic_machine-unknown +- os=-none +- ;; +- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) +- ;; +- ms1) +- basic_machine=mt-unknown +- ;; +- +- strongarm | thumb | xscale) +- basic_machine=arm-unknown +- ;; +- xgate) +- basic_machine=$basic_machine-unknown +- os=-none +- ;; +- xscaleeb) +- basic_machine=armeb-unknown +- ;; +- +- xscaleel) +- basic_machine=armel-unknown +- ;; +- +- # We use `pc' rather than `unknown' +- # because (1) that's what they normally are, and +- # (2) the word "unknown" tends to confuse beginning users. +- i*86 | x86_64) +- basic_machine=$basic_machine-pc +- ;; +- # Object if more than one company name word. +- *-*-*) +- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +- exit 1 +- ;; +- # Recognize the basic CPU types with company name. +- 580-* \ +- | a29k-* \ +- | aarch64-* | aarch64_be-* \ +- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ +- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ +- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ +- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ +- | avr-* | avr32-* \ +- | be32-* | be64-* \ +- | bfin-* | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* \ +- | clipper-* | craynv-* | cydra-* \ +- | d10v-* | d30v-* | dlx-* \ +- | elxsi-* \ +- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ +- | h8300-* | h8500-* \ +- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ +- | hexagon-* \ +- | i*86-* | i860-* | i960-* | ia64-* \ +- | ip2k-* | iq2000-* \ +- | le32-* | le64-* \ +- | lm32-* \ +- | m32c-* | m32r-* | m32rle-* \ +- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ +- | microblaze-* | microblazeel-* \ +- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ +- | mips16-* \ +- | mips64-* | mips64el-* \ +- | mips64octeon-* | mips64octeonel-* \ +- | mips64orion-* | mips64orionel-* \ +- | mips64r5900-* | mips64r5900el-* \ +- | mips64vr-* | mips64vrel-* \ +- | mips64vr4100-* | mips64vr4100el-* \ +- | mips64vr4300-* | mips64vr4300el-* \ +- | mips64vr5000-* | mips64vr5000el-* \ +- | mips64vr5900-* | mips64vr5900el-* \ +- | mipsisa32-* | mipsisa32el-* \ +- | mipsisa32r2-* | mipsisa32r2el-* \ +- | mipsisa64-* | mipsisa64el-* \ +- | mipsisa64r2-* | mipsisa64r2el-* \ +- | mipsisa64sb1-* | mipsisa64sb1el-* \ +- | mipsisa64sr71k-* | mipsisa64sr71kel-* \ +- | mipsr5900-* | mipsr5900el-* \ +- | mipstx39-* | mipstx39el-* \ +- | mmix-* \ +- | mt-* \ +- | msp430-* \ +- | nds32-* | nds32le-* | nds32be-* \ +- | nios-* | nios2-* | nios2eb-* | nios2el-* \ +- | none-* | np1-* | ns16k-* | ns32k-* \ +- | open8-* \ +- | orion-* \ +- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ +- | pyramid-* \ +- | rl78-* | romp-* | rs6000-* | rx-* \ +- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ +- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ +- | sparclite-* \ +- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ +- | tahoe-* \ +- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ +- | tile*-* \ +- | tron-* \ +- | ubicom32-* \ +- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ +- | vax-* \ +- | we32k-* \ +- | x86-* | x86_64-* | xc16x-* | xps100-* \ +- | xstormy16-* | xtensa*-* \ +- | ymp-* \ +- | z8k-* | z80-*) +- ;; +- # Recognize the basic CPU types without company name, with glob match. +- xtensa*) +- basic_machine=$basic_machine-unknown +- ;; +- # Recognize the various machine names and aliases which stand +- # for a CPU type and a company and sometimes even an OS. +- 386bsd) +- basic_machine=i386-unknown +- os=-bsd +- ;; +- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) +- basic_machine=m68000-att +- ;; +- 3b*) +- basic_machine=we32k-att +- ;; +- a29khif) +- basic_machine=a29k-amd +- os=-udi +- ;; +- abacus) +- basic_machine=abacus-unknown +- ;; +- adobe68k) +- basic_machine=m68010-adobe +- os=-scout +- ;; +- alliant | fx80) +- basic_machine=fx80-alliant +- ;; +- altos | altos3068) +- basic_machine=m68k-altos +- ;; +- am29k) +- basic_machine=a29k-none +- os=-bsd +- ;; +- amd64) +- basic_machine=x86_64-pc +- ;; +- amd64-*) +- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- amdahl) +- basic_machine=580-amdahl +- os=-sysv +- ;; +- amiga | amiga-*) +- basic_machine=m68k-unknown +- ;; +- amigaos | amigados) +- basic_machine=m68k-unknown +- os=-amigaos +- ;; +- amigaunix | amix) +- basic_machine=m68k-unknown +- os=-sysv4 +- ;; +- apollo68) +- basic_machine=m68k-apollo +- os=-sysv +- ;; +- apollo68bsd) +- basic_machine=m68k-apollo +- os=-bsd +- ;; +- aros) +- basic_machine=i386-pc +- os=-aros +- ;; +- aux) +- basic_machine=m68k-apple +- os=-aux +- ;; +- balance) +- basic_machine=ns32k-sequent +- os=-dynix +- ;; +- blackfin) +- basic_machine=bfin-unknown +- os=-linux +- ;; +- blackfin-*) +- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` +- os=-linux +- ;; +- bluegene*) +- basic_machine=powerpc-ibm +- os=-cnk +- ;; +- c54x-*) +- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- c55x-*) +- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- c6x-*) +- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- c90) +- basic_machine=c90-cray +- os=-unicos +- ;; +- cegcc) +- basic_machine=arm-unknown +- os=-cegcc +- ;; +- convex-c1) +- basic_machine=c1-convex +- os=-bsd +- ;; +- convex-c2) +- basic_machine=c2-convex +- os=-bsd +- ;; +- convex-c32) +- basic_machine=c32-convex +- os=-bsd +- ;; +- convex-c34) +- basic_machine=c34-convex +- os=-bsd +- ;; +- convex-c38) +- basic_machine=c38-convex +- os=-bsd +- ;; +- cray | j90) +- basic_machine=j90-cray +- os=-unicos +- ;; +- craynv) +- basic_machine=craynv-cray +- os=-unicosmp +- ;; +- cr16 | cr16-*) +- basic_machine=cr16-unknown +- os=-elf +- ;; +- crds | unos) +- basic_machine=m68k-crds +- ;; +- crisv32 | crisv32-* | etraxfs*) +- basic_machine=crisv32-axis +- ;; +- cris | cris-* | etrax*) +- basic_machine=cris-axis +- ;; +- crx) +- basic_machine=crx-unknown +- os=-elf +- ;; +- da30 | da30-*) +- basic_machine=m68k-da30 +- ;; +- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) +- basic_machine=mips-dec +- ;; +- decsystem10* | dec10*) +- basic_machine=pdp10-dec +- os=-tops10 +- ;; +- decsystem20* | dec20*) +- basic_machine=pdp10-dec +- os=-tops20 +- ;; +- delta | 3300 | motorola-3300 | motorola-delta \ +- | 3300-motorola | delta-motorola) +- basic_machine=m68k-motorola +- ;; +- delta88) +- basic_machine=m88k-motorola +- os=-sysv3 +- ;; +- dicos) +- basic_machine=i686-pc +- os=-dicos +- ;; +- djgpp) +- basic_machine=i586-pc +- os=-msdosdjgpp +- ;; +- dpx20 | dpx20-*) +- basic_machine=rs6000-bull +- os=-bosx +- ;; +- dpx2* | dpx2*-bull) +- basic_machine=m68k-bull +- os=-sysv3 +- ;; +- ebmon29k) +- basic_machine=a29k-amd +- os=-ebmon +- ;; +- elxsi) +- basic_machine=elxsi-elxsi +- os=-bsd +- ;; +- encore | umax | mmax) +- basic_machine=ns32k-encore +- ;; +- es1800 | OSE68k | ose68k | ose | OSE) +- basic_machine=m68k-ericsson +- os=-ose +- ;; +- fx2800) +- basic_machine=i860-alliant +- ;; +- genix) +- basic_machine=ns32k-ns +- ;; +- gmicro) +- basic_machine=tron-gmicro +- os=-sysv +- ;; +- go32) +- basic_machine=i386-pc +- os=-go32 +- ;; +- h3050r* | hiux*) +- basic_machine=hppa1.1-hitachi +- os=-hiuxwe2 +- ;; +- h8300hms) +- basic_machine=h8300-hitachi +- os=-hms +- ;; +- h8300xray) +- basic_machine=h8300-hitachi +- os=-xray +- ;; +- h8500hms) +- basic_machine=h8500-hitachi +- os=-hms +- ;; +- harris) +- basic_machine=m88k-harris +- os=-sysv3 +- ;; +- hp300-*) +- basic_machine=m68k-hp +- ;; +- hp300bsd) +- basic_machine=m68k-hp +- os=-bsd +- ;; +- hp300hpux) +- basic_machine=m68k-hp +- os=-hpux +- ;; +- hp3k9[0-9][0-9] | hp9[0-9][0-9]) +- basic_machine=hppa1.0-hp +- ;; +- hp9k2[0-9][0-9] | hp9k31[0-9]) +- basic_machine=m68000-hp +- ;; +- hp9k3[2-9][0-9]) +- basic_machine=m68k-hp +- ;; +- hp9k6[0-9][0-9] | hp6[0-9][0-9]) +- basic_machine=hppa1.0-hp +- ;; +- hp9k7[0-79][0-9] | hp7[0-79][0-9]) +- basic_machine=hppa1.1-hp +- ;; +- hp9k78[0-9] | hp78[0-9]) +- # FIXME: really hppa2.0-hp +- basic_machine=hppa1.1-hp +- ;; +- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) +- # FIXME: really hppa2.0-hp +- basic_machine=hppa1.1-hp +- ;; +- hp9k8[0-9][13679] | hp8[0-9][13679]) +- basic_machine=hppa1.1-hp +- ;; +- hp9k8[0-9][0-9] | hp8[0-9][0-9]) +- basic_machine=hppa1.0-hp +- ;; +- hppa-next) +- os=-nextstep3 +- ;; +- hppaosf) +- basic_machine=hppa1.1-hp +- os=-osf +- ;; +- hppro) +- basic_machine=hppa1.1-hp +- os=-proelf +- ;; +- i370-ibm* | ibm*) +- basic_machine=i370-ibm +- ;; +- i*86v32) +- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +- os=-sysv32 +- ;; +- i*86v4*) +- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +- os=-sysv4 +- ;; +- i*86v) +- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +- os=-sysv +- ;; +- i*86sol2) +- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +- os=-solaris2 +- ;; +- i386mach) +- basic_machine=i386-mach +- os=-mach +- ;; +- i386-vsta | vsta) +- basic_machine=i386-unknown +- os=-vsta +- ;; +- iris | iris4d) +- basic_machine=mips-sgi +- case $os in +- -irix*) +- ;; +- *) +- os=-irix4 +- ;; +- esac +- ;; +- isi68 | isi) +- basic_machine=m68k-isi +- os=-sysv +- ;; +- m68knommu) +- basic_machine=m68k-unknown +- os=-linux +- ;; +- m68knommu-*) +- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` +- os=-linux +- ;; +- m88k-omron*) +- basic_machine=m88k-omron +- ;; +- magnum | m3230) +- basic_machine=mips-mips +- os=-sysv +- ;; +- merlin) +- basic_machine=ns32k-utek +- os=-sysv +- ;; +- microblaze*) +- basic_machine=microblaze-xilinx +- ;; +- mingw64) +- basic_machine=x86_64-pc +- os=-mingw64 +- ;; +- mingw32) +- basic_machine=i386-pc +- os=-mingw32 +- ;; +- mingw32ce) +- basic_machine=arm-unknown +- os=-mingw32ce +- ;; +- miniframe) +- basic_machine=m68000-convergent +- ;; +- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) +- basic_machine=m68k-atari +- os=-mint +- ;; +- mips3*-*) +- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` +- ;; +- mips3*) +- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown +- ;; +- monitor) +- basic_machine=m68k-rom68k +- os=-coff +- ;; +- morphos) +- basic_machine=powerpc-unknown +- os=-morphos +- ;; +- msdos) +- basic_machine=i386-pc +- os=-msdos +- ;; +- ms1-*) +- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` +- ;; +- msys) +- basic_machine=i386-pc +- os=-msys +- ;; +- mvs) +- basic_machine=i370-ibm +- os=-mvs +- ;; +- nacl) +- basic_machine=le32-unknown +- os=-nacl +- ;; +- ncr3000) +- basic_machine=i486-ncr +- os=-sysv4 +- ;; +- netbsd386) +- basic_machine=i386-unknown +- os=-netbsd +- ;; +- netwinder) +- basic_machine=armv4l-rebel +- os=-linux +- ;; +- news | news700 | news800 | news900) +- basic_machine=m68k-sony +- os=-newsos +- ;; +- news1000) +- basic_machine=m68030-sony +- os=-newsos +- ;; +- news-3600 | risc-news) +- basic_machine=mips-sony +- os=-newsos +- ;; +- necv70) +- basic_machine=v70-nec +- os=-sysv +- ;; +- next | m*-next ) +- basic_machine=m68k-next +- case $os in +- -nextstep* ) +- ;; +- -ns2*) +- os=-nextstep2 +- ;; +- *) +- os=-nextstep3 +- ;; +- esac +- ;; +- nh3000) +- basic_machine=m68k-harris +- os=-cxux +- ;; +- nh[45]000) +- basic_machine=m88k-harris +- os=-cxux +- ;; +- nindy960) +- basic_machine=i960-intel +- os=-nindy +- ;; +- mon960) +- basic_machine=i960-intel +- os=-mon960 +- ;; +- nonstopux) +- basic_machine=mips-compaq +- os=-nonstopux +- ;; +- np1) +- basic_machine=np1-gould +- ;; +- neo-tandem) +- basic_machine=neo-tandem +- ;; +- nse-tandem) +- basic_machine=nse-tandem +- ;; +- nsr-tandem) +- basic_machine=nsr-tandem +- ;; +- op50n-* | op60c-*) +- basic_machine=hppa1.1-oki +- os=-proelf +- ;; +- openrisc | openrisc-*) +- basic_machine=or32-unknown +- ;; +- os400) +- basic_machine=powerpc-ibm +- os=-os400 +- ;; +- OSE68000 | ose68000) +- basic_machine=m68000-ericsson +- os=-ose +- ;; +- os68k) +- basic_machine=m68k-none +- os=-os68k +- ;; +- pa-hitachi) +- basic_machine=hppa1.1-hitachi +- os=-hiuxwe2 +- ;; +- paragon) +- basic_machine=i860-intel +- os=-osf +- ;; +- parisc) +- basic_machine=hppa-unknown +- os=-linux +- ;; +- parisc-*) +- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` +- os=-linux +- ;; +- pbd) +- basic_machine=sparc-tti +- ;; +- pbb) +- basic_machine=m68k-tti +- ;; +- pc532 | pc532-*) +- basic_machine=ns32k-pc532 +- ;; +- pc98) +- basic_machine=i386-pc +- ;; +- pc98-*) +- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- pentium | p5 | k5 | k6 | nexgen | viac3) +- basic_machine=i586-pc +- ;; +- pentiumpro | p6 | 6x86 | athlon | athlon_*) +- basic_machine=i686-pc +- ;; +- pentiumii | pentium2 | pentiumiii | pentium3) +- basic_machine=i686-pc +- ;; +- pentium4) +- basic_machine=i786-pc +- ;; +- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) +- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- pentiumpro-* | p6-* | 6x86-* | athlon-*) +- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) +- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- pentium4-*) +- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- pn) +- basic_machine=pn-gould +- ;; +- power) basic_machine=power-ibm +- ;; +- ppc | ppcbe) basic_machine=powerpc-unknown +- ;; +- ppc-* | ppcbe-*) +- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- ppcle | powerpclittle | ppc-le | powerpc-little) +- basic_machine=powerpcle-unknown +- ;; +- ppcle-* | powerpclittle-*) +- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- ppc64) basic_machine=powerpc64-unknown +- ;; +- ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- ppc64le | powerpc64little | ppc64-le | powerpc64-little) +- basic_machine=powerpc64le-unknown +- ;; +- ppc64le-* | powerpc64little-*) +- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- ps2) +- basic_machine=i386-ibm +- ;; +- pw32) +- basic_machine=i586-unknown +- os=-pw32 +- ;; +- rdos | rdos64) +- basic_machine=x86_64-pc +- os=-rdos +- ;; +- rdos32) +- basic_machine=i386-pc +- os=-rdos +- ;; +- rom68k) +- basic_machine=m68k-rom68k +- os=-coff +- ;; +- rm[46]00) +- basic_machine=mips-siemens +- ;; +- rtpc | rtpc-*) +- basic_machine=romp-ibm +- ;; +- s390 | s390-*) +- basic_machine=s390-ibm +- ;; +- s390x | s390x-*) +- basic_machine=s390x-ibm +- ;; +- sa29200) +- basic_machine=a29k-amd +- os=-udi +- ;; +- sb1) +- basic_machine=mipsisa64sb1-unknown +- ;; +- sb1el) +- basic_machine=mipsisa64sb1el-unknown +- ;; +- sde) +- basic_machine=mipsisa32-sde +- os=-elf +- ;; +- sei) +- basic_machine=mips-sei +- os=-seiux +- ;; +- sequent) +- basic_machine=i386-sequent +- ;; +- sh) +- basic_machine=sh-hitachi +- os=-hms +- ;; +- sh5el) +- basic_machine=sh5le-unknown +- ;; +- sh64) +- basic_machine=sh64-unknown +- ;; +- sparclite-wrs | simso-wrs) +- basic_machine=sparclite-wrs +- os=-vxworks +- ;; +- sps7) +- basic_machine=m68k-bull +- os=-sysv2 +- ;; +- spur) +- basic_machine=spur-unknown +- ;; +- st2000) +- basic_machine=m68k-tandem +- ;; +- stratus) +- basic_machine=i860-stratus +- os=-sysv4 +- ;; +- strongarm-* | thumb-*) +- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` +- ;; +- sun2) +- basic_machine=m68000-sun +- ;; +- sun2os3) +- basic_machine=m68000-sun +- os=-sunos3 +- ;; +- sun2os4) +- basic_machine=m68000-sun +- os=-sunos4 +- ;; +- sun3os3) +- basic_machine=m68k-sun +- os=-sunos3 +- ;; +- sun3os4) +- basic_machine=m68k-sun +- os=-sunos4 +- ;; +- sun4os3) +- basic_machine=sparc-sun +- os=-sunos3 +- ;; +- sun4os4) +- basic_machine=sparc-sun +- os=-sunos4 +- ;; +- sun4sol2) +- basic_machine=sparc-sun +- os=-solaris2 +- ;; +- sun3 | sun3-*) +- basic_machine=m68k-sun +- ;; +- sun4) +- basic_machine=sparc-sun +- ;; +- sun386 | sun386i | roadrunner) +- basic_machine=i386-sun +- ;; +- sv1) +- basic_machine=sv1-cray +- os=-unicos +- ;; +- symmetry) +- basic_machine=i386-sequent +- os=-dynix +- ;; +- t3e) +- basic_machine=alphaev5-cray +- os=-unicos +- ;; +- t90) +- basic_machine=t90-cray +- os=-unicos +- ;; +- tile*) +- basic_machine=$basic_machine-unknown +- os=-linux-gnu +- ;; +- tx39) +- basic_machine=mipstx39-unknown +- ;; +- tx39el) +- basic_machine=mipstx39el-unknown +- ;; +- toad1) +- basic_machine=pdp10-xkl +- os=-tops20 +- ;; +- tower | tower-32) +- basic_machine=m68k-ncr +- ;; +- tpf) +- basic_machine=s390x-ibm +- os=-tpf +- ;; +- udi29k) +- basic_machine=a29k-amd +- os=-udi +- ;; +- ultra3) +- basic_machine=a29k-nyu +- os=-sym1 +- ;; +- v810 | necv810) +- basic_machine=v810-nec +- os=-none +- ;; +- vaxv) +- basic_machine=vax-dec +- os=-sysv +- ;; +- vms) +- basic_machine=vax-dec +- os=-vms +- ;; +- vpp*|vx|vx-*) +- basic_machine=f301-fujitsu +- ;; +- vxworks960) +- basic_machine=i960-wrs +- os=-vxworks +- ;; +- vxworks68) +- basic_machine=m68k-wrs +- os=-vxworks +- ;; +- vxworks29k) +- basic_machine=a29k-wrs +- os=-vxworks +- ;; +- w65*) +- basic_machine=w65-wdc +- os=-none +- ;; +- w89k-*) +- basic_machine=hppa1.1-winbond +- os=-proelf +- ;; +- xbox) +- basic_machine=i686-pc +- os=-mingw32 +- ;; +- xps | xps100) +- basic_machine=xps100-honeywell +- ;; +- xscale-* | xscalee[bl]-*) +- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` +- ;; +- ymp) +- basic_machine=ymp-cray +- os=-unicos +- ;; +- z8k-*-coff) +- basic_machine=z8k-unknown +- os=-sim +- ;; +- z80-*-coff) +- basic_machine=z80-unknown +- os=-sim +- ;; +- none) +- basic_machine=none-none +- os=-none +- ;; +- +-# Here we handle the default manufacturer of certain CPU types. It is in +-# some cases the only manufacturer, in others, it is the most popular. +- w89k) +- basic_machine=hppa1.1-winbond +- ;; +- op50n) +- basic_machine=hppa1.1-oki +- ;; +- op60c) +- basic_machine=hppa1.1-oki +- ;; +- romp) +- basic_machine=romp-ibm +- ;; +- mmix) +- basic_machine=mmix-knuth +- ;; +- rs6000) +- basic_machine=rs6000-ibm +- ;; +- vax) +- basic_machine=vax-dec +- ;; +- pdp10) +- # there are many clones, so DEC is not a safe bet +- basic_machine=pdp10-unknown +- ;; +- pdp11) +- basic_machine=pdp11-dec +- ;; +- we32k) +- basic_machine=we32k-att +- ;; +- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) +- basic_machine=sh-unknown +- ;; +- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) +- basic_machine=sparc-sun +- ;; +- cydra) +- basic_machine=cydra-cydrome +- ;; +- orion) +- basic_machine=orion-highlevel +- ;; +- orion105) +- basic_machine=clipper-highlevel +- ;; +- mac | mpw | mac-mpw) +- basic_machine=m68k-apple +- ;; +- pmac | pmac-mpw) +- basic_machine=powerpc-apple +- ;; +- *-unknown) +- # Make sure to match an already-canonicalized machine name. +- ;; +- *) +- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +- exit 1 +- ;; +-esac +- +-# Here we canonicalize certain aliases for manufacturers. +-case $basic_machine in +- *-digital*) +- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +- ;; +- *-commodore*) +- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` +- ;; +- *) +- ;; +-esac +- +-# Decode manufacturer-specific aliases for certain operating systems. +- +-if [ x"$os" != x"" ] +-then +-case $os in +- # First match some system type aliases +- # that might get confused with valid system types. +- # -solaris* is a basic system type, with this one exception. +- -auroraux) +- os=-auroraux +- ;; +- -solaris1 | -solaris1.*) +- os=`echo $os | sed -e 's|solaris1|sunos4|'` +- ;; +- -solaris) +- os=-solaris2 +- ;; +- -svr4*) +- os=-sysv4 +- ;; +- -unixware*) +- os=-sysv4.2uw +- ;; +- -gnu/linux*) +- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` +- ;; +- # First accept the basic system types. +- # The portable systems comes first. +- # Each alternative MUST END IN A *, to match a version number. +- # -sysv* is not here because it comes later, after sysvr4. +- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ +- | -sym* | -kopensolaris* | -plan9* \ +- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* | -aros* \ +- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ +- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +- | -bitrig* | -openbsd* | -solidbsd* \ +- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ +- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ +- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ +- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* | -cegcc* \ +- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ +- | -linux-newlib* | -linux-musl* | -linux-uclibc* \ +- | -uxpv* | -beos* | -mpeix* | -udk* \ +- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ +- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ +- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ +- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ +- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) +- # Remember, each alternative MUST END IN *, to match a version number. +- ;; +- -qnx*) +- case $basic_machine in +- x86-* | i*86-*) +- ;; +- *) +- os=-nto$os +- ;; +- esac +- ;; +- -nto-qnx*) +- ;; +- -nto*) +- os=`echo $os | sed -e 's|nto|nto-qnx|'` +- ;; +- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ +- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) +- ;; +- -mac*) +- os=`echo $os | sed -e 's|mac|macos|'` +- ;; +- -linux-dietlibc) +- os=-linux-dietlibc +- ;; +- -linux*) +- os=`echo $os | sed -e 's|linux|linux-gnu|'` +- ;; +- -sunos5*) +- os=`echo $os | sed -e 's|sunos5|solaris2|'` +- ;; +- -sunos6*) +- os=`echo $os | sed -e 's|sunos6|solaris3|'` +- ;; +- -opened*) +- os=-openedition +- ;; +- -os400*) +- os=-os400 +- ;; +- -wince*) +- os=-wince +- ;; +- -osfrose*) +- os=-osfrose +- ;; +- -osf*) +- os=-osf +- ;; +- -utek*) +- os=-bsd +- ;; +- -dynix*) +- os=-bsd +- ;; +- -acis*) +- os=-aos +- ;; +- -atheos*) +- os=-atheos +- ;; +- -syllable*) +- os=-syllable +- ;; +- -386bsd) +- os=-bsd +- ;; +- -ctix* | -uts*) +- os=-sysv +- ;; +- -nova*) +- os=-rtmk-nova +- ;; +- -ns2 ) +- os=-nextstep2 +- ;; +- -nsk*) +- os=-nsk +- ;; +- # Preserve the version number of sinix5. +- -sinix5.*) +- os=`echo $os | sed -e 's|sinix|sysv|'` +- ;; +- -sinix*) +- os=-sysv4 +- ;; +- -tpf*) +- os=-tpf +- ;; +- -triton*) +- os=-sysv3 +- ;; +- -oss*) +- os=-sysv3 +- ;; +- -svr4) +- os=-sysv4 +- ;; +- -svr3) +- os=-sysv3 +- ;; +- -sysvr4) +- os=-sysv4 +- ;; +- # This must come after -sysvr4. +- -sysv*) +- ;; +- -ose*) +- os=-ose +- ;; +- -es1800*) +- os=-ose +- ;; +- -xenix) +- os=-xenix +- ;; +- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) +- os=-mint +- ;; +- -aros*) +- os=-aros +- ;; +- -zvmoe) +- os=-zvmoe +- ;; +- -dicos*) +- os=-dicos +- ;; +- -nacl*) +- ;; +- -none) +- ;; +- *) +- # Get rid of the `-' at the beginning of $os. +- os=`echo $os | sed 's/[^-]*-//'` +- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 +- exit 1 +- ;; +-esac +-else +- +-# Here we handle the default operating systems that come with various machines. +-# The value should be what the vendor currently ships out the door with their +-# machine or put another way, the most popular os provided with the machine. +- +-# Note that if you're going to try to match "-MANUFACTURER" here (say, +-# "-sun"), then you have to tell the case statement up towards the top +-# that MANUFACTURER isn't an operating system. Otherwise, code above +-# will signal an error saying that MANUFACTURER isn't an operating +-# system, and we'll never get to this point. +- +-case $basic_machine in +- score-*) +- os=-elf +- ;; +- spu-*) +- os=-elf +- ;; +- *-acorn) +- os=-riscix1.2 +- ;; +- arm*-rebel) +- os=-linux +- ;; +- arm*-semi) +- os=-aout +- ;; +- c4x-* | tic4x-*) +- os=-coff +- ;; +- hexagon-*) +- os=-elf +- ;; +- tic54x-*) +- os=-coff +- ;; +- tic55x-*) +- os=-coff +- ;; +- tic6x-*) +- os=-coff +- ;; +- # This must come before the *-dec entry. +- pdp10-*) +- os=-tops20 +- ;; +- pdp11-*) +- os=-none +- ;; +- *-dec | vax-*) +- os=-ultrix4.2 +- ;; +- m68*-apollo) +- os=-domain +- ;; +- i386-sun) +- os=-sunos4.0.2 +- ;; +- m68000-sun) +- os=-sunos3 +- ;; +- m68*-cisco) +- os=-aout +- ;; +- mep-*) +- os=-elf +- ;; +- mips*-cisco) +- os=-elf +- ;; +- mips*-*) +- os=-elf +- ;; +- or1k-*) +- os=-elf +- ;; +- or32-*) +- os=-coff +- ;; +- *-tti) # must be before sparc entry or we get the wrong os. +- os=-sysv3 +- ;; +- sparc-* | *-sun) +- os=-sunos4.1.1 +- ;; +- *-be) +- os=-beos +- ;; +- *-haiku) +- os=-haiku +- ;; +- *-ibm) +- os=-aix +- ;; +- *-knuth) +- os=-mmixware +- ;; +- *-wec) +- os=-proelf +- ;; +- *-winbond) +- os=-proelf +- ;; +- *-oki) +- os=-proelf +- ;; +- *-hp) +- os=-hpux +- ;; +- *-hitachi) +- os=-hiux +- ;; +- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) +- os=-sysv +- ;; +- *-cbm) +- os=-amigaos +- ;; +- *-dg) +- os=-dgux +- ;; +- *-dolphin) +- os=-sysv3 +- ;; +- m68k-ccur) +- os=-rtu +- ;; +- m88k-omron*) +- os=-luna +- ;; +- *-next ) +- os=-nextstep +- ;; +- *-sequent) +- os=-ptx +- ;; +- *-crds) +- os=-unos +- ;; +- *-ns) +- os=-genix +- ;; +- i370-*) +- os=-mvs +- ;; +- *-next) +- os=-nextstep3 +- ;; +- *-gould) +- os=-sysv +- ;; +- *-highlevel) +- os=-bsd +- ;; +- *-encore) +- os=-bsd +- ;; +- *-sgi) +- os=-irix +- ;; +- *-siemens) +- os=-sysv4 +- ;; +- *-masscomp) +- os=-rtu +- ;; +- f30[01]-fujitsu | f700-fujitsu) +- os=-uxpv +- ;; +- *-rom68k) +- os=-coff +- ;; +- *-*bug) +- os=-coff +- ;; +- *-apple) +- os=-macos +- ;; +- *-atari*) +- os=-mint +- ;; +- *) +- os=-none +- ;; +-esac +-fi +- +-# Here we handle the case where we know the os, and the CPU type, but not the +-# manufacturer. We pick the logical manufacturer. +-vendor=unknown +-case $basic_machine in +- *-unknown) +- case $os in +- -riscix*) +- vendor=acorn +- ;; +- -sunos*) +- vendor=sun +- ;; +- -cnk*|-aix*) +- vendor=ibm +- ;; +- -beos*) +- vendor=be +- ;; +- -hpux*) +- vendor=hp +- ;; +- -mpeix*) +- vendor=hp +- ;; +- -hiux*) +- vendor=hitachi +- ;; +- -unos*) +- vendor=crds +- ;; +- -dgux*) +- vendor=dg +- ;; +- -luna*) +- vendor=omron +- ;; +- -genix*) +- vendor=ns +- ;; +- -mvs* | -opened*) +- vendor=ibm +- ;; +- -os400*) +- vendor=ibm +- ;; +- -ptx*) +- vendor=sequent +- ;; +- -tpf*) +- vendor=ibm +- ;; +- -vxsim* | -vxworks* | -windiss*) +- vendor=wrs +- ;; +- -aux*) +- vendor=apple +- ;; +- -hms*) +- vendor=hitachi +- ;; +- -mpw* | -macos*) +- vendor=apple +- ;; +- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) +- vendor=atari +- ;; +- -vos*) +- vendor=stratus +- ;; +- esac +- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` +- ;; +-esac +- +-echo $basic_machine$os +-exit +- +-# Local variables: +-# eval: (add-hook 'write-file-hooks 'time-stamp) +-# time-stamp-start: "timestamp='" +-# time-stamp-format: "%:y-%02m-%02d" +-# time-stamp-end: "'" +-# End: ++echo arm-linux-androideabi diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-dlfcn.patch b/pythonforandroid/recipes/python2/patches/unused/fix-dlfcn.patch new file mode 100644 index 0000000000..85dd6c5c18 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-dlfcn.patch @@ -0,0 +1,26 @@ +diff -Naur Python-2.7.15.orig/Lib/plat-linux2/DLFCN.py Python-2.7.15/Lib/plat-linux2/DLFCN.py +--- Python-2.7.15.orig/Lib/plat-linux2/DLFCN.py 2017-12-29 17:46:24.000000000 +0200 ++++ Python-2.7.15/Lib/plat-linux2/DLFCN.py 2017-12-29 16:34:45.318131844 +0200 +@@ -74,10 +74,17 @@ + # Included from gnu/stubs.h + + # Included from bits/dlfcn.h ++# PATCHED FOR ANDROID (the only supported symbols are): ++# enum { ++# RTLD_NOW = 0, ++# RTLD_LAZY = 1, ++# RTLD_LOCAL = 0, ++# RTLD_GLOBAL = 2, ++# }; + RTLD_LAZY = 0x00001 +-RTLD_NOW = 0x00002 +-RTLD_BINDING_MASK = 0x3 +-RTLD_NOLOAD = 0x00004 +-RTLD_GLOBAL = 0x00100 ++RTLD_NOW = 0x00000 ++RTLD_BINDING_MASK = 0x0 ++RTLD_NOLOAD = 0x00000 ++RTLD_GLOBAL = 0x00002 + RTLD_LOCAL = 0 +-RTLD_NODELETE = 0x01000 ++RTLD_NODELETE = 0x00000 diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-dynamic-lookup.patch b/pythonforandroid/recipes/python2/patches/unused/fix-dynamic-lookup.patch new file mode 100644 index 0000000000..c48c867243 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-dynamic-lookup.patch @@ -0,0 +1,11 @@ +--- Python-2.7.15/Makefile.pre.in.orig 2017-12-29 13:37:39.934049414 +0100 ++++ Python-2.7.15/Makefile.pre.in 2017-12-29 13:41:38.101745579 +0100 +@@ -549,7 +549,7 @@ + fi + + libpython$(VERSION).dylib: $(LIBRARY_OBJS) +- $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ ++ $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + + + libpython$(VERSION).sl: $(LIBRARY_OBJS) diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-ftime-removal.patch b/pythonforandroid/recipes/python2/patches/unused/fix-ftime-removal.patch new file mode 100644 index 0000000000..3a405e7f8e --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-ftime-removal.patch @@ -0,0 +1,10 @@ +--- Python-2.7.15/Modules/timemodule.c.orig 2017-12-29 11:52:46.674588000 +0100 ++++ Python-2.7.15/Modules/timemodule.c 2017-12-29 11:53:34.028526305 +0100 +@@ -27,6 +27,7 @@ + #include + #endif + ++#undef HAVE_FTIME + #ifdef HAVE_FTIME + #include + #if !defined(MS_WINDOWS) && !defined(PYOS_OS2) diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-gethostbyaddr.patch b/pythonforandroid/recipes/python2/patches/unused/fix-gethostbyaddr.patch new file mode 100644 index 0000000000..53f2a845eb --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-gethostbyaddr.patch @@ -0,0 +1,12 @@ +--- Python-2.7.15/Modules/socketmodule.c.orig 2017-12-29 01:40:09.915694810 +0100 ++++ Python-2.7.15/Modules/socketmodule.c 2017-12-29 01:40:36.967694486 +0100 +@@ -156,6 +156,9 @@ + On the other hand, not all Linux versions agree, so there the settings + computed by the configure script are needed! */ + ++/* Android hack, same reason are what is described above */ ++#undef HAVE_GETHOSTBYNAME_R ++ + #ifndef linux + # undef HAVE_GETHOSTBYNAME_R_3_ARG + # undef HAVE_GETHOSTBYNAME_R_5_ARG diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-platform-2.7.15.patch b/pythonforandroid/recipes/python2/patches/unused/fix-platform-2.7.15.patch new file mode 100644 index 0000000000..2d4a59d9e5 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-platform-2.7.15.patch @@ -0,0 +1,32 @@ +--- Python-2.7.15/Python/getplatform.c.orig 2017-12-29 16:59:59.000000000 +0100 ++++ Python-2.7.15/Python/getplatform.c 2017-12-29 19:17:58.071596232 +0200 +@@ -1,12 +1,25 @@ + + #include "Python.h" + +-#ifndef PLATFORM +-#define PLATFORM "unknown" +-#endif ++#include ++#include + + const char * + Py_GetPlatform(void) + { +- return PLATFORM; ++ struct utsname u; ++ int i; ++ if ( uname(&u) < 0 ) ++ return "unknown"; ++ ++ char xx[37]; ++ memset(xx, 0, 37); ++ strcat (xx, u.sysname); ++ strcat (xx, "-"); ++ strcat (xx, u.machine); ++ ++ for (i=0; xx[i]; i++) ++ xx[i]=tolower(xx[i]); ++ ++ return xx; + } diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-remove-corefoundation.patch b/pythonforandroid/recipes/python2/patches/unused/fix-remove-corefoundation.patch new file mode 100644 index 0000000000..e04545d4e3 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-remove-corefoundation.patch @@ -0,0 +1,13 @@ +--- Python-2.7.2/configure.orig 2012-07-05 16:44:36.000000000 +0200 ++++ Python-2.7.2/configure 2012-07-05 16:44:44.000000000 +0200 +@@ -15182,10 +15182,6 @@ + + fi + +-if test $ac_sys_system = Darwin +-then +- LIBS="$LIBS -framework CoreFoundation" +-fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 diff --git a/pythonforandroid/recipes/python2/patches/unused/fix-termios.patch b/pythonforandroid/recipes/python2/patches/unused/fix-termios.patch new file mode 100644 index 0000000000..f21abc6708 --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/fix-termios.patch @@ -0,0 +1,29 @@ +--- Python-2.7.2.orig/Modules/termios.c 2012-06-12 02:49:39.780162534 +0200 ++++ Python-2.7.2/Modules/termios.c 2012-06-12 02:51:52.092157828 +0200 +@@ -230,6 +230,7 @@ + return Py_None; + } + ++#if 0 // No tcdrain defined for Android. + PyDoc_STRVAR(termios_tcdrain__doc__, + "tcdrain(fd) -> None\n\ + \n\ +@@ -249,6 +250,7 @@ + Py_INCREF(Py_None); + return Py_None; + } ++#endif + + PyDoc_STRVAR(termios_tcflush__doc__, + "tcflush(fd, queue) -> None\n\ +@@ -304,8 +306,10 @@ + METH_VARARGS, termios_tcsetattr__doc__}, + {"tcsendbreak", termios_tcsendbreak, + METH_VARARGS, termios_tcsendbreak__doc__}, ++#if 0 // No tcdrain defined for Android. + {"tcdrain", termios_tcdrain, + METH_VARARGS, termios_tcdrain__doc__}, ++#endif + {"tcflush", termios_tcflush, + METH_VARARGS, termios_tcflush__doc__}, + {"tcflow", termios_tcflow, diff --git a/pythonforandroid/recipes/python2/patches/unused/modules-locales-2.7.15.patch b/pythonforandroid/recipes/python2/patches/unused/modules-locales-2.7.15.patch new file mode 100644 index 0000000000..71382ec70b --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/modules-locales-2.7.15.patch @@ -0,0 +1,27 @@ +--- Python-2.7.15/Modules/_localemodule.c.orig 2017-12-29 05:32:50.000000000 +0200 ++++ Python-2.7.15/Modules/_localemodule.c 2017-12-29 21:33:42.241092717 +0200 +@@ -20,6 +20,8 @@ This software comes with no warranty. Us + #include + #endif + ++#define ANDROID ++ + #ifdef HAVE_LANGINFO_H + #include + #endif +@@ -206,6 +208,7 @@ PyDoc_STRVAR(localeconv__doc__, + static PyObject* + PyLocale_localeconv(PyObject* self) + { ++ #ifndef ANDROID + PyObject* result; + struct lconv *l; + PyObject *x; +@@ -266,6 +269,7 @@ PyLocale_localeconv(PyObject* self) + failed: + Py_XDECREF(result); + Py_XDECREF(x); ++ #endif // ANDROID + return NULL; + } + diff --git a/pythonforandroid/recipes/python2/patches/unused/verbose-compilation.patch b/pythonforandroid/recipes/python2/patches/unused/verbose-compilation.patch new file mode 100644 index 0000000000..128805fe0b --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/unused/verbose-compilation.patch @@ -0,0 +1,17 @@ +--- Python-2.7.15.orig/Makefile.pre.in 2017-12-29 21:05:06.000000000 +0100 ++++ Python-2.7.15/Makefile.pre.in 2017-12-29 23:26:13.094631704 +0100 +@@ -521,12 +521,12 @@ Modules/_math.o: Modules/_math.c Modules + # Under BSD make, MAKEFLAGS might be " -s -v x=y". + sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + @case "$$MAKEFLAGS" in \ +- *\ -s*|s*) quiet="-q";; \ ++ *\ -s*|s*) quiet="";; \ + *) quiet="";; \ + esac; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ +- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build ++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -v + + # Build static library + # avoid long command lines, same as LIBRARY_OBJS From e85969e448786e51b6c418b7813c2ce6811c74a5 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 14:27:36 +0100 Subject: [PATCH 05/66] Adapt sdl2's stuff to the new python2's build system --- .../bootstraps/common/build/build.py | 4 ++-- .../common/build/jni/application/src/start.c | 19 +++---------------- pythonforandroid/bootstraps/sdl2/__init__.py | 17 +---------------- pythonforandroid/recipes/sdl2/__init__.py | 9 ++++----- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index ffbcd58a10..3586f30158 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -46,7 +46,8 @@ def get_bootstrap_name(): # Try to find a host version of Python that matches our ARM version. PYTHON = join(curdir, 'python-install', 'bin', 'python.host') if not exists(PYTHON): - print('Could not find hostpython, will not compile to .pyo (this is normal with python3)') + print('Could not find hostpython, will not compile to .pyo ' + '(this is normal with python2 and python3)') PYTHON = None BLACKLIST_PATTERNS = [ @@ -151,7 +152,6 @@ def make_python_zip(): if not exists('private'): print('No compiled python is present to zip, skipping.') - print('this should only be the case if you are using the CrystaX python') return global python_files diff --git a/pythonforandroid/bootstraps/common/build/jni/application/src/start.c b/pythonforandroid/bootstraps/common/build/jni/application/src/start.c index b6ed24aebc..fb430518eb 100644 --- a/pythonforandroid/bootstraps/common/build/jni/application/src/start.c +++ b/pythonforandroid/bootstraps/common/build/jni/application/src/start.c @@ -144,10 +144,6 @@ int main(int argc, char *argv[]) { #if PY_MAJOR_VERSION >= 3 wchar_t *wchar_paths = Py_DecodeLocale(paths, NULL); Py_SetPath(wchar_paths); - #else - char *wchar_paths = paths; - LOGP("Can't Py_SetPath in python2, so crystax python2 doesn't work yet"); - exit(1); #endif LOGP("set wchar paths..."); @@ -161,6 +157,9 @@ int main(int argc, char *argv[]) { Py_Initialize(); #if PY_MAJOR_VERSION < 3 + // Can't Py_SetPath in python2 but we can set PySys_SetPath, which must + // be applied after Py_Initialize rather than before like Py_SetPath + PySys_SetPath(paths); PySys_SetArgv(argc, argv); #endif @@ -182,18 +181,6 @@ int main(int argc, char *argv[]) { * replace sys.path with our path */ PyRun_SimpleString("import sys, posix\n"); - if (dir_exists("lib")) { - /* If we built our own python, set up the paths correctly */ - LOGP("Setting up python from ANDROID_APP_PATH"); - PyRun_SimpleString("private = posix.environ['ANDROID_APP_PATH']\n" - "argument = posix.environ['ANDROID_ARGUMENT']\n" - "sys.path[:] = [ \n" - " private + '/lib/python27.zip', \n" - " private + '/lib/python2.7/', \n" - " private + '/lib/python2.7/lib-dynload/', \n" - " private + '/lib/python2.7/site-packages/', \n" - " argument ]\n"); - } char add_site_packages_dir[256]; if (dir_exists(crystax_python_dir)) { diff --git a/pythonforandroid/bootstraps/sdl2/__init__.py b/pythonforandroid/bootstraps/sdl2/__init__.py index e77d9c932a..1e64eea714 100644 --- a/pythonforandroid/bootstraps/sdl2/__init__.py +++ b/pythonforandroid/bootstraps/sdl2/__init__.py @@ -1,7 +1,7 @@ from pythonforandroid.toolchain import ( Bootstrap, shprint, current_directory, info, info_main) from pythonforandroid.util import ensure_dir -from os.path import join, exists +from os.path import join import sh @@ -33,26 +33,11 @@ def run_distribute(self): with current_directory(self.dist_dir): info("Copying Python distribution") - hostpython = sh.Command(self.ctx.hostpython) - if self.ctx.python_recipe.name == 'python2': - try: - shprint(hostpython, '-OO', '-m', 'compileall', - python_install_dir, - _tail=10, _filterout="^Listing") - except sh.ErrorReturnCode: - pass - if 'python2' in self.ctx.recipe_build_order and not exists('python-install'): - shprint( - sh.cp, '-a', python_install_dir, './python-install') - self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)]) self.distribute_javaclasses(self.ctx.javaclass_dir, dest_dir=join("src", "main", "java")) python_bundle_dir = join('_python_bundle', '_python_bundle') - if 'python2' in self.ctx.recipe_build_order: - # Python 2 is a special case with its own packaging location - python_bundle_dir = 'private' ensure_dir(python_bundle_dir) site_packages_dir = self.ctx.python_recipe.create_python_bundle( diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py index 411b97966f..9ddf2986b5 100644 --- a/pythonforandroid/recipes/sdl2/__init__.py +++ b/pythonforandroid/recipes/sdl2/__init__.py @@ -24,12 +24,11 @@ def get_recipe_env(self, arch=None): env['PYTHON_INCLUDE_ROOT'] = self.ctx.python_recipe.include_root(arch.arch) env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch) - if 'python2' in self.ctx.recipe_build_order: - env['EXTRA_LDLIBS'] = ' -lpython2.7' - - if 'python3' in self.ctx.recipe_build_order: - env['EXTRA_LDLIBS'] = ' -lpython{}m'.format( + if self.ctx.python_recipe.name in ('python2', 'python3'): + env['EXTRA_LDLIBS'] = ' -lpython{}'.format( self.ctx.python_recipe.major_minor_version_string) + if 'python3' in self.ctx.recipe_build_order: + env['EXTRA_LDLIBS'] += 'm' env['APP_ALLOW_MISSING_DEPS'] = 'true' return env From 9fb72b06cce66503818d1d704bc335cd53564efd Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 14:29:51 +0100 Subject: [PATCH 06/66] Adapt pythonforandroid's core files to the new python2's build system Cause we share the same build system for python2 and python3 recipes, we can safely remove some specific python2's code in favour of the python3's code, otherwise we will surely find troubles in our builds. --- pythonforandroid/bootstrap.py | 13 +++--- pythonforandroid/build.py | 6 --- pythonforandroid/recipe.py | 78 +++++++++++------------------------ 3 files changed, 29 insertions(+), 68 deletions(-) diff --git a/pythonforandroid/bootstrap.py b/pythonforandroid/bootstrap.py index 72385e9926..21429cec45 100644 --- a/pythonforandroid/bootstrap.py +++ b/pythonforandroid/bootstrap.py @@ -269,14 +269,11 @@ def strip_libraries(self, arch): return strip = sh.Command(strip) - if self.ctx.python_recipe.name == 'python2': - filens = shprint(sh.find, join(self.dist_dir, 'private'), - join(self.dist_dir, 'libs'), - '-iname', '*.so', _env=env).stdout.decode('utf-8') - else: - filens = shprint(sh.find, join(self.dist_dir, '_python_bundle', '_python_bundle', 'modules'), - join(self.dist_dir, 'libs'), - '-iname', '*.so', _env=env).stdout.decode('utf-8') + filens = shprint(sh.find, join(self.dist_dir, '_python_bundle', + '_python_bundle', 'modules'), + join(self.dist_dir, 'libs'), + '-iname', '*.so', _env=env).stdout.decode('utf-8') + logger.info('Stripping libraries in private dir') for filen in filens.split('\n'): try: diff --git a/pythonforandroid/build.py b/pythonforandroid/build.py index 274edfc6d8..38ac5ff198 100644 --- a/pythonforandroid/build.py +++ b/pythonforandroid/build.py @@ -536,12 +536,6 @@ def get_site_packages_dir(self, arch=None): '''Returns the location of site-packages in the python-install build dir. ''' - if self.python_recipe.name == 'python2': - return join(self.get_python_install_dir(), - 'lib', 'python2.7', 'site-packages') - - # Only python2 is a special case, other python recipes use the - # python install dir return self.get_python_install_dir() def get_libs_dir(self, arch): diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index 307bbb7618..5d6cacbe78 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -690,17 +690,12 @@ def clean_build(self, arch=None): @property def real_hostpython_location(self): - if 'hostpython2' in self.ctx.recipe_build_order: - return join( - Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(), - 'hostpython') - elif 'hostpython3crystax' in self.ctx.recipe_build_order: - return join( - Recipe.get_recipe('hostpython3crystax', self.ctx).get_build_dir(), - 'hostpython') - elif 'hostpython3' in self.ctx.recipe_build_order: - return join(Recipe.get_recipe('hostpython3', self.ctx).get_build_dir(), - 'native-build', 'python') + host_name = 'host{}'.format(self.ctx.python_recipe.name) + host_build = Recipe.get_recipe(host_name, self.ctx).get_build_dir() + if host_name in ['hostpython2', 'hostpython3']: + return join(host_build, 'native-build', 'python') + elif host_name == 'hostpython3crystax': + return join(host_build, 'hostpython') else: python_recipe = self.ctx.python_recipe return 'python{}'.format(python_recipe.version) @@ -726,14 +721,17 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): if not self.call_hostpython_via_targetpython: # sets python headers/linkages...depending on python's recipe + python_name = self.ctx.python_recipe.name python_version = self.ctx.python_recipe.version python_short_version = '.'.join(python_version.split('.')[:2]) - if 'python2' in self.ctx.recipe_build_order: - env['PYTHON_ROOT'] = self.ctx.get_python_install_dir() - env['CFLAGS'] += ' -I' + env[ - 'PYTHON_ROOT'] + '/include/python2.7' - env['LDFLAGS'] += ( - ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7') + if python_name in ['python2', 'python3']: + env['CFLAGS'] += ' -I{}'.format( + self.ctx.python_recipe.include_root(arch.arch)) + env['LDFLAGS'] += ' -L{} -lpython{}'.format( + self.ctx.python_recipe.link_root(arch.arch), + self.ctx.python_recipe.major_minor_version_string) + if python_name == 'python3': + env['LDFLAGS'] += 'm' elif self.ctx.python_recipe.from_crystax: ndk_dir_python = join(self.ctx.ndk_dir, 'sources', 'python', python_version) @@ -743,11 +741,6 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): env['LDFLAGS'] += ' -L{}'.format( join(ndk_dir_python, 'libs', arch.arch)) env['LDFLAGS'] += ' -lpython{}m'.format(python_short_version) - elif 'python3' in self.ctx.recipe_build_order: - env['CFLAGS'] += ' -I{}'.format(self.ctx.python_recipe.include_root(arch.arch)) - env['LDFLAGS'] += ' -L{} -lpython{}m'.format( - self.ctx.python_recipe.link_root(arch.arch), - self.ctx.python_recipe.major_minor_version_string) hppath = [] hppath.append(join(dirname(self.hostpython_location), 'Lib')) @@ -790,7 +783,7 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True): hostpython = sh.Command(self.hostpython_location) if (self.ctx.python_recipe.from_crystax or - self.ctx.python_recipe.name == 'python3'): + self.ctx.python_recipe.name in ['python2', 'python3']): hpenv = env.copy() shprint(hostpython, 'setup.py', 'install', '-O2', '--root={}'.format(self.ctx.get_python_install_dir()), @@ -799,19 +792,6 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True): elif self.call_hostpython_via_targetpython: shprint(hostpython, 'setup.py', 'install', '-O2', _env=env, *self.setup_extra_args) - else: - hppath = join(dirname(self.hostpython_location), 'Lib', - 'site-packages') - hpenv = env.copy() - if 'PYTHONPATH' in hpenv: - hpenv['PYTHONPATH'] = ':'.join([hppath] + - hpenv['PYTHONPATH'].split(':')) - else: - hpenv['PYTHONPATH'] = hppath - shprint(hostpython, 'setup.py', 'install', '-O2', - '--root={}'.format(self.ctx.get_python_install_dir()), - '--install-lib=lib/python2.7/site-packages', - _env=hpenv, *self.setup_extra_args) # If asked, also install in the hostpython build dir if self.install_in_hostpython: @@ -966,20 +946,13 @@ def build_cython_components(self, arch): info('First build appeared to complete correctly, skipping manual' 'cythonising.') - if 'python2' in self.ctx.recipe_build_order: - info('Stripping object files') - build_lib = glob.glob('./build/lib*') - shprint(sh.find, build_lib[0], '-name', '*.o', '-exec', - env['STRIP'], '{}', ';', _env=env) - - else: # python3crystax or python3 - info('Stripping object files') - shprint(sh.find, '.', '-iname', '*.so', '-exec', - '/usr/bin/echo', '{}', ';', _env=env) - shprint(sh.find, '.', '-iname', '*.so', '-exec', - env['STRIP'].split(' ')[0], '--strip-unneeded', - # '/usr/bin/strip', '--strip-unneeded', - '{}', ';', _env=env) + info('Stripping object files') + shprint(sh.find, '.', '-iname', '*.so', '-exec', + '/usr/bin/echo', '{}', ';', _env=env) + shprint(sh.find, '.', '-iname', '*.so', '-exec', + env['STRIP'].split(' ')[0], '--strip-unneeded', + # '/usr/bin/strip', '--strip-unneeded', + '{}', ';', _env=env) def cythonize_file(self, env, build_dir, filename): short_filename = filename @@ -1017,10 +990,7 @@ def get_recipe_env(self, arch, with_flags_in_cc=True): env['LDFLAGS'] = (env['LDFLAGS'] + ' -L{}'.format(join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))) - if self.ctx.python_recipe.from_crystax or self.ctx.python_recipe.name == 'python3': - env['LDSHARED'] = env['CC'] + ' -shared' - else: - env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink.sh') + env['LDSHARED'] = env['CC'] + ' -shared' # shprint(sh.whereis, env['LDSHARED'], _env=env) env['LIBLINK'] = 'NOTNONE' env['NDKPLATFORM'] = self.ctx.ndk_platform From c64248227735037bd4300e51a018abdb336af2fd Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 14:31:25 +0100 Subject: [PATCH 07/66] Adapt python2's test apps to the new python2's build system The python2's test with openssl and sqlite it will probably success, but without the libs until those are enabled. The pygame's test app will fail until properly fixed. --- testapps/setup_pygame.py | 6 ++++-- testapps/setup_testapp_python2.py | 3 ++- testapps/setup_testapp_python2_sqlite_openssl.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/testapps/setup_pygame.py b/testapps/setup_pygame.py index 3f96942b29..3314bc6114 100644 --- a/testapps/setup_pygame.py +++ b/testapps/setup_pygame.py @@ -4,11 +4,13 @@ options = {'apk': {'debug': None, 'requirements': 'pygame,pyjnius,kivy,python2,android', - 'android-api': 19, + 'android-api': 27, + 'ndk-api': 19, 'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2', 'dist-name': 'bdisttest_pygame', 'orientation': 'portrait', 'ndk-version': '10.3.2', + 'arch': 'armeabi-v7a', 'permission': 'VIBRATE', }} @@ -27,5 +29,5 @@ author_email='alexanderjohntaylor@gmail.com', packages=find_packages(), options=options, - package_data={'testapp_pygame': ['*.py', '*.png']} + package_data={'testapp': ['*.py', '*.png']} ) diff --git a/testapps/setup_testapp_python2.py b/testapps/setup_testapp_python2.py index b5cd416a21..a631455bd6 100644 --- a/testapps/setup_testapp_python2.py +++ b/testapps/setup_testapp_python2.py @@ -4,11 +4,12 @@ options = {'apk': {'requirements': 'sdl2,pyjnius,kivy,python2', 'android-api': 27, - 'ndk-api': 19, + 'ndk-api': 21, 'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2', 'dist-name': 'bdisttest_python2', 'ndk-version': '10.3.2', 'permission': 'VIBRATE', + 'arch': 'armeabi-v7a', 'window': None, }} diff --git a/testapps/setup_testapp_python2_sqlite_openssl.py b/testapps/setup_testapp_python2_sqlite_openssl.py index fc8beab771..98a184e58a 100644 --- a/testapps/setup_testapp_python2_sqlite_openssl.py +++ b/testapps/setup_testapp_python2_sqlite_openssl.py @@ -4,12 +4,13 @@ options = {'apk': {'requirements': 'sdl2,pyjnius,kivy,python2,openssl,requests,peewee,sqlite3', 'android-api': 27, - 'ndk-api': 19, + 'ndk-api': 21, 'ndk-dir': '/home/sandy/android/crystax-ndk-10.3.2', 'dist-name': 'bdisttest_python2_sqlite_openssl', 'ndk-version': '10.3.2', 'permission': 'VIBRATE', 'permission': 'INTERNET', + 'arch': 'armeabi-v7a', 'window': None, }} From fd99a30c1108fcc7496a1c6cf1ce808b9963ceaf Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 15:41:58 +0100 Subject: [PATCH 08/66] Enable sqlite support for python recipes --- pythonforandroid/python.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index b3970d9d95..ac68df0e2c 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -87,7 +87,7 @@ class GuestPythonRecipe(TargetPythonRecipe): '''The file extensions from site packages dir that we don't want to be included in our python bundle.''' - opt_depends = ['libffi'] + opt_depends = ['sqlite3', 'libffi'] '''The optional libraries which we would like to get our python linked''' def __init__(self, *args, **kwargs): @@ -173,14 +173,23 @@ def set_libs_flags(self, env, arch): '''Takes care to properly link libraries with python depending on our requirements and the attribute :attr:`opt_depends`. ''' + def add_flags(include_flags, link_flags): + env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include_flags + env['LDFLAGS'] = env.get('LDFLAGS', '') + link_flags + + if 'sqlite3' in self.ctx.recipe_build_order: + info('Activating flags for sqlite3') + recipe = Recipe.get_recipe('sqlite3', self.ctx) + add_flags(' -I' + recipe.get_build_dir(arch.arch), + ' -L' + recipe.get_lib_dir(arch) + ' -lsqlite3') + if 'libffi' in self.ctx.recipe_build_order: info('Activating flags for libffi') recipe = Recipe.get_recipe('libffi', self.ctx) - include = ' -I' + ' -I'.join(recipe.get_include_dirs(arch)) - ldflag = ' -L' + join(recipe.get_build_dir(arch.arch), - recipe.get_host(arch), '.libs') + ' -lffi' - env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include - env['LDFLAGS'] = env.get('LDFLAGS', '') + ldflag + add_flags(' -I' + ' -I'.join(recipe.get_include_dirs(arch)), + ' -L' + join(recipe.get_build_dir(arch.arch), + recipe.get_host(arch), '.libs') + ' -lffi') + return env def prebuild_arch(self, arch): From 71ba0fb6b62a03a6769fbeb8455c1d9804cf9e38 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sun, 25 Nov 2018 01:50:57 +0100 Subject: [PATCH 09/66] Add ability to compile recipes with clang The android ndk has been migrated his default compiler from gcc to clang and soon will be removed from the ndk. Here we prepare p4a to compile recipes with clang, which will allow us to successfully compile an updated openssl libs. Without this openssl upgrade we will not be able to grant support to python3's _ssl.so module. Note: The default p4a compiler still is gcc...so...no changes on the compile behaviour unless explicitly requested References: #1478 --- pythonforandroid/archs.py | 68 +++++++++++++++++++++++++------------- pythonforandroid/recipe.py | 4 +-- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 6039c0a262..6965d71107 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -30,13 +30,24 @@ def include_dirs(self): d.format(arch=self)) for d in self.ctx.include_dirs] - def get_env(self, with_flags_in_cc=True): + def get_env(self, with_flags_in_cc=True, clang=False): env = {} - env['CFLAGS'] = ' '.join([ - '-DANDROID', '-mandroid', '-fomit-frame-pointer' - ' -D__ANDROID_API__={}'.format(self.ctx.ndk_api), - ]) + cflags = [ + '-DANDROID', + '-fomit-frame-pointer', + '-D__ANDROID_API__={}'.format(self.ctx.ndk_api)] + if not clang: + cflags += ['-mandroid'] + else: + cflags += ['-target armv7-none-linux-androideabi'] + android_host = 'arm-linux-androideabi' + platform_dir = join(self.ctx.ndk_dir, 'platforms', 'android-{}'.format(self.ctx.ndk_api), 'arch-arm') + toolchain = '{android_host}-4.9'.format(android_host=android_host) + toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') + cflags += ['-gcc-toolchain {}'.format(toolchain)] + + env['CFLAGS'] = ' '.join(cflags) env['LDFLAGS'] = ' ' sysroot = join(self.ctx._ndk_dir, 'sysroot') @@ -82,8 +93,19 @@ def get_env(self, with_flags_in_cc=True): env['NDK_CCACHE'] = self.ctx.ccache env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')}) - cc = find_executable('{command_prefix}-gcc'.format( - command_prefix=command_prefix), path=environ['PATH']) + if clang: + clang_path = join( + self.ctx.ndk_dir, 'toolchains', 'llvm', 'prebuilt', + 'linux-x86_64', 'bin') + environ['PATH'] = '{clang_path}:{path}'.format( + clang_path=clang_path, path=environ['PATH']) + exe = join(clang_path, 'clang') + execxx = join(clang_path, 'clang++') + else: + exe = '{command_prefix}-gcc'.format(command_prefix=command_prefix) + execxx = '{command_prefix}-g++'.format(command_prefix=command_prefix) + + cc = find_executable(exe, path=environ['PATH']) if cc is None: print('Searching path are: {!r}'.format(environ['PATH'])) raise BuildInterruptingException( @@ -93,20 +115,20 @@ def get_env(self, with_flags_in_cc=True): 'installed. Exiting.') if with_flags_in_cc: - env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format( - command_prefix=command_prefix, + env['CC'] = '{ccache}{exe} {cflags}'.format( + exe=exe, ccache=ccache, cflags=env['CFLAGS']) - env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format( - command_prefix=command_prefix, + env['CXX'] = '{ccache}{execxx} {cxxflags}'.format( + execxx=execxx, ccache=ccache, cxxflags=env['CXXFLAGS']) else: - env['CC'] = '{ccache}{command_prefix}-gcc'.format( - command_prefix=command_prefix, + env['CC'] = '{ccache}{exe}'.format( + exe=exe, ccache=ccache) - env['CXX'] = '{ccache}{command_prefix}-g++'.format( - command_prefix=command_prefix, + env['CXX'] = '{ccache}{execxx}'.format( + execxx=execxx, ccache=ccache) env['AR'] = '{}-ar'.format(command_prefix) @@ -151,8 +173,8 @@ class ArchARM(Arch): class ArchARMv7_a(ArchARM): arch = 'armeabi-v7a' - def get_env(self, with_flags_in_cc=True): - env = super(ArchARMv7_a, self).get_env(with_flags_in_cc) + def get_env(self, with_flags_in_cc=True, clang=False): + env = super(ArchARMv7_a, self).get_env(with_flags_in_cc, clang=clang) env['CFLAGS'] = (env['CFLAGS'] + (' -march=armv7-a -mfloat-abi=softfp ' '-mfpu=vfp -mthumb')) @@ -166,8 +188,8 @@ class Archx86(Arch): command_prefix = 'i686-linux-android' platform_dir = 'arch-x86' - def get_env(self, with_flags_in_cc=True): - env = super(Archx86, self).get_env(with_flags_in_cc) + def get_env(self, with_flags_in_cc=True, clang=False): + env = super(Archx86, self).get_env(with_flags_in_cc, clang=clang) env['CFLAGS'] = (env['CFLAGS'] + ' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32') env['CXXFLAGS'] = env['CFLAGS'] @@ -180,8 +202,8 @@ class Archx86_64(Arch): command_prefix = 'x86_64-linux-android' platform_dir = 'arch-x86_64' - def get_env(self, with_flags_in_cc=True): - env = super(Archx86_64, self).get_env(with_flags_in_cc) + def get_env(self, with_flags_in_cc=True, clang=False): + env = super(Archx86_64, self).get_env(with_flags_in_cc, clang=clang) env['CFLAGS'] = (env['CFLAGS'] + ' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel') env['CXXFLAGS'] = env['CFLAGS'] @@ -194,8 +216,8 @@ class ArchAarch_64(Arch): command_prefix = 'aarch64-linux-android' platform_dir = 'arch-arm64' - def get_env(self, with_flags_in_cc=True): - env = super(ArchAarch_64, self).get_env(with_flags_in_cc) + def get_env(self, with_flags_in_cc=True, clang=False): + env = super(ArchAarch_64, self).get_env(with_flags_in_cc, clang=clang) incpath = ' -I' + join(dirname(__file__), 'includes', 'arm64-v8a') env['EXTRA_CFLAGS'] = incpath env['CFLAGS'] += incpath diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index 5d6cacbe78..b76323d9ec 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -407,12 +407,12 @@ def unpack(self, arch): else: info('{} is already unpacked, skipping'.format(self.name)) - def get_recipe_env(self, arch=None, with_flags_in_cc=True): + def get_recipe_env(self, arch=None, with_flags_in_cc=True, clang=False): """Return the env specialized for the recipe """ if arch is None: arch = self.filtered_archs[0] - return arch.get_env(with_flags_in_cc=with_flags_in_cc) + return arch.get_env(with_flags_in_cc=with_flags_in_cc, clang=clang) def prebuild_arch(self, arch): '''Run any pre-build tasks for the Recipe. By default, this checks if From 6cb1b20721a797b2510cab791c63657fe454dacd Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sun, 25 Nov 2018 02:30:53 +0100 Subject: [PATCH 10/66] Update OpenSSL to 1.1.1 (uses clang for compilation) This openssl version is an LTS, supported until 11th September 2023. Important: There is now a distinction between the version we use for downloading, and the version used for creating the library: OpenSSL 1.1 now have prefix with "1.1.so". This explains why others recipes that depends on it require the "library" version. Those recipes, still not are modified to support the new version. References: #1478 --- pythonforandroid/recipes/openssl/__init__.py | 35 +++++++++++-------- .../recipes/openssl/disable-sover.patch | 31 ++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index b8256e8662..9db41500d0 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -5,12 +5,13 @@ class OpenSSLRecipe(Recipe): - version = '1.0.2h' + version = '1.1.1' + lib_version = '1.1' url = 'https://www.openssl.org/source/openssl-{version}.tar.gz' def should_build(self, arch): - return not self.has_libs(arch, 'libssl' + self.version + '.so', - 'libcrypto' + self.version + '.so') + return not self.has_libs(arch, 'libssl' + self.lib_version + '.so', + 'libcrypto' + self.lib_version + '.so') def check_symbol(self, env, sofile, symbol): nm = env.get('NM', 'nm') @@ -22,11 +23,10 @@ def check_symbol(self, env, sofile, symbol): return False def get_recipe_env(self, arch=None): - env = super(OpenSSLRecipe, self).get_recipe_env(arch) - env['OPENSSL_VERSION'] = self.version - env['CFLAGS'] += ' ' + env['LDFLAGS'] - env['CC'] += ' ' + env['LDFLAGS'] + env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=True) + env['OPENSSL_VERSION'] = self.lib_version env['MAKE'] = 'make' # This removes the '-j5', which isn't safe + env['ANDROID_NDK'] = self.ctx.ndk_dir return env def select_build_arch(self, arch): @@ -34,7 +34,7 @@ def select_build_arch(self, arch): if 'arm64' in aname: return 'linux-aarch64' if 'v7a' in aname: - return 'android-armv7' + return 'android-arm' if 'arm' in aname: return 'android' if 'x86' in aname: @@ -48,20 +48,27 @@ def build_arch(self, arch): # so instead we manually run perl passing in Configure perl = sh.Command('perl') buildarch = self.select_build_arch(arch) - shprint(perl, 'Configure', 'shared', 'no-dso', 'no-krb5', buildarch, _env=env) + # XXX if we don't have no-asm, using clang and ndk-15c, i got: + # crypto/aes/bsaes-armv7.S:1372:14: error: immediate operand must be in the range [0,4095] + # add r8, r6, #.LREVM0SR-.LM0 @ borrow r8 + # ^ + # crypto/aes/bsaes-armv7.S:1434:14: error: immediate operand must be in the range [0,4095] + # sub r6, r8, #.LREVM0SR-.LSR @ pass constants + shprint(perl, 'Configure', 'shared', 'no-dso', 'no-asm', buildarch, _env=env) self.apply_patch('disable-sover.patch', arch.arch) - self.apply_patch('rename-shared-lib.patch', arch.arch) # check_ssl = partial(self.check_symbol, env, 'libssl' + self.version + '.so') - check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.version + '.so') + check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.lib_version + '.so') while True: shprint(sh.make, 'build_libs', _env=env) - if all(map(check_crypto, ('SSLeay', 'MD5_Transform', 'MD4_Init'))): + if all(map(check_crypto, ('MD5_Transform', 'MD4_Init'))): break + import time + time.sleep(3) shprint(sh.make, 'clean', _env=env) - self.install_libs(arch, 'libssl' + self.version + '.so', - 'libcrypto' + self.version + '.so') + self.install_libs(arch, 'libssl' + self.lib_version + '.so', + 'libcrypto' + self.lib_version + '.so') recipe = OpenSSLRecipe() diff --git a/pythonforandroid/recipes/openssl/disable-sover.patch b/pythonforandroid/recipes/openssl/disable-sover.patch index 6099fadcef..d944483cda 100644 --- a/pythonforandroid/recipes/openssl/disable-sover.patch +++ b/pythonforandroid/recipes/openssl/disable-sover.patch @@ -1,20 +1,11 @@ ---- openssl/Makefile 2016-01-28 17:26:49.159522273 +0100 -+++ b/Makefile 2016-01-28 17:26:54.358438402 +0100 -@@ -342,7 +342,7 @@ - link-shared: - @ set -e; for i in $(SHLIBDIRS); do \ - $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \ -- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ -+ LIBNAME=$$i LIBVERSION= \ - LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ - symlink.$(SHLIB_TARGET); \ - libs="$$libs -l$$i"; \ -@@ -356,7 +356,7 @@ - libs="$(LIBKRB5) $$libs"; \ - fi; \ - $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \ -- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ -+ LIBNAME=$$i LIBVERSION= \ - LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ - LIBDEPS="$$libs $(EX_LIBS)" \ - link_a.$(SHLIB_TARGET); \ +--- openssl/Makefile.orig 2018-10-20 22:49:40.418310423 +0200 ++++ openssl/Makefile 2018-10-20 22:50:23.347322403 +0200 +@@ -19,7 +19,7 @@ + SHLIB_MAJOR=1 + SHLIB_MINOR=1 + SHLIB_TARGET=linux-shared +-SHLIB_EXT=.so.$(SHLIB_VERSION_NUMBER) ++SHLIB_EXT=$(SHLIB_VERSION_NUMBER).so + SHLIB_EXT_SIMPLE=.so + SHLIB_EXT_IMPORT= + From f716a3a556df31e0cfe697cdd442c81e052b8477 Mon Sep 17 00:00:00 2001 From: opacam Date: Sun, 25 Nov 2018 03:01:06 +0100 Subject: [PATCH 11/66] Enhance openssl recipe and remove lib_version Several actions done: - The openssl recipe has been enhanced by introducing a couple of methods (include_flags and link_flags) which should help us to link other recipes with the openssl libs. - Remove lib_version introduced in the last openssl version update, so we don't have to modify all dependant recipes - Add a new variable `url_version`, used to download our recipe in the subclassed method versioned_url (this replaces the removed lib_version) - Add D__ANDROID_API__ to the configure command (needed to successfully build the libraries and link them with python) - Add documentation --- pythonforandroid/recipes/openssl/__init__.py | 79 +++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index 9db41500d0..2f264d040a 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -1,3 +1,5 @@ +import time +from os.path import join from functools import partial from pythonforandroid.toolchain import Recipe, shprint, current_directory @@ -5,13 +7,67 @@ class OpenSSLRecipe(Recipe): - version = '1.1.1' - lib_version = '1.1' - url = 'https://www.openssl.org/source/openssl-{version}.tar.gz' + ''' + The OpenSSL libraries for python-for-android. This recipe will generate the + following libraries as shared libraries (*.so): + + - crypto + - ssl + + The generated openssl libraries are versioned, where the version is the + recipe attribute :attr:`version` e.g.: ``libcrypto1.1.so``, + ``libssl1.1.so``...so...to link your recipe with the openssl libs, + remember to add the version at the end, e.g.: + ``-lcrypto1.1 -lssl1.1``. Or better, you could do it dynamically + using the methods: :meth:`include_flags` and :meth:`link_flags`. + + .. warning:: This recipe is very sensitive because is used for our core + recipes, the python recipes. The used API should match with the one + used in our python build, otherwise we will be unable to build the + _ssl.so python module. + + .. versionchanged:: 0.6.0 + + - The gcc compiler has been deprecated in favour of clang and libraries + updated to version 1.1.1 (LTS - supported until 11th September 2023) + - Added two new methods to make easier to link with openssl: + :meth:`include_flags` and :meth:`link_flags` + - subclassed versioned_url + - Adapted method :meth:`select_build_arch` to API 21+ + + ''' + + version = '1.1' + '''the major minor version used to link our recipes''' + + url_version = '1.1.1' + '''the version used to download our libraries''' + + url = 'https://www.openssl.org/source/openssl-{url_version}.tar.gz' + + @property + def versioned_url(self): + if self.url is None: + return None + return self.url.format(url_version=self.url_version) + + def include_flags(self, arch): + '''Returns a string with the include folders''' + openssl_includes = join(self.get_build_dir(arch.arch), 'include') + return ' -I' + openssl_includes + \ + ' -I' + join(openssl_includes, 'internal') + \ + ' -I' + join(openssl_includes, 'openssl') + + def link_flags(self, arch): + '''Returns a string with the right link flags to compile against the + openssl libraries''' + build_dir = self.get_build_dir(arch.arch) + return ' -L' + build_dir + \ + ' -lcrypto{version} -lssl{version}'.format(version=self.version) def should_build(self, arch): - return not self.has_libs(arch, 'libssl' + self.lib_version + '.so', - 'libcrypto' + self.lib_version + '.so') + return not self.has_libs(arch, 'libssl' + self.version + '.so', + 'libcrypto' + self.version + '.so') def check_symbol(self, env, sofile, symbol): nm = env.get('NM', 'nm') @@ -24,7 +80,7 @@ def check_symbol(self, env, sofile, symbol): def get_recipe_env(self, arch=None): env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=True) - env['OPENSSL_VERSION'] = self.lib_version + env['OPENSSL_VERSION'] = self.version env['MAKE'] = 'make' # This removes the '-j5', which isn't safe env['ANDROID_NDK'] = self.ctx.ndk_dir return env @@ -54,21 +110,22 @@ def build_arch(self, arch): # ^ # crypto/aes/bsaes-armv7.S:1434:14: error: immediate operand must be in the range [0,4095] # sub r6, r8, #.LREVM0SR-.LSR @ pass constants - shprint(perl, 'Configure', 'shared', 'no-dso', 'no-asm', buildarch, _env=env) + shprint(perl, 'Configure', 'shared', 'no-dso', 'no-asm', buildarch, + '-D__ANDROID_API__={}'.format(self.ctx.ndk_api), + _env=env) self.apply_patch('disable-sover.patch', arch.arch) # check_ssl = partial(self.check_symbol, env, 'libssl' + self.version + '.so') - check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.lib_version + '.so') + check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.version + '.so') while True: shprint(sh.make, 'build_libs', _env=env) if all(map(check_crypto, ('MD5_Transform', 'MD4_Init'))): break - import time time.sleep(3) shprint(sh.make, 'clean', _env=env) - self.install_libs(arch, 'libssl' + self.lib_version + '.so', - 'libcrypto' + self.lib_version + '.so') + self.install_libs(arch, 'libssl' + self.version + '.so', + 'libcrypto' + self.version + '.so') recipe = OpenSSLRecipe() From de6808f0394aa6966386095e9b2ddf085a182408 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 15:55:16 +0100 Subject: [PATCH 12/66] Enable openssl support for python recipes This commit grants openssl support for both python versions (2 and 3). The python2 recipe needs some extra work to make it link with python, we need to patch the setup.py file in order to that the python's build system recognises the libraries. This is not the case for the python3 recipe which works like a charm, except for the fact that we have to modify our static class variable ` config_args ` for the python's recipe, i found this to be necessary in my tests, otherwise the openssl libs aren't detected. --- pythonforandroid/python.py | 12 +++-- pythonforandroid/recipes/python2/__init__.py | 20 ++++++++ .../python2/patches/enable-openssl.patch | 46 +++++++++++++++++++ pythonforandroid/recipes/python3/__init__.py | 9 ++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 pythonforandroid/recipes/python2/patches/enable-openssl.patch diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index ac68df0e2c..038e4104ec 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -87,7 +87,7 @@ class GuestPythonRecipe(TargetPythonRecipe): '''The file extensions from site packages dir that we don't want to be included in our python bundle.''' - opt_depends = ['sqlite3', 'libffi'] + opt_depends = ['sqlite3', 'libffi', 'openssl'] '''The optional libraries which we would like to get our python linked''' def __init__(self, *args, **kwargs): @@ -138,12 +138,12 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): ndk_flags = ( '-fPIC --sysroot={ndk_sysroot} -D__ANDROID_API__={android_api} ' - '-isystem {ndk_android_host}').format( + '-isystem {ndk_android_host} -I{ndk_include}').format( ndk_sysroot=join(self.ctx.ndk_dir, 'sysroot'), android_api=self.ctx.ndk_api, ndk_android_host=join( - self.ctx.ndk_dir, 'sysroot', 'usr', 'include', - android_host)) + self.ctx.ndk_dir, 'sysroot', 'usr', 'include', android_host), + ndk_include=join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')) sysroot = join(self.ctx.ndk_dir, 'platforms', platform_name, 'arch-arm') env['CFLAGS'] = env.get('CFLAGS', '') + ' ' + ndk_flags @@ -190,6 +190,10 @@ def add_flags(include_flags, link_flags): ' -L' + join(recipe.get_build_dir(arch.arch), recipe.get_host(arch), '.libs') + ' -lffi') + if 'openssl' in self.ctx.recipe_build_order: + info('Activating flags for openssl') + recipe = Recipe.get_recipe('openssl', self.ctx) + add_flags(recipe.include_flags(arch), recipe.link_flags(arch)) return env def prebuild_arch(self, arch): diff --git a/pythonforandroid/recipes/python2/__init__.py b/pythonforandroid/recipes/python2/__init__.py index d9982a1eb9..c337513f77 100644 --- a/pythonforandroid/recipes/python2/__init__.py +++ b/pythonforandroid/recipes/python2/__init__.py @@ -1,5 +1,9 @@ +from os.path import join, exists +from pythonforandroid.recipe import Recipe from pythonforandroid.python import GuestPythonRecipe # from pythonforandroid.patching import is_api_lt +from pythonforandroid.logger import shprint +import sh class Python2Recipe(GuestPythonRecipe): @@ -44,5 +48,21 @@ class Python2Recipe(GuestPythonRecipe): '--prefix={prefix}', '--exec-prefix={exec_prefix}') + def prebuild_arch(self, arch): + super(Python2Recipe, self).prebuild_arch(arch) + patch_mark = join(self.get_build_dir(arch.arch), '.openssl-patched') + if 'openssl' in self.ctx.recipe_build_order and not exists(patch_mark): + self.apply_patch(join('patches', 'enable-openssl.patch'), arch.arch) + shprint(sh.touch, patch_mark) + + def set_libs_flags(self, env, arch): + env = super(Python2Recipe, self).set_libs_flags(env, arch) + if 'openssl' in self.ctx.recipe_build_order: + recipe = Recipe.get_recipe('openssl', self.ctx) + openssl_build = recipe.get_build_dir(arch.arch) + env['OPENSSL_BUILD'] = openssl_build + env['OPENSSL_VERSION'] = recipe.version + return env + recipe = Python2Recipe() diff --git a/pythonforandroid/recipes/python2/patches/enable-openssl.patch b/pythonforandroid/recipes/python2/patches/enable-openssl.patch new file mode 100644 index 0000000000..490e065c5f --- /dev/null +++ b/pythonforandroid/recipes/python2/patches/enable-openssl.patch @@ -0,0 +1,46 @@ +--- Python-2.7.15.orig/setup.py 2018-04-30 00:47:33.000000000 +0200 ++++ Python-2.7.15/setup.py 2018-07-05 11:08:57.305125432 +0200 +@@ -812,18 +840,15 @@ class PyBuildExt(build_ext): + '/usr/local/ssl/include', + '/usr/contrib/ssl/include/' + ] +- ssl_incs = find_file('openssl/ssl.h', inc_dirs, +- search_for_ssl_incs_in +- ) ++ ssl_incs = [ ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include'), ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')] + if ssl_incs is not None: + krb5_h = find_file('krb5.h', inc_dirs, + ['/usr/kerberos/include']) + if krb5_h: + ssl_incs += krb5_h +- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' +- ] ) ++ ssl_libs = [os.environ["OPENSSL_BUILD"]] + + if (ssl_incs is not None and + ssl_libs is not None): +@@ -841,8 +866,8 @@ class PyBuildExt(build_ext): + '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' ) + + # look for the openssl version header on the compiler search path. +- opensslv_h = find_file('openssl/opensslv.h', [], +- inc_dirs + search_for_ssl_incs_in) ++ opensslv_h = [os.path.join(os.environ["OPENSSL_BUILD"], 'include'), ++ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')] + if opensslv_h: + name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') + if host_platform == 'darwin' and is_macosx_sdk_path(name): +@@ -859,8 +884,7 @@ class PyBuildExt(build_ext): + + min_openssl_ver = 0x00907000 + have_any_openssl = ssl_incs is not None and ssl_libs is not None +- have_usable_openssl = (have_any_openssl and +- openssl_ver >= min_openssl_ver) ++ have_usable_openssl = (have_any_openssl and True) + + if have_any_openssl: + if have_usable_openssl: diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 83fe39e8d5..88cb8b36a1 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -1,4 +1,5 @@ from pythonforandroid.python import GuestPythonRecipe +from pythonforandroid.recipe import Recipe class Python3Recipe(GuestPythonRecipe): @@ -35,5 +36,13 @@ class Python3Recipe(GuestPythonRecipe): '--prefix={prefix}', '--exec-prefix={exec_prefix}') + def set_libs_flags(self, env, arch): + env = super(Python3Recipe, self).set_libs_flags(env, arch) + if 'openssl' in self.ctx.recipe_build_order: + recipe = Recipe.get_recipe('openssl', self.ctx) + self.configure_args += \ + ('--with-openssl=' + recipe.get_build_dir(arch.arch),) + return env + recipe = Python3Recipe() From bc9169640b559aacbf95a1f13b3baa27e353993c Mon Sep 17 00:00:00 2001 From: opacam Date: Sun, 25 Nov 2018 12:53:14 +0100 Subject: [PATCH 13/66] Fix hardcoded python2 entry for Arch --- pythonforandroid/archs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 6965d71107..0c48d0355c 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -145,12 +145,13 @@ def get_env(self, with_flags_in_cc=True, clang=False): env['READELF'] = '{}-readelf'.format(command_prefix) env['NM'] = '{}-nm'.format(command_prefix) - hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx) - - # This hardcodes python version 2.7, needs fixing + hostpython_recipe = Recipe.get_recipe( + 'host' + self.ctx.python_recipe.name, self.ctx) env['BUILDLIB_PATH'] = join( hostpython_recipe.get_build_dir(self.arch), - 'build', 'lib.linux-{}-2.7'.format(uname()[-1])) + 'build', 'lib.linux-{}-{}'.format( + uname()[-1], self.ctx.python_recipe.major_minor_version_string) + ) env['PATH'] = environ['PATH'] From 1c365d909a975fbb4d9396ef8fe1293a901a2d4f Mon Sep 17 00:00:00 2001 From: opacam Date: Sun, 25 Nov 2018 12:54:18 +0100 Subject: [PATCH 14/66] Fix hardcoded python2 entries for BootstrapNDKRecipes --- .../pygame/build/jni/application/Android.mk | 6 ++-- .../build/jni/application/src/Android.mk | 4 +-- .../build/jni/application/src/Android.mk | 4 +-- pythonforandroid/recipe.py | 29 +++++++++++++++++++ .../recipes/genericndkbuild/__init__.py | 10 ++----- pythonforandroid/recipes/sdl/__init__.py | 9 ++---- pythonforandroid/recipes/sdl2/__init__.py | 18 ++---------- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk b/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk index 51109a7e19..e30f708b7f 100644 --- a/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk +++ b/pythonforandroid/bootstraps/pygame/build/jni/application/Android.mk @@ -18,9 +18,7 @@ LOCAL_CFLAGS := $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \ -I$(LOCAL_PATH)/../jpeg \ -I$(LOCAL_PATH)/../intl \ -I$(LOCAL_PATH)/.. \ - -I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 - # -I$(LOCAL_PATH)/../../../../python-install/include/python2.7 - # -I$(LOCAL_PATH)/../../../build/python-install/include/python2.7 + -I$(LOCAL_PATH)/../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT) LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS) @@ -40,7 +38,7 @@ LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz # AND: Another hardcoded path that should be templated # AND: NOT TEMPALTED! We can use $ARCH -LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) +LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS) LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \ for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \ diff --git a/pythonforandroid/bootstraps/service_only/build/jni/application/src/Android.mk b/pythonforandroid/bootstraps/service_only/build/jni/application/src/Android.mk index 2a880fbb3a..6a8f1a65a2 100644 --- a/pythonforandroid/bootstraps/service_only/build/jni/application/src/Android.mk +++ b/pythonforandroid/bootstraps/service_only/build/jni/application/src/Android.mk @@ -7,13 +7,13 @@ LOCAL_MODULE := main # Add your application source files here... LOCAL_SRC_FILES := start.c pyjniusjni.c -LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 $(EXTRA_CFLAGS) +LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS) LOCAL_SHARED_LIBRARIES := python_shared LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS) -LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) +LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS) include $(BUILD_SHARED_LIBRARY) diff --git a/pythonforandroid/bootstraps/webview/build/jni/application/src/Android.mk b/pythonforandroid/bootstraps/webview/build/jni/application/src/Android.mk index d0e27227bc..b1403ec110 100644 --- a/pythonforandroid/bootstraps/webview/build/jni/application/src/Android.mk +++ b/pythonforandroid/bootstraps/webview/build/jni/application/src/Android.mk @@ -9,13 +9,13 @@ LOCAL_MODULE := main # Add your application source files here... LOCAL_SRC_FILES := start.c pyjniusjni.c -LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 $(EXTRA_CFLAGS) +LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS) LOCAL_SHARED_LIBRARIES := python_shared LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS) -LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) +LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS) include $(BUILD_SHARED_LIBRARY) diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index b76323d9ec..81f44896da 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -597,6 +597,11 @@ class BootstrapNDKRecipe(Recipe): To build an NDK project which is not part of the bootstrap, see :class:`~pythonforandroid.recipe.NDKRecipe`. + + To link with python, call the method :meth:`get_recipe_env` + with the kwarg *with_python=True*. If recipe contains android's mk files + which should be linked with python, you may want to use the env variables + MK_PYTHON_INCLUDE_ROOT and MK_PYTHON_LINK_ROOT set in there. ''' dir_name = None # The name of the recipe build folder in the jni dir @@ -613,6 +618,30 @@ def get_build_dir(self, arch): def get_jni_dir(self): return join(self.ctx.bootstrap.build_dir, 'jni') + def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=False): + env = super(BootstrapNDKRecipe, self).get_recipe_env( + arch, with_flags_in_cc) + if not with_python: + return env + + env['PYTHON_INCLUDE_ROOT'] = self.ctx.python_recipe.include_root(arch.arch) + env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch) + env['EXTRA_LDLIBS'] = ' -lpython{}'.format( + self.ctx.python_recipe.major_minor_version_string) + if 'python3' in self.ctx.python_recipe.name: + env['EXTRA_LDLIBS'] += 'm' + + # set some env variables that may be needed to build some bootstrap ndk + # recipes that needs linking with our python via mk files, like + # recipes: sdl2, genericndkbuild or sdl + other_builds = join(self.ctx.build_dir, 'other_builds') + '/' + env['MK_PYTHON_INCLUDE_ROOT'] = \ + self.ctx.python_recipe.include_root(arch.arch)[ + len(other_builds):] + env['MK_PYTHON_LINK_ROOT'] = \ + self.ctx.python_recipe.link_root(arch.arch)[len(other_builds):] + return env + class NDKRecipe(Recipe): '''A recipe class for any NDK project not included in the bootstrap.''' diff --git a/pythonforandroid/recipes/genericndkbuild/__init__.py b/pythonforandroid/recipes/genericndkbuild/__init__.py index f06e814fa0..84f4823b5a 100644 --- a/pythonforandroid/recipes/genericndkbuild/__init__.py +++ b/pythonforandroid/recipes/genericndkbuild/__init__.py @@ -13,13 +13,9 @@ class GenericNDKBuildRecipe(BootstrapNDKRecipe): def should_build(self, arch): return True - def get_recipe_env(self, arch=None): - env = super(GenericNDKBuildRecipe, self).get_recipe_env(arch) - py2 = self.get_recipe('python2', arch.ctx) - env['PYTHON2_NAME'] = py2.get_dir_name() - if 'python2' in self.ctx.recipe_build_order: - env['EXTRA_LDLIBS'] = ' -lpython2.7' - + def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True): + env = super(GenericNDKBuildRecipe, self).get_recipe_env( + arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python) env['APP_ALLOW_MISSING_DEPS'] = 'true' return env diff --git a/pythonforandroid/recipes/sdl/__init__.py b/pythonforandroid/recipes/sdl/__init__.py index a0e07b2675..b821138373 100644 --- a/pythonforandroid/recipes/sdl/__init__.py +++ b/pythonforandroid/recipes/sdl/__init__.py @@ -29,12 +29,9 @@ def build_arch(self, arch): shprint(sh.cp, '-a', join(self.ctx.bootstrap.build_dir, 'libs', arch.arch, content), self.ctx.libs_dir) - def get_recipe_env(self, arch=None): - env = super(LibSDLRecipe, self).get_recipe_env(arch) - py2 = self.get_recipe('python2', arch.ctx) - env['PYTHON2_NAME'] = py2.get_dir_name() - if 'python2' in self.ctx.recipe_build_order: - env['EXTRA_LDLIBS'] = ' -lpython2.7' + def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True): + env = super(LibSDLRecipe, self).get_recipe_env( + arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python) return env diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py index 9ddf2986b5..7565f81db2 100644 --- a/pythonforandroid/recipes/sdl2/__init__.py +++ b/pythonforandroid/recipes/sdl2/__init__.py @@ -15,21 +15,9 @@ class LibSDL2Recipe(BootstrapNDKRecipe): patches = ['add_nativeSetEnv.patch'] - def get_recipe_env(self, arch=None): - env = super(LibSDL2Recipe, self).get_recipe_env(arch) - - py2 = self.get_recipe('python2', arch.ctx) - env['PYTHON2_NAME'] = py2.get_dir_name() - - env['PYTHON_INCLUDE_ROOT'] = self.ctx.python_recipe.include_root(arch.arch) - env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch) - - if self.ctx.python_recipe.name in ('python2', 'python3'): - env['EXTRA_LDLIBS'] = ' -lpython{}'.format( - self.ctx.python_recipe.major_minor_version_string) - if 'python3' in self.ctx.recipe_build_order: - env['EXTRA_LDLIBS'] += 'm' - + def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True): + env = super(LibSDL2Recipe, self).get_recipe_env( + arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python) env['APP_ALLOW_MISSING_DEPS'] = 'true' return env From f67c8f82434f3efe9798305424380aeb9079a8ea Mon Sep 17 00:00:00 2001 From: opacam Date: Sun, 25 Nov 2018 04:03:55 +0100 Subject: [PATCH 15/66] Fix duplicated key in options for python2 test --- testapps/setup_testapp_python2_sqlite_openssl.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testapps/setup_testapp_python2_sqlite_openssl.py b/testapps/setup_testapp_python2_sqlite_openssl.py index 98a184e58a..f6a7f1166f 100644 --- a/testapps/setup_testapp_python2_sqlite_openssl.py +++ b/testapps/setup_testapp_python2_sqlite_openssl.py @@ -8,8 +8,7 @@ 'ndk-dir': '/home/sandy/android/crystax-ndk-10.3.2', 'dist-name': 'bdisttest_python2_sqlite_openssl', 'ndk-version': '10.3.2', - 'permission': 'VIBRATE', - 'permission': 'INTERNET', + 'permissions': ['INTERNET', 'VIBRATE'], 'arch': 'armeabi-v7a', 'window': None, }} From e11c4d1fb7394a2c5ab2174194f7de41095a129c Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 16:07:20 +0100 Subject: [PATCH 16/66] Fix numpy's recipe and adds python3's compatibility. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also:   - add numpy to CI tests for python3: this module is some kind of special and probably a dependency for a lot of python packages so better make sure that we not break anything...as we already do with python2   - Add numpy to python2 and python3 test apps, cause already have some buttons that allows to test it from the running app. --- .travis.yml | 2 +- pythonforandroid/recipes/numpy/__init__.py | 22 +++++++++---------- ...python2-fixes.patch => python-fixes.patch} | 0 testapps/setup_testapp_python2.py | 2 +- testapps/setup_testapp_python3.py | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) rename pythonforandroid/recipes/numpy/patches/{python2-fixes.patch => python-fixes.patch} (100%) diff --git a/.travis.yml b/.travis.yml index 99dcd99930..9051ab1bd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: - ANDROID_SDK_HOME=/opt/android/android-sdk - ANDROID_NDK_HOME=/opt/android/android-ndk matrix: - - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3' + - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3,numpy' # overrides requirements to skip `peewee` pure python module, see: # https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054 - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools' diff --git a/pythonforandroid/recipes/numpy/__init__.py b/pythonforandroid/recipes/numpy/__init__.py index 2cb6f59ec4..6bfc0480b3 100644 --- a/pythonforandroid/recipes/numpy/__init__.py +++ b/pythonforandroid/recipes/numpy/__init__.py @@ -9,14 +9,14 @@ class NumpyRecipe(CompiledComponentsPythonRecipe): url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip' site_packages_name = 'numpy' - depends = [('python2', 'python3crystax')] + depends = [('python2', 'python3', 'python3crystax')] patches = [ join('patches', 'fix-numpy.patch'), join('patches', 'prevent_libs_check.patch'), join('patches', 'ar.patch'), join('patches', 'lib.patch'), - join('patches', 'python2-fixes.patch') + join('patches', 'python-fixes.patch') ] def get_recipe_env(self, arch): @@ -27,17 +27,17 @@ def get_recipe_env(self, arch): self.ctx.ndk_platform ) + py_ver = self.ctx.python_recipe.major_minor_version_string + py_inc_dir = self.ctx.python_recipe.include_root(arch.arch) + py_lib_dir = self.ctx.python_recipe.link_root(arch.arch) if self.ctx.ndk == 'crystax': - py_ver = self.ctx.python_recipe.version[0:3] src_dir = join(self.ctx.ndk_dir, 'sources') - py_inc_dir = join(src_dir, 'python', py_ver, 'include', 'python') - py_lib_dir = join(src_dir, 'python', py_ver, 'libs', arch.arch) - cry_inc_dir = join(src_dir, 'crystax', 'include') - cry_lib_dir = join(src_dir, 'crystax', 'libs', arch.arch) - flags += ' -I{}'.format(py_inc_dir) - flags += ' -L{} -lpython{}m'.format(py_lib_dir, py_ver) - flags += " -I{}".format(cry_inc_dir) - flags += " -L{}".format(cry_lib_dir) + flags += " -I{}".format(join(src_dir, 'crystax', 'include')) + flags += " -L{}".format(join(src_dir, 'crystax', 'libs', arch.arch)) + flags += ' -I{}'.format(py_inc_dir) + flags += ' -L{} -lpython{}'.format(py_lib_dir, py_ver) + if 'python3' in self.ctx.python_recipe.name: + flags += 'm' if flags not in env['CC']: env['CC'] += flags diff --git a/pythonforandroid/recipes/numpy/patches/python2-fixes.patch b/pythonforandroid/recipes/numpy/patches/python-fixes.patch similarity index 100% rename from pythonforandroid/recipes/numpy/patches/python2-fixes.patch rename to pythonforandroid/recipes/numpy/patches/python-fixes.patch diff --git a/testapps/setup_testapp_python2.py b/testapps/setup_testapp_python2.py index a631455bd6..5aed64a44a 100644 --- a/testapps/setup_testapp_python2.py +++ b/testapps/setup_testapp_python2.py @@ -2,7 +2,7 @@ from distutils.core import setup from setuptools import find_packages -options = {'apk': {'requirements': 'sdl2,pyjnius,kivy,python2', +options = {'apk': {'requirements': 'sdl2,numpy,pyjnius,kivy,python2', 'android-api': 27, 'ndk-api': 21, 'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2', diff --git a/testapps/setup_testapp_python3.py b/testapps/setup_testapp_python3.py index 94545484c3..40ed20d231 100644 --- a/testapps/setup_testapp_python3.py +++ b/testapps/setup_testapp_python3.py @@ -2,7 +2,7 @@ from distutils.core import setup from setuptools import find_packages -options = {'apk': {'requirements': 'libffi,sdl2,pyjnius,kivy,python3', +options = {'apk': {'requirements': 'libffi,sdl2,numpy,pyjnius,kivy,python3', 'android-api': 27, 'ndk-api': 21, 'dist-name': 'bdisttest_python3_googlendk', From 6b60c62a8759362ff97f3db251cd429a9e6360a7 Mon Sep 17 00:00:00 2001 From: opacam Date: Sun, 25 Nov 2018 04:03:55 +0100 Subject: [PATCH 17/66] Add python3 test for sqlite and openssl and add python3's compatibility to dependant recipes To be able to run successfully the new test we must add python3 compatibility to some recipes that is why we touch them here. --- pythonforandroid/recipes/requests/__init__.py | 2 +- .../recipes/setuptools/__init__.py | 2 +- .../setup_testapp_python3_sqlite_openssl.py | 30 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 testapps/setup_testapp_python3_sqlite_openssl.py diff --git a/pythonforandroid/recipes/requests/__init__.py b/pythonforandroid/recipes/requests/__init__.py index 6d3ee7c78e..2e5e879705 100644 --- a/pythonforandroid/recipes/requests/__init__.py +++ b/pythonforandroid/recipes/requests/__init__.py @@ -4,7 +4,7 @@ class RequestsRecipe(PythonRecipe): version = '2.13.0' url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz' - depends = [('hostpython2', 'hostpython3crystax'), 'setuptools'] + depends = [('python2', 'python3', 'python3crystax'), 'setuptools'] site_packages_name = 'requests' call_hostpython_via_targetpython = False diff --git a/pythonforandroid/recipes/setuptools/__init__.py b/pythonforandroid/recipes/setuptools/__init__.py index fd873e7da8..167044478b 100644 --- a/pythonforandroid/recipes/setuptools/__init__.py +++ b/pythonforandroid/recipes/setuptools/__init__.py @@ -5,7 +5,7 @@ class SetuptoolsRecipe(PythonRecipe): version = '40.0.0' url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip' - depends = [('python2', 'python3crystax')] + depends = [('python2', 'python3', 'python3crystax')] call_hostpython_via_targetpython = False install_in_hostpython = True diff --git a/testapps/setup_testapp_python3_sqlite_openssl.py b/testapps/setup_testapp_python3_sqlite_openssl.py new file mode 100644 index 0000000000..d3c0de2d2e --- /dev/null +++ b/testapps/setup_testapp_python3_sqlite_openssl.py @@ -0,0 +1,30 @@ + +from distutils.core import setup +from setuptools import find_packages + +options = {'apk': {'requirements': 'libffi,openssl,sqlite3,requests,peewee,sdl2,pyjnius,kivy,python3', + 'android-api': 27, + 'ndk-api': 21, + 'dist-name': 'bdisttest_python3_sqlite_openssl_googlendk', + 'ndk-version': '10.3.2', + 'arch': 'armeabi-v7a', + 'permissions': ['INTERNET', 'VIBRATE'], + }} + +package_data = {'': ['*.py', + '*.png'] + } + +packages = find_packages() +print('packages are', packages) + +setup( + name='testapp_python3_sqlite_openssl_googlendk', + version='1.1', + description='p4a setup.py test', + author='Alexander Taylor', + author_email='alexanderjohntaylor@gmail.com', + packages=find_packages(), + options=options, + package_data={'testapp_sqlite_openssl': ['*.py', '*.png']} +) From 56cb4cc847450f63aec1a480f11885e4449ab08f Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 02:15:10 +0100 Subject: [PATCH 18/66] Make that travis test python3 with sqlite3 and openssl --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9051ab1bd6..7938918ade 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: - ANDROID_SDK_HOME=/opt/android/android-sdk - ANDROID_NDK_HOME=/opt/android/android-ndk matrix: - - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3,numpy' + - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools' # overrides requirements to skip `peewee` pure python module, see: # https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054 - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools' From c8f7d0aa3f9e7dbe818a0ac11e934e1700c3d60f Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 02:25:41 +0100 Subject: [PATCH 19/66] Update android ndk to r17c for docker images --- Dockerfile.py2 | 2 +- Dockerfile.py3 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.py2 b/Dockerfile.py2 index 9d001c695b..8afc72f1d5 100644 --- a/Dockerfile.py2 +++ b/Dockerfile.py2 @@ -26,7 +26,7 @@ RUN apt -y update -qq \ ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" -ENV ANDROID_NDK_VERSION="16b" +ENV ANDROID_NDK_VERSION="17c" ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" # get the latest version from https://developer.android.com/ndk/downloads/index.html diff --git a/Dockerfile.py3 b/Dockerfile.py3 index beace1537b..db65cd99c9 100644 --- a/Dockerfile.py3 +++ b/Dockerfile.py3 @@ -26,7 +26,7 @@ RUN apt -y update -qq \ ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" -ENV ANDROID_NDK_VERSION="16b" +ENV ANDROID_NDK_VERSION="17c" ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" # get the latest version from https://developer.android.com/ndk/downloads/index.html From 5d782e4f0197f4404867b4428df25788d5f2fef3 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 02:30:04 +0100 Subject: [PATCH 20/66] Add one more dependency to our docker images Or the ci tests where libffi is involved will fail. --- Dockerfile.py2 | 2 +- Dockerfile.py3 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.py2 b/Dockerfile.py2 index 8afc72f1d5..f8825906eb 100644 --- a/Dockerfile.py2 +++ b/Dockerfile.py2 @@ -104,7 +104,7 @@ RUN dpkg --add-architecture i386 \ # specific recipes dependencies (e.g. libffi requires autoreconf binary) RUN apt -y update -qq \ && apt -y install -qq --no-install-recommends \ - autoconf automake cmake gettext libltdl-dev libtool pkg-config \ + libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \ && apt -y autoremove \ && apt -y clean diff --git a/Dockerfile.py3 b/Dockerfile.py3 index db65cd99c9..878804c76a 100644 --- a/Dockerfile.py3 +++ b/Dockerfile.py3 @@ -104,7 +104,7 @@ RUN dpkg --add-architecture i386 \ # specific recipes dependencies (e.g. libffi requires autoreconf binary) RUN apt -y update -qq \ && apt -y install -qq --no-install-recommends \ - autoconf automake cmake gettext libltdl-dev libtool pkg-config \ + libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \ && apt -y autoremove \ && apt -y clean From fc657c733769a5afedb2b11ef2dd1c9036f8579c Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 02:32:45 +0100 Subject: [PATCH 21/66] Update documentation about the new python core --- README.rst | 14 ++++++++++++++ doc/source/quickstart.rst | 31 +++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 5a0455875f..f427c944ee 100644 --- a/README.rst +++ b/README.rst @@ -35,6 +35,20 @@ issues and PRs relating to this branch are still accepted. However, the new toolchain contains all the same functionality via the built in pygame bootstrap. +In the last quarter of 2018 the python recipes has been changed, the new recipe +for python3 (3.7.1) has a new build system which has been applied to the ancient +python recipe, allowing us to bump the python2 version number to 2.7.15. This +change, unifies the build process for both python recipes, and probably solve +some issues detected over the years, but unfortunately, this change breaks the +pygame bootstrap (in a near future we will fix it or remove it). This also +means that the ndk version to use in python-for-android should be at least the +version r17c. + +This has been done this way to make easier the transition between python3 and +python2. We will try to support python2, at least until the python team release +the last python2 version (2020), but if you are using python2 in your projects +you should consider to migrate it into python3. + Documentation ============= diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index db1f0a213a..90f0a9d8e3 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -93,11 +93,34 @@ named ``tools``, and you will need to run extra commands to install the SDK packages needed. For Android NDK, note that modern releases will only work on a 64-bit -operating system. If you are using a 32-bit distribution (or hardware), -the latest useable NDK version is r10e, which can be downloaded here: +operating system. The minimal, and recommended, NDK version to use is r17c: + + - `Linux (64-bits) `_ + - `Macos X (64-bits) `_ + - Windows users should create a virtual machine with an GNU Linux os + installed, and then you can follow the described instructions from within + your virtual machine. + +.. note:: + Versions below r17 may cause troubles while compiling some recipes. Our + tests had been done against ndk versions r17b and r17c. Later versions of + the android ndk still are not proved to work with python-for-android, and + may work or not...so...better to stick to the recommended version (r17c). + +If you are using a 32-bit distribution (or hardware), +the latest usable NDK version is r10e, which can be downloaded here: - `Legacy 32-bit Linux NDK r10e `_ +.. warning:: + **32-bit distributions** + + Since the python2 recipe updated to version 2.7.15, the build system has + been changed and you should use an old release of python-for-android, which + contains the legacy python recipe (v2.7.2). The last python-for-android + release with the legacy version of python is version + `0.6.0 `_. + First, install a platform to target (you can also replace ``27`` with a different platform number, this will be used again later):: @@ -113,8 +136,8 @@ Then, you can edit your ``~/.bashrc`` or other favorite shell to include new env # Adjust the paths! export ANDROIDSDK="$HOME/Documents/android-sdk-27" - export ANDROIDNDK="$HOME/Documents/android-ndk-r10e" - export ANDROIDAPI="27" # Target API version of your application + export ANDROIDNDK="$HOME/Documents/android-ndk-r17c" + export ANDROIDAPI="26" # Target API version of your application export NDKAPI="19" # Minimum supported API version of your application export ANDROIDNDKVER="r10e" # Version of the NDK you installed From 929f8fc36e0575717dbcd98ee9695865acce886c Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 4 Dec 2018 17:49:54 +0100 Subject: [PATCH 22/66] Prevent crash on create_python_bundle When building an apk for service_only's bootstrap the build will crash if we don't add some pure python packages, because the directory "python-install/" will not be ever created, so...this will make p4a crash when we try to enter into this directory. --- pythonforandroid/python.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index 038e4104ec..f9bed638af 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -283,6 +283,7 @@ def create_python_bundle(self, dirn, arch): # copy the site-packages into place ensure_dir(join(dirn, 'site-packages')) + ensure_dir(self.ctx.get_python_install_dir()) # TODO: Improve the API around walking and copying the files with current_directory(self.ctx.get_python_install_dir()): filens = list(walk_valid_filens( From 144c4a8f4c1fb82d995be23ea121122c08d968e3 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 15:35:14 +0100 Subject: [PATCH 23/66] Replace exit for BuildInterruptingException MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @AndreMiras!!! --- pythonforandroid/python.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index f9bed638af..a640015975 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -9,7 +9,7 @@ import sh from pythonforandroid.recipe import Recipe, TargetPythonRecipe -from pythonforandroid.logger import logger, info, error, shprint +from pythonforandroid.logger import logger, info, shprint from pythonforandroid.util import ( current_directory, ensure_dir, walk_valid_filens, BuildInterruptingException) @@ -199,9 +199,9 @@ def add_flags(include_flags, link_flags): def prebuild_arch(self, arch): super(TargetPythonRecipe, self).prebuild_arch(arch) if self.from_crystax and self.ctx.ndk != 'crystax': - error('The {} recipe can only be built when ' - 'using the CrystaX NDK. Exiting.'.format(self.name)) - exit(1) + raise BuildInterruptingException( + 'The {} recipe can only be built when using the CrystaX NDK. ' + 'Exiting.'.format(self.name)) self.ctx.python_recipe = self def build_arch(self, arch): From 0e41ac7796926174bab30546c2c4fd484b429159 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 21:20:43 +0100 Subject: [PATCH 24/66] Remove note of quickstart.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @inclement!!! --- doc/source/quickstart.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index 90f0a9d8e3..4455decda1 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -101,12 +101,6 @@ operating system. The minimal, and recommended, NDK version to use is r17c: installed, and then you can follow the described instructions from within your virtual machine. -.. note:: - Versions below r17 may cause troubles while compiling some recipes. Our - tests had been done against ndk versions r17b and r17c. Later versions of - the android ndk still are not proved to work with python-for-android, and - may work or not...so...better to stick to the recommended version (r17c). - If you are using a 32-bit distribution (or hardware), the latest usable NDK version is r10e, which can be downloaded here: From 70074bb8663202bf9da70b9e494aaba03908cdc2 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 21:36:10 +0100 Subject: [PATCH 25/66] Redaction corrections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @inclement!!! --- README.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index f427c944ee..fa6dc1c84e 100644 --- a/README.rst +++ b/README.rst @@ -40,14 +40,15 @@ for python3 (3.7.1) has a new build system which has been applied to the ancient python recipe, allowing us to bump the python2 version number to 2.7.15. This change, unifies the build process for both python recipes, and probably solve some issues detected over the years, but unfortunately, this change breaks the -pygame bootstrap (in a near future we will fix it or remove it). This also -means that the ndk version to use in python-for-android should be at least the -version r17c. - -This has been done this way to make easier the transition between python3 and -python2. We will try to support python2, at least until the python team release -the last python2 version (2020), but if you are using python2 in your projects -you should consider to migrate it into python3. +pygame bootstrap (in a near future we will fix it or remove it). All this work +has been done using android ndk version r17c, and your build should success +with that version...but be aware that the project is in constant development +so...the ndk version will change at some time. + +Those mentioned changes has been done this way to make easier the transition +between python3 and python2. We will slowly phase out python2 support +towards 2020...so...if you are using python2 in your projects you should +consider to migrate it into python3. Documentation ============= From 1063801698eeddb7c0f5bc7ffdeafcb96b9c0c03 Mon Sep 17 00:00:00 2001 From: opacam Date: Tue, 18 Dec 2018 21:38:36 +0100 Subject: [PATCH 26/66] Remove tuple of python versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because all 3 are automatically added by PythonRecipe. ¡¡¡Thanks @inclement!!! --- pythonforandroid/recipes/requests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipes/requests/__init__.py b/pythonforandroid/recipes/requests/__init__.py index 2e5e879705..22a6268c3e 100644 --- a/pythonforandroid/recipes/requests/__init__.py +++ b/pythonforandroid/recipes/requests/__init__.py @@ -4,7 +4,7 @@ class RequestsRecipe(PythonRecipe): version = '2.13.0' url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz' - depends = [('python2', 'python3', 'python3crystax'), 'setuptools'] + depends = ['setuptools'] site_packages_name = 'requests' call_hostpython_via_targetpython = False From 39bd03ac7cba716427124025c25425d333b5e006 Mon Sep 17 00:00:00 2001 From: opacam Date: Thu, 20 Dec 2018 11:06:42 +0100 Subject: [PATCH 27/66] Replace backslashes To be more readable and pythonic Thanks @KeyWeeUsr!!! --- pythonforandroid/python.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index a640015975..8c842321bd 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -96,9 +96,8 @@ def __init__(self, *args, **kwargs): def get_recipe_env(self, arch=None, with_flags_in_cc=True): if self.from_crystax: - return \ - super(GuestPythonRecipe, self).get_recipe_env( - arch=arch, with_flags_in_cc=with_flags_in_cc) + return super(GuestPythonRecipe, self).get_recipe_env( + arch=arch, with_flags_in_cc=with_flags_in_cc) env = environ.copy() platform_name = 'android-{}'.format(self.ctx.ndk_api) @@ -116,8 +115,8 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): target = '-'.join( [target_data[0], 'none', target_data[1], target_data[2]]) - env['CC'] = \ - '{clang} -target {target} -gcc-toolchain {toolchain}'.format( + env['CC'] = ( + '{clang} -target {target} -gcc-toolchain {toolchain}').format( clang=join(self.ctx.ndk_dir, 'toolchains', 'llvm', 'prebuilt', 'linux-x86_64', 'bin', 'clang'), target=target, @@ -126,12 +125,11 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): env['LD'] = join(toolchain, 'bin', android_host) + '-ld' env['RANLIB'] = join(toolchain, 'bin', android_host) + '-ranlib' env['READELF'] = join(toolchain, 'bin', android_host) + '-readelf' - env['STRIP'] = \ - join(toolchain, 'bin', android_host) + \ - '-strip --strip-debug --strip-unneeded' + env['STRIP'] = join(toolchain, 'bin', android_host) + '-strip' + env['STRIP'] += ' --strip-debug --strip-unneeded' - env['PATH'] = \ - '{hostpython_dir}:{old_path}'.format( + env['PATH'] = ( + '{hostpython_dir}:{old_path}').format( hostpython_dir=self.get_recipe( 'host' + self.name, self.ctx).get_path_to_python(), old_path=env['PATH']) From 70759018e68357c160857ce79d59055a841e48c7 Mon Sep 17 00:00:00 2001 From: opacam Date: Thu, 20 Dec 2018 12:49:29 +0100 Subject: [PATCH 28/66] Fix hardcoded toolchain version and arch for python recipe --- pythonforandroid/python.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index 8c842321bd..ec345fd132 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -100,12 +100,11 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): arch=arch, with_flags_in_cc=with_flags_in_cc) env = environ.copy() - platform_name = 'android-{}'.format(self.ctx.ndk_api) - # TODO: Get this information from p4a's arch system - android_host = env['HOSTARCH'] = 'arm-linux-androideabi' - - toolchain = '{android_host}-4.9'.format(android_host=android_host) + android_host = env['HOSTARCH'] = self.ctx.toolchain_prefix + toolchain = '{toolchain_prefix}-{toolchain_version}'.format( + toolchain_prefix=self.ctx.toolchain_prefix, + toolchain_version=self.ctx.toolchain_version) toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') @@ -142,8 +141,7 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): ndk_android_host=join( self.ctx.ndk_dir, 'sysroot', 'usr', 'include', android_host), ndk_include=join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')) - sysroot = join(self.ctx.ndk_dir, 'platforms', - platform_name, 'arch-arm') + sysroot = self.ctx.ndk_platform env['CFLAGS'] = env.get('CFLAGS', '') + ' ' + ndk_flags env['CPPFLAGS'] = env.get('CPPFLAGS', '') + ' ' + ndk_flags env['LDFLAGS'] = env.get('LDFLAGS', '') + ' --sysroot={} -L{}'.format( From d2b7ba55d2011dcc11fbc98283b4d1a07024f8da Mon Sep 17 00:00:00 2001 From: opacam Date: Thu, 20 Dec 2018 12:52:53 +0100 Subject: [PATCH 29/66] Fix hardcoded toolchain version and arch for clang --- pythonforandroid/archs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 0c48d0355c..820b06f356 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -41,9 +41,9 @@ def get_env(self, with_flags_in_cc=True, clang=False): cflags += ['-mandroid'] else: cflags += ['-target armv7-none-linux-androideabi'] - android_host = 'arm-linux-androideabi' - platform_dir = join(self.ctx.ndk_dir, 'platforms', 'android-{}'.format(self.ctx.ndk_api), 'arch-arm') - toolchain = '{android_host}-4.9'.format(android_host=android_host) + toolchain = '{android_host}-{toolchain_version}'.format( + android_host=self.ctx.toolchain_prefix, + toolchain_version=self.ctx.toolchain_version) toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') cflags += ['-gcc-toolchain {}'.format(toolchain)] From 3ecf55c721919d6896ac3ce1b7274711637353f9 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 01:53:03 +0100 Subject: [PATCH 30/66] Fix android host for python recipes To allow us to build python 2 or 3 for any arch supported for p4a --- pythonforandroid/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index ec345fd132..c529c09505 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -101,7 +101,7 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): env = environ.copy() - android_host = env['HOSTARCH'] = self.ctx.toolchain_prefix + android_host = env['HOSTARCH'] = arch.command_prefix toolchain = '{toolchain_prefix}-{toolchain_version}'.format( toolchain_prefix=self.ctx.toolchain_prefix, toolchain_version=self.ctx.toolchain_version) From d9eed7230d47fe3e3c7c3363d6a5dd4f917e1b54 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 01:57:44 +0100 Subject: [PATCH 31/66] Fix hardcoded target for python recipes and clang --- pythonforandroid/archs.py | 14 +++++++++++++- pythonforandroid/python.py | 8 +------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 820b06f356..25c0cedc95 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -30,6 +30,12 @@ def include_dirs(self): d.format(arch=self)) for d in self.ctx.include_dirs] + @property + def target(self): + target_data = self.command_prefix.split('-') + return '-'.join( + [target_data[0], 'none', target_data[1], target_data[2]]) + def get_env(self, with_flags_in_cc=True, clang=False): env = {} @@ -40,7 +46,7 @@ def get_env(self, with_flags_in_cc=True, clang=False): if not clang: cflags += ['-mandroid'] else: - cflags += ['-target armv7-none-linux-androideabi'] + cflags += ['-target ' + self.target] toolchain = '{android_host}-{toolchain_version}'.format( android_host=self.ctx.toolchain_prefix, toolchain_version=self.ctx.toolchain_version) @@ -170,6 +176,12 @@ class ArchARM(Arch): command_prefix = 'arm-linux-androideabi' platform_dir = 'arch-arm' + @property + def target(self): + target_data = self.command_prefix.split('-') + return '-'.join( + ['armv7a', 'none', target_data[1], target_data[2]]) + class ArchARMv7_a(ArchARM): arch = 'armeabi-v7a' diff --git a/pythonforandroid/python.py b/pythonforandroid/python.py index c529c09505..34a1e55735 100644 --- a/pythonforandroid/python.py +++ b/pythonforandroid/python.py @@ -108,17 +108,11 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True): toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') - target_data = arch.command_prefix.split('-') - if target_data[0] == 'arm': - target_data[0] = 'armv7a' - target = '-'.join( - [target_data[0], 'none', target_data[1], target_data[2]]) - env['CC'] = ( '{clang} -target {target} -gcc-toolchain {toolchain}').format( clang=join(self.ctx.ndk_dir, 'toolchains', 'llvm', 'prebuilt', 'linux-x86_64', 'bin', 'clang'), - target=target, + target=arch.target, toolchain=toolchain) env['AR'] = join(toolchain, 'bin', android_host) + '-ar' env['LD'] = join(toolchain, 'bin', android_host) + '-ld' From 0a797eda6157866716c6783ce648a1709b78c5b2 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 02:01:19 +0100 Subject: [PATCH 32/66] Add missing includes for clang Or we will get errors complaining about missing includes related with asm --- pythonforandroid/archs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 25c0cedc95..5fb12222b6 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -62,6 +62,8 @@ def get_env(self, with_flags_in_cc=True, clang=False): # https://android.googlesource.com/platform/ndk/+/ndk-r15-release/docs/UnifiedHeaders.md env['CFLAGS'] += ' -isystem {}/sysroot/usr/include/{}'.format( self.ctx.ndk_dir, self.ctx.toolchain_prefix) + env['CFLAGS'] += ' -I{}/sysroot/usr/include/{}'.format( + self.ctx.ndk_dir, self.command_prefix) else: sysroot = self.ctx.ndk_platform env['CFLAGS'] += ' -I{}'.format(self.ctx.ndk_platform) From 1f47a69f0da1dfdfdd3e69cbe8caa4a01995ef3f Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 02:02:26 +0100 Subject: [PATCH 33/66] Fix hardcoded arch for numpy --- pythonforandroid/recipes/numpy/patches/ar.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipes/numpy/patches/ar.patch b/pythonforandroid/recipes/numpy/patches/ar.patch index 33f601ffd0..ddb096cc81 100644 --- a/pythonforandroid/recipes/numpy/patches/ar.patch +++ b/pythonforandroid/recipes/numpy/patches/ar.patch @@ -38,7 +38,7 @@ index 11b2cce..f6dde79 100644 while tmp_objects: objects = tmp_objects[:50] tmp_objects = tmp_objects[50:] -+ self.archiver[0] = 'arm-linux-androideabi-ar' ++ self.archiver[0] = os.environ['AR'] display = '%s: adding %d object files to %s' % ( os.path.basename(self.archiver[0]), len(objects), output_filename) From f911677b5545b734fb966ff2d3362951c5b21260 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 02:03:20 +0100 Subject: [PATCH 34/66] Fix openssl build for arch x86_64 --- pythonforandroid/recipes/openssl/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index 2f264d040a..7c7f9b2ef0 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -93,6 +93,8 @@ def select_build_arch(self, arch): return 'android-arm' if 'arm' in aname: return 'android' + if 'x86_64' in aname: + return 'android-x86_64' if 'x86' in aname: return 'android-x86' return 'linux-armv4' From 00fe5ca943909765e17dba1dcf56847d61090535 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 02:19:12 +0100 Subject: [PATCH 35/66] Fix openssl build for arch arm64-v8a --- pythonforandroid/recipes/openssl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index 7c7f9b2ef0..a2ec619a7f 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -88,7 +88,7 @@ def get_recipe_env(self, arch=None): def select_build_arch(self, arch): aname = arch.arch if 'arm64' in aname: - return 'linux-aarch64' + return 'android-arm64' if 'v7a' in aname: return 'android-arm' if 'arm' in aname: From e94b765c6b5eeb71219eeca888ccb3747724a40b Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 02:52:02 +0100 Subject: [PATCH 36/66] Drop commented code from python2legacy recipe --- .../recipes/python2legacy/__init__.py | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/pythonforandroid/recipes/python2legacy/__init__.py b/pythonforandroid/recipes/python2legacy/__init__.py index 9299326da2..c17abdc0da 100644 --- a/pythonforandroid/recipes/python2legacy/__init__.py +++ b/pythonforandroid/recipes/python2legacy/__init__.py @@ -66,16 +66,6 @@ def build_arch(self, arch): if not exists(join(self.ctx.get_libs_dir(arch.arch), 'libpython2.7.so')): shprint(sh.cp, join(self.get_build_dir(arch.arch), 'libpython2.7.so'), self.ctx.get_libs_dir(arch.arch)) - # # if exists(join(self.get_build_dir(arch.arch), 'libpython2.7.so')): - # if exists(join(self.ctx.libs_dir, 'libpython2.7.so')): - # info('libpython2.7.so already exists, skipping python build.') - # if not exists(join(self.ctx.get_python_install_dir(), 'libpython2.7.so')): - # info('Copying python-install to dist-dependent location') - # shprint(sh.cp, '-a', 'python-install', self.ctx.get_python_install_dir()) - # self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host') - - # return - def do_python_build(self, arch): shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch)) @@ -170,17 +160,6 @@ def do_python_build(self, arch): shprint(sh.rm, '-rf', join('python-install', 'lib', 'python2.7', dir_name)) - # info('Copying python-install to dist-dependent location') - # shprint(sh.cp, '-a', 'python-install', self.ctx.get_python_install_dir()) - - # print('Copying hostpython binary to targetpython folder') - # shprint(sh.cp, self.ctx.hostpython, - # join(self.ctx.get_python_install_dir(), 'bin', 'python.host')) - # self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host') - - # print('python2legacy build done, exiting for debug') - # exit(1) - def create_python_bundle(self, dirn, arch): info("Filling private directory") if not exists(join(dirn, "lib")): From 2940c9aa829562e0c9a4ec6fe3825b66a937931f Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 11:22:02 +0100 Subject: [PATCH 37/66] Replace backslashes for openssl recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To enhance the readability of the sourcecode ¡¡¡Thanks KeyWeeUsr!!! --- pythonforandroid/recipes/openssl/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index a2ec619a7f..aff4cddc3e 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -54,16 +54,17 @@ def versioned_url(self): def include_flags(self, arch): '''Returns a string with the include folders''' openssl_includes = join(self.get_build_dir(arch.arch), 'include') - return ' -I' + openssl_includes + \ - ' -I' + join(openssl_includes, 'internal') + \ - ' -I' + join(openssl_includes, 'openssl') + return (' -I' + openssl_includes + + ' -I' + join(openssl_includes, 'internal') + + ' -I' + join(openssl_includes, 'openssl')) def link_flags(self, arch): '''Returns a string with the right link flags to compile against the openssl libraries''' build_dir = self.get_build_dir(arch.arch) - return ' -L' + build_dir + \ - ' -lcrypto{version} -lssl{version}'.format(version=self.version) + return (' -L' + build_dir + + ' -lcrypto{version} -lssl{version}'.format( + version=self.version)) def should_build(self, arch): return not self.has_libs(arch, 'libssl' + self.version + '.so', From 54fa1d8bb2410c44151e9a6b76091d9d3d484205 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 11:46:46 +0100 Subject: [PATCH 38/66] Fix hardcoded arch flags for libffi recipe To fix libffi build for any arch --- pythonforandroid/recipes/libffi/__init__.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pythonforandroid/recipes/libffi/__init__.py b/pythonforandroid/recipes/libffi/__init__.py index 57eac53188..d5a85c2865 100644 --- a/pythonforandroid/recipes/libffi/__init__.py +++ b/pythonforandroid/recipes/libffi/__init__.py @@ -2,6 +2,7 @@ from pythonforandroid.recipe import Recipe from pythonforandroid.logger import info, shprint from pythonforandroid.util import current_directory +import glob import sh @@ -43,7 +44,7 @@ def build_arch(self, arch): shprint(sh.Command('./autogen.sh'), _env=env) shprint(sh.Command('autoreconf'), '-vif', _env=env) shprint(sh.Command('./configure'), - '--host=' + arch.toolchain_prefix, + '--host=' + arch.command_prefix, '--prefix=' + self.ctx.get_python_install_dir(), '--enable-shared', _env=env) # '--with-sysroot={}'.format(self.ctx.ndk_platform), @@ -52,7 +53,7 @@ def build_arch(self, arch): # ndk 15 introduces unified headers required --sysroot and # -isysroot for libraries and headers. libtool's head explodes # trying to weave them into it's own magic. The result is a link - # failure tryng to link libc. We call make to compile the bits + # failure trying to link libc. We call make to compile the bits # and manually link... try: @@ -62,13 +63,10 @@ def build_arch(self, arch): cc = sh.Command(env['CC'].split()[0]) cflags = env['CC'].split()[1:] - cflags.extend(['-march=armv7-a', '-mfloat-abi=softfp', '-mfpu=vfp', - '-mthumb', '-shared', '-fPIC', '-DPIC', - 'src/.libs/prep_cif.o', 'src/.libs/types.o', - 'src/.libs/raw_api.o', 'src/.libs/java_raw_api.o', - 'src/.libs/closures.o', 'src/arm/.libs/sysv.o', - 'src/arm/.libs/ffi.o', ] - ) + src_arch = arch.toolchain_prefix.replace('-linux-android', '') + cflags.extend(['-shared', '-fPIC', '-DPIC']) + cflags.extend(glob.glob('src/.libs/*.o')) + cflags.extend(glob.glob('src/{}/.libs/ffi.o'.format(src_arch))) ldflags = env['LDFLAGS'].split() cflags.extend(ldflags) From 6a92b26ea496f6c0fb8feb24d02629817ac8515a Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 12:36:16 +0100 Subject: [PATCH 39/66] Remove unneeded warning for numpy --- pythonforandroid/recipes/numpy/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pythonforandroid/recipes/numpy/__init__.py b/pythonforandroid/recipes/numpy/__init__.py index 6bfc0480b3..1357689c36 100644 --- a/pythonforandroid/recipes/numpy/__init__.py +++ b/pythonforandroid/recipes/numpy/__init__.py @@ -1,5 +1,4 @@ from pythonforandroid.recipe import CompiledComponentsPythonRecipe -from pythonforandroid.toolchain import warning from os.path import join @@ -48,8 +47,5 @@ def get_recipe_env(self, arch): def prebuild_arch(self, arch): super(NumpyRecipe, self).prebuild_arch(arch) - warning('Numpy is built assuming the archiver name is ' - 'arm-linux-androideabi-ar, which may not always be true!') - recipe = NumpyRecipe() From 81066e26480c14bb312dd2c41cfca83b6943488d Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 19:38:17 +0100 Subject: [PATCH 40/66] Fix libffi build for all archs Adds some flags lost (removed when were fixed the hardcoded arch entries) --- pythonforandroid/recipes/libffi/__init__.py | 23 +++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/pythonforandroid/recipes/libffi/__init__.py b/pythonforandroid/recipes/libffi/__init__.py index d5a85c2865..d33dbb0f61 100644 --- a/pythonforandroid/recipes/libffi/__init__.py +++ b/pythonforandroid/recipes/libffi/__init__.py @@ -2,7 +2,7 @@ from pythonforandroid.recipe import Recipe from pythonforandroid.logger import info, shprint from pythonforandroid.util import current_directory -import glob +from glob import glob import sh @@ -62,22 +62,33 @@ def build_arch(self, arch): info("make libffi.la failed as expected") cc = sh.Command(env['CC'].split()[0]) cflags = env['CC'].split()[1:] + host_build = join(self.get_build_dir(arch.arch), self.get_host(arch)) - src_arch = arch.toolchain_prefix.replace('-linux-android', '') + arch_flags = '' + if '-march=' in env['CFLAGS']: + arch_flags = '-march={}'.format(env['CFLAGS'].split('-march=')[1]) + + src_arch = arch.command_prefix.split('-')[0] + if src_arch == 'x86_64': + # libffi has not specific arch files for x86_64...so...using + # the ones from x86 which seems to build fine... + src_arch = 'x86' + + cflags.extend(arch_flags.split()) cflags.extend(['-shared', '-fPIC', '-DPIC']) - cflags.extend(glob.glob('src/.libs/*.o')) - cflags.extend(glob.glob('src/{}/.libs/ffi.o'.format(src_arch))) + cflags.extend(glob(join(host_build, 'src/.libs/*.o'))) + cflags.extend(glob(join(host_build, 'src', src_arch, '.libs/*.o'))) ldflags = env['LDFLAGS'].split() cflags.extend(ldflags) cflags.extend(['-Wl,-soname', '-Wl,libffi.so', '-o', '.libs/libffi.so']) - with current_directory(self.get_host(arch)): + with current_directory(host_build): shprint(cc, *cflags, _env=env) shprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch), - join(self.get_host(arch), '.libs', 'libffi.so')) + join(host_build, '.libs', 'libffi.so')) def get_include_dirs(self, arch): return [join(self.get_build_dir(arch.arch), self.get_host(arch), From 3ac092daeb63303b3c04b4e98ca0cb04914df233 Mon Sep 17 00:00:00 2001 From: opacam Date: Fri, 21 Dec 2018 20:08:32 +0100 Subject: [PATCH 41/66] Remove lines from openssl recipe that seems not needed anymore The removed code was intended to check if the library were build with the right symbols, and if not, clean the build and trigger a rebuild with a pause of 3 seconds (to show a message warning about the rebuild). It seems that new version of the openssl libs doesn't need this anymore because the symbols checked with the removed source code seems to be build without problems. So we remove those lines in order the clean up a little the code and to be reintroduced again if needed (but properly documented) References: #1537 --- pythonforandroid/recipes/openssl/__init__.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/pythonforandroid/recipes/openssl/__init__.py b/pythonforandroid/recipes/openssl/__init__.py index aff4cddc3e..2222929aea 100644 --- a/pythonforandroid/recipes/openssl/__init__.py +++ b/pythonforandroid/recipes/openssl/__init__.py @@ -1,6 +1,4 @@ -import time from os.path import join -from functools import partial from pythonforandroid.toolchain import Recipe, shprint, current_directory import sh @@ -70,15 +68,6 @@ def should_build(self, arch): return not self.has_libs(arch, 'libssl' + self.version + '.so', 'libcrypto' + self.version + '.so') - def check_symbol(self, env, sofile, symbol): - nm = env.get('NM', 'nm') - syms = sh.sh('-c', "{} -gp {} | cut -d' ' -f3".format( - nm, sofile), _env=env).splitlines() - if symbol in syms: - return True - print('{} missing symbol {}; rebuilding'.format(sofile, symbol)) - return False - def get_recipe_env(self, arch=None): env = super(OpenSSLRecipe, self).get_recipe_env(arch, clang=True) env['OPENSSL_VERSION'] = self.version @@ -118,14 +107,7 @@ def build_arch(self, arch): _env=env) self.apply_patch('disable-sover.patch', arch.arch) - # check_ssl = partial(self.check_symbol, env, 'libssl' + self.version + '.so') - check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.version + '.so') - while True: - shprint(sh.make, 'build_libs', _env=env) - if all(map(check_crypto, ('MD5_Transform', 'MD4_Init'))): - break - time.sleep(3) - shprint(sh.make, 'clean', _env=env) + shprint(sh.make, 'build_libs', _env=env) self.install_libs(arch, 'libssl' + self.version + '.so', 'libcrypto' + self.version + '.so') From 6ceb46fcd1512a339ec47a1e822b2930cda4d549 Mon Sep 17 00:00:00 2001 From: opacam Date: Mon, 24 Dec 2018 14:16:28 +0100 Subject: [PATCH 42/66] Replace sum with append for cflags list --- pythonforandroid/archs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 5fb12222b6..a724d68a5d 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -44,14 +44,14 @@ def get_env(self, with_flags_in_cc=True, clang=False): '-fomit-frame-pointer', '-D__ANDROID_API__={}'.format(self.ctx.ndk_api)] if not clang: - cflags += ['-mandroid'] + cflags.append('-mandroid') else: - cflags += ['-target ' + self.target] + cflags.append('-target ' + self.target) toolchain = '{android_host}-{toolchain_version}'.format( android_host=self.ctx.toolchain_prefix, toolchain_version=self.ctx.toolchain_version) toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64') - cflags += ['-gcc-toolchain {}'.format(toolchain)] + cflags.append('-gcc-toolchain {}'.format(toolchain)) env['CFLAGS'] = ' '.join(cflags) env['LDFLAGS'] = ' ' From e91449f2a21f6088aea3fb52b422cf9a305dc7d6 Mon Sep 17 00:00:00 2001 From: opacam Date: Mon, 24 Dec 2018 14:22:30 +0100 Subject: [PATCH 43/66] Remove unneeded message for build.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @inclement!!! --- pythonforandroid/bootstraps/common/build/build.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 3586f30158..f373db2226 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -46,8 +46,6 @@ def get_bootstrap_name(): # Try to find a host version of Python that matches our ARM version. PYTHON = join(curdir, 'python-install', 'bin', 'python.host') if not exists(PYTHON): - print('Could not find hostpython, will not compile to .pyo ' - '(this is normal with python2 and python3)') PYTHON = None BLACKLIST_PATTERNS = [ From d985f220db0a5bdef41580e8e2e789eca71ab97b Mon Sep 17 00:00:00 2001 From: opacam Date: Mon, 24 Dec 2018 15:35:15 +0100 Subject: [PATCH 44/66] Remove commented line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @inclement!!! --- pythonforandroid/recipes/python2/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pythonforandroid/recipes/python2/__init__.py b/pythonforandroid/recipes/python2/__init__.py index c337513f77..ae03fb2bcc 100644 --- a/pythonforandroid/recipes/python2/__init__.py +++ b/pythonforandroid/recipes/python2/__init__.py @@ -1,7 +1,6 @@ from os.path import join, exists from pythonforandroid.recipe import Recipe from pythonforandroid.python import GuestPythonRecipe -# from pythonforandroid.patching import is_api_lt from pythonforandroid.logger import shprint import sh From cdbf2aee6be66a43a4b4e8baa04a75198912ac11 Mon Sep 17 00:00:00 2001 From: opacam Date: Mon, 24 Dec 2018 16:06:45 +0100 Subject: [PATCH 45/66] Remove unneeded files for the project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¡¡¡Thanks @inclement!!! --- .../recipes/python2legacy/patches/t.htm | 151 -------------- .../python2legacy/patches/t_files/a899e84.jpg | Bin 21489 -> 0 bytes .../patches/t_files/analytics.js | 42 ---- .../python2legacy/patches/t_files/b0dcca.css | 191 ------------------ .../python2legacy/patches/t_files/jquery.js | 4 - .../python2legacy/patches/t_files/json2.js | 1 - .../patches/t_files/legal_hacks.png | Bin 39895 -> 0 bytes .../python2legacy/patches/t_files/te-news.png | Bin 56830 -> 0 bytes .../patches/t_files/terrible_small_logo.png | Bin 11001 -> 0 bytes 9 files changed, 389 deletions(-) delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t.htm delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/a899e84.jpg delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/json2.js delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/legal_hacks.png delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/te-news.png delete mode 100644 pythonforandroid/recipes/python2legacy/patches/t_files/terrible_small_logo.png diff --git a/pythonforandroid/recipes/python2legacy/patches/t.htm b/pythonforandroid/recipes/python2legacy/patches/t.htm deleted file mode 100644 index ddb028acf3..0000000000 --- a/pythonforandroid/recipes/python2legacy/patches/t.htm +++ /dev/null @@ -1,151 +0,0 @@ - - - - -xkcd: Legal Hacks - - - - - - - - - - - -
- -
-
-xkcd.com logo -A webcomic of romance,
sarcasm, math, and language.
-
-
-
-Preorder: Amazon, Barnes & Noble, Indie Bound, Hudson
-In other news, Space Weird Thing is delightful, and I feel surprisingly invested in @xkcdbracket's results. - -
-
-
-
-
-
- -
Legal Hacks
- -
-Legal Hacks -
- -
-Permanent link to this comic: http://xkcd.com/504/
-Image URL (for hotlinking/embedding): http://imgs.xkcd.com/comics/legal_hacks.png - -
-
-Selected Comics - -Grownups -Circuit Diagram -Angular Momentum -Self-Description -Alternative Energy Revolution - - -
- -

Warning: this comic occasionally contains strong language (which may -be unsuitable for children), unusual humor (which may be unsuitable for -adults), and advanced mathematics (which may be unsuitable for -liberal-arts majors).

-
BTC 1FhCLQK2ZXtCUQDtG98p6fVH7S6mxAsEey
We did not invent the algorithm. The algorithm consistently finds Jesus. The algorithm killed Jeeves.
The algorithm is banned in China. The algorithm is from Jersey. The algorithm constantly finds Jesus.
This is not the algorithm. This is close.
-
-

-This work is licensed under a -Creative Commons Attribution-NonCommercial 2.5 License. -

-This means you're free to copy and share these comics (but not to sell them). More details.

-
-
- - - - - \ No newline at end of file diff --git a/pythonforandroid/recipes/python2legacy/patches/t_files/a899e84.jpg b/pythonforandroid/recipes/python2legacy/patches/t_files/a899e84.jpg deleted file mode 100644 index 5f2f1f77520916f0412f85ddbd246b48dab1ae12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21489 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 diff --git a/pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js b/pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js deleted file mode 100644 index 4cea34a1b7..0000000000 --- a/pythonforandroid/recipes/python2legacy/patches/t_files/analytics.js +++ /dev/null @@ -1,42 +0,0 @@ -(function(){var aa=encodeURIComponent,f=window,n=Math;function Pc(a,b){return a.href=b} -var Qc="replace",q="data",m="match",ja="port",u="createElement",id="setAttribute",da="getTime",A="split",B="location",ra="hasOwnProperty",ma="hostname",ga="search",E="protocol",Ab="href",kd="action",G="apply",p="push",h="hash",pa="test",ha="slice",r="cookie",t="indexOf",ia="defaultValue",v="name",y="length",Ga="sendBeacon",z="prototype",la="clientWidth",jd="target",C="call",na="clientHeight",F="substring",oa="navigator",H="join",I="toLowerCase";var $c=function(a){this.w=a||[]};$c[z].set=function(a){this.w[a]=!0};$c[z].encode=function(){for(var a=[],b=0;b=b[y])wc(a,b,c);else if(8192>=b[y])x(a,b,c)||wd(a,b,c)||wc(a,b,c);else throw ge("len",b[y]),new Da(b[y]);},wc=function(a,b,c){var d=ta(a+"?"+b);d.onload=d.onerror=function(){d.onload=null;d.onerror=null;c()}},wd=function(a,b,c){var d=O.XMLHttpRequest;if(!d)return!1;var e=new d;if(!("withCredentials"in e))return!1;e.open("POST", -a,!0);e.withCredentials=!0;e.setRequestHeader("Content-Type","text/plain");e.onreadystatechange=function(){4==e.readyState&&(c(),e=null)};e.send(b);return!0},x=function(a,b,c){return O[oa][Ga]?O[oa][Ga](a,b)?(c(),!0):!1:!1},ge=function(a,b,c){1<=100*n.random()||Aa("?")||(a=["t=error","_e="+a,"_v=j37","sr=1"],b&&a[p]("_f="+b),c&&a[p]("_m="+K(c[F](0,100))),a[p]("aip=1"),a[p]("z="+fe()),wc(oc()+"/collect",a[H]("&"),ua))};var Ha=function(){this.M=[]};Ha[z].add=function(a){this.M[p](a)};Ha[z].D=function(a){try{for(var b=0;b=100*R(a,Ka))throw"abort";}function Ma(a){if(Aa(P(a,Na)))throw"abort";}function Oa(){var a=M[B][E];if("http:"!=a&&"https:"!=a)throw"abort";} -function Pa(a){try{O[oa][Ga]?J(42):O.XMLHttpRequest&&"withCredentials"in new O.XMLHttpRequest&&J(40)}catch(b){}a.set(ld,Td(a),!0);a.set(Ac,R(a,Ac)+1);var c=[];Qa.map(function(b,e){if(e.F){var g=a.get(b);void 0!=g&&g!=e[ia]&&("boolean"==typeof g&&(g*=1),c[p](e.F+"="+K(""+g)))}});c[p]("z="+Bd());a.set(Ra,c[H]("&"),!0)} -function Sa(a){var b=P(a,gd)||oc()+"/collect",c=P(a,fa);!c&&a.get(Vd)&&(c="beacon");if(c){var d=P(a,Ra),e=a.get(Ia),e=e||ua;"image"==c?wc(b,d,e):"xhr"==c&&wd(b,d,e)||"beacon"==c&&x(b,d,e)||ba(b,d,e)}else ba(b,P(a,Ra),a.get(Ia));a.set(Ia,ua,!0)}function Hc(a){var b=O.gaData;b&&(b.expId&&a.set(Nc,b.expId),b.expVar&&a.set(Oc,b.expVar))}function cd(){if(O[oa]&&"preview"==O[oa].loadPurpose)throw"abort";}function yd(a){var b=O.gaDevIds;ka(b)&&0!=b[y]&&a.set("&did",b[H](","),!0)} -function vb(a){if(!a.get(Na))throw"abort";};var hd=function(){return n.round(2147483647*n.random())},Bd=function(){try{var a=new Uint32Array(1);O.crypto.getRandomValues(a);return a[0]&2147483647}catch(b){return hd()}},fe=hd;function Ta(a){var b=R(a,Ua);500<=b&&J(15);var c=P(a,Va);if("transaction"!=c&&"item"!=c){var c=R(a,Wa),d=(new Date)[da](),e=R(a,Xa);0==e&&a.set(Xa,d);e=n.round(2*(d-e)/1E3);0=c)throw"abort";a.set(Wa,--c)}a.set(Ua,++b)};var Ya=function(){this.data=new ee},Qa=new ee,Za=[];Ya[z].get=function(a){var b=$a(a),c=this[q].get(a);b&&void 0==c&&(c=ea(b[ia])?b[ia]():b[ia]);return b&&b.Z?b.Z(this,a,c):c};var P=function(a,b){var c=a.get(b);return void 0==c?"":""+c},R=function(a,b){var c=a.get(b);return void 0==c||""===c?0:1*c};Ya[z].set=function(a,b,c){if(a)if("object"==typeof a)for(var d in a)a[ra](d)&&ab(this,d,a[d],c);else ab(this,a,b,c)}; -var ab=function(a,b,c,d){if(void 0!=c)switch(b){case Na:wb[pa](c)}var e=$a(b);e&&e.o?e.o(a,b,c,d):a[q].set(b,c,d)},bb=function(a,b,c,d,e){this.name=a;this.F=b;this.Z=d;this.o=e;this.defaultValue=c},$a=function(a){var b=Qa.get(a);if(!b)for(var c=0;c=b)){var c=(new Date).getHours(),d=[Bd(),Bd(),Bd()][H](".");a=(3==b||5==b?"https:":"http:")+"//www.google-analytics.com/collect?z=br.";a+=[b,"A",c,d][H](".");var e=1!=b%3?"https:":"http:",e=e+"//www.google-analytics.com/collect?z=br.",e=e+[b,"B",c,d][H](".");7==b&&(e=e[Qc]("//www.","//ssl."));c=function(){4<=b&&6>=b?O[oa][Ga](e,""):ta(e)};Bd()%2?(ta(a),c()):(c(),ta(a))}}};function fc(){var a,b,c;if((c=(c=O[oa])?c.plugins:null)&&c[y])for(var d=0;d=c)&&(c={},Ec(c)||Fc(c))){var d=c[Eb];void 0==d||Infinity==d||isNaN(d)||(0c)a[b]=void 0},Fd=function(a){return function(b){"pageview"!=b.get(Va)||a.I||(a.I=!0,gc(b,function(b){a.send("timing",b)}))}};var hc=!1,mc=function(a){if("cookie"==P(a,ac)){var b=P(a,U),c=nd(a),d=kc(P(a,Yb)),e=lc(P(a,W)),g=1E3*R(a,Zb),ca=P(a,Na);if("auto"!=e)zc(b,c,d,e,ca,g)&&(hc=!0);else{J(32);var l;a:{c=[];e=xa()[A](".");if(4==e[y]&&(l=e[e[y]-1],parseInt(l,10)==l)){l=["none"];break a}for(l=e[y]-2;0<=l;l--)c[p](e[ha](l)[H]("."));c[p]("none");l=c}for(var k=0;k=a&&d[p]({hash:ca[0],R:e[g],O:ca})}return 0==d[y]?void 0:1==d[y]?d[0]:Zc(b,d)||Zc(c,d)||Zc(null,d)||d[0]}function Zc(a,b){var c,d;null==a?c=d=1:(c=La(a),d=La(D(a,".")?a[F](1):"."+a));for(var e=0;ed[y])){c=[];for(var e=0;e=ca[0]||0>=ca[1]?"":ca[H]("x");a.set(rb,c);a.set(tb,fc());a.set(ob,M.characterSet||M.charset);a.set(sb,b&&"function"===typeof b.javaEnabled&&b.javaEnabled()||!1);a.set(nb,(b&&(b.language||b.browserLanguage)||"")[I]());if(d&&a.get(cc)&&(b=M[B][h])){b=b[A](/[?&#]+/);d=[];for(c=0;carguments[y])){var b,c;"string"===typeof arguments[0]?(b=arguments[0],c=[][ha][C](arguments,1)):(b=arguments[0]&&arguments[0][Va],c=arguments);b&&(c=za(qc[b]||[],c),c[Va]=b,this.b.set(c,void 0,!0),this.filters.D(this.b),this.b[q].m={},je(this.b))}};var rc=function(a){if("prerender"==M.visibilityState)return!1;a();return!0};var td=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/,sc=function(a){if(ea(a[0]))this.u=a[0];else{var b=td.exec(a[0]);null!=b&&4==b[y]&&(this.c=b[1]||"t0",this.K=b[2]||"",this.C=b[3],this.a=[][ha][C](a,1),this.K||(this.A="create"==this.C,this.i="require"==this.C,this.g="provide"==this.C,this.ba="remove"==this.C),this.i&&(3<=this.a[y]?(this.X=this.a[1],this.W=this.a[2]):this.a[1]&&(qa(this.a[1])?this.X=this.a[1]:this.W=this.a[1])));b=a[1];a=a[2];if(!this.C)throw"abort";if(this.i&&(!qa(b)||""==b))throw"abort";if(this.g&& -(!qa(b)||""==b||!ea(a)))throw"abort";if(ud(this.c)||ud(this.K))throw"abort";if(this.g&&"t0"!=this.c)throw"abort";}};function ud(a){return 0<=a[t](".")||0<=a[t](":")};var Yd,Zd,$d;Yd=new ee;$d=new ee;Zd={ec:45,ecommerce:46,linkid:47}; -var ae=function(a){function b(a){var b=(a[ma]||"")[A](":")[0][I](),c=(a[E]||"")[I](),c=1*a[ja]||("http:"==c?80:"https:"==c?443:"");a=a.pathname||"";D(a,"/")||(a="/"+a);return[b,""+c,a]}var c=M[u]("a");Pc(c,M[B][Ab]);var d=(c[E]||"")[I](),e=b(c),g=c[ga]||"",ca=d+"//"+e[0]+(e[1]?":"+e[1]:"");D(a,"//")?a=d+a:D(a,"/")?a=ca+a:!a||D(a,"?")?a=ca+e[2]+(a||g):0>a[A]("/")[0][t](":")&&(a=ca+e[2][F](0,e[2].lastIndexOf("/"))+"/"+a);Pc(c,a);d=b(c);return{protocol:(c[E]||"")[I](),host:d[0],port:d[1],path:d[2],G:c[ga]|| -"",url:a||""}};var Z={ga:function(){Z.f=[]}};Z.ga();Z.D=function(a){var b=Z.J[G](Z,arguments),b=Z.f.concat(b);for(Z.f=[];0c;c++){var d=b[c].src;if(d&&0==d[t]("https://www.google-analytics.com/analytics")){J(33);b=!0;break a}}b=!1}b&&(Ba=!0)}Ud()|| -Ba||!Ed(new Od)||(J(36),Ba=!0);(O.gaplugins=O.gaplugins||{}).Linker=Dc;b=Dc[z];Yd.set("linker",Dc);X("decorate",b,b.ca,20);X("autoLink",b,b.S,25);Yd.set("displayfeatures",fd);Yd.set("adfeatures",fd);a=a&&a.q;ka(a)?Z.D[G](N,a):J(50)}};N.da=function(){for(var a=N.getAll(),b=0;b>21:b;return b};})(window); diff --git a/pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css b/pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css deleted file mode 100644 index 427083d941..0000000000 --- a/pythonforandroid/recipes/python2legacy/patches/t_files/b0dcca.css +++ /dev/null @@ -1,191 +0,0 @@ -/* START GENERAL FORMAT */ -body{ - background-color:#96A8C8; - text-align:center; - font-size:16px; - font-variant:small-caps; - font-family:Lucida,Helvetica,sans-serif; - font-weight:500; - text-decoration: none; - position: absolute; - left: 50%; - width: 780px; - margin-left: -390px; -} -a{ - color:#96A8C8; - text-decoration:none; - font-weight:800 -} -a:hover{ - text-decoration:underline -} -img{ - border:0 -} -.box { /*any of the box layouts & white backgrounds*/ - background:white; - border-style:solid; - border-width:1.5px; - border-color:#071419; - border-radius: 12px; - -moz-border-radius: 12px; -} -/* END GENERAL FORMAT */ -/* START UPPER LAYOUT */ -#topContainer{ - width:780px; - position:relative; - overflow:hidden; -} -#topLeft{ - width:166px; - float:left; - position:relative; - text-align:left; - padding: 17px; -} -#topLeft ul { - margin: 0; - list-style-type: none; -} -#topLeft a { - color: #282B30; - font-size: 21px; - font-weight: 800; -} -#topLeft a:hover { - text-decoration: underline; -} -#bgLeft { - float: left; - left:0; - width: 200px; - bottom:0; - top: 0px; -} -#topRight { - width:560px; - padding-top:15px; - padding-bottom:15px; - padding-left:15px; - float:right; - position:relative; - text-align:left; - line-height: 150%; -} -#masthead { - display: block; -} -#slogan { - padding: 20px; - display: inline-block; - font-size: 20px; - font-style: italic; - font-weight: 800; - line-height: 120%; - vertical-align: top; -} -#bgRight { - right: 0; - float: right; - width: 572px; - bottom:0; - top: 0px; -} -.bg { /* necessary for positioning box layouts for bg */ - position:absolute; - z-index:-1; -} -/* END UPPER LAYOUT */ - -/*START MIDDLE */ -#middleContainer { - width:780px; - margin: 5px auto; - padding: 10px 0; -} - -#ctitle { - margin: 10px; - font-size: 21px; - font-weight: 800; -} - -ul.comicNav { - padding:0; - list-style-type:none; -} -ul.comicNav li { - display: inline; -} - -ul.comicNav li a { - /*background-color: #6E6E6E;*/ - background-color:#6E7B91; - color: #FFF; - border: 1.5px solid #333; - font-size: 16px; - font-weight: 600; - padding: 1.5px 12px; - margin: 0 4px; - text-decoration: none; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - box-shadow: 0 0 5px 0 gray; - -moz-box-shadow: 0 0 5px 0 gray; - -webkit-box-shadow: 0 0 5px 0 gray; -} - - -ul.comicNav a:hover, ul.comicNav a:focus { - background-color: #FFF; - color: #6E7B91; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; -} - -.comicInfo { - font-size:12px; - font-style:italic; - font-weight:800; -} -#bottom { - margin-top:5px; - padding:25px 15px; - width:750px; -} -#comicLinks { - display: block; - margin: auto; - width: 300px; -} -#footnote { - clear: both; - font-size: 6px; - font-style: italic; - font-variant: small-caps; - font-weight: 800; - margin: 0; - padding: 0; -} -#licenseText { - display: block; - margin: auto; - width: 410px; -} - -#transcript {display: none;} - -#middleContainer { position:relative; left:50%; margin-left:-390px; } -#comic .comic { position:absolute; } -#comic .panel, #comic .cover, #comic .panel img { position:absolute; } -#comic .cover { z-index:10; } -#comic table { margin: auto; } - -@font-face { - font-family: 'xkcd-Regular'; - src: url('//xkcd.com/fonts/xkcd-Regular.eot?') format('eot'), url('//xkcd.com/fonts/xkcd-Regular.otf') format('opentype'); -} diff --git a/pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js b/pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js deleted file mode 100644 index 73f33fb3aa..0000000000 --- a/pythonforandroid/recipes/python2legacy/patches/t_files/jquery.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f -}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML="
a",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/\s*$/g,sb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:l.htmlSerialize?[0,"",""]:[1,"X
","
"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?""!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("