Skip to content

Commit 0335c93

Browse files
committed
get patches for cffi from PR
1 parent e2d88c3 commit 0335c93

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

pythonforandroid/recipes/cffi/__init__.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
1010
version = '1.11.5'
1111
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
1212

13-
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
13+
depends = ['setuptools', 'pycparser', 'libffi']
1414

1515
patches = ['disable-pkg-config.patch']
1616

@@ -27,11 +27,10 @@ def get_hostrecipe_env(self, arch=None):
2727

2828
def get_recipe_env(self, arch=None):
2929
env = super(CffiRecipe, self).get_recipe_env(arch)
30-
# sets linker to use the correct gcc (cross compiler)
31-
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
3230
libffi = self.get_recipe('libffi', self.ctx)
3331
includes = libffi.get_include_dirs(arch)
3432
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
33+
env['CFLAGS'] += ' -I{}'.format(self.ctx.python_recipe.include_root(arch.arch))
3534
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
3635
self.ctx.get_libs_dir(arch.arch))
3736
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
@@ -44,15 +43,10 @@ def get_recipe_env(self, arch=None):
4443
self.ctx.get_site_packages_dir(),
4544
env['BUILDLIB_PATH'],
4645
])
47-
if self.ctx.ndk == 'crystax':
48-
# only keeps major.minor (discards patch)
49-
python_version = self.ctx.python_recipe.version[0:3]
50-
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
51-
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
52-
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
53-
# until `pythonforandroid/archs.py` gets merged upstream:
54-
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
55-
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
46+
env['LDFLAGS'] += ' -L{}'.format(self.ctx.python_recipe.link_root(arch.arch))
47+
env['LDFLAGS'] += ' -lpython{}'.format(self.ctx.python_recipe.major_minor_version_string)
48+
if 'python3' in self.ctx.python_recipe.name:
49+
env['LDFLAGS'] += 'm'
5650
return env
5751

5852

0 commit comments

Comments
 (0)