|
1 |
| -from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory |
| 1 | +from pythonforandroid.recipe import Recipe |
| 2 | +from pythonforandroid.toolchain import shprint, shutil, current_directory |
2 | 3 | from os.path import exists, join
|
3 | 4 | import sh
|
4 | 5 |
|
5 | 6 |
|
6 | 7 | class Libxml2Recipe(Recipe):
|
7 |
| - version = "2.7.8" |
8 |
| - url = "http://xmlsoft.org/sources/libxml2-{version}.tar.gz" |
| 8 | + version = '2.9.8' |
| 9 | + url = 'http://xmlsoft.org/sources/libxml2-{version}.tar.gz' |
9 | 10 | depends = []
|
10 |
| - patches = ["add-glob.c.patch"] |
| 11 | + patches = ['add-glob.c.patch'] |
11 | 12 |
|
12 | 13 | def should_build(self, arch):
|
13 | 14 | super(Libxml2Recipe, self).should_build(arch)
|
14 |
| - return not exists(join(self.ctx.get_libs_dir(arch.arch), "libxml2.a")) |
| 15 | + return not exists( |
| 16 | + join(self.get_build_dir(arch.arch), '.libs', 'libxml2.a')) |
15 | 17 |
|
16 | 18 | def build_arch(self, arch):
|
17 | 19 | super(Libxml2Recipe, self).build_arch(arch)
|
18 | 20 | env = self.get_recipe_env(arch)
|
19 | 21 | with current_directory(self.get_build_dir(arch.arch)):
|
20 |
| - env["CC"] += " -I%s" % self.get_build_dir(arch.arch) |
21 |
| - shprint( |
22 |
| - sh.Command("./configure"), |
23 |
| - "--host=arm-linux-eabi", |
24 |
| - "--without-modules", |
25 |
| - "--without-legacy", |
26 |
| - "--without-history", |
27 |
| - "--without-debug", |
28 |
| - "--without-docbook", |
29 |
| - "--without-python", |
30 |
| - "--without-threads", |
31 |
| - "--without-iconv", |
32 |
| - _env=env, |
33 |
| - ) |
| 22 | + |
| 23 | + if not exists('configure'): |
| 24 | + shprint(sh.Command('./autogen.sh'), _env=env) |
| 25 | + shprint(sh.Command('autoreconf'), '-vif', _env=env) |
| 26 | + build_arch = shprint( |
| 27 | + sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0] |
| 28 | + shprint(sh.Command('./configure'), |
| 29 | + '--build=' + build_arch, |
| 30 | + '--host=' + arch.command_prefix, |
| 31 | + '--target=' + arch.command_prefix, |
| 32 | + '--without-modules', |
| 33 | + '--without-legacy', |
| 34 | + '--without-history', |
| 35 | + '--without-debug', |
| 36 | + '--without-docbook', |
| 37 | + '--without-python', |
| 38 | + '--without-threads', |
| 39 | + '--without-iconv', |
| 40 | + '--disable-shared', |
| 41 | + '--enable-static', |
| 42 | + _env=env) |
34 | 43 |
|
35 | 44 | # Ensure we only build libxml2.la as if we do everything
|
36 | 45 | # we'll need the glob dependency which is a big headache
|
37 | 46 | shprint(sh.make, "libxml2.la", _env=env)
|
38 |
| - shutil.copyfile( |
39 |
| - ".libs/libxml2.a", join(self.ctx.get_libs_dir(arch.arch), "libxml2.a") |
40 |
| - ) |
| 47 | + |
| 48 | + shutil.copyfile('.libs/libxml2.a', |
| 49 | + join(self.ctx.libs_dir, 'libxml2.a')) |
41 | 50 |
|
42 | 51 | def get_recipe_env(self, arch):
|
43 | 52 | env = super(Libxml2Recipe, self).get_recipe_env(arch)
|
44 |
| - env["CONFIG_SHELL"] = "/bin/bash" |
45 |
| - env["SHELL"] = "/bin/bash" |
46 |
| - env[ |
47 |
| - "CC" |
48 |
| - ] = "arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}".format( |
49 |
| - self.ctx.ndk_platform |
50 |
| - ) |
| 53 | + env['CONFIG_SHELL'] = '/bin/bash' |
| 54 | + env['SHELL'] = '/bin/bash' |
| 55 | + env['CC'] += ' -I' + self.get_build_dir(arch.arch) |
51 | 56 | return env
|
52 | 57 |
|
53 | 58 |
|
|
0 commit comments