-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
234 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,26 @@ | ||
import os | ||
from pythonforandroid.recipe import CompiledComponentsPythonRecipe | ||
|
||
|
||
class CffiRecipe(CompiledComponentsPythonRecipe): | ||
""" | ||
Extra system dependencies: autoconf, automake and libtool. | ||
""" | ||
name = 'cffi' | ||
version = '1.15.1' | ||
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz' | ||
|
||
depends = ['setuptools', 'pycparser', 'libffi'] | ||
|
||
patches = ['disable-pkg-config.patch'] | ||
|
||
# call_hostpython_via_targetpython = False | ||
install_in_hostpython = True | ||
|
||
def get_hostrecipe_env(self, arch=None): | ||
# fixes missing ffi.h on some host systems (e.g. gentoo) | ||
env = super().get_hostrecipe_env(arch) | ||
libffi = self.get_recipe('libffi', self.ctx) | ||
includes = libffi.get_include_dirs(arch) | ||
env['FFI_INC'] = ",".join(includes) | ||
return env | ||
|
||
def get_recipe_env(self, arch=None): | ||
env = super().get_recipe_env(arch) | ||
libffi = self.get_recipe('libffi', self.ctx) | ||
includes = libffi.get_include_dirs(arch) | ||
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes) | ||
env['CFLAGS'] += ' -I{}'.format(self.ctx.python_recipe.include_root(arch.arch)) | ||
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' + | ||
self.ctx.get_libs_dir(arch.arch)) | ||
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch)) | ||
# required for libc and libdl | ||
env['LDFLAGS'] += ' -L{}'.format(arch.ndk_lib_dir_versioned) | ||
env['PYTHONPATH'] = ':'.join([ | ||
self.ctx.get_site_packages_dir(arch), | ||
env['BUILDLIB_PATH'], | ||
]) | ||
env['LDFLAGS'] += ' -L{}'.format(self.ctx.python_recipe.link_root(arch.arch)) | ||
env['LDFLAGS'] += ' -lpython{}'.format(self.ctx.python_recipe.link_version) | ||
return env | ||
from os.path import exists, join | ||
from pythonforandroid.logger import info | ||
from pythonforandroid.recipe import PythonRecipe | ||
|
||
|
||
# A very hacky recipe | ||
# This avoids hassle of finding and correctly linking libffi | ||
# and just works | ||
|
||
|
||
class CffiRecipe(PythonRecipe): | ||
version = "1.15.1" | ||
hostpython_prerequisites = ["cffi=={}".format(version), "pycparser"] | ||
|
||
def should_build(self, arch): | ||
if exists(join(self.hostpython_site_dir, "cffi")): | ||
info('Python package already exists in site-packages') | ||
return False | ||
info('cffi apparently isn\'t already in site-packages') | ||
return True | ||
|
||
def build_arch(self, arch): | ||
self.install_hostpython_prerequisites() | ||
|
||
|
||
recipe = CffiRecipe() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.