2022-12-02 21:15:34 +01:00
|
|
|
from pythonforandroid.recipe import Recipe
|
|
|
|
from pythonforandroid.util import current_directory
|
|
|
|
from pythonforandroid.logger import shprint
|
|
|
|
from multiprocessing import cpu_count
|
2017-08-13 03:24:00 +02:00
|
|
|
import sh
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2017-08-13 03:24:00 +02:00
|
|
|
class LibsodiumRecipe(Recipe):
|
2019-03-30 21:58:45 +01:00
|
|
|
version = '1.0.16'
|
2017-08-13 03:24:00 +02:00
|
|
|
url = 'https://github.com/jedisct1/libsodium/releases/download/{version}/libsodium-{version}.tar.gz'
|
2019-03-30 21:58:45 +01:00
|
|
|
depends = []
|
|
|
|
patches = ['size_max_fix.patch']
|
2022-12-02 21:15:34 +01:00
|
|
|
built_libraries = {'libsodium.so': 'src/libsodium/.libs'}
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def build_arch(self, arch):
|
|
|
|
env = self.get_recipe_env(arch)
|
|
|
|
with current_directory(self.get_build_dir(arch.arch)):
|
|
|
|
bash = sh.Command('bash')
|
2022-12-02 21:15:34 +01:00
|
|
|
shprint(
|
|
|
|
bash,
|
|
|
|
'configure',
|
|
|
|
'--disable-soname-versions',
|
|
|
|
'--host={}'.format(arch.command_prefix),
|
|
|
|
'--enable-shared',
|
|
|
|
_env=env,
|
|
|
|
)
|
|
|
|
shprint(sh.make, '-j', str(cpu_count()), _env=env)
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def get_recipe_env(self, arch):
|
2022-12-02 21:15:34 +01:00
|
|
|
env = super().get_recipe_env(arch)
|
2017-08-13 03:24:00 +02:00
|
|
|
env['CFLAGS'] += ' -Os'
|
|
|
|
return env
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2017-08-13 03:24:00 +02:00
|
|
|
recipe = LibsodiumRecipe()
|