Skip to content

Commit 7ff372c

Browse files
committed
Remove libffi's method get_host
To simplify the linkage of the libffi library (with this we will know exactly where will be built libffi files before the build happens)
1 parent 178d552 commit 7ff372c

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

pythonforandroid/python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def add_flags(include_flags, link_dirs, link_libs):
179179
info('Activating flags for libffi')
180180
recipe = Recipe.get_recipe('libffi', self.ctx)
181181
add_flags(' -I' + ' -I'.join(recipe.get_include_dirs(arch)),
182-
' -L' + join(recipe.get_build_dir(arch.arch),
183-
recipe.get_host(arch), '.libs'), ' -lffi')
182+
' -L' + join(recipe.get_build_dir(arch.arch), '.libs'),
183+
' -lffi')
184184

185185
if 'openssl' in self.ctx.recipe_build_order:
186186
info('Activating flags for openssl')

pythonforandroid/recipes/libffi/__init__.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ class LibffiRecipe(Recipe):
1919

2020
patches = ['remove-version-info.patch']
2121

22-
def get_host(self, arch):
23-
with current_directory(self.get_build_dir(arch.arch)):
24-
host = None
25-
with open('Makefile') as f:
26-
for line in f:
27-
if line.startswith('host = '):
28-
host = line.strip()[7:]
29-
break
30-
31-
if not host or not exists(host):
32-
raise RuntimeError('failed to find build output! ({})'
33-
.format(host))
34-
35-
return host
36-
3722
def should_build(self, arch):
3823
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))
3924

@@ -46,6 +31,7 @@ def build_arch(self, arch):
4631
shprint(sh.Command('./configure'),
4732
'--host=' + arch.command_prefix,
4833
'--prefix=' + self.ctx.get_python_install_dir(),
34+
'--disable-builddir',
4935
'--enable-shared', _env=env)
5036
# '--with-sysroot={}'.format(self.ctx.ndk_platform),
5137
# '--target={}'.format(arch.toolchain_prefix),
@@ -62,7 +48,7 @@ def build_arch(self, arch):
6248
info("make libffi.la failed as expected")
6349
cc = sh.Command(env['CC'].split()[0])
6450
cflags = env['CC'].split()[1:]
65-
host_build = join(self.get_build_dir(arch.arch), self.get_host(arch))
51+
host_build = self.get_build_dir(arch.arch)
6652

6753
arch_flags = ''
6854
if '-march=' in env['CFLAGS']:
@@ -91,8 +77,7 @@ def build_arch(self, arch):
9177
join(host_build, '.libs', 'libffi.so'))
9278

9379
def get_include_dirs(self, arch):
94-
return [join(self.get_build_dir(arch.arch), self.get_host(arch),
95-
'include')]
80+
return [join(self.get_build_dir(arch.arch), 'include')]
9681

9782

9883
recipe = LibffiRecipe()

0 commit comments

Comments
 (0)