Skip to content

Commit 239c749

Browse files
committed
support crystax ndk
1 parent 5ed46a7 commit 239c749

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

pythonforandroid/archs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ def get_env(self):
3939

4040
env["CXXFLAGS"] = env["CFLAGS"]
4141

42-
env["LDFLAGS"] = " ".join(['-lm'])
42+
env["LDFLAGS"] = " ".join(['-lm', '-L' + self.ctx.get_libs_dir(self.arch)])
43+
44+
if self.ctx.ndk == 'crystax':
45+
env['LDFLAGS'] += ' -L{}/sources/crystax/libs/{} -lcrystax'.format(self.ctx.ndk_dir, self.arch)
4346

4447
py_platform = sys.platform
4548
if py_platform in ['linux2', 'linux3']:
@@ -84,6 +87,7 @@ def get_env(self):
8487
env['STRIP'] = '{}-strip --strip-unneeded'.format(command_prefix)
8588
env['MAKE'] = 'make -j5'
8689
env['READELF'] = '{}-readelf'.format(command_prefix)
90+
env['NM'] = '{}-nm'.format(command_prefix)
8791

8892
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
8993

pythonforandroid/build.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,17 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
274274
if ndk_dir is not None:
275275
info('Got NDK version from $ANDROIDNDKVER')
276276

277+
self.ndk = 'google'
278+
277279
try:
278280
with open(join(ndk_dir, 'RELEASE.TXT')) as fileh:
279-
reported_ndk_ver = fileh.read().split(' ')[0]
281+
reported_ndk_ver = fileh.read().split(' ')[0].strip()
280282
except IOError:
281283
pass
282284
else:
285+
if reported_ndk_ver.startswith('crystax-ndk-'):
286+
reported_ndk_ver = reported_ndk_ver[12:]
287+
self.ndk = 'crystax'
283288
if ndk_ver is None:
284289
ndk_ver = reported_ndk_ver
285290
info(('Got Android NDK version from the NDK dir: '
@@ -298,6 +303,8 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
298303
warning('Android NDK version could not be found, exiting.')
299304
self.ndk_ver = ndk_ver
300305

306+
info('Using {} NDK {}'.format(self.ndk.capitalize(), self.ndk_ver))
307+
301308
virtualenv = None
302309
if virtualenv is None:
303310
virtualenv = sh.which('virtualenv2')
@@ -407,6 +414,7 @@ def __init__(self):
407414
self._ndk_dir = None
408415
self._android_api = None
409416
self._ndk_ver = None
417+
self.ndk = None
410418

411419
self.toolchain_prefix = None
412420
self.toolchain_version = None

pythonforandroid/patching.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ def will(recipe, **kwargs):
6363
return recipe_name in recipe.ctx.recipe_build_order
6464
return will
6565

66+
67+
def is_ndk(ndk):
68+
def is_x(recipe, **kwargs):
69+
return recipe.ctx.ndk == ndk
70+
return is_x
71+

0 commit comments

Comments
 (0)