lbry-android-sdk/p4a/pythonforandroid/recipes/libsecp256k1/__init__.py

33 lines
1.1 KiB
Python
Raw Permalink Normal View History

2022-12-02 21:15:34 +01:00
from pythonforandroid.logger import shprint
from pythonforandroid.util import current_directory
2017-08-13 03:24:00 +02:00
from pythonforandroid.recipe import Recipe
from multiprocessing import cpu_count
from os.path import exists
import sh
class LibSecp256k1Recipe(Recipe):
2022-12-02 21:15:34 +01:00
built_libraries = {'libsecp256k1.so': '.libs'}
2017-08-13 03:24:00 +02:00
url = 'https://github.com/bitcoin-core/secp256k1/archive/master.zip'
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
shprint(
sh.Command('./configure'),
2022-12-02 21:15:34 +01:00
'--host=' + arch.command_prefix,
'--prefix=' + self.ctx.get_python_install_dir(arch.arch),
2017-08-13 03:24:00 +02:00
'--enable-shared',
'--enable-module-recovery',
'--enable-experimental',
'--enable-module-ecdh',
_env=env)
shprint(sh.make, '-j' + str(cpu_count()), _env=env)
recipe = LibSecp256k1Recipe()