|
1 | | -from pythonforandroid.recipe import CompiledComponentsPythonRecipe |
| 1 | +from pythonforandroid.recipe import PyProjectRecipe |
2 | 2 | import os |
3 | 3 |
|
4 | 4 |
|
5 | | -class PyNaCLRecipe(CompiledComponentsPythonRecipe): |
| 5 | +class PyNaCLRecipe(PyProjectRecipe): |
6 | 6 | name = 'pynacl' |
7 | 7 | version = '1.3.0' |
8 | | - url = 'https://pypi.python.org/packages/source/P/PyNaCl/PyNaCl-{version}.tar.gz' |
| 8 | + url = 'https://github.com/pyca/pynacl/archive/refs/tags/{version}.tar.gz' |
9 | 9 |
|
10 | 10 | depends = ['hostpython3', 'six', 'setuptools', 'cffi', 'libsodium'] |
11 | 11 | call_hostpython_via_targetpython = False |
| 12 | + hostpython_prerequisites = ["cffi>=2.0.0"] |
12 | 13 |
|
13 | | - def get_recipe_env(self, arch): |
14 | | - env = super().get_recipe_env(arch) |
| 14 | + def get_recipe_env(self, arch, **kwargs): |
| 15 | + env = super().get_recipe_env(arch, **kwargs) |
15 | 16 | env['SODIUM_INSTALL'] = 'system' |
16 | 17 |
|
17 | 18 | libsodium_build_dir = self.get_recipe( |
18 | | - 'libsodium', self.ctx).get_build_dir(arch.arch) |
19 | | - env['CFLAGS'] += ' -I{}'.format(os.path.join(libsodium_build_dir, |
20 | | - 'src/libsodium/include')) |
21 | | - env['LDFLAGS'] += ' -L{}'.format( |
22 | | - self.ctx.get_libs_dir(arch.arch) + |
23 | | - '-L{}'.format(self.ctx.libs_dir)) + ' -L{}'.format( |
24 | | - libsodium_build_dir) |
| 19 | + 'libsodium', self.ctx |
| 20 | + ).get_build_dir(arch.arch) |
| 21 | + |
| 22 | + env['CFLAGS'] += ' -I{}'.format( |
| 23 | + os.path.join(libsodium_build_dir, 'src/libsodium/include') |
| 24 | + ) |
| 25 | + |
| 26 | + for ldflag in [ |
| 27 | + self.ctx.get_libs_dir(arch.arch), |
| 28 | + self.ctx.libs_dir, |
| 29 | + libsodium_build_dir |
| 30 | + ]: |
| 31 | + env['LDFLAGS'] += ' -L{}'.format(ldflag) |
25 | 32 |
|
26 | 33 | return env |
27 | 34 |
|
|
0 commit comments