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

40 lines
1.4 KiB
Python
Raw Normal View History

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
from os.path import realpath
2017-08-13 03:24:00 +02:00
import sh
class LibShineRecipe(Recipe):
version = 'c72aba9031bde18a0995e7c01c9b53f2e08a0e46'
2017-08-13 03:24:00 +02:00
url = 'https://github.com/toots/shine/archive/{version}.zip'
2022-12-02 21:15:34 +01:00
built_libraries = {'libshine.so': 'lib'}
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super().get_recipe_env(arch, with_flags_in_cc)
# technically, libraries should go to `LDLIBS`, but it seems
# that libshine doesn't like so, and it will fail on linking stage
env['LDLIBS'] = env['LDLIBS'].replace(' -lm', '')
env['LDFLAGS'] += ' -lm'
return env
2017-08-13 03:24:00 +02:00
def build_arch(self, arch):
with current_directory(self.get_build_dir(arch.arch)):
env = self.get_recipe_env(arch)
shprint(sh.Command('./bootstrap'))
configure = sh.Command('./configure')
shprint(configure,
2022-12-02 21:15:34 +01:00
f'--host={arch.command_prefix}',
2017-08-13 03:24:00 +02:00
'--enable-pic',
2022-12-02 21:15:34 +01:00
'--disable-static',
'--enable-shared',
f'--prefix={realpath(".")}',
2017-08-13 03:24:00 +02:00
_env=env)
2022-12-02 21:15:34 +01:00
shprint(sh.make, '-j', str(cpu_count()), _env=env)
2017-08-13 03:24:00 +02:00
shprint(sh.make, 'install', _env=env)
2017-08-13 03:24:00 +02:00
recipe = LibShineRecipe()