Skip to content

Commit

Permalink
Fix openssl dependant recipe: scrypt (and grants python3 compatibility)
Browse files Browse the repository at this point in the history
Because since the python/openssl build system changed this recipe stopped to work.
  • Loading branch information
opacam committed Jan 15, 2019
1 parent 8493d5e commit 39c6b5b
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions pythonforandroid/recipes/scrypt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
from pythonforandroid.recipe import CythonRecipe


class ScryptRecipe(CythonRecipe):

version = '0.8.6'
url = 'https://bitbucket.org/mhallin/py-scrypt/get/v{version}.zip'
depends = [('python2', 'python3crystax'), 'setuptools', 'openssl']
depends = ['setuptools', 'openssl']
call_hostpython_via_targetpython = False
patches = ["remove_librt.patch"]

Expand All @@ -15,23 +14,12 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
Adds openssl recipe to include and library path.
"""
env = super(ScryptRecipe, self).get_recipe_env(arch, with_flags_in_cc)
openssl_build_dir = self.get_recipe(
'openssl', self.ctx).get_build_dir(arch.arch)
env['CFLAGS'] += ' -I{}'.format(os.path.join(openssl_build_dir, 'include'))
env['LDFLAGS'] += ' -L{}'.format(
self.ctx.get_libs_dir(arch.arch) +
'-L{}'.format(self.ctx.libs_dir)) + ' -L{}'.format(
openssl_build_dir)
# required additional library and path for Crystax
if self.ctx.ndk == 'crystax':
# only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
openssl_recipe = self.get_recipe('openssl', self.ctx)
env['CFLAGS'] += openssl_recipe.include_flags(arch)
env['LDFLAGS'] += ' -L{}'.format(self.ctx.get_libs_dir(arch.arch))
env['LDFLAGS'] += ' -L{}'.format(self.ctx.libs_dir)
env['LDFLAGS'] += openssl_recipe.link_dirs_flags(arch)
env['LIBS'] = env.get('LIBS', '') + openssl_recipe.link_libs_flags()
return env


Expand Down

0 comments on commit 39c6b5b

Please sign in to comment.