diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py index 45a998ff71..0a42713e60 100644 --- a/pythonforandroid/archs.py +++ b/pythonforandroid/archs.py @@ -39,7 +39,10 @@ def get_env(self): env["CXXFLAGS"] = env["CFLAGS"] - env["LDFLAGS"] = " ".join(['-lm']) + env["LDFLAGS"] = " ".join(['-lm', '-L' + self.ctx.get_libs_dir(self.arch)]) + + if self.ctx.ndk == 'crystax': + env['LDFLAGS'] += ' -L{}/sources/crystax/libs/{} -lcrystax'.format(self.ctx.ndk_dir, self.arch) py_platform = sys.platform if py_platform in ['linux2', 'linux3']: @@ -84,6 +87,7 @@ def get_env(self): env['STRIP'] = '{}-strip --strip-unneeded'.format(command_prefix) env['MAKE'] = 'make -j5' env['READELF'] = '{}-readelf'.format(command_prefix) + env['NM'] = '{}-nm'.format(command_prefix) hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx) diff --git a/pythonforandroid/build.py b/pythonforandroid/build.py index a975956b90..6ad63cf5cb 100644 --- a/pythonforandroid/build.py +++ b/pythonforandroid/build.py @@ -274,12 +274,17 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir, if ndk_dir is not None: info('Got NDK version from $ANDROIDNDKVER') + self.ndk = 'google' + try: with open(join(ndk_dir, 'RELEASE.TXT')) as fileh: - reported_ndk_ver = fileh.read().split(' ')[0] + reported_ndk_ver = fileh.read().split(' ')[0].strip() except IOError: pass else: + if reported_ndk_ver.startswith('crystax-ndk-'): + reported_ndk_ver = reported_ndk_ver[12:] + self.ndk = 'crystax' if ndk_ver is None: ndk_ver = reported_ndk_ver info(('Got Android NDK version from the NDK dir: ' @@ -298,6 +303,8 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir, warning('Android NDK version could not be found, exiting.') self.ndk_ver = ndk_ver + info('Using {} NDK {}'.format(self.ndk.capitalize(), self.ndk_ver)) + virtualenv = None if virtualenv is None: virtualenv = sh.which('virtualenv2') @@ -407,6 +414,7 @@ def __init__(self): self._ndk_dir = None self._android_api = None self._ndk_ver = None + self.ndk = None self.toolchain_prefix = None self.toolchain_version = None diff --git a/pythonforandroid/patching.py b/pythonforandroid/patching.py index 823a5fc727..70d7e9c9cf 100644 --- a/pythonforandroid/patching.py +++ b/pythonforandroid/patching.py @@ -63,3 +63,9 @@ def will(recipe, **kwargs): return recipe_name in recipe.ctx.recipe_build_order return will + +def is_ndk(ndk): + def is_x(recipe, **kwargs): + return recipe.ctx.ndk == ndk + return is_x +