|
1 | 1 | from os.path import exists, join
|
| 2 | +from multiprocessing import cpu_count |
2 | 3 | from pythonforandroid.recipe import Recipe
|
3 |
| -from pythonforandroid.logger import info, shprint |
| 4 | +from pythonforandroid.logger import shprint |
4 | 5 | from pythonforandroid.util import current_directory, ensure_dir
|
5 |
| -from glob import glob |
6 | 6 | import sh
|
7 | 7 |
|
8 | 8 |
|
@@ -37,46 +37,10 @@ def build_arch(self, arch):
|
37 | 37 | '--prefix=' + self.get_build_dir(arch.arch),
|
38 | 38 | '--disable-builddir',
|
39 | 39 | '--enable-shared', _env=env)
|
40 |
| - # '--with-sysroot={}'.format(self.ctx.ndk_platform), |
41 |
| - # '--target={}'.format(arch.toolchain_prefix), |
42 | 40 |
|
43 |
| - # ndk 15 introduces unified headers required --sysroot and |
44 |
| - # -isysroot for libraries and headers. libtool's head explodes |
45 |
| - # trying to weave them into it's own magic. The result is a link |
46 |
| - # failure trying to link libc. We call make to compile the bits |
47 |
| - # and manually link... |
| 41 | + shprint(sh.make, '-j', str(cpu_count()), 'libffi.la', _env=env) |
48 | 42 |
|
49 |
| - try: |
50 |
| - shprint(sh.make, '-j5', 'libffi.la', _env=env) |
51 |
| - except sh.ErrorReturnCode_2: |
52 |
| - info("make libffi.la failed as expected") |
53 |
| - cc = sh.Command(env['CC'].split()[0]) |
54 |
| - cflags = env['CC'].split()[1:] |
55 | 43 | host_build = self.get_build_dir(arch.arch)
|
56 |
| - |
57 |
| - arch_flags = '' |
58 |
| - if '-march=' in env['CFLAGS']: |
59 |
| - arch_flags = '-march={}'.format(env['CFLAGS'].split('-march=')[1]) |
60 |
| - |
61 |
| - src_arch = arch.command_prefix.split('-')[0] |
62 |
| - if src_arch == 'x86_64': |
63 |
| - # libffi has not specific arch files for x86_64...so...using |
64 |
| - # the ones from x86 which seems to build fine... |
65 |
| - src_arch = 'x86' |
66 |
| - |
67 |
| - cflags.extend(arch_flags.split()) |
68 |
| - cflags.extend(['-shared', '-fPIC', '-DPIC']) |
69 |
| - cflags.extend(glob(join(host_build, 'src/.libs/*.o'))) |
70 |
| - cflags.extend(glob(join(host_build, 'src', src_arch, '.libs/*.o'))) |
71 |
| - |
72 |
| - ldflags = env['LDFLAGS'].split() |
73 |
| - cflags.extend(ldflags) |
74 |
| - cflags.extend(['-Wl,-soname', '-Wl,libffi.so', '-o', |
75 |
| - '.libs/libffi.so']) |
76 |
| - |
77 |
| - with current_directory(host_build): |
78 |
| - shprint(cc, *cflags, _env=env) |
79 |
| - |
80 | 44 | ensure_dir(self.ctx.get_libs_dir(arch.arch))
|
81 | 45 | shprint(sh.cp,
|
82 | 46 | join(host_build, '.libs', 'libffi.so'),
|
|
0 commit comments