2019-03-30 21:58:45 +01:00
|
|
|
from os.path import exists, join
|
|
|
|
from multiprocessing import cpu_count
|
2017-08-13 03:24:00 +02:00
|
|
|
from pythonforandroid.recipe import Recipe
|
|
|
|
from pythonforandroid.logger import shprint
|
2022-12-02 21:15:34 +01:00
|
|
|
from pythonforandroid.util import current_directory
|
2017-08-13 03:24:00 +02:00
|
|
|
import sh
|
|
|
|
|
|
|
|
|
|
|
|
class LibffiRecipe(Recipe):
|
2019-03-30 21:58:45 +01:00
|
|
|
"""
|
|
|
|
Requires additional system dependencies on Ubuntu:
|
|
|
|
- `automake` for the `aclocal` binary
|
|
|
|
- `autoconf` for the `autoreconf` binary
|
|
|
|
- `libltdl-dev` which defines the `LT_SYS_SYMBOL_USCORE` macro
|
|
|
|
"""
|
|
|
|
name = 'libffi'
|
2022-12-02 21:15:34 +01:00
|
|
|
version = 'v3.4.2'
|
|
|
|
url = 'https://github.com/libffi/libffi/archive/{version}.tar.gz'
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
patches = ['remove-version-info.patch']
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
built_libraries = {'libffi.so': '.libs'}
|
2019-03-30 21:58:45 +01:00
|
|
|
|
|
|
|
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('autoreconf'), '-vif', _env=env)
|
|
|
|
shprint(sh.Command('./configure'),
|
|
|
|
'--host=' + arch.command_prefix,
|
|
|
|
'--prefix=' + self.get_build_dir(arch.arch),
|
|
|
|
'--disable-builddir',
|
|
|
|
'--enable-shared', _env=env)
|
|
|
|
shprint(sh.make, '-j', str(cpu_count()), 'libffi.la', _env=env)
|
|
|
|
|
|
|
|
def get_include_dirs(self, arch):
|
|
|
|
return [join(self.get_build_dir(arch.arch), 'include')]
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
recipe = LibffiRecipe()
|