Skip to content

Commit 34a9d05

Browse files
opacamAndreMiras
authored andcommitted
[CORE UPDATE - PART V] Fix pycrypto (#1546)
* Fix openssl dependant recipe: pycrypto (and grants python3 compatibility) Since the recent openssl upgrade this recipe stopped to work. Here we adapt the recipe to the new python2 build system and to new openssl version. Also bump the recipe version number to the latest available (to avoid possible errors with our python3). * Move libraries from LDFLAGS to LIBS for pycrypto recipe Because this is how you are supposed to do it, you must use LDFLAGS for linker flags and LDLIBS (or the equivalent LOADLIBES) for the libraries
1 parent 6caa51a commit 34a9d05

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pythonforandroid/recipes/pycrypto/__init__.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@
44
info,
55
shprint,
66
)
7-
from os.path import join
87
import sh
98

109

1110
class PyCryptoRecipe(CompiledComponentsPythonRecipe):
12-
version = '2.6.1'
13-
url = 'https://pypi.python.org/packages/source/p/pycrypto/pycrypto-{version}.tar.gz'
14-
depends = ['openssl', 'python2']
11+
version = '2.7a1'
12+
url = 'https://github.com/dlitz/pycrypto/archive/v{version}.zip'
13+
depends = ['openssl', ('python2', 'python3')]
1514
site_packages_name = 'Crypto'
16-
15+
call_hostpython_via_targetpython = False
1716
patches = ['add_length.patch']
1817

19-
def get_recipe_env(self, arch=None):
18+
def get_recipe_env(self, arch=None, clang=True):
2019
env = super(PyCryptoRecipe, self).get_recipe_env(arch)
21-
openssl_build_dir = Recipe.get_recipe('openssl', self.ctx).get_build_dir(arch.arch)
22-
env['CC'] = '%s -I%s' % (env['CC'], join(openssl_build_dir, 'include'))
23-
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format(
24-
self.ctx.get_libs_dir(arch.arch) +
25-
'-L{}'.format(self.ctx.libs_dir)) + ' -L{}'.format(
26-
openssl_build_dir)
20+
openssl_recipe = Recipe.get_recipe('openssl', self.ctx)
21+
env['CC'] = env['CC'] + openssl_recipe.include_flags(arch)
22+
23+
env['LDFLAGS'] += ' -L{}'.format(self.ctx.get_libs_dir(arch.arch))
24+
env['LDFLAGS'] += ' -L{}'.format(self.ctx.libs_dir)
25+
env['LDFLAGS'] += openssl_recipe.link_dirs_flags(arch)
26+
env['LIBS'] = env.get('LIBS', '') + openssl_recipe.link_libs_flags()
27+
2728
env['EXTRA_CFLAGS'] = '--host linux-armv'
2829
env['ac_cv_func_malloc_0_nonnull'] = 'yes'
2930
return env

0 commit comments

Comments
 (0)