Skip to content

Commit 6ed40d5

Browse files
committed
Rework libxml2 recipe and update version
Actions taken:   - replace double quotes to single quotes because I think that it's more readable - fixed imports - shortened lines
1 parent 21bc8b8 commit 6ed40d5

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

pythonforandroid/recipes/libxml2/__init__.py

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,58 @@
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
23
from os.path import exists, join
34
import sh
45

56

67
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'
910
depends = []
10-
patches = ["add-glob.c.patch"]
11+
patches = ['add-glob.c.patch']
1112

1213
def should_build(self, arch):
1314
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'))
1517

1618
def build_arch(self, arch):
1719
super(Libxml2Recipe, self).build_arch(arch)
1820
env = self.get_recipe_env(arch)
1921
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)
3443

3544
# Ensure we only build libxml2.la as if we do everything
3645
# we'll need the glob dependency which is a big headache
3746
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'))
4150

4251
def get_recipe_env(self, arch):
4352
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)
5156
return env
5257

5358

0 commit comments

Comments
 (0)