Skip to content

Add lxml recipe and other recipes from ZachGoldberg fork #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pythonforandroid/recipes/levenshtein/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe
from os.path import dirname

class LevenshteinRecipe(CompiledComponentsPythonRecipe):
name="levenshtein"
version = '0.12.0'
url = 'https://pypi.python.org/packages/source/p/python-Levenshtein/python-Levenshtein-{version}.tar.gz'
depends = [('python2', 'python3'), 'setuptools']

call_hostpython_via_targetpython = False

def get_recipe_env(self, arch):
env = super(LevenshteinRecipe, self).get_recipe_env(arch)
libxslt_recipe = Recipe.get_recipe('libxslt', self.ctx)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My testing application compiles until these lines get referenced, which I believe may be because the class Recipe is called instead of the instance. But something seems to have accidentally filled my VM up to the brim so I need to clean it out before I can continue testing, so I haven't been able to test the change into an instance.

libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
targetpython = "%s/include/python2.7/" % dirname(dirname(self.ctx.hostpython))
env['CC'] += " -I%s/include -I%s -I%s" % (libxml2_recipe, libxslt_recipe, targetpython)
env['LDSHARED'] = '%s -nostartfiles -shared -fPIC -lpython2.7' % env['CC']
return env

recipe = LevenshteinRecipe()
37 changes: 37 additions & 0 deletions pythonforandroid/recipes/libxml2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from os.path import exists, join
import sh

class Libxml2Recipe(Recipe):
version = '2.7.8'
url = 'http://xmlsoft.org/sources/libxml2-{version}.tar.gz'
depends = []
patches = ['add-glob.c.patch']

def should_build(self, arch):
super(Libxml2Recipe, self).should_build(arch)
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libxml2.a'))

def build_arch(self, arch):
super(Libxml2Recipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
env['CC'] += " -I%s" % self.get_build_dir(arch.arch)
shprint(sh.Command('./configure'), '--host=arm-linux-eabi',
'--without-modules', '--without-legacy', '--without-hfinistory', '--without-debug', '--without-docbook', '--without-python', '--without-threads', '--without-iconv',
_env=env)

# Ensure we only build libxml2.la as if we do everything
# we'll need the glob dependency which is a big headache
shprint(sh.make, "libxml2.la", _env=env)
shutil.copyfile('.libs/libxml2.a', join(self.ctx.get_libs_dir(arch.arch), 'libxml2.a'))


def get_recipe_env(self, arch):
env = super(Libxml2Recipe, self).get_recipe_env(arch)
env['CONFIG_SHELL'] = '/bin/bash'
env['SHELL'] = '/bin/bash'
env['CC'] = '/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer'
return env

recipe = Libxml2Recipe()
Loading