Skip to content

Commit 8fae315

Browse files
ZachGoldberggoffi-contrib
authored andcommitted
lxml recipe
This is a squash of many commits comming from #1166 work by Zachary Goldberg (https://github.com/ZachGoldberg) and Elena Pereira (https://github.com/Scefing)
1 parent e6cf4a9 commit 8fae315

File tree

8 files changed

+2197
-0
lines changed

8 files changed

+2197
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe
2+
from os.path import dirname
3+
4+
class LevenshteinRecipe(CompiledComponentsPythonRecipe):
5+
name="levenshtein"
6+
version = '0.12.0'
7+
url = 'https://pypi.python.org/packages/source/p/python-Levenshtein/python-Levenshtein-{version}.tar.gz'
8+
depends = [('python2', 'python3'), 'setuptools']
9+
10+
call_hostpython_via_targetpython = False
11+
12+
def get_recipe_env(self, arch):
13+
env = super(LevenshteinRecipe, self).get_recipe_env(arch)
14+
libxslt_recipe = Recipe.get_recipe('libxslt', self.ctx)
15+
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
16+
targetpython = "%s/include/python2.7/" % dirname(dirname(self.ctx.hostpython))
17+
env['CC'] += " -I%s/include -I%s -I%s" % (libxml2_recipe, libxslt_recipe, targetpython)
18+
env['LDSHARED'] = '%s -nostartfiles -shared -fPIC -lpython2.7' % env['CC']
19+
return env
20+
21+
recipe = LevenshteinRecipe()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2+
from os.path import exists, join
3+
import sh
4+
5+
class Libxml2Recipe(Recipe):
6+
version = '2.7.8'
7+
url = 'http://xmlsoft.org/sources/libxml2-{version}.tar.gz'
8+
depends = []
9+
patches = ['add-glob.c.patch']
10+
11+
def should_build(self, arch):
12+
super(Libxml2Recipe, self).should_build(arch)
13+
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libxml2.a'))
14+
15+
def build_arch(self, arch):
16+
super(Libxml2Recipe, self).build_arch(arch)
17+
env = self.get_recipe_env(arch)
18+
with current_directory(self.get_build_dir(arch.arch)):
19+
env['CC'] += " -I%s" % self.get_build_dir(arch.arch)
20+
shprint(sh.Command('./configure'), '--host=arm-linux-eabi',
21+
'--without-modules', '--without-legacy', '--without-hfinistory', '--without-debug', '--without-docbook', '--without-python', '--without-threads', '--without-iconv',
22+
_env=env)
23+
24+
# Ensure we only build libxml2.la as if we do everything
25+
# we'll need the glob dependency which is a big headache
26+
shprint(sh.make, "libxml2.la", _env=env)
27+
shutil.copyfile('.libs/libxml2.a', join(self.ctx.get_libs_dir(arch.arch), 'libxml2.a'))
28+
29+
30+
def get_recipe_env(self, arch):
31+
env = super(Libxml2Recipe, self).get_recipe_env(arch)
32+
env['CONFIG_SHELL'] = '/bin/bash'
33+
env['SHELL'] = '/bin/bash'
34+
env['CC'] = '/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer'
35+
return env
36+
37+
recipe = Libxml2Recipe()

0 commit comments

Comments
 (0)