Skip to content

Commit 13638ff

Browse files
authored
Merge pull request #1428 from goffi-contrib/lxml_fix
lxml, libxml2 and libxslt recipes
2 parents e6cf4a9 + d36cd9d commit 13638ff

File tree

7 files changed

+2223
-0
lines changed

7 files changed

+2223
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2+
from os.path import exists, join
3+
import sh
4+
5+
6+
class Libxml2Recipe(Recipe):
7+
version = "2.7.8"
8+
url = "http://xmlsoft.org/sources/libxml2-{version}.tar.gz"
9+
depends = []
10+
patches = ["add-glob.c.patch"]
11+
12+
def should_build(self, arch):
13+
super(Libxml2Recipe, self).should_build(arch)
14+
return not exists(join(self.ctx.get_libs_dir(arch.arch), "libxml2.a"))
15+
16+
def build_arch(self, arch):
17+
super(Libxml2Recipe, self).build_arch(arch)
18+
env = self.get_recipe_env(arch)
19+
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+
)
34+
35+
# Ensure we only build libxml2.la as if we do everything
36+
# we'll need the glob dependency which is a big headache
37+
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+
)
41+
42+
def get_recipe_env(self, arch):
43+
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+
)
51+
return env
52+
53+
54+
recipe = Libxml2Recipe()

0 commit comments

Comments
 (0)