11from pythonforandroid .toolchain import Recipe , shprint , shutil , current_directory
2+ from pythonforandroid .util import current_directory , ensure_dir
3+ from pythonforandroid .logger import debug , shprint , info
24from os .path import exists , join
35import sh
46
57class LXMLRecipe (Recipe ):
68 version = '3.6.0'
79 url = 'https://pypi.python.org/packages/source/l/lxml/lxml-{version}.tar.gz'
810 depends = ['python2' , 'libxml2' , 'libxslt' ]
11+ name = 'lxml'
912
1013 def should_build (self , arch ):
1114 super (LXMLRecipe , self ).should_build (arch )
@@ -14,17 +17,29 @@ def should_build(self, arch):
1417
1518 def build_arch (self , arch ):
1619 env = self .get_recipe_env (arch )
20+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/png -I{jni_path}/jpeg' .format (
21+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
22+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/sdl/include -I{jni_path}/sdl_mixer' .format (
23+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
24+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/sdl_ttf -I{jni_path}/sdl_image' .format (
25+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
26+ debug ('pygame cflags' , env ['CFLAGS' ])
27+
28+
29+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{libs_path} -L{src_path}/obj/local/{arch} -lm -lz' .format (
30+ libs_path = self .ctx .libs_dir , src_path = self .ctx .bootstrap .build_dir , arch = env ['ARCH' ])
31+
32+ env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink' )
33+
1734 with current_directory (self .get_build_dir (arch .arch )):
35+ info ('hostpython is ' + self .ctx .hostpython )
1836 hostpython = sh .Command (self .ctx .hostpython )
19- shprint (hostpython ,
20- 'setup.py' ,
37+ shprint (hostpython , 'setup.py' ,
2138 'build_ext' ,
22- "-p%s" % arch .arch ,
2339 "-I/home/zgoldberg/.local/share/python-for-android/dists/peggo-python/python-install/include/python2.7/pyconfig.h" ,
2440 "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxml2/armeabi/libxml2/include" ,
25- "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt"
26-
27- , _env = env )
41+ "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt" ,
42+ _tail = 10000 , _critical = True , _env = env )
2843
2944 super (LXMLRecipe , self ).build_arch (arch )
3045
@@ -37,6 +52,16 @@ def get_recipe_env(self, arch):
3752 env ['LDSHARED' ] = "$LIBLINK"
3853 env ['PATH' ] += ":%s" % bxsl
3954 env ['CFLAGS' ] += ' -Os'
55+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{}' .format (
56+ self .ctx .get_libs_dir (arch .arch ))
57+ env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink' )
58+ env ['LIBLINK' ] = 'NOTNONE'
59+ env ['NDKPLATFORM' ] = self .ctx .ndk_platform
60+
61+ # Every recipe uses its own liblink path, object files are collected and biglinked later
62+ liblink_path = join (self .get_build_container_dir (arch .arch ), 'objects_{}' .format (self .name ))
63+ env ['LIBLINK_PATH' ] = liblink_path
64+ ensure_dir (liblink_path )
4065 return env
4166
4267recipe = LXMLRecipe ()
0 commit comments